Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi i want to install ruby on my Ubuntu 12.04. I tried it with following command sudo apt-get install curl but it gives me following error.

The hostname -f command returned: $1

Your system needs to have a fully qualified domain name (fqdn) in
order to install the var-qmail packages.

Installation aborted.

dpkg: error processing qmail (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of qmail-run:
 qmail-run depends on qmail (>= 1.06-2.1); however:
  Package qmail is not configured yet.
dpkg: error processing qmail-run (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                      Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

How to solve this error. Need Help. I am using ubuntu 12.04

share|improve this question
Could you add the contents of /etc/hosts and /etc/nsswitch.conf – AndrewS Aug 24 '13 at 7:12
thank you andrew for quick replay but there no such hosts or nsswitch.config inside etc – nilkash Aug 24 '13 at 7:16
But what to add in that – nilkash Aug 24 '13 at 7:35
Can you update your question with the output from the following: cat /etc/hosts. Also, are these commands being ran as root (so sudo su -'d in) or using sudo? – andrew Aug 24 '13 at 10:54

The issue is that you do not have a FQDN in your /etc/hosts file.

Here is an example of what /etc/hosts should contain:

root@precise64:/home/vagrant# cat /etc/hosts precise64

# 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

Once you have corrected the /etc/hosts file, you can check your FQDN with hostname -f

root@precise64:/home/vagrant# hostname -f

You should be able to sudo apt-get install qmail after the changes.

share|improve this answer
OK andrew I will try this and let you whether its working or not. Thank you for help. – nilkash Aug 24 '13 at 8:58
H andrew according to your solution i update my hosts file but still it is giving same problem. – nilkash Aug 24 '13 at 9:39
When you run hostname -f, what is the output? – andrew Aug 24 '13 at 10:29
hostname -f shows me which is same as set into hostname field and hosts file – nilkash Aug 24 '13 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .