Snappy's Snapd Installation Doesn't Work? Try This! (MX Linux, AntiX Linux, Manjaro Linux, Arch Linux)

9:45 PM

Snapd Installation Doesn't Work In Distros That Aren't Ubuntu

I have ran into this issue with several distros now where Snappy's snapd doesn't work. Snapd fails to install any Snappy snap packages.

jonquil@info-demon:~$ sudo snap install skype
error: cannot communicate with server: Post http://localhost/v2/snaps/skype: dial unix /run/snapd-snap.socket: connect: no such file or directory

When I try to work with the Snappy snapd service, the system acts like it doesn't exist. This is what that looks like:

jonquil@info-demon:~$ systemctl start snapd.service
Failed to add /run/systemd/ask-password to directory watch: No such file or directory
Failed to start snapd.service: Unknown unit: snapd.service
See system logs and 'systemctl status snapd.service' for details.
jonquil@info-demon:~$ sudo service snap start[sudo] password for jonquil:
snap: unrecognized service

How To Fix The Snapd Service In Linux

Thankfully, someone in the MX Linux forums clued me in on what was going on after I had Googled this to no avail. There's a current issue right now where Snappy's snapd calls systemctl without running it as PID 1, which causes it to fail. The following is a workaround fix for this which utilizes a script that creates a fake systemctl function.  

sudo apt install snapd

sudo nano /usr/bin/systemctl

Paste the following:



# First parameter should be start or stop
# Second parameter will be the name of a unit file

if [ $# -lt 2 ]
echo "usage: $0 start unit-file"
exit 0

if [ $1 == "start" ]
what=$(grep What /etc/systemd/system/"$2" | cut -f 2 -d '=')
where=$(grep Where /etc/systemd/system/"$2" | cut -f 2 -d '=')
mkdir -p "$where"
mount $what $where
exit 0

if [ $1 == "stop" ]
where=$(grep Where /etc/systemd/system/"$2" | cut -f 2 -d '=')
umount $where
exit 0


Save the text file then:

sudo chmod 755 /usr/bin/systemctl

cd /usr/lib/snapd && sudo ./snapd

Now you should be able to install most Snappy snap packages with ease.

Original Wiki: MX Linux Snap Packages

You Might Also Like