Package: ssmtp
Version: 2.64-4
Severity: normal

In some rare cases the "hostname" command can't answer, making the postinst script crash.

I stumbled upon one of these cases when I tried to install ssmtp in a Xen vm during image creation, through a "role" script (those are scripts run after debian base system is installed, but before first boot - it's the final part of a Xen guest install with xen-tools).

These scripts are run on the host, chrooted in the mounted guest's system. I'm not sure what happened, but since the hostname and domain name are correctly configured before xen-create-image runs the role scripts, I changed the postinst script like this:

hostname="${RET:-`grep -m 1 \`cat /etc/hostname\` /etc/hosts | awk '{print $2}'`}"

...and could modify the script, run "dpkg --configure -a" and undo the changes all through the role script to fix things even before the first boot, but I don't know if this rare case justifies changing the postinst script for everyone, since in a "normal" setup, if at least the /etc/hosts is correctly written, the "hostname" command would work and the postinst script wouldn't crash.

As for the original poster, I can't see any other case where the "hostname" command would fail, maybe /etc/hosts was corrupted or missing.

Hope it helps.

--
Raph



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to