netplan try is broken

Bug #1949104 reported by Stefan Greiner
50
This bug affects 8 people
Affects Status Importance Assigned to Milestone
netplan.io (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
Hirsute
Fix Released
Undecided
Unassigned
Impish
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned

Bug Description

[Impact]
The last netplan SRU (0.103-0ubuntu5~20.04.2) introduced a state tracking
feature, that regressed the 'netplan try' CLI command, if no such --state
argument is passed, making it fail with a error message like this:

An error occurred: 'NetplanApply' object has no attribute 'state'

This upload contains a fix to properly initialize the 'self.state' attribute in
all cases to avoid this problem.

[Test Plan]
In addition to runing & passing the full set of unit- and integration-tests
(that contains new tests to check for this regression), as described in
https://wiki.ubuntu.com/NetplanUpdates we want to run the following commands
to make sure the 'netplan try' command is working properly:

$ netplan try
$ [Ctrl+C] # to abort the waiting
=> Make sure it does not print a "An error occurred" message

$ netplan try
$ [Enter]
=> Make sure it does not print a "An error occurred" message

autopkgtest logs:
* Impish:
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/impish_amd64.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/impish_arm64.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/impish_armhf.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/impish_ppc64el.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/impish_s390x.log
* Hirsute:
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/hirsute_amd64.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/hirsute_arm64.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/hirsute_armhf.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/hirsute_ppc64el.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/hirsute_s390x.log
* Focal:
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/focal_amd64.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/focal_arm64.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/focal_armhf.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/focal_ppc64el.log
https://git.launchpad.net/~slyon/+git/files/tree/LP1949104/focal_s390x.log

[Where problems could occur]
This upload contains changes to the CLI of netplan, if anything goes wrong it
could impact the interactive usage of 'netplan try'/'netplan apply' by the user.

[Other Info]
The full set of autopkgtest logs will be attached after the upload is accepted
into -proposed and the tests have been run on the official autopkgtest.u.c
infrastructure.

=== Original Description ===

I hava a freshly installed Ubuntu Server 20.04 LTS.
I am using a static IP config (100% sure it is correct, also the YAML is correct)

If you then enter "netplan try" I get this:
--------------------------------------------------------------------------------
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket

An error occurred: 'NetplanApply' object has no attribute 'state'

Reverting.
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
--------------------------------------------------------------------------------

"netplan generate && netplan apply" does work.
I found some other people having these issues too on freshly installed 20.04 and 21.10 and online forums.

System Infos:

lsb_release -rd:
Description: Ubuntu 20.04.3 LTS
Release: 20.04

apt-cache policy netplan.io:
netplan.io:
  Installed: 0.103-0ubuntu5~20.04.2
  Candidate: 0.103-0ubuntu5~20.04.2
  Version table:
 *** 0.103-0ubuntu5~20.04.2 500
        500 http://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     0.99-0ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu focal/main amd64 Packages

systemd --version:
systemd 245 (245.4-4ubuntu3.13)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

Thank you!

Revision history for this message
Carlos F. (acsfer) wrote :

No matter the netplan configuration, it always fails with 'NetplanApply' object has no attribute 'state'.

###
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 2a01:5f9:a2c:d230::1/64
            dhcp4: true
            gateway6: fe80::1
            match:
                macaddress: 96:00:00:e4:cd:cb
            set-name: eth0

# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket

An error occurred: 'NetplanApply' object has no attribute 'state'

Reverting.
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket

### Installed packages

libnetplan0/0.103-0ubuntu5~20.04.2 amd64
netplan.io/0.103-0ubuntu5~20.04.2 amd64

### No such problem on another machine with:

libnetplan0/0.103-0ubuntu5~20.04.1 amd64
netplan.io/0.103-0ubuntu5~20.04.1 amd64

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in netplan.io (Ubuntu):
status: New → Confirmed
Carlos sola (solimoni)
Changed in netplan.io (Ubuntu):
status: Confirmed → New
status: New → Confirmed
Revision history for this message
Lukas Märdian (slyon) wrote :

I can confirm that this issue was introduced with the latest update. A fix is being worked on here: https://github.com/canonical/netplan/pull/243

Changed in netplan.io (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Lukas Märdian (slyon) wrote (last edit ):

As a workaround you can execute the "netplan try" command as:
netplan try --state /etc/netplan

This will mitigate the problem for the time being.

tags: added: regression-update
tags: added: rls-jj-incoming
tags: added: fr-1833
tags: removed: rls-jj-incoming
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in netplan.io (Ubuntu Focal):
status: New → Confirmed
Changed in netplan.io (Ubuntu Hirsute):
status: New → Confirmed
Changed in netplan.io (Ubuntu Impish):
status: New → Confirmed
Revision history for this message
Ralf Heiringhoff (frosty-geek) wrote :

I can confirm that #4 works for me as a workaround

Lukas Märdian (slyon)
description: updated
Steve Langasek (vorlon)
Changed in netplan.io (Ubuntu Jammy):
status: Triaged → Fix Committed
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Stefan, or anyone else affected,

Accepted netplan.io into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/netplan.io/0.103-0ubuntu5~20.04.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in netplan.io (Ubuntu Focal):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-focal
Changed in netplan.io (Ubuntu Impish):
status: Confirmed → Fix Committed
tags: added: verification-needed-impish
Revision history for this message
Steve Langasek (vorlon) wrote :

Hello Stefan, or anyone else affected,

Accepted netplan.io into impish-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/netplan.io/0.103-0ubuntu7.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-impish to verification-done-impish. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-impish. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Steve Langasek (vorlon) wrote :

Hello Stefan, or anyone else affected,

Accepted netplan.io into hirsute-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/netplan.io/0.103-0ubuntu5~21.04.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-hirsute to verification-done-hirsute. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-hirsute. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in netplan.io (Ubuntu Hirsute):
status: Confirmed → Fix Committed
tags: added: verification-needed-hirsute
Revision history for this message
Walter (wdoekes) wrote :

Fix 0.103-0ubuntu5~20.04.3 appears to work on Focal.

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

Thank you @wdoekes for confirming it works on Focal!

I've tested netplan.io 0.103-0ubuntu7.1 from impish-proposed and attached the autopkgtest logs to the bug description, according to https://wiki.ubuntu.com/NetplanUpdates.

The 'netplan try' command was run successfully without any "An error occurred" message:

root@sru-ii:~# dpkg -l | grep netplan
ii libnetplan0:amd64 0.103-0ubuntu7.1 amd64 YAML network configuration abstraction runtime library
ii netplan.io 0.103-0ubuntu7.1 amd64 YAML network configuration abstraction for various backends

root@sru-ii:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 115 seconds
Reverting.
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
root@sru-ii:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 115 seconds
Configuration accepted.

tags: added: verification-done-impish
removed: verification-needed-impish
Revision history for this message
Lukas Märdian (slyon) wrote :

I've tested netplan.io 0.103-0ubuntu5~21.04.3 from hirsute-proposed.

The 'netplan try' command was run successfully without any "An error occurred" message:

root@sru-hh:~# dpkg -l | grep netplan
ii libnetplan0:amd64 0.103-0ubuntu5~21.04.3 amd64 YAML network configuration abstraction runtime library
ii netplan.io 0.103-0ubuntu5~21.04.3 amd64 YAML network configuration abstraction for various backends

root@sru-hh:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 118 seconds
Reverting.
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
root@sru-hh:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 118 seconds
Configuration accepted.

tags: added: verification-done-hirsute
removed: verification-needed-hirsute
Revision history for this message
Stefan Greiner (sgreiner) wrote (last edit ):

I can also confirm that 0.103-0ubuntu5~20.04.3 from focal-proposed fixes this bug.

root@xxx:~# dpkg -l | grep netplan
ii libnetplan0:amd64 0.103-0ubuntu5~20.04.3 amd64 YAML network configuration abstraction runtime library
ii netplan.io 0.103-0ubuntu5~20.04.3 amd64 YAML network configuration abstraction for various backends

root@xxx:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 118 seconds
Reverting.
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket

root@xxx:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 119 seconds
Configuration accepted.

tags: added: verification-done-focal verification-needed-hirsute
removed: verification-done-hirsute verification-needed-focal
tags: added: verification-done-hirsute
removed: verification-needed-hirsute
Revision history for this message
Stefan Greiner (sgreiner) wrote :

Sorry we edited the tags at the same time...

tags: added: verification-done
removed: verification-needed
Revision history for this message
Lukas Märdian (slyon) wrote :

I've tested netplan.io 0.103-0ubuntu5~20.04.3 from focal-proposed.

The 'netplan try' command was run successfully without any "An error occurred" message:

root@sru-ff:~# dpkg -l | grep netplan
ii libnetplan0:amd64 0.103-0ubuntu5~20.04.3 amd64 YAML network configuration abstraction runtime library
ii netplan.io 0.103-0ubuntu5~20.04.3 amd64 YAML network configuration abstraction for various backends

root@sru-ff:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 117 seconds
Reverting.
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
root@sru-ff:~# netplan try
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 116 seconds
Configuration accepted.

tags: added: verification-needed
removed: verification-done
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.103-0ubuntu7.1

---------------
netplan.io (0.103-0ubuntu7.1) impish; urgency=medium

  [ Nicolas Bock ]
  * d/p/0001-Add-support-for-additional-Link-options-225-LP-17717.patch:
    - Add offload configuration options.
      (LP: #1771740)
  * Add d/p/partial-d4884cfd40e1e33540b274371c3272df6595d22c.patch:
    - Partial application of d4884cfd40e1e33540b274371c3272df6595d22c in order
      preserve ABI compatibility for future updates.

  [ Lukas Märdian ]
  * Add d/p/0010-parse-nm-Handle-missing-gateway-in-keyfile-routes-ke.patch
    (LP: #1949761)
  * Fix regression in 'netplan try' (LP: #1949104)
    + d/p/lp1949104/cli-apply-initialize-self.state-LP-1949104-243.patch
    + d/p/lp1949104/tests-regressions-make-netplan_try-autopkgtest-more-.patch

 -- Lukas Märdian <email address hidden> Fri, 05 Nov 2021 14:44:08 +0100

Changed in netplan.io (Ubuntu Impish):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for netplan.io has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.103-0ubuntu5~21.04.3

---------------
netplan.io (0.103-0ubuntu5~21.04.3) hirsute; urgency=medium

  [ Nicolas Bock ]
  * d/p/0001-Add-support-for-additional-Link-options-225-LP-17717.patch:
    - Add offload configuration options.
      (LP: #1771740)
  * Add d/p/partial-d4884cfd40e1e33540b274371c3272df6595d22c.patch:
    - Partial application of d4884cfd40e1e33540b274371c3272df6595d22c in order
      preserve ABI compatibility for future updates.

  [ Lukas Märdian ]
  * Add d/p/0010-parse-nm-Handle-missing-gateway-in-keyfile-routes-ke.patch
    (LP: #1949761)
  * Fix regression in 'netplan try' (LP: #1949104)
    + d/p/lp1949104/cli-apply-initialize-self.state-LP-1949104-243.patch
    + d/p/lp1949104/tests-regressions-make-netplan_try-autopkgtest-more-.patch

 -- Lukas Märdian <email address hidden> Fri, 05 Nov 2021 15:18:41 +0100

Changed in netplan.io (Ubuntu Hirsute):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.103-0ubuntu5~20.04.3

---------------
netplan.io (0.103-0ubuntu5~20.04.3) focal; urgency=medium

  [ Nicolas Bock ]
  * d/p/0001-Add-support-for-additional-Link-options-225-LP-17717.patch:
    - Add offload configuration options.
      (LP: #1771740)
  * Add d/p/partial-d4884cfd40e1e33540b274371c3272df6595d22c.patch:
    - Partial application of d4884cfd40e1e33540b274371c3272df6595d22c in order
      preserve ABI compatibility for future updates.

  [ Lukas Märdian ]
  * Add d/p/0010-parse-nm-Handle-missing-gateway-in-keyfile-routes-ke.patch
    (LP: #1949761)
  * Fix regression in 'netplan try' (LP: #1949104)
    + d/p/lp1949104/cli-apply-initialize-self.state-LP-1949104-243.patch
    + d/p/lp1949104/tests-regressions-make-netplan_try-autopkgtest-more-.patch

 -- Lukas Märdian <email address hidden> Fri, 05 Nov 2021 15:15:57 +0100

Changed in netplan.io (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.103-0ubuntu9

---------------
netplan.io (0.103-0ubuntu9) jammy; urgency=medium

  [ Lukas Märdian ]
  * Add an upstream patch for glib 2.70 compatibility
  * Add d/p/0010-parse-nm-Handle-missing-gateway-in-keyfile-routes-ke.patch
    (LP: #1949761)
  * Fix regression in 'netplan try' (LP: #1949104)
    + d/p/lp1949104/cli-apply-initialize-self.state-LP-1949104-243.patch
    + d/p/lp1949104/tests-regressions-make-netplan_try-autopkgtest-more-.patch

  [ Andrej Shadura ]
  * Explicitly depend on glib 2.70

 -- Lukas Märdian <email address hidden> Fri, 05 Nov 2021 09:14:58 +0100

Changed in netplan.io (Ubuntu Jammy):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.