I encountered this problem with my Postfix install:
https://www.virtualmin.com/node/23909
i.e. I was getting the error:
postfix/smtp[130]: fatal: unknown service: smtp/tcp
and like at the url above, the solution was to manually copy /etc/services
and /etc/resolv.conf
into /var/spool/postfix/etc
My impression is this "just started happening" and previously wasn't a problem, however I have only been making minor seemingly unrelated changes to postfix main.cf so I don't understand why.
The Postfix installation tutorials I was following don't mention anything about having to manually copy those files... this feels like something Postfix ought to do by itself and isn't for some reason.
Is there some underlying misconfiguration that would cause this?
Some Postfix processes are running in a chroot environment by default. Therefore there usually is something to provide them with the necessary files on startup.
On my Debian 7 system, the file
/etc/init.d/postfix
has the following lines that copy all necessary files inside the chroot:It is strange that your installation does not include this; you shouldn’t have to do anything by yourself here.
How did you install postfix and on which system?
It looks like Postfix wants to run chrooted. See here for more info about what that means.
You can change it with the
Chroot
configuration option in/etc/postfix/master.cf
.It can be a timing issue with NetworkManager. Make postfix load later in the boot process by changing the name of the postfix file in /etc/rc{x}.d
For example:
You may have to change this in all your /etc/rc{x}.d directories. Remember to reboot to test it.
If the file just contains one line with the text "# Generated by resolvconf" it is most likely a problem with boot order.
First check if "/etc/resolv.conf" contains the nameserver. If this is the case your network is correctly configured and up.
Even on modern distributions with systemd postfix is currently still booted up by init.d scripts that are processed during systemd boot. To understand what is happening during boot just read this article: https://unix.stackexchange.com/questions/233468/how-does-systemd-use-etc-init-d-scripts
Postfix is started by executing "/etc/rc1.d/K01postfix". This script contains the following line to ensure network:
And here is the problem. We have to ensure that the network is not only up but also online. Otherwise the resolv.conf is copied from "/etc/resolv.conf" before it has been completely created.
This can be done by executing:
See also this article for a good description: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
I found that the easiest solution to this problem for me was to add a restart of the postfix restart into /etc/rc.local