Snap stopped working for me

[joliver@leaf ~]$ time snap version
snap    2.67-0.el8
snapd   unavailable
series  -

real	0m25.024s
user	0m0.009s
sys	0m0.021s
[joliver@leaf ~]$ !955
sudo snap install --classic certbot
[sudo] password for joliver: 
error: cannot communicate with server: timeout exceeded while waiting for response
[joliver@leaf ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.10 (Ootpa)
[joliver@leaf ~]$ rpm -qa | grep snap
snapd-2.67-0.el8.x86_64
snappy-1.1.8-3.el8.x86_64
snapd-selinux-2.67-0.el8.noarch
snap-confine-2.67-0.el8.x86_64

This worked ā€œbeforeā€ (I’d say about three months ago, last time I had to renew certs). I can’t think of anything I’ve done since other than dnf update

Help us help you and attach a log from snapd, .e.g journalctl --no-pager -u snpd.

Whoops! Intended to do that…

Mar 18 13:00:53 leaf.arpnic.net systemd[1]: Stopping Snap Daemon...
Mar 18 13:00:53 leaf.arpnic.net snapd[18805]: main.go:168: Exiting on terminated signal.
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: snapd.service: State 'stop-sigterm' timed out. Killing.
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: snapd.service: Killing process 18805 (snapd) with signal SIGKILL.
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: snapd.service: Main process exited, code=killed, status=9/KILL
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: snapd.service: Failed with result 'timeout'.
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: Stopped Snap Daemon.
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: snapd.service: Triggering OnFailure= dependencies.
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: Starting Snap Daemon...
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: overlord.go:274: Acquiring state lock file
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: overlord.go:279: Acquired state lock file
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: patch.go:64: Patching system state level 6 to sublevel 1...
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: patch.go:64: Patching system state level 6 to sublevel 2...
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: patch.go:64: Patching system state level 6 to sublevel 3...
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: daemon.go:250: started snapd/2.67-0.el8 (series 16; classic; devmode) rhel/8.10 (amd64) linux/4.18.0-553.44.1.el8_10.x8.
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: daemon.go:353: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Mar 18 13:02:23 leaf.arpnic.net snapd[19303]: backends.go:58: AppArmor status: apparmor not enabled
Mar 18 13:02:23 leaf.arpnic.net systemd[1]: Started Snap Daemon.
Mar 18 13:06:31 leaf.arpnic.net systemd[1]: Stopping Snap Daemon...
Mar 18 13:06:31 leaf.arpnic.net snapd[19303]: main.go:168: Exiting on terminated signal.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: State 'stop-sigterm' timed out. Killing.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: Killing process 19303 (snapd) with signal SIGKILL.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: Main process exited, code=killed, status=9/KILL
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: Failed with result 'timeout'.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: Stopped Snap Daemon.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: Triggering OnFailure= dependencies.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: Starting Snap Daemon...
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: overlord.go:274: Acquiring state lock file
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: overlord.go:279: Acquired state lock file
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: daemon.go:250: started snapd/2.67-0.el8 (series 16; classic; devmode) rhel/8.10 (amd64) linux/4.18.0-553.44.1.el8_10.x8.
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: daemon.go:353: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: backends.go:58: AppArmor status: apparmor not enabled
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: Started Snap Daemon.
[joliver@leaf ~]$ sudo systemctl status snapd
[sudo] password for joliver: 
ā— snapd.service - Snap Daemon
   Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2025-03-18 13:08:01 MST; 18h ago
 Main PID: 19443 (snapd)
    Tasks: 6 (limit: 11134)
   Memory: 12.3M
   CGroup: /system.slice/snapd.service
           └─19443 /usr/libexec/snapd/snapd

Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: Failed with result 'timeout'.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: Stopped Snap Daemon.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: snapd.service: Triggering OnFailure= dependencies.
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: Starting Snap Daemon...
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: overlord.go:274: Acquiring state lock file
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: overlord.go:279: Acquired state lock file
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: daemon.go:250: started snapd/2.67-0.el8 (series 16; classic; devmode) rhel/8.10 (amd64) linux/4.18.0-553.44.1.el8_10.x8.
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: daemon.go:353: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Mar 18 13:08:01 leaf.arpnic.net snapd[19443]: backends.go:58: AppArmor status: apparmor not enabled
Mar 18 13:08:01 leaf.arpnic.net systemd[1]: Started Snap Daemon.

@mborzecki1 any thoughts? I’d really like to be able to get certbot to run and update some certs!

Thanks.

I don’t have RHEL8 VM so I tried Rocky, snapd installs and works fine. I added the /snap symlink and installed certbot, which then I tried to run:

[cloud-user@r1 ~]$ sudo /snap/bin/certbot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Certbot doesn't know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run "certbot certonly" to do so. You'll need to manually configure your web server to use the resulting certificate.

Can you share more details of what you are trying to do? The logs you attached aren’t that informative, all I see is snapd restarted a couple of times.

I don’t quite know what is wrong yet but using rocky 8 qcow2 cloud image I got the distribution updated, installed epel-release, snapd and then got snapd into a funny state where it stopped responding. I will debug this more on Monday.

1 Like

First, thanks for helping with this!

You can get access to RHEL by joining Red Hat’s developer program, no charge. https://developers.redhat.com/https://developers.redhat.com/

My issue, in a nutshell, is that snap commands fail with error: cannot communicate with server: timeout exceeded while waiting for response even though snapd.service is running.

I had the exact same experience. I need to spend a moment to see why snapd is not responding. My gut feeling is that it’s not, internally, ready and has not enabled the API layer yet. Why is a mystery but we have everything needed to untangle this.

1 Like

It is SELinux related. Same issue here on AlmaLinux since 2.67.0, see also

Disabling SELinux temporarily, updating certs and then enabling SELinux helped in my case.

1 Like

Thanks @jtosovsky I should have thought of that!

Have you observed any denials? ausearch -m AVC may contain some useful info

Unfortunately, there are only unrelated items (tomcat + elasticsearch related). I remember I tried to add some SELinux exceptions and haven’t found anything recorded in logs that time I could ā€˜allow’.

Later I realized I have also snapd-selinux.noarch package which itself should set all policies. Maybe this package plays some role here.

I can try other commands on my system if you like.