Snapcraft fails in LXD container on Debian 9

OS information

  • Distribution: Debian
  • Distribution version: 9

lxc info

  driver: lxc
  driver_version: 2.1.1
  kernel: Linux
  kernel_architecture: x86_64
  kernel_version: 4.9.0-5-amd64
  server: lxd
  server_pid: 12509
  server_version: "2.21"
  storage: btrfs
  storage_version: "4.4"

Issue description

Running SNAPCRAFT_CONTAINER_BUILDS=1 snapcraft results in

Looking up assertion ['account-key', 'public-key-sha3-384=BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul']
Looking up assertion ['snap-declaration', 'snap-name=core']
Looking up assertion ['snap-revision', 'snap-revision=4017', 'snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776']
Adding assertion core_4017.assert
Installing /run/core_4017.snap
error: cannot perform the following tasks:
- Mount snap "core" (4017) ([start snap-core-4017.mount] failed with exit status 1: Job for snap-core-4017.mount failed. See "systemctl status snap-core-4017.mount" and "journalctl -xe" for details.
)
Stopping local:snapcraft-rstudio
The following command failed to run: 'snap install /run/core_4017.snap' exited with 1

Steps to reproduce

  1. install snapd on Debian 9 (sudo apt-get install snapd)
  2. Install lxd using snap install lxd
  3. Add yourself to group “lxd” and logout/login
  4. Clone any project that contains a snapcraft.yaml file, e.g. https://github.com/pat-s/rstudio
  5. Run SNAPCRAFT_CONTAINER_BUILDS=1 snapcraft on the project root

Note

This approach works fine in 16.04 and 17.10

Confirmed on a Debian stretch VM here.

root@snapcraft-rstudio:~# systemctl status snap-core-4017.mount
● snap-core-4017.mount - Mount unit for core
   Loaded: loaded (/etc/systemd/system/snap-core-4017.mount; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-02-20 12:56:04 UTC; 6min ago
    Where: /snap/core/4017
     What: /var/lib/snapd/snaps/core_4017.snap
  Process: 81 ExecMount=/bin/mount /var/lib/snapd/snaps/core_4017.snap /snap/core/4017 -t fuse.squashfuse -o nodev,ro,allow_other (code=exited, status=1/FAILURE)

Feb 20 12:56:04 snapcraft-rstudio systemd[1]: Mounting Mount unit for core...
Feb 20 12:56:04 snapcraft-rstudio mount[81]: fusermount: mount failed: Operation not permitted
Feb 20 12:56:04 snapcraft-rstudio systemd[1]: snap-core-4017.mount: Mount process exited, code=exited status=1
Feb 20 12:56:04 snapcraft-rstudio systemd[1]: Failed to mount Mount unit for core.
Feb 20 12:56:04 snapcraft-rstudio systemd[1]: snap-core-4017.mount: Unit entered failed state.
root@snapcraft-rstudio:~# 

I think this would probably do well as a bug report which can be filed at https://bugs.launchpad.net/snapcraft

IIRC debian requires the user to be in the fuse group to use fusectl … does adding the user help here ?

Also: dont you need the squashfuse package installed to enable mounting of squashfs files via fuse ?

There is no group named fuse under /etc/group.

Installing squashfuse does not seem to be a one-liner. Is it installed on Ubuntu systems? Or what is used there instead?

it is easily installable via “apt install squashfuse” in ubuntu …

Yes, but not on Debian.
It seems it was not installed on my Ubuntu 16.04 but LXD worked fine. So I assume its unrelated to squashfuse?