Snap.d error: cannot communicate with server connection refused

i guess you mean systemctl status snapd.socket
(my suspicion would be that this is a system that doesnt (fully ?) use systemd though)

$ sudo systemctl status snapd.socket
● snapd.socket - Socket activation for snappy daemon
Loaded: loaded (/lib/systemd/system/snapd.socket; enabled; vendor preset: enabled)
Active: inactive (dead)
Listen: /run/snapd.socket (Stream)
/run/snapd-snap.socket (Stream)

i am using MX19 distro (Debian based) - https://mxlinux.org/mx19-features/

kernel 5.6.0-2-amd64

Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

well, there you go …

quoting from https://mxlinux.org/about-us/

so this is unlikely to work unless you can either fully enable systemd on MX or provide some MX specific snapd changes similar to to the ones used on ubuntu 14.04 where the systemd-shim was still in use …

1 Like

yea thanks, i did do some diggin and just had to boot with the systemd option so its all well now…thank you!

2020-10-19

1 Like

you can change /var/lib/snapd permission and refresh snap run this commands:

sudo chmod o-w /var/lib/snapd sudo snap refresh

and you can will download and install your software :slight_smile:

I am adding the command I ran in case it helps anyone.
sudo systemctl enable --now snapd.socket

Overview:
1.
sudo apt install snapd

sudo snap install notepad-plus-plus
error: cannot communicate with server: Post “http://localhost/v2/snaps/notepad-plus-plus”: dial unix /run/snapd.socket: connect: no such file or directory

3
snap version 1 ⨯
snap 2.49-1+b4
snapd unavailable
series -

4
sudo systemctl enable --now snapd.socket

5
snap version
snap 2.49-1+b4
snapd 2.49-1+b4
series 16
kali 2021.2
kernel 5.10.0-kali8-amd64

6
sudo snap install notepad-plus-plus

Everything is working now.
OS is Kali GNU/Linux Rolling with kernel Linux 5.10.0-kali8-amd64

2 Likes

As told by @ogra the snapd.service is inactive to solve the error run the following commands
systemctl start snapd.service
and then try to install the package with snap, in my case it was.
sudo snap install libreoffice

This issue came to me because i changed permission to 777
I searched every where and I find only this solution is best
sudo apt-get purge snapd
sudo apt-get install snapd

it’s perfect , my problem solved . thanks a lot.

Based on other threads I’ve found that for some it might be SELinux related. For this I needed to add the following:

Frist create a module:

cat <<EOF >snapd-selinux.te
module snapd-selinux 1.0;

require {
  type timedatex_t;
  type snappy_t;
  class dbus send_msg;
}

#============= snappy_t ==============
allow snappy_t timedatex_t:dbus send_msg;

#============= timedatex_t ==============
allow timedatex_t snappy_t:dbus send_msg;
EOF

Then run:

checkmodule -M -m -o snapd-selinux.mod snapd-selinux.te

And:

semodule_package -o snapd-selinux.pp -m snapd-selinux.mod

And:

semodule -i snapd-selinux.pp

After this you should be able to restart:

systemctl restart snapd snapd.socket

Hi, that was also solution for me. I had snapd installed but somehow service turned down. Thanks.

merci mon grand … j ai pu résoudre mon problème

comment t as fait frr?? still have no clue

I had the same problem and what I did was to reinstall snap and one more configure, I think I made a mistake when installing snap, installing it this way.

sudo apt-get install snap

Or that was my mistake, because the correct way to install snap was or that happens in my case:

sudo apt-get install snapd

That’s why to solve that problem what I did was:

sudo apt-get purge snapd
sudo apt-get install snapd
sudo systemctl start snapd

Despues de esos comandos debes reiniciar tu PC o Portatil, para asegurar que los cambios, sean mas efectivos

Afterwards I was able to install a package that had snap, I hope this type of solution worked for you.

Note:If you install your packages this way:

sudo apt install <your package>

no problem it’s the same, just with some more colors in apt, try it if you want you will see that it is the same

sudo zypper install snapd
[sudo] password for root: 
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  snapd

1 new package to install.
Overall download size: 16.4 MiB. Already cached: 0 B. After the operation, additional 64.4 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving: snapd-2.59.5-1.23.x86_64 (snappy)                                                                                                                                                                                                                                                           (1/1),  16.4 MiB    
Retrieving: snapd-2.59.5-1.23.x86_64.rpm .................................................................................................................................................................................................................................................................[done (1.3 MiB/s)]

Checking for file conflicts: .........................................................................................................................................................................................................................................................................................[done]
/usr/libexec/snapd/snap-confine: no configuration entry in active permission profiles found. Cannot check this path.
Please reboot, logout/login or source /etc/profile to have /snap/bin added to PATH.
On a Tumbleweed and Leap 15.3+ systems you need to run: systemctl enable snapd.apparmor.service
(1/1) Installing: snapd-2.59.5-1.23.x86_64 ...........................................................................................................................................................................................................................................................................[done]
RokeJulianLockhart@s1e8h4:~> systemctl enable snapd.apparmor.service
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.apparmor.service → /usr/lib/systemd/system/snapd.apparmor.service.
RokeJulianLockhart@s1e8h4:~> sudo snap install icq-im --edge
error: cannot communicate with server: Post "http://localhost/v2/snaps/icq-im": dial unix /run/snapd.socket: connect: connection refused
RokeJulianLockhart@s1e8h4:~> systemctl status snapd.service
○ snapd.service - Snap Daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; preset: disabled)
     Active: inactive (dead)
TriggeredBy: ○ snapd.socket
RokeJulianLockhart@s1e8h4:~> systemctl start snapd.service
RokeJulianLockhart@s1e8h4:~> sudo snap install icq-im --edge
2023-09-24T02:28:22+01:00 INFO Waiting for automatic snapd restart...
icq-im (edge) 22.11.0.16827-1.deb from VK LLC (icqatubuntu) installed

It works! Thanks!

ubuntu@localhost:~$ snap install firefox error: cannot communicate with server: Post “http://localhost/v2/snaps/firefox”: dial unix /run/snapd.socket: connect: no such file or directory

ubuntu@localhost:~$ snap version snap 2.61.3+23.10
snapd unavailable series -

ubuntu@localhost:~$ sudo systemctl enable --now snapd.socket System has not been booted with systemd as init system (PID 1). Can’t operate. Failed to connect to bus: Host is down

ubuntu@localhost:~$ snap version snap 2.61.3+23.10 snapd unavailable series -

anyone help please

How did you get into this state ? systemd is indeed a hard requirement for snap packages to work at all, what OS are you running over there ? (apparently snap version does not even find an /etc/os-release file to determine the OS)

1 Like

OS: Ubuntu 23.10 aarch64 Host: Itel itel L6501 Kernel: 6.2.1-PRoot-Distro Uptime: 2 mins Packages: 1126 (dpkg), 1 (pkg) Shell: bash 5.2.15 Terminal: proot CPU: Unisoc SC9863a (8) @ 1.200GHz Memory: 1128MiB / 1841MiB

so I think I have to reinstall the full process if there any other way without reinstalling this system please let me know I have spend more than 3 hours in installing and more than 4 hours to find out what the problem is and still didn’t get any way to solve it

Your kernel needs to use all ubuntu patches and needs to use the exact ubuntu defconfig, else you will miss support for certain snap features on the kernel side … the kernel " Kernel: 6.2.1-PRoot-Distro" is definitely not from the ubuntu archive, so make sure all ubuntu “sauce” patches are applied first and make sure to use the generic ubuntu defconfig when building it.

additionally as i said above already, your system needs to be a fully functional ubuntu install which includes using systemd as your init system and having the apparmor userspace properly functional.

Also, it would make some sense to not hijack old resolved threads for this but instead open a new one as your problem seems to not be related to the original issue at all but to the fact that you have not a proper install at all.

1 Like