Building snapd on clearlinux

Hi guys,

I’m tried to build snapd and snap on clearlinux. After building I had a problem with running snap apps. I can successfully install any app, but when I try to run something, I always get an error:

execv failed: No such file or directory

When I built snapd from sources I used next commands:

  1. ./mkversion.sh
  2. cd cmd
  3. autoreconf -i -f
  4. ./configure --enable-merged-usr --disable-apparmor --enable-nvidia-biarch --prefix=/usr --libexecdir=/usr/lib/snapd
  5. make hack

For building snap and snapd binaries I use next commands:

  1. go build -o /usr/lib/snap github.com/snapcore/snapd/cmd/snap
  2. go build -o /usr/lib/snapd github.com/snapcore/snapd/cmd/snapd

And finally I run make install command from snapd/data folder.

Could you please help me to determine why I can install any app but can’t run them. Where is my mistake?

P.s. Sorry for my bad English

Can you clarify, what command produces this? Did you try running snap run <name-of-snap>? If so, can you try:

SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 snap run <name-of-snap>

Yep, I used snap run <name-of-snap>.

For this command SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 snap run <name-of-snap> I got next output:

2020/10/26 19:03:55.110260 tool_linux.go:68: DEBUG: re-exec not supported on distro “clear-linux-os” yet error: cannot find current revision for snap run: readlink /snap/run/current: no such file or directory

This error message indicates that it thinks the name of the snap you are trying to run is verbatim “run”, did you use run as the name of the snap ? Try

snap install hello-world
SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 snap run hello-world

Yep, sorry in previous message I had a mistake.

It’s work for hello-world application. I see ‘Hello World!’ in terminal.

But don’t work for code(Visual Studio Code) app or for slack app.

For example:

snap install code --classic SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 snap run code

Output:

2020/10/26 19:14:41.650212 tool_linux.go:68: DEBUG: re-exec not supported on distro “clear-linux-os” yet 2020/10/26 19:14:41.655121 cmd_run.go:404: DEBUG: SELinux not enabled DEBUG: umask reset, old umask was 022 DEBUG: security tag: snap.code.code DEBUG: executable: /usr/lib/snapd/snap-exec DEBUG: confinement: classic DEBUG: base snap: core DEBUG: ruid: 1000, euid: 0, suid: 0 DEBUG: rgid: 1000, egid: 1000, sgid: 1000 DEBUG: preparing classic execution environment DEBUG: set_effective_identity uid:1000 (change: yes), gid:1000 (change: yes) DEBUG: creating user data directory: /home/pi/snap/code/48 DEBUG: ruid: 1000, euid: 1000, suid: 0 DEBUG: setting capabilities bounding set DEBUG: regaining SYS_ADMIN DEBUG: loading bpf program for security tag snap.code.code DEBUG: read 14 bytes from /var/lib/snapd/seccomp/bpf//snap.code.code.bin DEBUG: clearing SYS_ADMIN DEBUG: execv(/usr/lib/snapd/snap-exec, /usr/lib/snapd/snap-exec…) DEBUG: argv[1] = code DEBUG: umask restored to 022 DEBUG: working directory restored to /usr/lib/snapd execv failed: No such file or directory

I think you should not “make hack” but look at the installation process of snapd. This is clearly a missing executable.

1 Like

What is ldd /usr/lib/snapd/snap-exec ? It might be the case that strict snaps work because the step that is failing for classic snaps is executing snap-exec, which for a strict snap will transition to an environment where snap-exec has the necessary dependencies provided by the base snap, but on the host these do not exist. This may indicate a linking error when building snap-exec for example

Output for this command:

ldd: /usr/lib/snapd/snap-exec: No such file or directory.

I don’t have this binary at all.

Now I can run any app, after building snap-exec binary.

Thank you guys for the help.

Hi guys,

I need help with one more thing. Right now all --classic apps and hello app is perfectly worked for me, but some apps like chromium, brave, snap-store(and maybe something else) still can’t start.

This is one example of log when I try to load brave browser:

2020/10/30 08:05:20.633460 tool_linux.go:68: DEBUG: re-exec not supported on distro “clear-linux-os” yet 2020/10/30 08:05:20.636955 cmd_run.go:404: DEBUG: SELinux not enabled DEBUG: umask reset, old umask was 022 DEBUG: security tag: snap.brave.brave DEBUG: executable: /usr/lib/snapd/snap-exec DEBUG: confinement: non-classic DEBUG: base snap: core DEBUG: ruid: 1000, euid: 0, suid: 0 DEBUG: rgid: 1000, egid: 1000, sgid: 1000 DEBUG: creating lock directory /run/snapd/lock (if missing) DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes) DEBUG: opening lock directory /run/snapd/lock DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes) DEBUG: opening lock file: /run/snapd/lock/.lock DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes) DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes) DEBUG: sanity timeout initialized and set for 30 seconds DEBUG: acquiring exclusive lock (scope (global), uid 0) DEBUG: sanity timeout reset and disabled DEBUG: ensuring that snap mount directory is shared DEBUG: unsharing snap namespace directory DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes) DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes) DEBUG: releasing lock 5 DEBUG: opened snap-update-ns executable as file descriptor 5 DEBUG: opened snap-discard-ns executable as file descriptor 6 DEBUG: creating lock directory /run/snapd/lock (if missing) DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes) DEBUG: opening lock directory /run/snapd/lock DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes) DEBUG: opening lock file: /run/snapd/lock/brave.lock DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes) DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes) DEBUG: sanity timeout initialized and set for 30 seconds DEBUG: acquiring exclusive lock (scope brave, uid 0) DEBUG: sanity timeout reset and disabled DEBUG: initializing mount namespace: brave DEBUG: snappy_udev_init DEBUG: setup_devices_cgroup DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes) DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes) DEBUG: write_string_to_file /sys/fs/cgroup/devices/snap.brave.brave/cgroup.procs 7127 DEBUG: write_string_to_file /sys/fs/cgroup/devices/snap.brave.brave/devices.deny a DEBUG: running snap-device-helper add snap_brave_brave /sys/class/mem/null 1:3 execl failed: No such file or directory child exited with status 1: File exists

I appreciate any help to figure out this problem.

Fixed problem with coping snap-device-helper file from sources to /usr/lib/snapd folder.

2 Likes