install nmh crashed with error "hostname -f command returned: $1"

Asked by Mats Blomberg

I ran command "sudo apt-get install nmh" in order to have access to the packf command. Process crashed with error "hostname -f command returned: $1 " and diagnosis "Your system needs to have a fully qualified domain name (fqdn)" although I have one. Running the hostname -f command in a terminal window returns the correct name.

package qmail 1.06-5 failed to install/upgrade: underprocessen installerade post-installation-skript gav felkod 1

The problem initially appeared in Ubuntu 12.04 but has remained through upgrades to 12.10 and 13.04.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
tuxar
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

hostname; cat /etc/hosts

Thanks

Revision history for this message
Mats Blomberg (mats-e-blomberg) said :
#2

The output of "hostname; cat /etc/hosts" is:

mats@mats-desktop-Ubuntu:~$ hostname; cat /etc/hosts
mats-desktop-Ubuntu
127.0.0.1 localhost
127.0.1.1 mats-desktop-Ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
mats@mats-desktop-Ubuntu:~$

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Did you buy a domain name to run email from?

Revision history for this message
Mats Blomberg (mats-e-blomberg) said :
#4

Thanks for your reply.

I am not sure why you ask this question and don't quite know how to answer to it. I don't think I have bought a domain name. I was maybe not sufficiently clear with my reason for installing qmail. I use thunderbird (using server at my job) and gmail for my email and have no intention of switching to qmail. My intention with installing qmail was only to use the included command packf. I have old mail folders which are stored in mh format which I want to convert to mbox format and I have read that packf can do that. When I typed the command "packf" in a terminal window I was instructed to install nmh. During this installation the error showed up.

I have just found a web page, http://ericlathrop.com/2013/02/mh2mbox.sh-convert-mh-mail-folders-to-mbox-files, which seems to describe the same error which I get. It also presents a solution. I will try this and report the results.

Revision history for this message
Best tuxar (tuxar) said :
#5

More about FQDN or Fully Qualified Domain Name:
http://en.wikipedia.org/wiki/Fully_qualified_domain_name

Please try the folowing commands in terminal (Ctrl+Alt+T)
1.Set the FQDN - http://manpages.ubuntu.com/manpages/precise/man1/hostname.1.html

sudo hostname mats-desktop-Ubuntu.example.com

2.Edit /etc/hosts to have the below lines

127.0.0.1 localhost.localdomain localhost
127.0.0.1 mats-desktop-Ubuntu.example.com mats-desktop-Ubuntu

3.Be sure that your /etc/host.conf contents

# The "order" line is only used by old versions of the C library.
order hosts,bind

4. Restart
sudo service hostname restart

5.Check the FQDN
hostname -f

The output should be

mats-desktop-Ubuntu.example.com

Revision history for this message
Mats Blomberg (mats-e-blomberg) said :
#6

Thanks for your help, which largely solved my problem. There was some strange effect though, which forced me to deviate somewhat from your recommendation. After step 1, emacs could not find the file /etc/hosts (referring to some problem with the new hostname). So, I reset the hostname and made a reboot, after which emacs found the file. I tried with leaving line 1 unchanged and editing line 2 into:

127.0.1.1 mats-desktop-Ubuntu.example.com mats-desktop-Ubuntu

(There was maybe a typing error in your suggestion? I guess the beginning of line 2 should be "127.0.1.1"?)

Now I could install nmh and I could then find packf in /usr/bin/mh/

Thanks a lot!

Revision history for this message
Mats Blomberg (mats-e-blomberg) said :
#7

Thanks tuxar, that solved my question.

Revision history for this message
tuxar (tuxar) said :
#8

You are welcome!
Just for information - 127.0.0.1 is IP Loopback Address

" 127.0.0.1 is is a special purpose IP address conventionally used as a computer's loopback address. Messages sent to loopback IP addresses like 127.0.0.1 do not reach outside to the local area network (LAN) but instead are automatically re-routed by the computer's own network adapter back to the receiving end of the TCP/IP stack."

http://compnetworking.about.com/b/2007/02/28/127001-ip-loopback-address.htm