Can't run compiled snapd

I followed the instructions from to download and compile snapd. I think everything went fine, given that I didn’t get any error message.

However, when I run my version of snapd as per the instructions, it won’t start :

$ sudo systemctl stop snapd.service snapd.socket
$ sudo SNAPD_DEBUG=1 SNAPD_DEBUG_HTTP=3 /tmp/snapd
AppArmor status: apparmor is enabled and all features are available
cannot run daemon: cannot obtain snap-seccomp version information: error: unsupported argument "version-info"

Is there something I missed ? Do I have to build snapd in a clean VM ?

I can provide more details, just let me know what you need to see !

1 Like

did you try make hack?

Or just build snap-seccomp and drop it at the same location as snapd binary.

@mborzecki That didn’t help. Same error.

@chipaca here am I to type that command from ?

if you followed the section called “Building the code locally”, you should be able to make hack from the cmd directory itself.

Ha ! Ok, I’ve done that, it added a file in /etc/apparmor.d but nothing changed.

Oh… strange : with either the snap-seccomp in /tmp (build with go build -o /tmp/snap-seccomp or the one build with make hack, if I type :

./snap-seccomp version-info

I actually get something : 301522bfb8fff43ba4822c1f787e650e67a1553d 2.3.1 955c3a8a3ed30b9ffea279657e2bc95454d06816d4175de999720e8de028231f

So it’s only when I run snapd that I get the error message…

May I suggest run-snapd-srv? it takes care of a bunch of silly stuff to run snapd directly.

In this case I suspect what you’re hitting is that you have core installed, and the version inside it is somehow newer than the snapd you’re building. I could be wrong, but that’s what I’d try next: run snapd with SNAP_REEXEC=0

We’re progressing !

Running strace -f ... reveals that snapd forks and runs /usr/lib/snapd/snap-seccomp, whatever the value of ${PATH} is :

[pid 32276] execve("/usr/lib/snapd/snap-seccomp", ["/usr/lib/snapd/snap-seccomp", "version-info"], 0xc0002e28c0 /* 19 vars */ <unfinished ...>

Let me look into that. There was a change about finding the internal tools merged recently. It did make things a little harder when trying to run snapd from some random location.

In the meantime, can you copy the snap-seccomp binary you built to /usr/lib/snapd/snap-seccomp ?

Yep ! That worked. I ran sudo SNAPD_DEBUG=1 SNAPD_DEBUG_HTTP=3 ./snapd from inside /usr/lib/snapd, and then installed my snap. I got a bunch of traces in the terminal.

I guess I can CTRL-C that and sudo systemctl start snapd.service snapd.socket to run my own version ?

I have the basis to have a look at how to write an interface now !