>@Marius Gedminas (mgedmin)
>Curiously, I never saw this problem on my laptop in Ubuntu versions
>up to and including 16.04 LTS.
>I'm seeing a lot of this problem ever since I upgraded to 16.10 LTS.
I experienced the same issues when deploying Ubuntu 16.10 to a new
MiniPC (opposed to Ubuntu 14.x that worked fine).
I have finally found an automated solution for this: enable the
NetworkManager-wait-online.service and deploy a custom script that
restarts the postfix service +-5 minutes after the machine has booted
(assuming that the wireless connection is active by then).
A. Enable this.
It is a generic approach that might be beneficial for other service than
Postfix as well so I keep it in the script.
````
systemctl enable NetworkManager-wait-online.service; systemctl status
NetworkManager-wait-online.service;
````
B. Add a customer Systemd timer + service
@info The timer will start ONCE, {x} minutes after the machine was booted.
````
nano /etc/systemd/system/mjd-restart-postfix-after-wlan-connected.timer
[Unit]
Description=(timer)mjd-restart-postfix-after-wlan-connected
[Timer]
OnBootSec=5min
[Install]
WantedBy=timers.target
````
````
nano /etc/systemd/system/mjd-restart-postfix-after-wlan-connected.service
[Unit]
Description=mjd-restart-postfix-after-wlan-connected
[Service]
Type=oneshot
ExecStart=/bin/sh -ec "systemctl restart postfix; systemctl status postfix;
uname -a | /usr/bin/mailx -s \"Server (`hostname`): postfix was restarted.\"
[email protected]"
````
````
MYUNIT=mjd-restart-postfix-after-wlan-connected
MYTIMER=${MYUNIT}.timer
systemctl enable ${MYTIMER}; systemctl status ${MYTIMER};
systemctl list-units --all | grep "${MYUNIT}"
systemctl status ${MYUNIT}
````
C. Restart
````reboot
````# wait 5 minutes
D. Check
````
MYUNIT=mjd-restart-postfix-after-wlan-connected
MYTIMER=${MYUNIT}.timer
systemctl status ${MYTIMER}
````
If the contents of these 2 config files (one of Resolve and one of Postfix) are
not the same then the issue is PROBLEMATIC (Postfix started before LAN/WLAN
gets connected).
cat /etc/resolv.conf
cat /var/spool/postfix/etc/resolv.conf
E. Info
@doc https://bugs.launchpad.net/ubuntu/+source/postfix/+bug/1519331
@doc https://wiki.archlinux.org/index.php/Systemd/Timers
@doc qshape deferred
@doc cat /var/log/syslog | egrep "NetworkManager|postfix"
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1519331
Title:
Postfix cannot resolve DNS if network was unavailable when it was
started, such as on a laptop
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/postfix/+bug/1519331/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs