snap just stop working

Issues related to applications and software problems
Post Reply
bischop
Posts: 6
Joined: 2021/12/22 22:19:41

snap just stop working

Post by bischop » 2021/12/22 22:25:13

snap just stop working - not sure why:

Code: Select all

# snap list
error: cannot list snaps: cannot communicate with server: timeout exceeded while waiting for response

# snap find kubernates
error: cannot list snaps: cannot communicate with server: timeout exceeded while waiting for response

Code: Select all

# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

# uname -r
5.15.0-1.el7.elrepo.x86_64

# snap --version
snap    2.53.4-1.el7
snapd   unavailable
series  -
Tried to restart snap and reinstall it. System is updated.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: snap just stop working

Post by TrevorH » 2021/12/22 23:37:32

I've never used snap but I installed it here and get exactly the same results as you.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

bischop
Posts: 6
Joined: 2021/12/22 22:19:41

Re: snap just stop working

Post by bischop » 2021/12/23 16:43:30

TrevorH wrote:
2021/12/22 23:37:32
I've never used snap but I installed it here and get exactly the same results as you.
Can you paste the result of:
# snap --version
What I noticed, there are no snapd available:
snap --version
snap 2.53.4-1.el7
snapd unavailable
series -
But service snapd is working:
systemctl status snapd.service -l
● snapd.service - Snap Daemon
Loaded: loaded (/usr/lib/systemd/system/snapd.service; enabled; vendor preset: disabled)
Active: active (running) since czw 2021-12-23 17:36:48 CET; 29s ago
Main PID: 2705 (snapd)
Tasks: 10
CGroup: /system.slice/snapd.service
└─2705 /usr/libexec/snapd/snapd

gru 23 17:36:48 cerebro systemd[1]: Starting Snap Daemon...
gru 23 17:36:48 cerebro snapd[2705]: AppArmor status: apparmor not enabled
gru 23 17:36:48 cerebro snapd[2705]: daemon.go:242: started snapd/2.53.4-1.el7 (series 16; classic; devmode) centos/7 (amd64) linux/5.15.0-1.el7.elrepo.x86_6.
gru 23 17:36:48 cerebro snapd[2705]: daemon.go:335: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
gru 23 17:36:48 cerebro systemd[1]: Started Snap Daemon.




I tried same on another system:
# snap --version
snap 2.52.1
snapd 2.52.1
series 16
ubuntu 20.04
kernel 5.4.0-91-generic

bischop
Posts: 6
Joined: 2021/12/22 22:19:41

Re: snap just stop working

Post by bischop » 2021/12/23 19:18:50

Tried to downgrade snap to prev version, but looks like it's only available version on CentOS 7:
# yum --showduplicates list snapd | expand
Loaded plugins: copr, etckeeper, fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos2.hti.pl
* elrepo: ftp.icm.edu.pl
* epel: mirror.datacenter.by
* extras: centos.wielun.net
* nux-dextop: li.nux.ro
* updates: centos2.hti.pl
Installed Packages
snapd.x86_64 2.53.4-1.el7 @epel
Available Packages
snapd.x86_64 2.53.4-1.el7 epel

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: snap just stop working

Post by TrevorH » 2021/12/24 00:03:44

The snap packages are from EPEL and they only keep one copy (the latest) of each package in the repo. If you google you should be able to find the EPEL archive and download the relevant packages manually and install/downgrade them but you will need to do them all in one command at the same time.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

bischop
Posts: 6
Joined: 2021/12/22 22:19:41

Re: snap just stop working

Post by bischop » 2021/12/24 01:20:38

Well, I removed current version of snapd, snap-selinux, snap-confine.

Then found from fedora [1]:
-rw-r--r--. 1 root root 3,1M 2020-02-16 snap-confine-2.43.3-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 17M 2020-02-16 snapd-2.43.3-1.el7.x86_64.rpm
-rw-r--r--. 1 root root 283K 2020-02-16 snapd-selinux-2.43.3-1.el7.noarch.rpm
Then
# systemctl enable --now snapd.socket
Created symlink from /etc/systemd/system/sockets.target.wants/snapd.socket to /usr/lib/systemd/system/snapd.socket.

# ln -s /var/lib/snapd/snap /snap
After:
# # snap list
No snaps are installed yet. Try 'snap install hello-world'.
So I think - maybe it's fixed now.

[1] https://archives.fedoraproject.org/pub/ ... ackages/s/
https://archives.fedoraproject.org/pub/ ... ackages/s/

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: snap just stop working

Post by TrevorH » 2021/12/24 02:18:27

EPEL uses bugzilla.redhat.com for its bug reports - there is a Fedora EPEL section. I would suggest you raise one there to say it's broken and your findings so far.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

rospionne
Posts: 1
Joined: 2021/12/28 10:33:08

Re: snap just stop working

Post by rospionne » 2021/12/28 10:36:22

Hello, apparently it would be a permission issue implemented on the new version. I'll share the correction code with you. To see, this last solves your bug.

Code: Select all

#! /bin/bash

#update ref EPEL
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf upgrade

#install snap
yum install snapd
systemctl enable --now snapd.socket
ln -s /var/lib/snapd/snap /snap

#Fix bug allow
setenforce 0
getenforce
systemctl restart snapd.service snapd.socket
snap refresh
snap version
setenforce 1
ausearch -ts recent --raw | audit2allow -m snapd-selinux
sudo ausearch -ts recent --raw | audit2allow -M snapd-selinux
sudo semodule -i snapd-selinux.pp
getenforce
snap version


ELTauer
Posts: 1
Joined: 2021/12/28 14:46:17

Re: snap just stop working

Post by ELTauer » 2021/12/28 14:56:45

This works fine.Thanks a lot @rospionne

bischop
Posts: 6
Joined: 2021/12/22 22:19:41

Re: snap just stop working

Post by bischop » 2021/12/29 05:22:56

I got EPEL 7.

Code: Select all

uname -a
Linux XXXXXXX 3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 30 15:51:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
⏎
cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

setenforce 0
⏎
getenforce
Permissive
⏎
systemctl restart snapd.service snapd.socket
Job for snapd.service canceled.
⏎                                                                                             
snap refresh
error: cannot communicate with server: Post "http://localhost/v2/snaps": dial unix /run/snapd.socket: connect: connection refused
⏎
snap version
snap    2.53.4-1.el7
snapd   unavailable
series  -
⏎
setenforce 1
⏎
ausearch -ts recent --raw | audit2allow -m snapd-selinux

module snapd-selinux 1.0;
⏎
sudo ausearch -ts recent --raw | audit2allow -M snapd-selinux
compilation failed:
snapd-selinux.te:6:ERROR 'syntax error' at token '' on line 6:


/usr/bin/checkmodule:  error(s) encountered while parsing configuration
/usr/bin/checkmodule:  loading policy configuration from snapd-selinux.te
⏎
sudo semodule -i snapd-selinux.pp
libsemanage.map_file: Unable to open snapd-selinux.pp
 (No such file or directory).
libsemanage.semanage_direct_install_file: Unable to read file snapd-selinux.pp
 (No such file or directory).
semodule:  Failed on snapd-selinux.pp!
⏎
getenforce
Enforcing
⏎
snap version
snap    2.53.4-1.el7
snapd   unavailable
series  -

snap list
error: cannot list snaps: cannot communicate with server: Get "http://localhost/v2/snaps": dial unix /run/snapd.socket: connect: connection refused
⏎

Looks like solution doesn't work for me.

UPDATE:
well, I tried to install EPEL 2.53 version and after install old 2.43. Old version "stop" working as well.
Then I tried to install new one again and then:

Code: Select all

systemctl enable --now snapd.socket

setenforce 0
getenforce
systemctl restart snapd.service snapd.socket

And now it's working:

Code: Select all

snap version
snap    2.53.4-1.el7
snapd   2.53.4-1.el7
series  16
centos  7
kernel  3.10.0-1160.49.1.el7.x86_64

setenforce 1
ausearch -ts recent --raw | audit2allow -m snapd-selinux
sudo ausearch -ts recent --raw | audit2allow -M snapd-selinux
sudo semodule -i snapd-selinux.pp
getenforce

Post Reply