Join us on Discord!
You can help CodeWalrus stay online by donating here.

Running Xorg without any root rights

Started by gameblabla, May 01, 2018, 06:27:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gameblabla

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 :
https://github.com/gameblabla/xorg-rootless-devuan
  • Calculators owned: None (used to own an Nspire and TI-89)

Yuki

#1
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.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

gameblabla

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.
  • Calculators owned: None (used to own an Nspire and TI-89)

Yuki

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.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Powered by EzPortal