mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

sudo mandatory to run Xorg? #99

Closed Lecrapouille closed 5 years ago

Lecrapouille commented 5 years ago

Hi !

When I'm logged on my Linux X session (xfce), I cannot type the following command on a console x11docker --desktop x11docker/lxde-wine without sudo else X server cannot start. This is what the message said (as point 1). If I log out the X session, I can run the command without being root. This is what the message said (as point 4).

Point 2 is using tty which is said to be not recommended and Point 3 is gdm3 that I do not want to use. So how to run x11docker without being root and within a X session ?

Thx !

mviereck commented 5 years ago

Hello,

I am not sure if I understand your question correctly. From point 1 to 4 you probably mean this message:

Your configuration seems not to allow to start
  a second core Xorg server from within X. Option --xorg will probably fail.
  (Per default, only root or console users are allowed to run an Xorg server).

  Possible solutions:
  1.) Install one of nested X servers 'Xephyr', 'Xnest' or 'nxagent'.
      For --gpu support: install 'weston' and 'Xwayland'.
  2.) Switch to console tty1...tty6 with <CTRL><ALT><F1>...<F6>
      and start x11docker there.
  3.) Run x11docker as root.
  4.) Edit file '/etc/X11/Xwrapper.config' and replace line:
          allowed_users=console
      with lines
          allowed_users=anybody
          needs_root_rights=yes
      If the file does not exist already, you can create it.
      On Ubuntu 16.04 and debian 9 you need package xserver-xorg-legacy.

If you can run unprivileged x11docker with Xorg from console, but not within an X session, than you need to edit or create /etc/X11/Xwrapper.config (point 4). On Debian and its derivates you also need package xserver-xorg-legacy.

Point 2 is using tty which is said to be not recommended

That is ok, no problem. In general I found an issue on debian that sometimes one X server crashes if two Xorg's runs on different ttys and you directly switch between them with ctrl+alt+Fn. It seems to be some sort of race condition. Switching to a black tty first helps.

Point 3 is gdm3 that I do not want to use

Sorry, I don't understand. x11docker isn't related to gdm3.

So how to run x11docker without being root and within a X session ?

My recommendation is to install Xephyr to allow a nested X session. (Point 1).

If I missed the point of your question, please tell me.

Lecrapouille commented 5 years ago

I should have copy/pasted the message in my 1st message, sorry !

That is strange but the message is no longer the one I got initially and I cannot success to get the first back (probably because I did not restarted my computer after the installation). The message did not tell me about /etc/X11/Xwrapper.config. So now I have the same than you :)

I changed the config and this solved my problem. Thank you !

mviereck commented 5 years ago

:-)