I am trying to install heroku cli using

sudo snap install heroku --classic

The command line says

error: cannot communicate with server: Post http://localhost/v2/apps: dial unix /run/snapd.socket: connect: no such file or directory

I tried systemctl status snapd.service this is the result :

   Loaded: masked (/dev/null; bad)  
   Active: inactive (dead)

I tried systemctl restart snapd.service it says:

Failed to restart snapd.service: Unit snapd.service is masked.

Any help on above problem in appreciated. Thanks.

  • 2
    Related: systemctl, how to unmask
    – Ravexina
    Jul 11, 2020 at 7:43
  • 3
    For anyone seeing this issue with Windows Subsystem for Linux (WSL) see - github.com/microsoft/WSL/issues/5126 Run this before attempting a snap install - it should work: sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME Mar 24 at 4:10

1 Answer 1


Unmask the snapd.service:

sudo systemctl unmask snapd.service

Enable it:

sudo systemctl enable snapd.service

Start it:

sudo systemctl start snapd.service

Then try installing your desired app.

  • 8
    I am running WSL based on Ubuntu Linux, And running these instructions gives error after last command: System has not been booted with systemd as init system (PID 1). Can't operate.
    – Andy
    Aug 17, 2021 at 14:55
  • 12
    If you are using WSL then this answer is not applicable to your situation. Basically because there is no systemd on WSL in the first place. However this might be helpful to you.
    – Ravexina
    Aug 17, 2021 at 16:31
  • 7
    I am inside a docker image of ubuntu. Running systemctl start snapd.service returns System has not been booted with systemd as init system (PID 1). Can't operate.
    – Jortega
    Sep 13, 2021 at 23:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.