Run a Flathub app using chroot?

Hello, for testing purposes I would like to run an application distributed on Flathub without Bubblewrap.

I was thinking of using mount --bind and chroot, something vaguely along those lines:

mount_point=$(mktemp -d)
mkdir -p ${mount_point}

mount --bind  /var/lib/flatpak/app/some.app/x86_64/latest/active/files  ${mount_point}
mount --bind /var/lib/flatpak/runtime/org.gnome.Platform/x86_64/3.36/active/files \
             ${mount_point}

Questions:

  • Is something like this expected to work?
  • How can I find out what I need to mount, and where? Especially things like the graphics driver runtime and things like that
  • Is there another/better way to run an application from Flathub when you cannot, for some reason, use Bubblewrap?

Its not in general expected that this will works, because it ignores large parts of how flatpak works, including things like extensions and how it sets up the rest for the environment that flatpak apps expect.

There is no simple list of things you need to do to setup, because this what a large part of the flatpak codebase does. Basically, you’d need to look at the code to get all the details right. I would recommend that you read through common/flatpak-run.c in the sources which is where most of the setup happens. It is not trivial, but on the other hand its not doing anything that complex, especially if you’re willing to ignore anything related to the sandboxing.