I’ve run one form or anothe of Linux for over 10 years and openSUSE for a large part of this. I recently upgraded one of my home PCs from openSUSE 13.2 to leap 42.2 - eventually by running a new install onto a newly formatted system disk, keeping my data didks unchanged. (Don’t laugh at how old the system was - when I get this one sprted, I’ve got a 12.3 system to rebuild as well). These are all home computers, which should not be visible to the internet.
My local mail system uses postfix and I’m trying to use a minimal configuration for the new system to forward nearly all mail to the old box (this has worked well under the old systems for some time) by using postfix’s built-in defaults for myhostname & mydomain. Now it fails.
BTW This problem doesn’t look to me like one jusrt form postfix …
According to postfix documentation, $myhostname defaults to "use the fully-qualified domain name (FQDN) from gethostname(), or to use the non-FQDN result from gethostname() and append “.$mydomain”.
Similarly, $mydomain default is to use $myhostname minus the first component, or “localdomain” (Postfix 2.3 and later). OK, so postfix is now at 2.11.8, so i may not be able to use this default any longer :-(. But it started me playing …
I wrote the following:
#define _GNU_SOURCE 1
#include <stdio.h>
#include <unistd.h>
main(int argc, char *argv])
{
char buffer[64];
int i;
i = gethostname(buffer, sizeof(buffer));
printf("The host name is %s (%d)
", buffer, i);
i = getdomainname(buffer, sizeof(buffer));
printf("The domain name is %s (%d)
", buffer, i);
return 0;
}
My /etc/hostname contains “pc2015.greymoon.com” (without the quotes!).
This program outputs:
richard@pc2015:/mnt/md0/richard-home-2015/tmp> ./hostname
The host name is pc2015 (0)
The domain name is (none) (0)
richard@pc2015:/mnt/md0/richard-home-2015/tmp>
Now, reading the man page fro gethostname, it could mean gethostname() returns the unqualified host name. However, getdomainname() should return the domain name, but returns that strintg “(null)” (or is it a null pointer?).
So … how should I be setting the domain name at all? I understood that /etc/hostname should do it, and can’t find anywhere else. I can see the hostname appear in the log (journal), but without the domain.
I remain confused …
Apologies if this is a bit long, but I’m trying to put as much information in as I can.
Richard “greymoon”