Flatpak – How to Get ‘flatpak enter’ to Work

flatpak

I'm trying to use flatpak enter to enter a sandboxed Steam client. To get a PID or instance ID I do like so:

$ flatpak ps
Instance   PID  Application             Runtime
2581746118 4294 com.valvesoftware.Steam org.freedesktop.Platform

However, doing flatpak enter as root doesn't work:

# flatpak enter 4294 bash
error: 4294 is neither a pid nor an application or instance ID
# flatpak enter 2581746118 bash
error: 2581746118 is neither a pid nor an application or instance ID
# flatpak enter com.valvesoftware.Steam bash
error: com.valvesoftware.Steam is neither a pid nor an application or instance ID

Also, using tab completion after flatpak enter only shows command line options, rather than any argument to enter.

Best Answer

The problem is you need to be root to use flatpak enter because it requires entering various container namespaces. What makes that more complex is that sudo changes environment variables making flatpak unaware of your application instances.

That results in this rather non-obvious usage:

sudo -E flatpak enter instance-id /bin/bash
Related Question