Development => PC, Mac & Vintage Computers => Topic started by: gameblabla on May 01, 2018, 06:27:57 am

Title: Running Xorg without any root rights
Post by: gameblabla on May 01, 2018, 06:27:57 am
While i was using Devuan, i ran startx as a normal user (instead of using sudo).
Surprisingly, i was able to get a screen. However, neither the keyboard or mouse would work so i had to reboot.

Fast forward to now, i was very annoyed to see people claiming that you need to have systemd in order to run Xorg without any root rights.
I later discovered it was in fact false, as people were able to do just that before systemd even existed. (back in 2009)

You do need a driver that supports KVM, which nouveau, intel and radeon does. (i heard nvidia's proprietary driver also recently supports KVM)
Also make sure to use libinput for xorg.

It was a simple matter of making a udev script (or using chown on /dev/input*, your choice) and voila, Xorg without any root rights.


It's worth nothing that none of this would work with a window manager. (In fact, i think SDDM still doesn't support rootless xorg !)
So i also had to make it nice and convenient for me to use and i opted for a script in /etc/profile.d which will prompt you if you want to run your window manager. (with xorg of course)

You can give it a try here : (
Title: Re: Running Xorg without any root rights
Post by: Yuki on May 01, 2018, 06:50:02 am
Yeah, pretty sure rootless X predates systemd or had anything to do with it, you pretty much have to give a bunch of files in /dev the right permissions or something. The fact it doesn't work in Devuan probably is a bug with the distro, actually, you might want to check out their bug tracker if any.

EDIT: Ah yeah, some old document on the Ubuntu Wiki from 2010 ( corroborate this, you need KMS drivers and give the right permissions to the tty and /dev/input.
Title: Re: Running Xorg without any root rights
Post by: gameblabla on May 11, 2018, 08:19:34 pm
I'm sure pretty much all distributions are affected.
I did encounter one issue with this approach though : Teamviewer only works with a display manager.
Kind of a huge pain in the pass and that forced me to temporary install wdm before reverting back to startx.
It would also sometimes crash randomly when things get messy with steam... Though it's kind of an improvement as before it would freeze my computer forever and i was forced to reboot it.

Wine 3.8 fixed some Steam bugs so hopefully it will play nicer now.
As for teamviewer, i think i'll use another alternative for now or maybe use it on another computer.
Title: Re: Running Xorg without any root rights
Post by: Yuki on May 12, 2018, 07:59:19 am
Well, it is possible some apps and toolkits depends on a window manager to work correctly, so yeah. You'd need a window manager to do anything useful anyway.

I'm pretty sure on most distros it works at least correctly (even though it's systemd), personally on my Arch Linux I have EmulationStation launch startx as a normal user with a little script that sets the correct mode, starts a simple window manager (steamcompmgr, which merely starts the current app fullscreen) and Steam in big picture mode. It just works, probably with some udev rules or the like, it just worked out of the box.