FILM icon indicating copy to clipboard operation
FILM copied to clipboard

can run Xorg without sudo?

Open hcscctv opened this issue 3 years ago • 3 comments

[3147052.780] (II) xfree86: Adding drm device (/dev/dri/card1) [3147052.781] (EE) systemd-logind: failed to take device /dev/dri/card1: Operation not permitted

[3147052.825] (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)

can the Xorg run without root permission?

hcscctv avatar Apr 05 '22 09:04 hcscctv

Hello, sorry for my late reply. I think it requires "root" although not sudo. Inside a docker container, you can be the root and if you turn on xserver inside the container, you will have permission (even if you don't have root access for the computer itself)

soyeonm avatar Apr 11 '22 16:04 soyeonm

@hcscctv, after many hours of trying It seems to me that if you don't have root access inside docker, then running Xorg server is impossible.

What have I tried and looked at? I've gone through every issue related to Xorg in the Alfred and AI2Thor repositories. More specifically, I:

  1. Tried display > 0 as suggested here: https://github.com/askforalfred/alfred#cloud-instance
  2. Fixed https://github.com/askforalfred/alfred/issues/29#issuecomment-866774654 by adding allowed_users=anybody at the end of /etc/X11/Xwrapper.config
  3. Fixed https://github.com/askforalfred/alfred/issues/51#issue-714415967 with DEBIAN_FRONTEND=noninteractive
  4. Looked at https://github.com/askforalfred/alfred#run-headless, but since I didn't have root access, I couldn't run nvidia-xconfig.
  5. Looked at https://github.com/askforalfred/alfred/issues/61 but since I just login inside a container that is automatically launched from my docker image, I can't use --privileged.
  6. Tried different ways to install Xorg: xorg openbox (stackoverflow) vs xserver-xorg-core xorg (ai2thor docker) vs xserver-xorg xserver-xorg-video-fbdev xauth (alfred).
  7. Checked that tempfile is not used in startx.py https://github.com/allenai/ai2thor/issues/325#issuecomment-853924515
  8. Tried https://github.com/dnschneid/crouton/issues/3339#issuecomment-325223722
  9. Fixed _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created by editing the command to run Xorg (added -nolisten unix)

So, it seems the problem is in having access to /dev/tty0. This device is a virtual console that can be used for running a display. Only system and root users are allowed to write inside it. Moreover, if you run without --privileged, it doesn't show up in /dev/ (I checked this locally). Also, when I tried to run Xorg inside a locally running container (launched with --privileged), my display turned black, thus Xorg was successfully launched.

TopCoder2K avatar Apr 13 '22 08:04 TopCoder2K

@TopCoder2K Thank you very much for taking the time to answer my questions

hcscctv avatar Apr 13 '22 09:04 hcscctv