Score:5

Ubuntu 21.10 - Netplan: object has no attribute 'state'

jp flag

EDIT: So after about three hours of trying to get 'netplan try' to work, I tried 'netplan apply' and the setting worked. Yet, 'netplan try' still throws the same error. I am assuming that this is a bug?

I just upgraded to 21.10. However, I am having troubles with NetPlan. Trying to apply the following new setup, NetPlan is coming back with the error "'netplanapply' object has no attribute 'state'" and reverts back to the last setup

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      link-local: []
      optional: true
      dhcp4: no
      addresses:
       - 192.168.189.6/24
      routes:
        - to: default
          via: 192.168.189.2
      nameservers:
        addresses: [192.168.189.2]
        search: [young.youngind.ca]

Even when I copy back the default netplan config file and run netplan try, I get the same error.

network:
  ethernets:
    enp1s0:
      dhcp4: true
  version: 2

Any ideas as to what is going on? I get the same error with the freshly installed netplan config!!

ru flag
Can you get teh *exact* error output, all of it? If it's reproducible then this is an error in the program that needs fixed, and not your doing.
Jeffrey Young avatar
jp flag
root@dc:/home/jay# 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
Mark AU avatar
in flag
I am also seeing this issue. Did you solve it Jeffrey?
Jeffrey Young avatar
jp flag
Nope, issue is still there. Weird. Netplan apply works, but not try. Thinking it is a bug in 21.10.
us flag
not only 21.10, I have the same issue on a freshly installed 20.04.3 LTS dedicated server
arupgsh avatar
cn flag
Having the same issue with fresh installs of Ubuntu 20.04.3 LTS server version.
karel avatar
sa flag
This has been report to Launchpad as [Bug 1949104](https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1949104).
Score:7
br flag

There is a bug report about this issue with 'netplan try' https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1949104

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.

Jeffrey Young avatar
jp flag
Than you. Appreciate the update
Jeffrey Young avatar
jp flag
The last update included updates for netplan.io. the issue is now resolved
Score:0
in flag

I used netplan apply instead and it worked for my situation.

Score:-1
ng flag

I managed to make it work with this configuration below:

network:  
  version: 2  
  renderer: networkd  
  ethernets: 
    eth0:  
      link-local: []  
      optional: true  
      dhcp4: no  
      addresses:  
       - 192.168.189.6/24  
      routes:  
        - to: default  
          via: 192.168.189.2  
      match:
          macaddress: 08:00:27:7d:21:fd  
      set-name: eth0  
      nameservers:  
        addresses: [8.8.8.8]  
        search: []
ru flag
Ask Ubuntu is an English language only site - you must answer in English, so I ran your post through a conversion mechanism. Also, eth0 is deprecated nowadays, and not needed.
Jeffrey Young avatar
jp flag
Unfortunately, adding the match and macaddress has not solved the issue. I am still getting the same error. Thanks for posting though.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.