Mount of core failed to setup loop device

I tried to do sudo snap install hello, but got this error:

error: cannot perform the following tasks:
- Mount snap "core" (3606) ([start snap-core-3606.mount] failed with exit status 1: Job for snap-core-3606.mount failed. See "systemctl status snap-core-3606.mount" and "journalctl -xe" for details.)

Run the command systemctl status snap-core-3606.mount gives

 snap-core-3606.mount - Mount unit for core
   Loaded: loaded (/etc/systemd/system/snap-core-3606.mount; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2017-12-20 21:04:38 UTC; 6min ago
    Where: /snap/core/3606
     What: /var/lib/snapd/snaps/core_3606.snap
  Process: 14990 ExecMount=/bin/mount /var/lib/snapd/snaps/core_3606.snap /snap/core/3606 -t squashfs -o nodev,ro (code=exited, status=32)

Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: Mounting Mount unit for core...
Dec 20 21:04:38 NanoPi-NEO-Air mount[14990]: mount: /var/lib/snapd/snaps/core_3606.snap: failed to setup loop device: No such device or address
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Mount process exited, code=exited status=32
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: Failed to mount Mount unit for core.
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Unit entered failed state.

running journalctl -xe

-- Subject: Unit snap-core-3606.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-core-3606.mount has failed.
-- 
-- The result is failed.
Dec 20 21:01:36 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Unit entered failed state.
Dec 20 21:01:41 NanoPi-NEO-Air snapd[13593]: 2017/12/20 21:01:41.489271 handlers.go:310: Reported install problem for "core" as f985e5a8-e5c8-11e7-8e88-fa163ebeb28a OOPSID
Dec 20 21:01:41 NanoPi-NEO-Air sudo[14549]: pam_unix(sudo:session): session closed for user root
Dec 20 21:02:20 NanoPi-NEO-Air sudo[14786]:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/bin/snap install core
Dec 20 21:02:20 NanoPi-NEO-Air sudo[14786]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:02:21 NanoPi-NEO-Air snapd[13593]: 2017/12/20 21:02:21.182055 api.go:957: Installing snap "core" revision unset
Dec 20 21:04:33 NanoPi-NEO-Air systemd[1]: Reloading.
Dec 20 21:04:36 NanoPi-NEO-Air systemd[1]: Reloading.
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: Mounting Mount unit for core...
-- Subject: Unit snap-core-3606.mount has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-core-3606.mount has begun starting up.
Dec 20 21:04:38 NanoPi-NEO-Air mount[14990]: mount: /var/lib/snapd/snaps/core_3606.snap: failed to setup loop device: No such device or address
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Mount process exited, code=exited status=32
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: Failed to mount Mount unit for core.
-- Subject: Unit snap-core-3606.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-core-3606.mount has failed.
-- 
-- The result is failed.
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Unit entered failed state.
Dec 20 21:04:42 NanoPi-NEO-Air snapd[13593]: 2017/12/20 21:04:42.816244 handlers.go:310: Reported install problem for "core" as 6609ec42-e5c9-11e7-93d3-fa163e171d9b OOPSID
Dec 20 21:04:43 NanoPi-NEO-Air sudo[14786]: pam_unix(sudo:session): session closed for user root
Dec 20 21:07:30 NanoPi-NEO-Air sudo[15158]:     root : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/snap
Dec 20 21:07:30 NanoPi-NEO-Air sudo[15158]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:07:30 NanoPi-NEO-Air sudo[15158]: pam_unix(sudo:session): session closed for user root
Dec 20 21:07:38 NanoPi-NEO-Air sudo[15170]:     root : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/snap start
Dec 20 21:07:38 NanoPi-NEO-Air sudo[15170]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:07:39 NanoPi-NEO-Air sudo[15170]: pam_unix(sudo:session): session closed for user root
Dec 20 21:11:19 NanoPi-NEO-Air sudo[15380]:     root : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/snap install hellosystemctl status snap-core-3606.mount
Dec 20 21:11:19 NanoPi-NEO-Air sudo[15380]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:11:21 NanoPi-NEO-Air sudo[15380]: pam_unix(sudo:session): session closed for user root

root@NanoPi-NEO-Air:/usr/bin# clear

root@NanoPi-NEO-Air:/usr/bin# cd ~
root@NanoPi-NEO-Air:~# journalctl -xe
Dec 20 21:01:36 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Mount process exited, code=exited status=32
Dec 20 21:01:36 NanoPi-NEO-Air systemd[1]: Failed to mount Mount unit for core.
-- Subject: Unit snap-core-3606.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-core-3606.mount has failed.
-- 
-- The result is failed.
Dec 20 21:01:36 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Unit entered failed state.
Dec 20 21:01:41 NanoPi-NEO-Air snapd[13593]: 2017/12/20 21:01:41.489271 handlers.go:310: Reported install problem for "core" as f985e5a8-e5c8-11e7-8e88-fa163ebeb28a OOPSID
Dec 20 21:01:41 NanoPi-NEO-Air sudo[14549]: pam_unix(sudo:session): session closed for user root
Dec 20 21:02:20 NanoPi-NEO-Air sudo[14786]:     root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/bin/snap install core
Dec 20 21:02:20 NanoPi-NEO-Air sudo[14786]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:02:21 NanoPi-NEO-Air snapd[13593]: 2017/12/20 21:02:21.182055 api.go:957: Installing snap "core" revision unset
Dec 20 21:04:33 NanoPi-NEO-Air systemd[1]: Reloading.
Dec 20 21:04:36 NanoPi-NEO-Air systemd[1]: Reloading.
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: Mounting Mount unit for core...
-- Subject: Unit snap-core-3606.mount has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-core-3606.mount has begun starting up.
Dec 20 21:04:38 NanoPi-NEO-Air mount[14990]: mount: /var/lib/snapd/snaps/core_3606.snap: failed to setup loop device: No such device or address
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Mount process exited, code=exited status=32
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: Failed to mount Mount unit for core.
-- Subject: Unit snap-core-3606.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-core-3606.mount has failed.
-- 
-- The result is failed.
Dec 20 21:04:38 NanoPi-NEO-Air systemd[1]: snap-core-3606.mount: Unit entered failed state.
Dec 20 21:04:42 NanoPi-NEO-Air snapd[13593]: 2017/12/20 21:04:42.816244 handlers.go:310: Reported install problem for "core" as 6609ec42-e5c9-11e7-93d3-fa163e171d9b OOPSID
Dec 20 21:04:43 NanoPi-NEO-Air sudo[14786]: pam_unix(sudo:session): session closed for user root
Dec 20 21:07:30 NanoPi-NEO-Air sudo[15158]:     root : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/snap
Dec 20 21:07:30 NanoPi-NEO-Air sudo[15158]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:07:30 NanoPi-NEO-Air sudo[15158]: pam_unix(sudo:session): session closed for user root
Dec 20 21:07:38 NanoPi-NEO-Air sudo[15170]:     root : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/snap start
Dec 20 21:07:38 NanoPi-NEO-Air sudo[15170]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:07:39 NanoPi-NEO-Air sudo[15170]: pam_unix(sudo:session): session closed for user root
Dec 20 21:11:19 NanoPi-NEO-Air sudo[15380]:     root : TTY=pts/0 ; PWD=/usr/bin ; USER=root ; COMMAND=/usr/bin/snap install hellosystemctl status snap-core-3606.mount
Dec 20 21:11:19 NanoPi-NEO-Air sudo[15380]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Dec 20 21:11:21 NanoPi-NEO-Air sudo[15380]: pam_unix(sudo:session): session closed for user root
lines 2021-2065/2065 (END)

This is my snap version

root@NanoPi-NEO-Air:~# snap version
snap    2.29.4.2
snapd   2.29.4.2
series  16
ubuntu  16.04
kernel  4.11.2

Thanks for any suggestion to fix the error

For some reason this line is failing in your system with an error related to the loop devices.

Can you please execute it as root or sudo, but prefixing it with strace -f so we can see more details of what’s actually failing?

Hi Niemeyer,
Can you pass me a complete command to enter. I tried and got
strace: command not found

Thank you.

You need to install strace first. Sorry that this isn’t easier to debug, but I don’t have better ideas right now.

Somebody else might have more insights into the issue, though.

I installed strace, and then should i do?

sudo strace -f snap install hello

I tried that, and it printed a lot on screen. Thanks for your help.

The command to try is the mount one mentioned above. Just grab any snap file (see snap download), if you don’t have that one file locally, and try to mount it with that command under strace. According to those logs it’s failing to setup the loopback device for some reason, and that might give us a hint why.

Can you check that the kernel has support for loopback devices? It’s CONFIG_BLK_DEV_LOOP. Kernel configuration should be available through /proc/config[.gz].

Hi mborzecki,
Sorry for my late reply. I think it was the problem of the kernel. I updated the kernel for NanoPi AIR from this link, (just released 1 week ago), and it can mount now

https://drive.google.com/drive/folders/1_mPtgAVaRtYVfsYRgLJ15CAB_48ob_yQ

However, I got another error when try to run hello

cannot open freezer cgroup (/sys/fs/cgroup/freezer): No such file or directory

There is a bunch of options that we require to be enabled in the kernels. Off the top of my head:

  • CONFIG_CGROUPS
  • CONFIG_CGROUP_DEVICE
  • CONFIG_CGROUP_FREEZER
  • CONFIG_NAMESPACES
  • CONFIG_SQUASHFS
  • CONFIG_SQUASHFS_ZLIB
  • CONFIG_SQUASHFS_LZO
  • CONFIG_SQUASHFS_XZ
  • CONFIG_BLK_DEV_LOOP
  • CONFIG_SECCOMP
  • CONFIG_SECCOMP_FILTER

Note, the list may be incomplete. I’ll open a forum topic under doc category to have this sorted out.

FWIW, some kernel configuration fragments can be found right here:

note that i provide nanopi-air core images since severeal monts at

feel free to simply use that one, it gets regular testing etc (i run some infrastructure here locally with it) …

the gadget code is at https://github.com/ogra1/nanopi-air-gadget and the kernel is a re-packed linux-generic ubuntu kernel (with some sunxi options and the nanopi wlan driver added)

This is what I found so far:

I can reproduce it on fedora 28 and arch linux on google, for those systems I am sharing the kernel version and systemd version.

I can also reproduce it when we install 2 snaps with the following spread task:

summary: Check mount issue
execute: |
    for _ in $(seq 50); do
        snap install test-snapd-tools test-snapd-public
        snap remove test-snapd-tools test-snapd-public
    done

This is the PR to reproduce the error: https://github.com/snapcore/snapd/pull/5544

Results:

System: arch-linux-64

  • snap install test-snapd-tools test-snapd-public
    2018-07-20T16:13:28Z INFO Waiting for var-lib-snapd-snap-test\x2dsnapd\x2dpublic-1.mount to stop.
    error: cannot perform the following tasks:
  • Mount snap “test-snapd-public” (1) ([start var-lib-snapd-snap-test\x2dsnapd\x2dpublic-1.mount] failed with exit status 1: Job for var-lib-snapd-snap-test\x2dsnapd\x2dpublic-1.mount failed.
    See “systemctl status “var-lib-snapd-snap-test\x2dsnapd\x2dpublic-1.mount”” and “journalctl -xe” for details.
    )

Linux arch 4.17.6-1-ARCH #1 SMP PREEMPT Wed Jul 11 19:14:29 UTC 2018 x86_64 GNU/Linux
systemd 239
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid

System: fedora-28-64

  • snap remove test-snapd-tools test-snapd-public
    test-snapd-tools removed
    test-snapd-public removed
  • for _ in $(seq 50)
  • snap install test-snapd-tools test-snapd-public
    error: cannot perform the following tasks:
  • Mount snap “test-snapd-tools” (6) ([start var-lib-snapd-snap-test\x2dsnapd\x2dtools-6.mount] failed with exit status 1: Job for var-lib-snapd-snap-test\x2dsnapd\x2dtools-6.mount failed.
    See “systemctl status “var-lib-snapd-snap-test\x2dsnapd\x2dtools-6.mount”” and “journalctl -xe” for details.
    )

Linux jul201435-630697 4.17.2-200.fc28.x86_64 #1 SMP Mon Jun 18 20:09:31 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

systemd 238
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid