netplan crash when using command netplan

Bug #2059415 reported by jenloi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
netplan.io (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

➜ ~ netplan status
Traceback (most recent call last):
  File "/sbin/netplan", line 20, in <module>
    from netplan_cli import Netplan
  File "/usr/share/netplan/netplan_cli/__init__.py", line 18, in <module>
    from .cli.core import Netplan
  File "/usr/share/netplan/netplan_cli/cli/core.py", line 24, in <module>
    from . import utils
  File "/usr/share/netplan/netplan_cli/cli/utils.py", line 28, in <module>
    from netplan import NetDefinition, NetplanException
ImportError: cannot import name 'NetDefinition' from 'netplan' (/usr/share/netplan/netplan/__init__.py)

➜ ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Noble Numbat (development branch)
Release: 24.04
Codename: noble

Revision history for this message
jenloi (jenloi) wrote :

python --version
Python 3.12.2

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote :

Hello, can you explain how you got to this situation?

Have you upgraded your system from Jammy to Noble?

Can you paste the output of "dpkg --list | grep netplan", please?

Can you also paste the output of "find /usr/share/netplan/netplan/"?

Thanks!

Revision history for this message
jenloi (jenloi) wrote :

Hello Danilo thanks for quick follow up!

~ dpkg --list | grep netplan
ii libnetplan0:amd64 0.107.1-3 amd64 YAML network configuration abstraction runtime library
ii netplan-generator 0.107.1-3 amd64 YAML network configuration abstraction systemd-generator
ii netplan.io 0.107.1-3 amd64 YAML network configuration abstraction for various backends
ii python3-netplan 0.107.1-3 amd64 YAML network configuration abstraction Python bindings

Revision history for this message
jenloi (jenloi) wrote :
Download full text (3.4 KiB)

~ find /usr/share/netplan/netplan/
/usr/share/netplan/netplan/
/usr/share/netplan/netplan/_features.py
/usr/share/netplan/netplan/terminal.py
/usr/share/netplan/netplan/libnetplan.py
/usr/share/netplan/netplan/__pycache__
/usr/share/netplan/netplan/__pycache__/terminal.cpython-310.pyc
/usr/share/netplan/netplan/__pycache__/configmanager.cpython-311.pyc
/usr/share/netplan/netplan/__pycache__/libnetplan.cpython-312.pyc
/usr/share/netplan/netplan/__pycache__/libnetplan.cpython-310.pyc
/usr/share/netplan/netplan/__pycache__/configmanager.cpython-310.pyc
/usr/share/netplan/netplan/__pycache__/configmanager.cpython-312.pyc
/usr/share/netplan/netplan/__pycache__/libnetplan.cpython-311.pyc
/usr/share/netplan/netplan/__pycache__/_features.cpython-310.pyc
/usr/share/netplan/netplan/__pycache__/__init__.cpython-311.pyc
/usr/share/netplan/netplan/__pycache__/__init__.cpython-312.pyc
/usr/share/netplan/netplan/__pycache__/__init__.cpython-310.pyc
/usr/share/netplan/netplan/__init__.py
/usr/share/netplan/netplan/cli
/usr/share/netplan/netplan/cli/__pycache__
/usr/share/netplan/netplan/cli/__pycache__/utils.cpython-312.pyc
/usr/share/netplan/netplan/cli/__pycache__/utils.cpython-311.pyc
/usr/share/netplan/netplan/cli/__pycache__/ovs.cpython-310.pyc
/usr/share/netplan/netplan/cli/__pycache__/core.cpython-312.pyc
/usr/share/netplan/netplan/cli/__pycache__/sriov.cpython-310.pyc
/usr/share/netplan/netplan/cli/__pycache__/utils.cpython-310.pyc
/usr/share/netplan/netplan/cli/__pycache__/__init__.cpython-311.pyc
/usr/share/netplan/netplan/cli/__pycache__/core.cpython-311.pyc
/usr/share/netplan/netplan/cli/__pycache__/__init__.cpython-312.pyc
/usr/share/netplan/netplan/cli/__pycache__/__init__.cpython-310.pyc
/usr/share/netplan/netplan/cli/__pycache__/core.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands
/usr/share/netplan/netplan/cli/commands/status.py
/usr/share/netplan/netplan/cli/commands/apply.py
/usr/share/netplan/netplan/cli/commands/ip.py
/usr/share/netplan/netplan/cli/commands/__pycache__
/usr/share/netplan/netplan/cli/commands/__pycache__/try_command.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/generate.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/status.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/get.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/sriov_rebind.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/ip.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/set.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/info.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/migrate.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/__init__.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/__pycache__/apply.cpython-310.pyc
/usr/share/netplan/netplan/cli/commands/get.py
/usr/share/netplan/netplan/cli/commands/generate.py
/usr/share/netplan/netplan/cli/commands/__init__.py
/usr/share/netplan/netplan/cli/commands/info.py
/usr/share/netplan/netplan/cli/commands/migrate.py
/usr/share/netplan/netplan/cli/commands/try_command.py
/usr/share/netplan/netplan/cli/commands/sriov_rebi...

Read more...

Revision history for this message
jenloi (jenloi) wrote :

I am getting netplan crash when I am at Jammy dist.
I do not know how to report a bug that time.
I am hoping updating the dist would resolve it.

Revision history for this message
jenloi (jenloi) wrote :

I have tried to remove and reinstall NetworkManager together with netplan.io, but it didnt help

Revision history for this message
Danilo Egea Gondolfo (danilogondolfo) wrote :

Thanks for the information.

The crash you mentioned you were getting on Jammy, is that the same crash you reported?

Did you manually upgrade netplan to 0.107 on Jammy for any chance?

So, after upgrading to 0.107.1, the directory /usr/share/netplan/netplan should have been removed (or at least all the .py files should've been removed). The code from this directory was moved to the package python3-netplan, which you have installed.

Try to rename this directory to something like /usr/share/netplan/netplan.old and try netplan again, it should fix the issue for you. Then you can just delete it.

It's not clear to me yet how all the .py files from this directory were left behind...

Revision history for this message
jenloi (jenloi) wrote :

For whatever reason, what I did was

1. rename the dir of /usr/share/netplan to /usr/share/netplan.old
2. reinstall netplan
3. pip uninstall netplan (guess this is the culprit)

And my netplan finally works

~ netplan status
     Online state: online

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