1

I have just started dwelling into the world of Ubuntu Server.

I started editing netplan to add NetworkManager as the renderer. The *.yaml file looks like this

network:
  ethernets:
    eno1:
      dhcp4: true
  version: 2
  renderer: NetworkManager

If I remove the renderer, systemd-networkd-wait-online.service starts just fine.

-- Boot f8c386c2c80b40b983635e474ef9129c --
Jan 17 22:06:11 server systemd[1]: Starting Wait for Network to be Configured...
Jan 17 22:06:16 server systemd[1]: Finished Wait for Network to be Configured.
Jan 18 08:10:17 server systemd[1]: systemd-networkd-wait-online.service: Deactivated successfully.
Jan 18 08:10:17 server systemd[1]: Stopped Wait for Network to be Configured.

However when I add the renderer this service fails on wait

-- Boot 03b42ba713bb4da4b5cf96600ae9f67f --
Jan 18 08:10:39 server systemd[1]: Starting Wait for Network to be Configured...
Jan 18 08:12:39 server systemd-networkd-wait-online[670]: Timeout occurred while waiting for network connectivity.
Jan 18 08:12:39 server systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Jan 18 08:12:39 server systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Jan 18 08:12:39 server systemd[1]: Failed to start Wait for Network to be Configured.
Jan 18 08:23:08 server systemd[1]: Starting Wait for Network to be Configured...
Jan 18 08:25:08 server systemd-networkd-wait-online[5857]: Timeout occurred while waiting for network connectivity.
Jan 18 08:25:08 server systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Jan 18 08:25:08 server systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Jan 18 08:25:08 server systemd[1]: Failed to start Wait for Network to be Configured.

Could someone please guide me on how to solve this and why would this even happen?

Ashkan
  • 111
  • 4
  • First off, do you have a particular reason to add renderer: NetworkManager? The defaults normally just work on servers, even with advanced configurations with bridges, vlans, etc. Regarding the failing service: likely your server has other network ports, and it may be waiting for those to come up. But above all, just go with the default. If it ain't broke don't fix it. – zwets Jan 18 '24 at 20:13
  • Also: add attribute link-local: [] to all your interfaces (at the same level as the dhcp4 attribute), even the ones you don't use. Inconveniently, the default for this attribute is [ ipv6 ], meaning the failing service may be waiting for the IPv6 link-local connections to come up. – zwets Jan 18 '24 at 21:01
  • @zwets I installed Cockpit and it requires NetworkManager to function. Is there an alternative for Cockpit? – Ashkan Jan 18 '24 at 22:43
  • I've never needed anything other than the command line in many years installing and managing Ubuntu servers, and I think (but will happily be corrected with evidence) that nearly all Ubuntu server administrators do the same. All configuration of an Ubuntu server sits in (generally well-documented) plain text files. Keeping track of what you did on the system is trivial: just copy your commands and config changes to a text file for later reference. Unless I'd manage one single server for the rest of my life, I can't imagine how I could do without my logs. – zwets Jan 19 '24 at 01:19

1 Answers1

1

NetworkManager and systemd-networkd are incompatible when running together. They do the same job and try to manage the same resource, network. If you have some configuration inside systemd-networkd, you should keep using it and not switch.

Otherwise, you need to disable systemd-networkd before enabling NetworkManager. I will assume you have the packages installed already. Now your goal is what I have on my non-server desktop Ubuntu installation:

$ networkctl
WARNING: systemd-networkd is not running, output will be incomplete.
[...]
$ systemctl status systemd-networkd
○ systemd-networkd.service - Network Configuration
     Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; preset: enabled)
     Active: inactive (dead)
[...]
$ systemctl status systemd-networkd-wait-online.service
○ systemd-networkd-wait-online.service - Wait for Network to be Configured
     Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; disabled; preset: disabled)
     Active: inactive (dead)
       Docs: man:systemd-networkd-wait-online.service(8)

To get there, you can apply the opposite of https://askubuntu.com/a/1387807/1004020 :

sudo systemctl stop systemd-networkd
sudo systemctl disable systemd-networkd
sudo systemctl mask systemd-networkd

sudo systemctl stop systemd-networkd-wait-online.service sudo systemctl disable systemd-networkd-wait-online.service sudo systemctl mask systemd-networkd-wait-online.service

sudo systemctl unmask network-manager sudo systemctl enable network-manager sudo systemctl start network-manager

sudo mv /etc/systemd/network /etc/systemd/network.old sudo mkdir /etc/systemd/network

Basically, it is important to disable system-networkd.service so that you don't have two network managers interfering with each other. The failures of the systemd-networkd-wait-online.service are harmless and ignorable, and we simply disable that service when moving to NetworkManager.

Once this is done and you reboot, everything should be controlled by NetworkManager. Again, if your Ubuntu Server version defaults to systemd-networkd, the tutorials, documentation, and support might not fit NetworkManager best. You may need to adjust your netplan config and ensure that it is still respected.

Daniel T
  • 4,594
  • Thank you for the answer. I installed Cockpit and that requires NetworkManager to function otherwise I would not try to switch. – Ashkan Jan 18 '24 at 22:41