systemd-networkd-wait-online.service fails to complete if one of the network interfaces is not physically connected

Bug #2045756 reported by Heinrich Schuchardt
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Invalid
Undecided
Unassigned
netplan.io (Ubuntu)
Invalid
Undecided
Unassigned
systemd (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

My StarFive VisionFive 2 board has two network interfaces of which I have only connected one to a switch. The systemd-networkd-wait-online.service always fails delaying boot by 150 s. The problem does not occur if both network interfaces are physically connected.

It does not make any sense to wait for the initialization of a network interface that is not physically connected.

As described in https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net the physical link state can be determined via /sys/class/net/<iface>/carrier.

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: systemd 253.5-1ubuntu7
ProcVersionSignature: Ubuntu 6.5.0-9.9.1-generic 6.5.3
Uname: Linux 6.5.0-9-generic riscv64
ApportVersion: 2.27.0-0ubuntu6
Architecture: riscv64
CasperMD5json:
 {
   "result": "skip"
 }
Date: Wed Dec 6 10:57:52 2023
InstallationDate: Installed on 2023-12-04 (2 days ago)
InstallationMedia: Ubuntu-Server 24.04 "Noble Numbat" - Daily riscv64 (20231204)
Lspci-vt:
 -[0000:00]---00.0-[01]----00.0 VIA Technologies, Inc. VL805/806 xHCI USB 3.0 Controller
 -[0001:00]---00.0-[01]----00.0 KIOXIA Corporation NVMe SSD Controller BG4 (DRAM-less)
Lsusb:
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Lsusb-t:
 /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
 /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
ProcEnviron:
 LANG=en_US.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=vt220
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-6.5.0-9-generic root=UUID=2ee109fa-e475-473e-a8da-79f18ec0c1a3 ro
SourcePackage: systemd
SystemdFailedUnits:
 Error: command ['systemctl', 'status', '--full', '●'] failed with exit code 4: Invalid unit name "●" escaped as "\xe2\x97\x8f" (maybe you should use systemd-escape?).
 Unit \xe2\x97\x8f.service could not be found.
UpgradeStatus: No upgrade log present (probably fresh install)
acpidump:

Revision history for this message
Heinrich Schuchardt (xypron) wrote :
summary: - systemd-networkd-wait-online.service fails to complete
+ systemd-networkd-wait-online.service fails to complete if one of the
+ network interfaces is not physically connected
Revision history for this message
Heinrich Schuchardt (xypron) wrote :
Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The following files where created when installing the system:
/run/systemd/network/10-netplan-end0.network

[Match]
Name=end0

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6

[DHCP]
RouteMetric=100
UseMTU=true

/run/systemd/network/10-netplan-end1.network
[Match]
Name=end1

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6

[DHCP]
RouteMetric=100
UseMTU=true

Upstream recommends adding RequiredForOnline=no

Revision history for this message
Lukas Märdian (slyon) wrote :

The RequiredForOnline=no flag can be controlled using Netplan's "optional: true" setting.
In your specific case (cable not connected) you might also be interested in Netplan's "ignore-carrier: true" setting, which brings up the interface regardless.

Please check /etc/netplan/ for those settings (or "sudo netplan get"). Those initial settings might have been written by cloud-init or subiquity or some other means of deployment.

Changed in netplan.io (Ubuntu):
status: New → Incomplete
Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The netplan configuration is in /etc/netplan/50-cloud-init.yaml.

"optional: true" works, with "ignore-carrier: true" I still get the failure.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

Probably cloud-init's cloudinit/net/netplan.py should add "optional: true" to interfaces that have no carrier.

Changed in netplan.io (Ubuntu):
status: Incomplete → Invalid
Changed in systemd (Ubuntu):
status: New → Invalid
Revision history for this message
Nick Rosbrook (enr0n) wrote :

As Yu said on the upstream bug, this is the expected default behavior for systemd-networkd-wait-online. You can make it more tailored to your use case, e.g. by writing an override like this:

# /etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf
[Service]
ExecStart=
ExecStart=/lib/systemd/systemd-networkd-wait-online --any

Or, if you always want the same interface, pass --interface $name instead.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

cloud-init could check the availability of the carrier at installation time and add 'optional: true' in cloudinit/net/netplan.py. But this would only reflect the state at the time of installation.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

Thanks Nick, your suggestion works fine. Let's see where it makes sense to add the overlay to our images.

Changed in cloud-init (Ubuntu):
status: New → Invalid
Revision history for this message
bam (mybigspam) wrote :

"optional: true" setting doesn't work for me, maybe because I use Network Manager:

$ cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    eno0:
      dhcp4: true
      dhcp6: true
      optional: true
  renderer: NetworkManager
  version: 2

I also do not have cables connected, WiFi only.

Any advice?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.