5

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!!

7
  • 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.
    – Thomas Ward
    Oct 16, 2021 at 19:46
  • 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 Oct 17, 2021 at 21:28
  • 1
    I am also seeing this issue. Did you solve it Jeffrey?
    – Mark AU
    Oct 18, 2021 at 8:39
  • Nope, issue is still there. Weird. Netplan apply works, but not try. Thinking it is a bug in 21.10. Oct 19, 2021 at 13:19
  • not only 21.10, I have the same issue on a freshly installed 20.04.3 LTS dedicated server
    – the_nuts
    Oct 27, 2021 at 15:09

3 Answers 3

8

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.

2
  • Than you. Appreciate the update Oct 30, 2021 at 8:52
  • The last update included updates for netplan.io. the issue is now resolved Nov 28, 2021 at 17:16
0

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

-1

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: []
2
  • 1
    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.
    – Thomas Ward
    Oct 22, 2021 at 17:15
  • Unfortunately, adding the match and macaddress has not solved the issue. I am still getting the same error. Thanks for posting though. Oct 24, 2021 at 0:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .