netplan apply will crash if openvswitch is not running

Bug #1995598 reported by Danilo Egea Gondolfo
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
netplan.io (Ubuntu)
Fix Released
Medium
Danilo Egea Gondolfo

Bug Description

The problem was reported on Ubuntu 22.04.

netplan apply will call ovs-vsctl and will crash if openvswitch is not running.

# sudo netplan apply
ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)
Traceback (most recent call last):
  File "/usr/sbin/netplan", line 23, in <module>
    netplan.main()
  File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 247, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 61, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 247, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 167, in command_apply
    NetplanApply.process_ovs_cleanup(config_manager, old_files_ovs, restart_ovs, exit_on_error)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 394, in process_ovs_cleanup
    apply_ovs_cleanup(config_manager, ovs_old, ovs_current)
  File "/usr/share/netplan/netplan/cli/ovs.py", line 138, in apply_ovs_cleanup
    out = subprocess.check_output([OPENVSWITCH_OVS_VSCTL, '--columns=name,external-ids',
  File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/ovs-vsctl', '--columns=name,external-ids', '-f', 'csv', '-d', 'bare', '--no-headings', 'list', 'Port']' returned non-zero exit status 1.

Netplan should throw a warning message and ignore ovs configuration is cases like this.

Lukas Märdian (slyon)
Changed in netplan.io (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in netplan.io (Ubuntu):
assignee: nobody → Danilo Egea Gondolfo (danilogondolfo)
tags: added: foundations-todo
Revision history for this message
Lukas Märdian (slyon) wrote :
Lukas Märdian (slyon)
Changed in netplan.io (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.106-0ubuntu1

---------------
netplan.io (0.106-0ubuntu1) lunar; urgency=medium

  * New upstream release: 0.106
    - New 'netplan status' CLI (#290)
    - API: implement APIs from the new specification (#298)
    - Check and fix non-inclusive laguange (#303)
    - Documentation improvements (using Diátaxis & RTD)
    - Match by PermanentMACAddress (#278)
    - Netplan api iterator (#306)
    - API: update netplan_delete_connection() (#322)
    - NM 1.40 compat & file permission fixes (#300), LP: #1862600, LP: #1997348
    - Migrate from (deprecated) nose to pytest (#302)
    - parse: Add the filepath to OVS ports netdefs (#295)
    - Check if the interface name is too long (#313), LP: #1988749
    - doc/examples: remove unnecessary route for IPv6 on-link gateways (#312)
    - Memory leak CI action (#321)
    - tests:base:ethernets: Improve stability of autopkgtests (#223)
    Bug fixes:
    - Fix some memory leaks (#297)
    - parser: plug a memory leak (#309)
    - src:parse: plug memory leaks in nullable handling (#319)
    - Fix 'netplan ip leases' crash (#301), LP: #1996941
    - tests: mock calls to systemctl (#314)
    - ctests: fix an integer conversion issue (#315)
    - docs: small fix on netplan-set doc (#316)
    - parser: return the correct error on failure (#308), LP: #2000324
    - apply: Fix crash when OVS is stopped (#307),LP: #1995598
    - networkd: make sure VXLAN is in the right section (#310), LP: #2000713
    - cli:set: update only specific origin-hint if given (#299), LP: #1997467
    - vxlan: convert some settings to tristate (#311), LP: #2000712
    - parser: check for route duplicates (#320), LP: #2003061
  * Update symbols file for 0.106
  * d/patches/: Drop patches, applied upstream
  * d/control: bump Standards-Version to 4.6.2, no changes needed
  * d/t/control: prepare Debian testbed
  * d/control: Add python3-dbus, python3-rich deps, also CMocka and Pytest B-Ds
  * d/watch: fix checking for upstream tags
  * d/copyright: update for 2023
  * d/source/: add lintian-overrides

 -- Lukas Märdian <email address hidden> Thu, 09 Feb 2023 12:10:19 +0100

Changed in netplan.io (Ubuntu):
status: Fix Committed → Fix Released
Benjamin Drung (bdrung)
tags: removed: foundations-todo
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.