Hi Jegadish,


My new install of ubuntu 26.04 was getting an autoconfig address, despite a
fresh out of the box install. I ended up using a local agent to diagnose
the issue and it was not set for dhcp out of the box. I had the agent
summarize the situation more closely and respond to your question:




 Good question — let me give you the full context, because this didn't
happen in an isolated setting. I'll answer your dispatcher question
directly first, then explain why I was running the command.




 To your question: No, an NM dispatcher program did not drop its
privileges. In my setup the crash was a direct manual invocation of netplan
generate from a terminal, run as uid 1000 — there was no dispatcher in the
process path. The apport crash report confirms this:




 - ProcCmdline: /usr/bin/python3 /usr/sbin/netplan generate



 - ProcCwd: /home/austinsr (invoking user's home directory — i.e. a shell,
not a dispatcher)


 - ProcEnviron: XDG_RUNTIME_DIR=<set>, TERM=xterm-256color, SHELL=/bin/bash
(interactive terminal traits)


 - Crash owner .1000 = uid 1000; user's groups include sudo, adm





 Why I was running it — and this is the relevant part:





 I had just discovered the root cause of an ethernet problem on a fresh
Ubuntu 26.04 workstation: the subiquity-generated config
(00-installer-config.yaml) defined enp1s0 with only match: {macaddress} and
set-name, but omitted dhcp4: true. Netplan then defaulted to link-local
addressing, so enp1s0 came up with a
 169.254.x.x address instead of a DHCP lease. This is the exact scenario in
the traceback — it's a broken/mis-generated netplan config that leaves the
user troubleshooting network config.




 While diagnosing that, I ran netplan generate — without sudo, from my user
shell, from /home/austinsr — which is a natural thing to do since netplan
generate only renders backend files and applies nothing. Generating
succeeded, but the final systemctl daemon-reload --no-ask-password step
requires root, failed with
 exit 1, and the unhandled subprocess.CalledProcessError produced the
apport report rather than degrading gracefully.





 So the crash surfaced in a very real scenario: netplan's own config
generation left the box offline, a user ran the (apparently harmless)
netplan generate to inspect what was happening, and netplan crashed as
non-root instead of telling them what it did.




 Additional detail that may matter for the fix: A user with sudo in their
groups (like me) still runs these diagnostic netplan commands without sudo
routinely; they should fail cleanly, not crash and file a crash report.
Guarding systemctl_daemon_reload() for the non-root case (skip or tolerate
the failure via an
 euid check or try/except) would resolve this. The config generation itself
is safe and useful to run as non-root.





 Happy to test a candidate build if you push one.





 Thanks,



 austinsr

On Fri, Jul 31, 2026 at 5:30 AM Jegadish <[email protected]>
wrote:

> @austinsr
>
> Thanks for the bug report. I am able to reproduce the issue when
> 'netplan generate' is run as non root user. And yes, this needs to be
> fixed.
>
> The part that is not clear to me is, Considering Network-Manager
> dispatcher programs are run as root, how this issue was seen in your
> setup. Did one of the NM dispatcher programs dropped its root privileges
> during execution?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2161924
>
> Title:
>   netplan generate crashes with CalledProcessError when run as non-root
>   user
>
> Status in netplan.io package in Ubuntu:
>   Triaged
>
> Bug description:
>   When `netplan generate` is run as a non-root user (e.g., triggered by
>   a NetworkManager dispatcher after a connection change), it
>   successfully generates config files but then crashes with an unhandled
>   subprocess.CalledProcessError when attempting `systemctl daemon-reload
>   --no-ask-password`. The daemon-reload command requires root privileges
>   and fails, causing the entire operation to crash and file an apport
>   report instead of completing gracefully.
>
>   Steps to reproduce:
>   1. Run `netplan generate` as a non-root user (e.g., after NetworkManager
> triggers it via dispatcher)
>   2. The config generation succeeds, but systemctl daemon-reload fails
> with exit status 1
>   3. The unhandled exception causes an apport crash report
>
>   Traceback:
>    File "/usr/sbin/netplan", line 23, in <module>
>      netplan.main()
>    File "/usr/share/netplan/netplan_cli/cli/core.py", line 58, in main
>      self.run_command()
>    File "/usr/share/netplan/netplan_cli/cli/utils.py", line 340, in
> run_command
>      self.func()
>    File "/usr/share/netplan/netplan_cli/cli/commands/generate.py", line
> 47, in run
>      self.run_command()
>    File "/usr/share/netplan/netplan_cli/cli/utils.py", line 340, in
> run_command
>      self.func()
>    File "/usr/share/netplan/netplan_cli/cli/commands/generate.py", line
> 127, in command_generate
>      utils.systemctl_daemon_reload()
>    File "/usr/share/netplan/netplan_cli/cli/utils.py", line 173, in
> systemctl_daemon_reload
>      subprocess.check_call(['systemctl', 'daemon-reload',
> '--no-ask-password'])
>   subprocess.CalledProcessError: Command '['systemctl', 'daemon-reload',
> '--no-ask-password']' returned non-zero exit status 1.
>
>   Expected behavior: netplan generate should handle the daemon-reload
>   failure gracefully when run as a non-root user, since generating
>   config files does not require elevated privileges. The daemon-reload
>   should be wrapped in a try/except or checked for root privileges
>   before attempting.
>
>   Ubuntu version: 26.04 LTS (Resolute Raccoon)
>   netplan.io version: (from crash report - apport generated report
> _usr_share_netplan_netplan.script.1000.crash)
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2161924/+subscriptions
>
>

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2161924

Title:
  netplan generate crashes with CalledProcessError when run as non-root
  user

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2161924/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to