"netplan apply" produces ovsdb-server.service WARNING even when openvswitch-switch not installed

Bug #2041727 reported by Brian Elliott Finley
116
This bug affects 25 people
Affects Status Importance Assigned to Milestone
Netplan
Fix Committed
Undecided
Unassigned
netplan.io (Ubuntu)
Triaged
Low
Unassigned
Mantic
Incomplete
Undecided
Unassigned

Bug Description

Example:

bfinley@flashmq2:~$ sudo netplan apply
WARNING:root:Cannot call Open vSwitch: ovsdb-server.service is not running.

bfinley@flashmq2:~$ apt-file search ovsdb-server.service
openvswitch-switch: /lib/systemd/system/ovsdb-server.service

bfinley@flashmq2:~$ dpkg -l openvswitch-switch
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================-============-============-=================================
un openvswitch-switch <none> <none> (no description available)

Possible resolution:

If the package isn't installed, there's no reason to warn that a non-existent service can't be restarted.

Therefore, in "/usr/share/netplan/netplan/cli/commands/apply.py", on line 417 (as of this version), include a test for the existence of ovsdb-server.service before warning about it.

Here's a patch that does just that:

bfinley@flashmq1:/usr/share/netplan/netplan$ diff -urN cli/commands/apply.py.orig cli/commands/apply.py
--- cli/commands/apply.py.orig 2023-10-28 17:18:39.690507475 +0000
+++ cli/commands/apply.py 2023-10-28 17:25:23.940383821 +0000
@@ -414,4 +414,5 @@
             if exit_on_error:
                 sys.exit(1)
         except OvsDbServerNotRunning as e:
- logging.warning('Cannot call Open vSwitch: {}.'.format(e))
+ if utils.systemctl_is_active('ovsdb-server.service'):
+ logging.warning('Cannot call Open vSwitch: {}.'.format(e))

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: netplan.io 0.106.1-7ubuntu0.22.04.2
ProcVersionSignature: Ubuntu 5.15.0-87.97-generic 5.15.122
Uname: Linux 5.15.0-87-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckResult: pass
CloudArchitecture: x86_64
CloudID: none
CloudName: none
CloudPlatform: none
CloudSubPlatform: config
Date: Sat Oct 28 16:54:18 2023
InstallationDate: Installed on 2023-10-24 (4 days ago)
InstallationMedia: Ubuntu-Server 22.04.3 LTS "Jammy Jellyfish" - Release amd64 (20230810)
ProcEnviron:
 TERM=tmux-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: netplan.io
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Brian Elliott Finley (finley) wrote :
Revision history for this message
Lukas Märdian (slyon) wrote :

Thanks for your report.

> If the package isn't installed, there's no reason to warn that a non-existent service can't be restarted.

That's very true! Would you mind transforming your patch into a pull-request at our GitHub repository?
https://github.com/canonical/netplan

Changed in netplan.io (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Mike Ferreira (mafoelffen) wrote :

This exists today in my tests on DEV Noble Server 24.04, even on an unchanged, unmodified netplan yaml file.

Got the first error on my 1st test case that I was modifying to a static address.

Spun up the 2nd test case which was unmodifed/unchange netplan yaml file from the initial install, and by just running:
...
sudo netplan generate
sudo netplan apply
Cannot call Open vSwitch: ovsdb-server.service is not running.
...

I can confirm that it is just a warning, as it did successfully change the 1st test case to a static IP...

Revision history for this message
Dexuan Cui (decui) wrote :

I hit the same bug today. Thanks Brian for proposing the fix, which works for me.

Revision history for this message
MSN (eric-breezy) wrote :

Agreed that it's annoying. I Googled the error and arrived here. :-)

You can also install the Open vSwitch package, even if you're not planning to use it:

     apt-get install openvswitch-switch

The spurious warning message problem goes away. Not elegant, but it works.

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

Having the same issue in a fresh install of Ubuntu Server 22.04 on Raspberry Pi 4. Installing openvswitch-switch appears to resolve the issue.

Revision history for this message
Josir Cardoso Gomes (josircg) wrote :

Having the same issue on Ubuntu Server 23.10
Linux linux08 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Lukas Märdian (slyon)
Changed in netplan.io (Ubuntu):
status: Triaged → In Progress
Lukas Märdian (slyon)
Changed in netplan.io (Ubuntu):
status: In Progress → Confirmed
Changed in netplan:
status: New → In Progress
Changed in netplan.io (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
lee (lingyun123) wrote :
  • HELP.7z Edit (580.3 KiB, application/x-7z-compressed)

help me.
 modified the apply.py like the author did
/usr/share/netplan/netplan$ diff -urN cli/commands/apply.py
line 417 like attachment

Revision history for this message
Patric Hansen (phansen2002) wrote :

This is perhaps a more elegant patch:

--- a/cli/ovs.py
+++ b/cli/ovs.py
@@ -120,17 +120,17 @@
 def apply_ovs_cleanup(config_manager, ovs_old, ovs_current): # pragma: nocover (covered in autopkgtest)
     """
     Query OpenVSwitch state through 'ovs-vsctl' and filter for netplan=true
     tagged ports/bonds and bridges. Delete interfaces which are not defined
     in the current configuration.
     Also filter for individual settings tagged netplan/<column>[/<key]=value
     in external-ids and clear them if they have been set by netplan.
     """
- if not systemctl_is_active(OPENVSWITCH_OVSDB_SERVER_UNIT):
+ if os.path.isfile(OPENVSWITCH_OVS_VSCTL) and os.access(OPENVSWITCH_OVS_VSCTL, os.X_OK) and not systemctl_is_active(OPENVSWITCH_OVSDB_SERVER_UNIT):
         raise OvsDbServerNotRunning('{} is not running'.format(OPENVSWITCH_OVSDB_SERVER_UNIT))

     config_manager.parse()
     ovs_ifaces = set()
     for i in config_manager.all_defs.keys():
         if (is_ovs_interface(i, config_manager.all_defs)):
             ovs_ifaces.add(i)

Lukas Märdian (slyon)
Changed in netplan:
status: In Progress → Fix Committed
Revision history for this message
Inder Kochar (ikochar) wrote :

I am setting up a ubuntu 22.04.4 (LTS) today. This error/warning still exists.
no any package installed. Just ubuntu server and tried to configure static IP address.

Revision history for this message
Lami (tolem) wrote :

Thanks!

Revision history for this message
Peter Gimesi (gimesip) wrote :

I've just set up ubuntu 22.04.4 (LTS) on a raspberry nano 2 and this error still there after adding WiFi networks.

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

It will be handled once we backport the next version of Netplan to 22.04 LTS, see bug #2058031

Revision history for this message
Gene (e-n-shylaev) wrote :

confirm it.
fresh install from CD 2024.4-minimal. attempt to change network settings from dhcp to static by netplan results unoperable network

Revision history for this message
Gene (e-n-shylaev) wrote :

sorry. mistake.
CD 22.04.4-minimal of course

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Can we get proper SRU information on this bug? Thank you!

Changed in netplan.io (Ubuntu Mantic):
status: New → Incomplete
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.