Snap not working

TLDR; To fix, create /etc/environment.d/, set the path in a configuration file there, and reboot:

sudo mkdir /etc/environment.d
sudo echo -e "PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/snap/bin"\nXDG_DATA_DIRS="/usr/local/share:/usr/share:/var/lib/snapd/desktop"" > /etc/environment.d/60-snap-icons-and-bin.conf
sudo reboot now 

I had the same problem on Ubuntu 18.04.02 LTS aka bionic, kernel 4.15.0-50. My snap was working but I couldn't look at logs, switch channels, save snapshots, or manage services:

error: system does not fully support snapd: cannot mount squashfs image using "squashfs": exec:
   "mount": executable file not found in $PATH

Turned out the problem has nothing to do with squashfs; I eventually found evidence it had to be an environment problem:

error: cannot get logs: exec: "journalctl": executable file not found in $PATH

The squashfs mounts are present:

/var/lib/snapd/snaps/core_0000.snap on /snap/core/0000 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/nextcloud_11111.snap on /snap/nextcloud/11111 type squashfs (ro,nodev,relatime,x-gdu.hide)

I had set /etc/environment this way:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap:/snap/bin"

Couldn't see how that wouldn't be working, so I ruled out problems with seccomp or apparmor, modules, missing packages, or snap configuration files.


When I'd almost concluded that I was one of two people in the world having this problem, I hit upon an old post about snap desktop apps; I modified the solution to fit. Probably there are other ways to make the environment work - see environment.d manual. The system sources environment variables from very different files depending on what kind of shell you're in, or if you're in one at all.

sudo mkdir /etc/environment.d
sudo echo -e "PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/snap/bin"\nXDG_DATA_DIRS="/usr/local/share:/usr/share:/var/lib/snapd/desktop"" > /etc/environment.d/60-snap-icons-and-bin.conf
sudo reboot now