ganzgustav22
Posts: 59
Joined: Tue Feb 11, 2020 1:04 pm

startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 1:25 pm

Sorry for crossposting, but I believe this belongs here and probably nobody has seen the issue under "Using the Raspberry Pi -> Advanced users"

viewtopic.php?f=29&t=270737

Issue is, starting with release 2020-05-27, xinit seems to require root privileges, atleast that other user and I cannot start it without being root anymore. As a quick (and dirty and insecure) workaround, I figured I'll just start xinit with sudo. But now (ofcourse) everything in X runs as root and chromium complains that it doesn't want to run as root. Duh.

I'm reluctant to start chromium with "sudo -u <non-root-user> chromium" to make it stop complaining for apparent reasons ;)

Is it somehow possible to start X without being root somehow with the newer Rasperry OS release?

User avatar
PeterO
Posts: 5821
Joined: Sun Jul 22, 2012 4:14 pm

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 1:45 pm

Try

Code: Select all

cd
sudo chown pi:pi .Xauthority
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

ganzgustav22
Posts: 59
Joined: Tue Feb 11, 2020 1:04 pm

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 2:42 pm

That file doesn't seem to exist on my system (isn't it created by X during runtime? not sure).

User avatar
PeterO
Posts: 5821
Joined: Sun Jul 22, 2012 4:14 pm

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 2:51 pm

ganzgustav22 wrote:
Mon Jun 29, 2020 2:42 pm
That file doesn't seem to exist on my system (isn't it created by X during runtime? not sure).
Yes, but if it already exits and is owned by root then when X is run by pi it can't access the file and won't start. Wrong ownership is the common cause of X failing to start.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5821
Joined: Sun Jul 22, 2012 4:14 pm

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 2:56 pm

ganzgustav22 wrote:
Mon Jun 29, 2020 1:25 pm
Is it somehow possible to start X without being root somehow with the newer Rasperry OS release?
It's amusing that you think this a problem with the release rather than a consequence of something you have done that has broken your system.
Do you not think that if it was a problem with the release that it would not have been reported and fixed after nearly a month ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

ejolson
Posts: 5128
Joined: Tue Mar 18, 2014 11:47 am

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 4:35 pm

PeterO wrote:
Mon Jun 29, 2020 2:56 pm
ganzgustav22 wrote:
Mon Jun 29, 2020 1:25 pm
Is it somehow possible to start X without being root somehow with the newer Rasperry OS release?
It's amusing that you think this a problem with the release rather than a consequence of something you have done that has broken your system.
Do you not think that if it was a problem with the release that it would not have been reported and fixed after nearly a month ?
PeterO
As far as I can tell this is the report, but just because there is a report doesn't mean it will get fixed. In order to make things seem more secure, many people go about making changes that break the general use case but not the common use. Traditionally the X server is a setuid root program. For some time Debian has cleared the setuid bit from the server binary and created a separate setuid wrapper that calls the server. The thinking seems to be two programs are somehow easier to secure and maintain than one.

Likely solutions to the problem in the original post include
  • Install the setuid wrapper or fix it.
  • Enable the setuid bit on the server.
Given the way modern user interfaces hide error messages in order to reduce complaints about too many errors, it is impossible for a beginner to figure out what's wrong when there is a problem.

User avatar
PeterO
Posts: 5821
Joined: Sun Jul 22, 2012 4:14 pm

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 4:44 pm

ejolson wrote:
Mon Jun 29, 2020 4:35 pm
As far as I can tell this is the report, but just because there is a report doesn't mean it will get fixed.
If this was a report of a problem with the release, then please explain why has it taken a month for someone to discover that something as fundamental as the X server is not working ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

ejolson
Posts: 5128
Joined: Tue Mar 18, 2014 11:47 am

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 4:53 pm

PeterO wrote:
Mon Jun 29, 2020 4:44 pm
ejolson wrote:
Mon Jun 29, 2020 4:35 pm
As far as I can tell this is the report, but just because there is a report doesn't mean it will get fixed.
If this was a report of a problem with the release, then please explain why has it taken a month for someone to discover that something as fundamental as the X server is not working ?

PeterO
Does it work for you?

GlowInTheDark
Posts: 564
Joined: Sat Nov 09, 2019 12:14 pm

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 5:00 pm

I think the big picture question that we all seem to be ignoring is: Who runs startx or xinit anymore ?

On any Linux OS, but in particular in Raspbian.

Isn't the whole point that the desktop comes up "automatically"?

Now, having said all that, there are specialized use cases where you do boot to a command line and then invoke startx/xinit manually, but they are rare. I think what we should be doing is trying to figure out why OP is doing this.

P.S., regarding setuid-ness. The long term movement in Linux these days is towards making the X server *NOT* setuid. This can be done, but at the cost of making the X server run on (usually) tty1, not the usual (and expected by all us old-timers) tty7. For further clarification about what I'm talking about, try installing and running ArchLinux on the Pi. (Or current Ubuntu on an x86 machine).

P.P.S. PeterO has made a wild shot in guessing that OP's problem has something to do with .Xauthority. He might be right. Then again, he might not...
Last edited by GlowInTheDark on Mon Jun 29, 2020 5:48 pm, edited 1 time in total.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

User avatar
dickon
Posts: 1413
Joined: Sun Dec 09, 2012 3:54 pm
Location: Home, just outside Reading

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 5:04 pm

ganzgustav22 wrote:
Mon Jun 29, 2020 2:42 pm
That file doesn't seem to exist on my system (isn't it created by X during runtime? not sure).
I believe it's created by your login manager (xdm, gdm, etc.). It sounds like you're not running one.

Probably your best (easiest) bet is to run Xorg suid, but run 'xhost +localhost' in your .xsession file (or similar), which should allow you to run the browser as any random user you like. You'll likely need to set DISPLAY, of course.

User avatar
thagrol
Posts: 2917
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: startx or xinit requires root since Release 2020-05-27

Mon Jun 29, 2020 5:51 pm

GlowInTheDark wrote:
Mon Jun 29, 2020 5:00 pm
I think the big picture question that we all seem to be ignoring is: Who runs startx or xinit anymore ?
I do, for one.
On any Linux OS, but in particular in Raspbian.

Isn't the whole point that the desktop comes up "automatically"?
On a desktop sytem, yes. But on a server do you really want a desktop running and a user logged in*? That's horribly insecure and resource inefficient.
Now, having said all that, there are specialized use cases where you do boot to a command line and then invoke startx/xinit manually, but they are rare.
Probably rare in the desktop world. May be rare in the server world but not for the reason you think. I suspect when doing remote admin that needs a GUI app the method used will be to run it over X11 forwarding to a remote X server running a desktop rather than start an entire desktop on the server. Or to use a remote X server to login to the server via XDM (or whatever the modern replacement for that is).

Oh, and here's one special case that a suspect a quite a few Pi users could make use of: running a single full screen X app (e.g. a kiosk mode browser). It's more efficient and arguable more secure to use

Code: Select all

startx /path/to/app
than it is to start the entire desktop then launch your app on top of that.
I think what we should be doing is trying to figure out why OP is doing this.
Maybe, but I doubt it'll shed light on the problem.


*: by 'desktop comes up "automatically"' you're implying that a user will also be logged in automatically.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

busywait
Posts: 57
Joined: Sat May 09, 2020 10:48 pm
Location: Southampton, UK

Re: startx or xinit requires root since Release 2020-05-27

Tue Jun 30, 2020 8:05 am

thagrol wrote:
Mon Jun 29, 2020 5:51 pm
GlowInTheDark wrote:
Mon Jun 29, 2020 5:00 pm
I think the big picture question that we all seem to be ignoring is: Who runs startx or xinit anymore ?
I do, for one.

Me too.

I've also just done a fresh install of the 2020-05-27 image for a quick test/play with some other things.

I've used raspi-config to boot to the console login prompt (run-level 3/multi-user target).

I rebooted, logged in to the prompt as pi, and typed startx. My GUI desktop started and everything worked as expected. So, it works for me (Pi 4B, Rapberry Pi 32-bit OS).

User avatar
PeterO
Posts: 5821
Joined: Sun Jul 22, 2012 4:14 pm

Re: startx or xinit requires root since Release 2020-05-27

Tue Jun 30, 2020 8:08 am

ejolson wrote:
Mon Jun 29, 2020 4:53 pm
PeterO wrote:
Mon Jun 29, 2020 4:44 pm
ejolson wrote:
Mon Jun 29, 2020 4:35 pm
As far as I can tell this is the report, but just because there is a report doesn't mean it will get fixed.
If this was a report of a problem with the release, then please explain why has it taken a month for someone to discover that something as fundamental as the X server is not working ?

PeterO
Does it work for you?
Yes, tried it before my first reply :roll:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Raspberry Pi OS”