> hostname -f or domainname fail: Temporary failure in name resolution. > > The /etc/hosts and /etc/hostname files where set up appropiatly and booting > the > container normally and then installing ssmtp works fine. > > It should thus be avoided to use hostname -f in the postinst script.
Do you have a suggestion what to use instead? I've been thinking about this for a bit, but I haven't had an idea for a satisfactory solution (that's compatible to the old one), yet. 1. Just using 'hostname' should be equivalent to reading '/proc/sys/kernel/hostname' and thus shouldn't go through the resolver. But it misses the domain name part, which might not be desirable as a default for the ssmtp configuration. Also, it would rely on the system hostname being set properly before ssmtp is configured. I'm not sure whether that's a problem or not. 2. Parsing `/etc/hosts` is likely out of question, as this wouldn't be robust at all. Also, I'm not sure whether '/etc/hosts' is guaranteed to be set up before ssmtp is configured. 3. getent could be used to parse `/etc/hosts` more reliably (and could be forced to use the file only, without doing any other resolution), but it would still require that '/etc/hosts' is set up beforehand. Also, just getting the entry for '127.0.1.1' won't work in those situations where this entry doesn't exist. And it's in the `libc-bin` package, so it might not be available during initial installation. 4. Retrieving the configured hostname from the debconf database is not a good idea, as this appears to be configured for 'd-i' only and isn't carried over to '/var/cache/debconf/config.dat' of the installed system, so a later installation of ssmtp wouldn't be able to retrieve those values. Regards, Niels Boehm