snapcrafters / android-studio

A community-maintained package to easily install Android Studio on Linux
https://developer.android.com/studio/index.html
47 stars 16 forks source link

Install on CentOS 7 fails: system does not fully support snapd: cannot mount squashfs image using "squashfs" #90

Closed AJCxZ0 closed 2 years ago

AJCxZ0 commented 2 years ago

Looks like issue Error: System does not fully support snapd, but I've been unable to establish the cause in this case.

$ sudo snap install android-studio --classic
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": -----
       mount: wrong fs type, bad option, bad superblock on /dev/loop0,

       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

       -----
$ dmesg | tail
...
[854469.990241] SELinux: security_context_to_sid(system_u:object_r:snappy_snap_t:s0) failed for (dev loop0, type squashfs) errno=-22

SElinux is permissive.

$ sestatus 
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

Packages snapd, snapd-selinux and kernel-modules are installed.

$ rpm -q snapd snapd-selinux kmod-kvdo
snapd-2.51-1.el7.x86_64
snapd-selinux-2.51-1.el7.noarch
kmod-kvdo-6.1.3.23-5.el7.x86_64

Kernel modules squashfs and loop are loaded.

$ lsmod | egrep 'squashfs|loop'
squashfs               47827  0 
loop                   28072  0 

The hello-world snap downloads and mounts the squashfs.

$ snap download hello-world
Fetching snap "hello-world"
2021/08/23 14:24:37.452618 store_download.go:482: Download size for https://api.snapcraft.io/api/v1/snaps/download/buPKUD3TKqCOgLEjjHx5kSiCpIs5cMuQ_29.snap: 20480
Fetching assertions for "hello-world"
Install the snap with:
   snap ack hello-world_29.assert
   snap install hello-world_29.snap
$ mkdir -v -m 555 squash
mkdir: created directory ‘squash’
$ sudo mount -v hello-world_29.snap squash
mount: /home/a-acaines/squash does not contain SELinux labels.
       You just mounted an file system that supports labels which does not
       contain labels, onto an SELinux box. It is likely that confined
       applications will generate AVC messages and not be allowed access to
       this file system.  For more details see restorecon(8) and mount(8).
mount: /dev/loop0 mounted on /home/a-acaines/squash.
$ df -hT squash
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/loop0     squashfs  128K  128K     0 100% /home/a-acaines/squash

The snappy SELinux module is not installed and manually installing it fails.

$ sudo semodule -l | fgrep snappy
$ sudo semodule -i /usr/share/selinux/packages/snappy.pp.bz2
libsemanage.semanage_make_sandbox: Could not copy files to sandbox /etc/selinux/targeted/tmp. (Input/output error).
semodule:  Failed on /usr/share/selinux/packages/snappy.pp.bz2!

The snapd.service is running, however it appears to exit after testing, which appears to bne intentional and normal.

$ systemctl status snapd.service snapd.socket
● snapd.service - Snap Daemon
   Loaded: loaded (/usr/lib/systemd/system/snapd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-08-23 14:32:44 EDT; 3s ago
 Main PID: 48355 (snapd)
    Tasks: 22
   CGroup: /system.slice/snapd.service
           └─48355 /usr/libexec/snapd/snapd

● snapd.socket - Socket activation for snappy daemon
   Loaded: loaded (/usr/lib/systemd/system/snapd.socket; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-08-23 14:32:44 EDT; 3s ago
   Listen: /run/snapd.socket (Stream)
           /run/snapd-snap.socket (Stream)

After testing,

$ systemctl status snapd.service snapd.socket
● snapd.service - Snap Daemon
   Loaded: loaded (/usr/lib/systemd/system/snapd.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Mon 2021-08-23 14:04:34 EDT; 26min ago
  Process: 46024 ExecStart=/usr/libexec/snapd/snapd (code=exited, status=42)
 Main PID: 46024 (code=exited, status=42)

● snapd.socket - Socket activation for snappy daemon
   Loaded: loaded (/usr/lib/systemd/system/snapd.socket; enabled; vendor preset: disabled)
   Active: active (listening) since Thu 2021-08-19 10:49:41 EDT; 4 days ago
   Listen: /run/snapd.socket (Stream)
           /run/snapd-snap.socket (Stream)
Aug 23 14:33:01 host.example.com systemd[1]: Starting Snap Daemon...
-- Subject: Unit snapd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snapd.service has begun starting up.
Aug 23 14:33:01 host.example.com snapd[48432]: AppArmor status: apparmor not enabled
Aug 23 14:33:01 host.example.com snapd[48432]: daemon.go:248: started snapd/2.51-1.el7 (series 16; classic; devmode) centos/7 (amd64) linux/3.10.0-1160.36.2.el7.x86_.
Aug 23 14:33:01 host.example.com snapd[48432]: main.go:129: system does not fully support snapd: cannot mount squashfs image using "squashfs":
Aug 23 14:33:01 host.example.com snapd[48432]: -----
Aug 23 14:33:01 host.example.com snapd[48432]: mount: wrong fs type, bad option, bad superblock on /dev/loop0,
Aug 23 14:33:01 host.example.com snapd[48432]: missing codepage or helper program, or other error
Aug 23 14:33:01 host.example.com snapd[48432]: In some cases useful info is found in syslog - try
Aug 23 14:33:01 host.example.com snapd[48432]: dmesg | tail or so.
Aug 23 14:33:01 host.example.com snapd[48432]: -----
Aug 23 14:33:01 host.example.com snapd[48432]: daemon.go:341: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Aug 23 14:33:01 host.example.com systemd[1]: Started Snap Daemon.
-- Subject: Unit snapd.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snapd.service has finished starting up.
-- 
-- The start-up result is done.
Aug 23 14:33:06 host.example.com snapd[48432]: daemon.go:508: gracefully waiting for running hooks
Aug 23 14:33:06 host.example.com snapd[48432]: daemon.go:510: done waiting for running hooks
Aug 23 14:33:06 host.example.com snapd[48432]: daemon stop requested to wait for socket activation

The host is up-to-date and has been rebooted since updates and relevant packages were installed.

om26er commented 2 years ago

I think this is not relevant to android-studio snap and the issue with snapd.