Job systemd-networkd-wait-online.service start running

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

On Ubuntu systems with multiple network interfaces', there may be a two-minute delay during the start process. During this time, the message Job systemd-networkd-wait-online.service/start running (1min 58s / no limit) is displayed, whereby the minutes/seconds are continuously counted up to 2min.

Problem

When the system boots up, there is a two-minute wait, during which the message Job systemd-networkd-wait-online.service/start running is displayed:

Ubuntu-24-04-Server-systemd-networkd-wait-online-service.jpeg

Root cause / Affected systems

Systems with several network interfaces are affected if

  • at least one network interface is not connected (no cable connected), and
  • this network interface was not deactivated during installation.

During installation (here is an example from Install Ubuntu 24.04 LTS Server), all network interfaces are activated by default, even if no cable is connected to one interface (epn1s0), as in the example here:

Ubuntu-24-04-Server-Installation-05-Network-configuration-Detail.jpeg

Solution

To prevent this two-minute wait, affected network interfaces can be deactivated either during installation or afterwards.

Deactivate network interface during installation

During installation, carry out the following steps to deactivate the network interface:

Deactivate network interface retrospectively or set as an option

After installation, the network configuration file /etc/netplan/05-cloud-init.yaml looks like this, for example:

werner@tk-les-plus-v3-ubuntu-24-04:/etc/netplan$ sudo cat 50-cloud-init.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp1s0:
            dhcp4: true
        enp2s0:
            dhcp4: true
    version: 2

To avoid waiting times, either the affected network interface can be completely removed from the configuration or a custom configuration (with optional: true)[1] can be used - see also Network configuration Ubuntu - Netplan. The additional output of systemd-analyze illustrates the shortened startup time:

werner@tk-les-plus-v3-ubuntu-24-04:/etc/netplan$ sudo systemd-analyze 
Startup finished in 13.115s (firmware) + 6.225s (loader) + 1.834s (kernel) + 2min 1.810s (userspace) = 2min 22.986s 
graphical.target reached after 2min 1.786s in userspace.
werner@tk-les-plus-v3-ubuntu-24-04:/etc/netplan$ sudo vi 99-network.yaml 
werner@tk-les-plus-v3-ubuntu-24-04:/etc/netplan$ sudo cat 99-network.yaml 
network:
    ethernets:
        enp1s0:
            dhcp4: true
            optional: true
        enp2s0:
            dhcp4: true
            optional: true
    version: 2
werner@tk-les-plus-v3-ubuntu-24-04:/etc/netplan$ sudo rm 50-cloud-init.yaml 
werner@tk-les-plus-v3-ubuntu-24-04:/etc/netplan$ sudo reboot
[...]
werner@tk-les-plus-v3-ubuntu-24-04:~$ sudo systemd-analyze 
Startup finished in 13.103s (firmware) + 6.226s (loader) + 1.786s (kernel) + 2min 1.870s (userspace) = 2min 22.986s 
graphical.target reached after 2min 1.846s in userspace.

References


Foto Werner Fischer.jpg

Author: Werner Fischer

Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.


Related articles

Activate Hibernate in Ubuntu 12.04
Display and deactivate Firefox Browser Disk Cache
Install Ubuntu from a USB flash drive