jLuger.de - Start snap firefox with hustior

With Ubuntu 21.10 Canonical started to ship Firefox not as a deb package but as a snap package by default. While Ubuntu 21.10 still has the deb package of Firefox with 22.04 the snap version of Firefox will be the only one available. Snap apps are self contained and isolated. For the isolation they use linux namespaces. Just like hustior does and running namespaced applications in a namespace isn't easy. So this promised some work.

Running hustior without any arguments resulted in a firefox not found message. That is because all snap apps are stored under the /snap directory. Adding the /snap directory showed that the application wants to access also /sys/kernel and /home/<user>/snap. After adding these directories I got the following error message:
futex(0x55c6557aac30, FUTEX_WAIT_PRIVATE, 0, NULLinterner Fehler, bitte melden: Ausf├╝hrung von "firefox" fehlgeschlagen: cannot create transient scope: DBus error "org.freedesktop.DBus.Error.InvalidArgs": [Process 10 is a kernel thread, refusing.]

So somehow it took the process number in hustior (10) and wanted to do something with it outside of hustior but there was the process id (10) protected. So I went over to github to view the code:
https://github.com/snapcore/snapd.
It turns out that all snap apps under /snap/bin are links to /usr/bin/snap and the snap command uses a unix socket to let a central daemon start the snap app. This was a huge problem as hustior isn't designed to isolate running daemons.

After that I looked around the /snap subdirectories and found the firefox binaries under /snap/firefox/current/usr/lib/firefox. Calling /snap/firefox/current/usr/lib/firefox/firefox actually started firefox directly. So I've used the following config to run snap Firefox in hustior:
{"ExecProgramm":"/snap/firefox/current/usr/lib/firefox/firefox -no-remote","AdditionalBindings":["/snap"]}