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

Bug #2041727 reported by Brian Elliott Finley
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
netplan
New
Undecided
Unassigned
netplan.io (Ubuntu)
Triaged
Low
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.

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.