Unable to test a container build on Arch Linux


#1

I’m trying to get Snapcraft setup on Arch Linux. I installed snapd-git from the AUR. I installed Snapcraft snap with snap install snapcraft --classic. I also installed the LXC snap. I’m now trying to test a container build using snapcraft init && snapcraft cleanbuild and I’m getting the following output:

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

Is it possible for me to build a snap package on Arch Linux? Am I missing something? I am following the instructions here: https://docs.snapcraft.io/build-snaps/get-started-snapcraft


#2

I also found this bug. I wonder if it is also effecting Debian 9 users. https://bugs.launchpad.net/snapcraft/+bug/1750642


#3

On Arch-Linux there is var-lib-snapd-snap-core-4917.mount instead of snapd-snap-core-4917.mount as snap filesystem is mounted in /var/lib to satisfy filesystem hierarchy scheme. Maybe this the cause of your erro ?


#4

It is possibly the source of my error. What should I do to test? What would be the fix?


#5

I’m quite new to snap, but as far as I understand it would require creating arch compatible snapcraft snap to handle the issue…
Or rebuild Archs snapd package replacing SNAP_MOUNT_DIR=/var/lib/snapd/snap with SNAP_MOUNT_DIR=/snap :thinking:
I’m currently trying to incorporate second solution, without success, yet (PKGBUILD.patch https://pastebin.com/Ji1pPstX)


#6

That’s something you do not want to do. Arch package is using /var/lib/snapd/snap as /snap is not FHS compliant and in general ends up being a point of controversy across distros. Given this, the code expects /var/lib/snapd/snap on Arch.


#7

I have not used snapcraft on Arch (maybe I should?). My guess, there’s something failing in the container. Try entering the debug shell (snapcraft foo --debug) and inspecting the journal manually. Since it’s a container and LXD there’s probably a bunch of things that can go wrong.


#8

For some reason I’m not getting the same error anymore. I’m now getting the following:

(Reading database ... 25658 files and directories currently installed.)
Preparing to unpack .../squashfuse_0.1.100-0ubuntu1~ubuntu16.04.1_amd64.deb ...
Unpacking squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...         
Setting up squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ...
error: cannot communicate with server: Get http://localhost/v2/changes?select=all: dial unix /run/snapd.socket: connect: connection refused
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=5145', 'snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776']
Adding assertion core_5145.assert         
error: cannot assert: cannot communicate with server: Post http://localhost/v2/assertions: dial unix /run/snapd.socket: connect: connection refused
Stopping local:snapcraft-manlikely-nonreversed-jim
The following command failed to run: 'snap ack /run/core_5145.assert' exited with 1

Any idea what I might be doing wrong?

The .bz2 file was generated.


#9

Use privilege container: lxc profile edit default and replace config: {} with

config:
  security.privileged: "true"

#10

Thank you. I’m now getting a different error message. I’m not sure about this one either. Does this have to do with my lxc configuration again?

Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
  squashfuse
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 17.4 kB of archives.
After this operation, 54.3 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 squashfuse amd64 0.1.100-0ubuntu1~ubuntu16.04.1 [17.4 kB]
Fetched 17.4 kB in 0s (40.8 kB/s)    
Selecting previously unselected package squashfuse.
(Reading database ... 25658 files and directories currently installed.)
Preparing to unpack .../squashfuse_0.1.100-0ubuntu1~ubuntu16.04.1_amd64.deb ...
Unpacking squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up squashfuse (0.1.100-0ubuntu1~ubuntu16.04.1) ...
error: no changes of type "auto-refresh" found
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=5145', 'snap-id=99T7MUlRhtI3U0QFgl5mXXESAiSwt776']
Adding assertion core_5145.assert
Installing /run/core_5145.snap
error: cannot perform the following tasks:
- Setup snap "core" (5145) security profiles (cannot setup udev for snap "core": cannot reload udev rules: exit status 2
udev output:
)
- Setup snap "core" (5145) security profiles (cannot reload udev rules: exit status 2
udev output:
)
Stopping local:snapcraft-ridiculously-unforgeable-lorette
The following command failed to run: 'snap install /run/core_5145.snap' exited with 1

#11

Check this post, it might help somewhat: