Skip to content

Instantly share code, notes, and snippets.

@scmanjarrez
Last active February 3, 2024 11:24
Show Gist options
  • Save scmanjarrez/b0dfaf2b78b3accf5efeb80c69e902aa to your computer and use it in GitHub Desktop.
Save scmanjarrez/b0dfaf2b78b3accf5efeb80c69e902aa to your computer and use it in GitHub Desktop.
Backup on how to ignore waiting for interfaces with optional: true in netplan (bug)

Backup of https://stackoverflow.com/a/77365896/4305230 fixes https://bugs.launchpad.net/netplan/+bug/2039083 https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1906646

i have solved this problem

netplan apply says ovsdb-server.service is not running, then i just install this openvswitch

since i run ubuntu server in raspberry pi, i need to install extra lib:

# run this first
$ sudo apt-get install linux-modules-extra-raspi
# run this then
$ sudo apt-get install openvswitch-switch-dpdk

you may need to check installation by run these command again

after the installation complete, no annoying WARNING shows again:

$ sudo netplan try

however, systemd-networkd-wait-online.service still timeout, no matter how many times you restart it

i have consulted the man page for systemd-networkd-wait-online.service usage

this service is just to wait all interface managed by systemd-networkd are ready

in fact, i only use ethernet interface and wlan interface, these interfaces work well

$ ip a
# status of my interfaces

so i asked chatgpt about how to wait specific interfaces for systemd-networkd-wait-online.service

it told my to add args in /lib/systemd/system/systemd-networkd-wait-online.service

$ vim /lib/systemd/system/systemd-networkd-wait-online.service
[Service]
Type=oneshot
# flag `--interface` is used to wait specific interface
# in this case, i need to wait wlan interface and ethernet interface
ExecStart=/lib/systemd/systemd-networkd-wait-online --interface=wlan0 --interface=eth0
RemainAfterExit=yes
# this parameter is used to set timeout, 30s is enough for my pi
TimeoutStartSec=30sec

after edition, you need to reload this script and restart service

$ systemctl daemon-reload
$ systemctl restart systemd-networkd-wait-online.service

that is all, everything gonna be fine (maybe)

When interface disabled (dtoverlay=disable-wifi), just comment wlan0 lines instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment