I update my system by:
apt-get upgrade
Then bad things happened. When I rebooted the system, I had it get a timeout about the network connection.
I am pretty sure that my network connection is fine (it is unchanged during the update). I can get an IP address allocated (both Ethernet and WLAN).
I have consulted Google:
# Anyway, I was told to run
sudo netplan apply
And I get:
WARNING:root:Cannot call Open vSwitch: ovsdb-server.service is not running.
I have never installed this ovsdb stuff in my server, but this warning is really annoying:
it may related to network timeout, or not
How can I fix this (to erase this warning or just help me to solve the network connection problem)?
I tried:
systemctl status systemd-networkd-wait-online.service
And I get:
× systemd-networkd-wait-online.service - Wait for Network to be Configured
Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; enabled; vendor preset: disabled)
Active: failed (Result: timeout) since Tue 2023-08-22 05:12:01 CST; 2 months 3 days ago
Docs: man:systemd-networkd-wait-online.service(8)
Process: 702 ExecStart=/lib/systemd/systemd-networkd-wait-online (code=exited, status=0/SUCCESS)
Main PID: 702 (code=exited, status=0/SUCCESS)
CPU: 22ms
Aug 22 05:11:59 ubuntu systemd[1]: Starting Wait for Network to be Configured...
Aug 22 05:12:01 ubuntu systemd[1]: systemd-networkd-wait-online.service: start operation timed out. Terminating.
Aug 22 05:12:01 ubuntu systemd[1]: systemd-networkd-wait-online.service: Failed with result 'timeout'.
Aug 22 05:12:01 ubuntu systemd[1]: Failed to start Wait for Network to be Configured.
I have solved this problem.
netplan apply
says ovsdb-server.service is not running, and then I just install this openvswitch
.
Since I run Ubuntu server on Raspberry Pi, I need to install an extra library:
# 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 the installation by running these commands again.
After the installation is complete, no annoying warning shows again:
sudo netplan try
However, the systemd-networkd-wait-online.service still times out, 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 for all interface managed by systemd-networkd to be ready.
In fact, I only use the Ethernet interface and WLAN interface. These interfaces work well:
ip a
# Status of my interfaces
So I asked ChatGPT about how to wait for specific interfaces for the systemd-networkd-wait-online.service.
It told my to add arguments in /lib/systemd/system/systemd-networkd-wait-online.service
:
vim /lib/systemd/system/systemd-networkd-wait-online.service
Content:
[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 the timeout, and 30 seconds is enough for my Raspberry Pi
TimeoutStartSec=30sec
After editing, you need to reload this script and restart the service:
systemctl daemon-reload
systemctl restart systemd-networkd-wait-online.service
That is all, and everything is going to be fine (maybe).