Unable to run netplan try on RPi4 after removing link local

Bug #1880054 reported by Zachary Berger
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Netplan
Confirmed
Undecided
Unassigned

Bug Description

After changing my config file from

```
network:
    ethernets:
        eth0:
            dhcp4: false
            dhcp6: true
            link-local: [ ]
            addresses: [192.168.86.10/24]
            gateway4: 192.168.86.1
            nameservers:
                addresses: [192.168.86.10]
            optional: true
    wifis:
        wlan0:
            optional: true
            dhcp4: no
            addresses: [192.168.86.20/24]
            link-local: [ ipv4 ]
            gateway4: 192.168.86.1
            nameservers:
                addresses: [8.8.8.8, 8.8.4.4]
            access-points:
                "REDACTED":
                    password: "REDACTED"
    version: 2
```

to

```
network:
    ethernets:
        eth0:
            dhcp4: false
            dhcp6: true
            link-local: [ ]
            addresses: [192.168.86.10/24]
            gateway4: 192.168.86.1
            nameservers:
                addresses: [192.168.86.10]
            optional: true
    wifis:
        wlan0:
            optional: true
            dhcp4: no
            addresses: [192.168.86.20/24]
            link-local: [ ]
            gateway4: 192.168.86.1
            nameservers:
                addresses: [8.8.8.8, 8.8.4.4]
            access-points:
                "Get SchWiFi":
                    password: "REDACTED"
    version: 2
```

When I run `sudo netplan try` I get the following errors:

```
ubuntu@pi-01:~/netplan$ sudo netplan try
Job for netplan-wpa-wlan0.service canceled.

An error occurred: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

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

This is built from GitHub 35548a4 as I was experiencing the daemon-reload issue in #1874494

Revision history for this message
Zachary Berger (zachberger) wrote :

I manully ran `sudo systemctl stop systemd-networkd netplan-wpa-wlan0` and now netplan try fails with another error:

ubuntu@pi-01:~/netplan$ sudo netplan try
Job for netplan-wpa-wlan0.service canceled.

An error occurred: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

Reverting.
Job for netplan-wpa-wlan0.service canceled.
Traceback (most recent call last):
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 83, in command_try
    NetplanApply.command_apply(run_generate=True, sync=True, exit_on_error=False)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 120, in command_apply
    utils.systemctl_networkd('stop', sync=sync, extra_services=wpa_services)
  File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd
    subprocess.check_call(command)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

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 191, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 66, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 191, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 94, in command_try
    self.revert()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 117, in revert
    NetplanApply.command_apply(run_generate=False, sync=True, exit_on_error=False)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 120, in command_apply
    utils.systemctl_networkd('stop', sync=sync, extra_services=wpa_services)
  File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd
    subprocess.check_call(command)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

description: updated
Revision history for this message
Panos Chatzigiannis (bomberb17) wrote :
Download full text (4.0 KiB)

I also have the same problem after changing my yaml configuration. I decided to change the DNS configuration, i.e. remove my router local DNS and replace it with Cloudflare's DNS.
So knowing that the yaml file is very sensitive with spaces, the only change I made is to remove the "92" and "68", so the file now is as follows:

$ cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            dhcp4: true
    wifis:
        wlan0:
            dhcp4: no
            addresses: [192.168.1.12/24]
            gateway4: 192.168.1.1
            nameservers:
                addresses: [1.1.1.1, 8.8.8.8]
            access-points:
                "accesspointname":
                    password: "accesspointpassword"
    version: 2

 However when I run netplan try, I get the following:

$ sudo netplan try
Job for netplan-wpa-wlan0.service canceled.

An error occurred: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

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

or:

$ sudo netplan try
Job for netplan-wpa-wlan0.service canceled.

An error occurred: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

Reverting.
Job for netplan-wpa-wlan0.service canceled.
Traceback (most recent call last):
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 84, in command_try
    NetplanApply().command_apply(run_generate=True, sync=True, exit_on_error=False)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 164, in command_apply
    utils.systemctl_networkd('stop', sync=sync, extra_services=wpa_services)
  File "/usr/share/netplan/netplan/cli/utils.py", line 131, in systemctl_networkd
    subprocess.check_call(command)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['systemctl', 'stop', 'systemd-networkd.service', 'netplan-wpa-*.service']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

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 264, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 66, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 264, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 95, in command_try
    self.revert()
  File "/usr/share/netplan/netplan/cli/commands/try_command.p...

Read more...

Changed in netplan:
status: New → Confirmed
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.