TransWikia.com

eth0 not set up after network.target is reached

Super User Asked by choumat on February 5, 2021

When I reboot my Raspberry Pi 4, the OpenSMTPD (an alternative to postfix) service fails to start:

● opensmtpd.service - OpenSMTPD SMTP server
   Loaded: loaded (/lib/systemd/system/opensmtpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-01-12 21:39:06 CET; 10min ago
     Docs: man:smtpd(8)

Jan 12 21:39:05 solstitium systemd[1]: Starting OpenSMTPD SMTP server...
Jan 12 21:39:06 solstitium smtpd[518]: invalid virtual ip or interface: eth0
Jan 12 21:39:06 solstitium systemd[1]: opensmtpd.service: Control process exited, code=exited, status=1/FAILURE
Jan 12 21:39:06 solstitium systemd[1]: opensmtpd.service: Failed with result 'exit-code'.
Jan 12 21:39:06 solstitium systemd[1]: Failed to start OpenSMTPD SMTP server.

It listens to eth0 for incoming emails. See below the content of the opensmtpd.service file.

[Unit]
Description=OpenSMTPD SMTP server
Documentation=man:smtpd(8)
After=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/smtpd
ExecStop=/bin/kill -15 $MAINPID

[Install]
WantedBy=multi-user.target

eth0 is not configured, although I got Reached network.target in the log. So I found this documentation that suggests I should replace the 4th line with After=network-online.target or Wants=network-online.target, but it also says that it could delay the boot: is it a good solution? Which keyword should I use between After and Wants? It mentions NetworkManager and systemd-networkd, but I don’t know of the first and the second is a dead service; the network is set up by networking.service. Thanks for your help!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP