[GH-ISSUE #2711] What is the correct way to pass /tmp/.X11-unix into a chroot? #1707

Closed
opened 2026-05-05 08:21:52 -06:00 by gitea-mirror · 9 comments
Owner

Originally created by @dandelionred on GitHub (May 20, 2019).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2711

I debootstrapped ubuntu 19.04 into /nas/chroot/disco and installed smplayer inside.

Running this

firejail --noprofile --chroot=/nas/chroot/disco smplayer

I get this

...
qt.qpa.xcb: could not connect to display :0
...

As a dirty fix I set up such bind

sudo mount --bind /tmp /nas/chroot/disco/tmp

and chrooted smplayer can start now.


Is there some native to firejail way to pass /tmp/.X11-unix into a chroot?


Btw I run xorg with -nolisten local so there is no abstract socket. Hence /tmp/.X11-unix is the only way to X.

Originally created by @dandelionred on GitHub (May 20, 2019). Original GitHub issue: https://github.com/netblue30/firejail/issues/2711 I debootstrapped ubuntu 19.04 into /nas/chroot/disco and installed smplayer inside. Running this ``` firejail --noprofile --chroot=/nas/chroot/disco smplayer ``` I get this ``` ... qt.qpa.xcb: could not connect to display :0 ... ``` As a dirty fix I set up such bind ``` sudo mount --bind /tmp /nas/chroot/disco/tmp ``` and chrooted smplayer can start now. <br> Is there some **native to firejail** way to pass /tmp/.X11-unix into a chroot? <br> Btw I run xorg with `-nolisten local` so there is no abstract socket. Hence /tmp/.X11-unix is the only way to X.
gitea-mirror 2026-05-05 08:21:52 -06:00
Author
Owner

@smitsohu commented on GitHub (May 20, 2019):

Setting an environment variable FIREJAIL_X11 should work.

<!-- gh-comment-id:494169131 --> @smitsohu commented on GitHub (May 20, 2019): Setting an environment variable `FIREJAIL_X11` should work.
Author
Owner

@dandelionred commented on GitHub (May 20, 2019):

Setting an environment variable FIREJAIL_X11 should work.

I'm not sure how to use it

$ FIREJAIL_X11=1 firejail --noprofile --chroot=/nas/chroot/disco smplayer
Error: cannot find /tmp/.X11-unix in chroot directory
<!-- gh-comment-id:494171243 --> @dandelionred commented on GitHub (May 20, 2019): > Setting an environment variable `FIREJAIL_X11` should work. I'm not sure how to use it ``` $ FIREJAIL_X11=1 firejail --noprofile --chroot=/nas/chroot/disco smplayer Error: cannot find /tmp/.X11-unix in chroot directory ```
Author
Owner

@smitsohu commented on GitHub (May 20, 2019):

You need to create an empty /tmp/.X11-unix directory as mount point first.

<!-- gh-comment-id:494172068 --> @smitsohu commented on GitHub (May 20, 2019): You need to create an empty `/tmp/.X11-unix` directory as mount point first.
Author
Owner

@dandelionred commented on GitHub (May 20, 2019):

Thanks, it works now.

Mby the FIREJAIL_X11 tip should be added to https://firejail.wordpress.com/documentation-2/x11-guide/ ?

<!-- gh-comment-id:494173436 --> @dandelionred commented on GitHub (May 20, 2019): Thanks, it works now. Mby the FIREJAIL_X11 tip should be added to https://firejail.wordpress.com/documentation-2/x11-guide/ ?
Author
Owner

@smitsohu commented on GitHub (May 20, 2019):

To be honest, FIREJAIL_X11 is quite a dirty solution itself.

In the moment Firejail doesn't help too much in setting up the chroot, but this also means it will not get in your way too much. I think what you described in the original post is "the correct way" actually.

<!-- gh-comment-id:494177513 --> @smitsohu commented on GitHub (May 20, 2019): To be honest, `FIREJAIL_X11` is quite a dirty solution itself. In the moment Firejail doesn't help too much in setting up the chroot, but this also means it will not get in your way too much. I think what you described in the original post is "the correct way" actually.
Author
Owner

@dandelionred commented on GitHub (May 20, 2019):

KK, got it.

<!-- gh-comment-id:494178230 --> @dandelionred commented on GitHub (May 20, 2019): KK, got it.
Author
Owner

@smitsohu commented on GitHub (May 21, 2019):

A last note:

Don't set FIREJAIL_X11 to yes, any other value will work just fine.

<!-- gh-comment-id:494191153 --> @smitsohu commented on GitHub (May 21, 2019): A last note: Don't set `FIREJAIL_X11` to `yes`, any other value will work just fine.
Author
Owner

@dandelionred commented on GitHub (May 21, 2019):

@smitsohu What is wrong with FIREJAIL_X11=yes?

<!-- gh-comment-id:494247750 --> @dandelionred commented on GitHub (May 21, 2019): @smitsohu What is wrong with FIREJAIL_X11=yes?
Author
Owner

@smitsohu commented on GitHub (May 21, 2019):

@dandelionred FIREJAIL_X11=yes is used internally to indicate that an --x* option has been parsed; setting it to a value other than yes navigates around possible issues.

Did I already mention it is dirty? 😄

<!-- gh-comment-id:494326436 --> @smitsohu commented on GitHub (May 21, 2019): @dandelionred FIREJAIL_X11=yes is used internally to indicate that an `--x*` option has been parsed; setting it to a value other than yes navigates around possible issues. Did I already mention it is dirty? :smile:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#1707
No description provided.