Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm getting this error when ever I install any packages via apt-get:

hostname: Name or service not known
dpkg: error processing ssmtp (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libt1-5 (5.1.2-3.4ubuntu1) ...
Setting up php5-gd (5.3.10-1ubuntu3.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 ssmtp
E: Sub-process /usr/bin/dpkg returned an error code (1)

Why this is happening?

share|improve this question

4 Answers

up vote 2 down vote accepted

Solution:

(These types of problems don't have good solutions. But only some haking-ish)

You should first try this command in a terminal:

sudo apt-get -f install

If it doesn't work, process with haking-ish solution.

Try temporarily moving the configuration script of ssmtp.

  1. Open a terminal and execute this command to move them to the current dir

     sudo mv /var/lib/dpkg/info/ssmtp* .
    
  2. Then try using apt-get

The cause of the problem:

The previous installation or removal might not completed successfully, leaving some configuration step to be done for ssmtp package. Since, dpkg won't progress without first completing the steps, subsequent use of apt-get now get stuck on that step.

share|improve this answer
+1 Thanks. Really saved my day! :D – batman Sep 7 '12 at 11:42

Just so everyone knows, the edit of /etc/hosts did the trick the etc/hostname was right with server.exmaple.com

however the hosts was not correct

127.0.0.1 localhost 127.0.0.1 server

change it to this:

127.0.0.1 localhost.localdomain localhost 192.168.xxx.xxx server.example.com server

I ran hostname -f and hostname --fqdn and got the following.

server.example.com

Just thought everyone would like to know.

share|improve this answer

run hostname --fqdn

If you get an error, edit /etc/hostname and /etc/hosts with a proper hostname.

Then aptitude install ssmtp again to get it to install.

share|improve this answer

most likely your internet connection is not working properly. In detail i think your DNS is not resolving properly.

try to add the line

nameserver 8.8.8.8

to your /etc/resolv.conf

This will add google DNS server

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.