Fix "error: cannot communicate with server" (dial unix /run/snapd.socket)

Quick fix

Start the snapd socket and service, then retry. If the unit does not exist, install snapd first.

sudo systemctl enable --now snapd.socket
sudo systemctl restart snapd
snap version

The error appears with whatever command you ran, for example:

error: cannot communicate with server: Post "http://localhost/v2/snaps/hello-world": dial unix /run/snapd.socket: connect: no such file or directory
error: cannot communicate with server: Get "http://localhost/v2/snaps?snaps=": dial unix /run/snapd.socket: connect: connection refused

What the error means

The snap command is only a client. It sends HTTP requests (the Post http://localhost/v2/... part) to the snapd daemon over a Unix socket, /run/snapd.socket. The message tells you that connection failed:

  • no such file or directory: the socket does not exist, so snapd.socket is stopped, disabled, not installed, or systemd is not running at all.
  • connection refused: the socket file exists but nothing is accepting connections, usually because snapd crashed or is restarting.

Check the state of both units:

systemctl status snapd.socket snapd.service --no-pager

Example output when the socket is disabled:

○ snapd.socket - Socket activation for snappy daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.socket; disabled; preset: enabled)
     Active: inactive (dead)

Cause 1: snapd.socket is stopped or disabled

On Ubuntu, snapd is socket-activated: snapd.socket listens, and the service starts when a request arrives. If someone disabled or masked the socket (a common step in "remove snap" guides), every snap command fails like this. Re-enable it:

sudo systemctl unmask snapd.socket snapd.service
sudo systemctl enable --now snapd.socket
snap list

On Ubuntu, Firefox, Thunderbird and several system components are snaps, so a disabled snapd also breaks those apps. If you do want to stop using snap entirely, remove the snaps and the package properly rather than masking the daemon; our package managers guide explains the alternatives.

Cause 2: snapd crashed or hangs

If the socket exists but connections are refused, or commands hang and then fail, restart the daemon and read its log:

sudo systemctl restart snapd.socket snapd.service
sudo journalctl -u snapd -b --no-pager | tail -n 50

Typical log causes are a full disk (snapd stores downloads in /var/lib/snapd), a broken AppArmor profile after a partial upgrade, or a stuck change. Free space if df -h /var shows the disk full (see No space left on device), make sure the system is fully upgraded with sudo apt update && sudo apt full-upgrade, and check pending changes:

snap changes
# abort a change stuck in "Doing" (use its ID)
sudo snap abort 42

Right after a fresh install or first boot you may instead see error: too early for operation, device not yet seeded or device model not acknowledged. That means snapd is still seeding its preinstalled snaps; wait a minute or two and retry.

Cause 3: snapd is not installed

If systemctl status snapd.socket says the unit could not be found, the package is missing. Only Ubuntu (and flavours) ship snapd by default. Elsewhere you install it yourself:

# Debian
sudo apt install snapd
sudo snap install snapd      # get the current snapd as a snap
# Fedora
sudo dnf install snapd
sudo ln -s /var/lib/snapd/snap /snap    # needed for "classic" snaps
# openSUSE: add the snappy repository first (see snapcraft.io docs), then
sudo zypper install snapd
sudo systemctl enable --now snapd.socket

On Arch, snapd is in the AUR, not the official repositories. Log out and back in (or reboot) after installing so /snap/bin is added to your PATH. On Fedora and openSUSE, the AppArmor confinement snapd relies on is not available in the same way, so some snaps run with reduced confinement.

Before installing snapd just for one app, check whether a Flatpak or a native package exists; see installing .deb, .rpm, AppImage and Flatpak apps.

Cause 4: WSL or a container without systemd

snapd is a systemd service and needs systemd as PID 1. In WSL without systemd, in Docker containers and in chroots, the socket never appears. Check:

ps -p 1 -o comm=

If this does not print systemd, enable systemd in WSL ([boot] systemd=true in /etc/wsl.conf, then wsl --shutdown), or avoid snaps inside containers. The full explanation is on System has not been booted with systemd.

Distro notes

  • Ubuntu 24.04 and 26.04: snapd is preinstalled and required for the default Firefox and the App Center. Cause 1 or 2 is the usual explanation.
  • Linux Mint: snapd is blocked by /etc/apt/preferences.d/nosnap.pref, and apt refuses to install it. If you really need it: sudo rm /etc/apt/preferences.d/nosnap.pref, sudo apt update, sudo apt install snapd. Mint's own recommendation is Flatpak, which Software Manager uses already. See the Linux Mint reference.
  • Debian: not installed by default; packaged in the main archive.
  • Fedora, openSUSE, Arch: optional and community-maintained; Flatpak is the native choice for desktop apps.

How to prevent it

  • Do not mask snapd.socket on Ubuntu unless you have removed all snaps you depend on.
  • Keep free space on /var; snapd keeps several revisions of each snap. sudo snap set system refresh.retain=2 keeps fewer.
  • After an interrupted upgrade, finish it (sudo apt full-upgrade) before debugging snapd.
  • In scripts that run early in boot or in fresh VMs, run sudo snap wait system seed.loaded before the first snap install, so you do not race snapd's first-boot setup.

Still not working?

Collect the details snapd itself reports:

snap version
systemctl status snapd.socket snapd.service apparmor --no-pager
sudo journalctl -u snapd -b --no-pager | grep -iE 'error|cannot'

If AppArmor is inactive on Ubuntu, snap confinement fails; re-enable it rather than running without it. The systemctl cheat sheet lists more commands for inspecting units.

Frequently asked questions

How do I start snapd?

Run sudo systemctl enable --now snapd.socket. The socket starts the snapd service on demand when you run a snap command. Check it with systemctl status snapd.socket snapd.

Why does snap not work in WSL?

snapd needs systemd. Enable systemd in /etc/wsl.conf with [boot] systemd=true, run wsl --shutdown in Windows, then start the distribution again.

Why can't I install snapd on Linux Mint?

Mint blocks snapd with an APT preference file, /etc/apt/preferences.d/nosnap.pref. Remove that file and run sudo apt update to allow it, or use the Flatpak version of the app, which Mint supports out of the box.

What does error: too early for operation, device not yet seeded mean?

snapd is running but still finishing its first-boot setup (seeding). Wait a minute and retry; snap changes shows progress. If it never finishes, restart snapd and check its journal.

Spotted a mistake or a command that no longer works? Send a correction — pages are re-checked when reports come in.