[Bug 1771858] Re: /snap/bin not in default PATH for units, snapd should ship system-environment-generators to inject /snap/bin into $PATH
Balint Reczey
balint.reczey at canonical.com
Wed Jun 26 21:38:54 UTC 2019
@mvo @xnox ok, so if I run unfixed systemd and fixed snapd and unfixed
initramfs-tools /usr/local/... patch are missing when booting with
initramfs:
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ sudo systemd-run --pty --wait /usr/bin/env | grep PATH
Running as unit: run-u69.service
Press ^] three times within 1s to disconnect TTY.
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/snap/bin
Finished with result: success
Main processes terminated with: code=exited/status=0
Service runtime: 8ms
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ dpkg -l systemd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================-================-================-==================================================
ii systemd 237-3ubuntu10.23 amd64 system and service manager
ubuntu at ubuntu-Standard-PC-i440FX-PIIX-1996:~$ dpkg -l snapd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================-================-================-==================================================
ii snapd 2.37.1+18.04 amd64 Daemon and tooling that enable snap packages
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1771858
Title:
/snap/bin not in default PATH for units, snapd should ship system-
environment-generators to inject /snap/bin into $PATH
Status in snapd package in Ubuntu:
Confirmed
Status in systemd package in Ubuntu:
Fix Released
Status in snapd source package in Xenial:
Confirmed
Status in systemd source package in Xenial:
Confirmed
Status in snapd source package in Bionic:
Confirmed
Status in systemd source package in Bionic:
Fix Committed
Status in snapd source package in Cosmic:
Fix Released
Status in systemd source package in Cosmic:
Fix Released
Bug description:
[Impact]
* This means that software installed via snap isn't transparently
available for units to use. As snaps are first-class citizens in
Ubuntu, we should update the PATH.
* When a generator started to be provided by systemd, it was
recognized that $PATH is not correctly set, nonetheless, due to an
environment bug that systemd generators run in.
[Testcase]
# make snapd-env-generator executable if it is not
$ sudo chmod +x /usr/lib/systemd/system-environment-generators/snapd-env-generator
# reboot, then test the effect of the fix
$ systemd-run /usr/bin/env
$ journalctl -e | grep PATH
Output should contain /snap/bin
Output should contain a complete and a valid PATH, i.e.
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" or similar.
[Regression Potential]
* snapd generator was already fixed separately to cause no harm, when
running under a broken systemd. With the corrected environment,
generators will now run with a correct PATH out of the box. A slight
change of PATH will be observed by all generators, when running in
containers/initramfs-less boots. However most generators will not be
affected as they typically do not execute external binaries.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1771858/+subscriptions
More information about the foundations-bugs
mailing list