Comment 6 for bug 1832675

Revision history for this message
M-A Harvey (ma-harvey) wrote :

Wow! This puzzled me for a while.

On a fresh Ubuntu Server 18.04 install. snap up to date. It turns out that in my case, the issue was caused by a change in Debian's default behavior of the su command.
https://unix.stackexchange.com/questions/460478/debian-su-and-su-path-differences

Since package installs require elevated privileges, it is useful to just type "sudo su" and install all the required packages. See for yourself:

user@ubuntu-hyperv-vm:~$ sudo su
root@ubuntu-hyperv-vm:/home/user# echo $PATH && exit
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

exit
user@ubuntu-hyperv-vm:~$ sudo su -
root@ubuntu-hyperv-vm:~# echo $PATH && exit
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
logout

I traced down the issue to the /etc/profile. This file is only loaded when typing "sudo su -", which in turn calls the /etc/profile.d/apps-bin-path.sh script where the snapd fix to keep the path is placed.

I have no clue where the true fix to enable it would need to be inserted. Perhaps modifying the /etc/pam.d/su config file or something.