Error while using snap command

I installed Snap.

When I run the commands, snap install --classic certbot or snap install core; sudo snap refresh core , I am getting the following error

error: cannot communicate with server: Post "http://localhost/v2/snaps/certbot": dial unix /run/snapd.socket: connect: connection refused

Any ideas how to fix?

Thanks

1 Like

Do I need to enable SELinux for it to work?

I think snap runs as a daemon. Is snap "started"?

3 Likes

@Osiris No. It is having an error starting. It shows the following status on command, systemctl status snapd

● snapd.service - Snap Daemon
Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2022-09-09 09:17:29 UTC; 6s ago
Process: 100679 ExecStart=/usr/libexec/snapd/snapd (code=exited, status=1/FAILURE)
Main PID: 100679 (code=exited, status=1/FAILURE)

Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILURE
Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Failed with result 'exit-code'.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: Failed to start Snap Daemon.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Service RestartSec=100ms expired, scheduling restart.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: Stopped Snap Daemon.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Start request repeated too quickly.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Failed with result 'exit-code'.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: Failed to start Snap Daemon.
Sep 09 09:17:29 lolhug-california-04 systemd[1]: snapd.service: Triggering OnFailure= dependencies.

I'm afraid I don't know how to debug snap itself, as I don't run it on my Gentoo systems (snap requires systemd while Gentoo by default uses OpenRC, so I cannot install snap even if I wanted to).

3 Likes

You might ask about that on the Snapcraft snap forums. I run certbot with snap but do not know how to debug snap.

3 Likes