Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Non root Xorg on AMD video cards
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page 1, 2, 3, 4, 5, 6, 7, 8  Next  
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Tue Feb 05, 2019 10:36 pm    Post subject: [Solved] Non root Xorg on AMD video cards Reply with quote

Is it possible ?

Last edited by The Main Man on Thu Apr 25, 2019 1:05 pm; edited 3 times in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Feb 06, 2019 2:41 am    Post subject: Reply with quote

You need to give the X server process read/write access to your input/DRI devices, and it needs to not change VT at startup (that requires root). Some config tweaks required, but it's doable.
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Wed Feb 06, 2019 7:55 am    Post subject: Reply with quote

With Intel I had no issues, with AMD I got error, error was modesetting or something, can't remember.
I asked because Wiki mentions just nvidia and intel, plus it says that the article is outdated.
https://wiki.gentoo.org/wiki/Non_root_Xorg

I'll try again more thoroughly, I gave up on first try and error because I needed X asap.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Feb 06, 2019 10:52 am    Post subject: Reply with quote

If you are using modesetting driver, no matter which card, non-suid X doesn't work.
The non-modesetting drivers will work and the wiki needs to be updated to reflect that.
Especially since everyone seems to be heading towards modesetting.
To do modesetting will require a library/kernel change, if I'm not mistaken.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Wed Feb 06, 2019 1:21 pm    Post subject: Reply with quote

Yeah, I tried again and it says that amdgpu KMS modesetting driver is enabled, that's the error.

Got new hardware and I used genkernel, it's probably enabled in initramfs, didn't have the time to manually configure kernel, hardware rather.
When I do I'll try it again, I guess it will work.
Thanks for the information.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Feb 06, 2019 2:09 pm    Post subject: Reply with quote

kajzer wrote:
Yeah, I tried again and it says that amdgpu KMS modesetting driver is enabled, that's the error.

Got new hardware and I used genkernel, it's probably enabled in initramfs, didn't have the time to manually configure kernel, hardware rather.
When I do I'll try it again, I guess it will work.
Thanks for the information.


It's not the kernel modesetting that's the problem. It's setting the modesetting driver for xorg.
In my case I was using the nouveau driver and I could run non-suid X, albeit with an error message, but when I switched driver to modesetting, it wouldn't work, even though the modesetting driver ultimately calls the nouveau driver underneath it. The problem is in the x modesetting driver itself and how it interfaces with the kernel and other driver modules. At least this is my current understanding.

What driver is selected in xorg log?
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Wed Feb 06, 2019 2:22 pm    Post subject: Reply with quote

amdgpu

Code:
cat /var/log/Xorg.0.log | grep driver
[   378.364]    X.Org XInput driver : 24.1
[   378.373]    loading driver: amdgpu
[   378.373] (==) Matched amdgpu as autoconfigured driver 0
[   378.373] (==) Matched ati as autoconfigured driver 1
[   378.373] (==) Matched modesetting as autoconfigured driver 2
[   378.373] (==) Matched fbdev as autoconfigured driver 3
[   378.373] (==) Matched vesa as autoconfigured driver 4
[   378.373] (==) Assigned the driver to the xf86ConfigLayout
[   378.373] (II) Loading /usr/lib64/xorg/modules/drivers/amdgpu_drv.so
[   378.373] (II) Loading /usr/lib64/xorg/modules/drivers/ati_drv.so
[   378.403] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so
   All GPUs supported by the amdgpu kernel driver
[   378.503] (II) AMDGPU(0): [DRI2]   DRI driver: radeonsi
[   378.503] (II) AMDGPU(0): [DRI2]   VDPAU driver: radeonsi
[   379.071]    ABI class: X.Org XInput driver, version 24.1
[   379.071] (II) Using input driver 'evdev' for 'Power Button'
[   379.072] (II) Using input driver 'evdev' for 'Video Bus'
[   379.072] (II) Using input driver 'evdev' for 'Power Button'
[   379.073] (II) Using input driver 'evdev' for 'USB Optical Mouse'
[   379.125] (II) No input driver specified, ignoring this device.
[   379.126] (II) No input driver specified, ignoring this device.
[   379.126] (II) No input driver specified, ignoring this device.
[   379.126] (II) No input driver specified, ignoring this device.
[   379.127] (II) No input driver specified, ignoring this device.
[   379.127] (II) No input driver specified, ignoring this device.
[   379.127] (II) No input driver specified, ignoring this device.
[   379.127] (II) No input driver specified, ignoring this device.
[   379.127] (II) Using input driver 'evdev' for 'AT Translated Set 2 keyboard'
[   379.128] (II) No input driver specified, ignoring this device.
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Wed Feb 06, 2019 3:56 pm    Post subject: Reply with quote

I compiled kernel manually, it still loads modesetting driver
Code:
Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so


In kernel I just enabled amdgpu driver and AMD DC in display engine configuration.
Other stuff AMD related I don't know yet what they are , system is working fine with those disabled though.
Don't know what HSA kernel driver is, highlighted in the first picture below

Anyway, as I understand this so far, -suid doesn't work because modesetting driver is loaded, I can't seem to find out how to disable that driver, maybe that's not doable !?

https://imgur.com/dsx5Y71
https://imgur.com/6In25tX
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Feb 06, 2019 5:08 pm    Post subject: Reply with quote

To get it not to use modesetting you would have to set (at least part of) xorg.conf for that driver.

Code:
Section "Device"
    Identifier     "Device0"
    Driver         "modesetting"
    Screen         0
EndSection


The Driver option used to be "nouveau" which only set nouveau not modesetting.
If you don't use an xorg.conf or part of one in xorg.conf.d then you are getting what X thinks it needs.

I haven't played with the amdgpu driver as I don't have a new enough amd card (2nd card is amd) so I haven't tried it out.

Having said all the above, it won't be long (IMO) before the only way X will work will be with the modesetting driver, so just learn to accept suid (which is the way it's been for a long time) or work with suid wrappers to see if that won't work with amd gpus. But even with suid wrappers, part of X is still being run as root.
Blame it on the fact that only root can set/change/use the DRM*master calls. something like
Code:
(EE) modeset(0): drmSetMaster failed: Permission denied



Edit to add: to try a partial xorg.conf create a file in /etc/X11/xorg.conf.d and call it 30amd.conf or something like that
Code:
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "amdgpu"
    VendorName     "AMD"
    Option         "Backingstore" "true"
EndSection


Modify as needed for your system (no guarantees that it will work)
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Wed Feb 06, 2019 5:57 pm    Post subject: Reply with quote

Well, I'm afraid that KMS is mandatory for AMDGPU
Long story short, to disable modesetting all that was needed was nomodesetting as kernel parameter.
However, xorg (with no suid) changed the error message and now saying something about how DRI needs something... (I know... should have noted that down but I'm tired)
And indeed modesetting wasn't loaded, which I was able to see visually too, but turns out AMDGPU doesn't work without it.
Arch Wiki says that it's mandatory, so I don't know.

I guess, maybe someone with AMDGPU and the desire to use Xorg with -suid can solve this.

@Anon-E-moose, big thanks for trying, maybe I'll try playing with this more in next few days, but for now I give up.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Feb 06, 2019 6:44 pm    Post subject: Reply with quote

You do indeed need KMS in the kernel,

But modesetting in X is separate from KMS.

X can use either modesetting driver which you'll see with the loading modesetting module message or not.

You have to specifically tell it to use the amdgpu driver only using something like the xorg code that I posted earlier, otherwise it tries to use the modesetting driver, which in turn calls the amdgpu driver.

I know it's confusing and I wish they would quit using the same terms for different things.
I feel the same way when the kernel talks about DRM and then we hear about drm applied to movies/media.

Note: Again I haven't played with amdgpu and am going on what I know from the nouveau driver. I assume that amdgpu will work without modesetting module in Xorg.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Wed Feb 06, 2019 7:17 pm    Post subject: Reply with quote

Forgot to say that I prior to that already made xorg config file /etc/X11/xorg.conf.d/20-amdgpu.conf with this inside :
Code:
Section "Device"
     Identifier "AMD"
     Driver "amdgpu"
     Option "TearFree" "true"
 EndSection


and Xorg log doesn't report modesetting to be loaded
Code:
 cat /var/log/Xorg.0.log | grep driver                                                                                                                                                                             
[    27.795]    X.Org XInput driver : 24.1
[    27.943] (II) Loading /usr/lib64/xorg/modules/drivers/amdgpu_drv.so
   All GPUs supported by the amdgpu kernel driver
[    29.128] (II) AMDGPU(0): [DRI2]   DRI driver: radeonsi
[    29.128] (II) AMDGPU(0): [DRI2]   VDPAU driver: radeonsi
[    29.716]    ABI class: X.Org XInput driver, version 24.1
....


Yes, it's all very confusing, wasn't using AMD gpu for several years now, back then it was simple fglrx and crippled open source.
I guess there's a reason why Gentoo Wiki only mention nvidia and intel for Non root Xorg.

So, I didn't try your xorg.conf suggestion, but I will for sure, if not today then tomorrow.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Wed Feb 06, 2019 7:49 pm    Post subject: Reply with quote

That xorg file you posted should work. It's similar to what I posted.

As long as the modesetting driver doesn't show up, then you might be able to run non-suid X, using what the wiki mentions.

Note: I added my user to these groups, video, input and tty

You might want to read https://forums.gentoo.org/viewtopic-t-1088682-start-50.html scroll down about 1/3 way to see a long post by me talking about modesetting.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Thu Feb 07, 2019 9:58 am    Post subject: Reply with quote

I'm in those groups, that's not the problem, error would be different, permission denied related.
I was using -suid for a very long time but on Intel.
But this one I don't understand, there's not much info about it.
You say that with modesetting no matter which card, -suid can't work.
More specifically KMS is different than card MS
I tried with disabling KMS as the kernel parameter, then startx reported different error, instead of "...modesetting is loaded...." I got "....DRI needs...." (paraphrasing both error messages)
When I added xorg config file and specified amdgpu driver to be loaded, then the other two (radeonsi and modesetting) drivers weren't loaded.
According to Arch Wiki KMS is mandatory
Now, you say that doesn't matter and the one that matters for -suid is the Xorg modesetting driver.
I'm not loading Xorg modesetting driver anymore since I added xorg config file.

I'll try again but I'm not optimistic about it at this point.

Edit:
actually I'm not in the tty group, wasn't needed for Intel btw, doubt it's any different for amdgpu, I think that part is ok, gpu driver is the problem.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Thu Feb 07, 2019 10:49 am    Post subject: Reply with quote

It just might not run as non root.

I played around with non root, but just went back to suid X, just the way I've been using it for many years. Non root is still too flaky, IMO.
What needs to be done is what bind and apache do, start as root and drop privileges that it doesn't need but that will require changes to at least the video drivers (as that's the basic holdup)
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1995

PostPosted: Thu Feb 07, 2019 10:58 am    Post subject: Reply with quote

AFAIK Arch linux default is usermode X; I did a brief scan of their wiki article on AMDGPU and found no mention of problems. Their wiki article on Xorg has a section on "Rootless Xorg" that might point at relevant configuration. I've tried none of this myself.
_________________
Greybeard
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Mon Apr 22, 2019 1:20 pm    Post subject: Reply with quote

Goverp wrote:
AFAIK Arch linux default is usermode X; I did a brief scan of their wiki article on AMDGPU and found no mention of problems. Their wiki article on Xorg has a section on "Rootless Xorg" that might point at relevant configuration. I've tried none of this myself.


Don't know if Arch is using usermode X by default, but they not mentioning problems with amdgpu and non-root X11 doesn't mean that it works with that video driver.
if it indeed works in Arch I would be interested to know how they do it.

Anyway, I would be happy to test any suggestion, I just don't know what else to try, like I said earlier, steps in Gentoo Wiki are clear and the procedure works with Intel GPU, with AMD it's not working, never had Nvidia so I didn't try but I guess it's working with those cards.
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Thu Apr 25, 2019 10:58 am    Post subject: Reply with quote

Well, I just had to try and indeed Arch uses Non root Xorg by default.
Even tried Ubuntu 18.04 and they also have it working by default.

I think I tried everything in Gentoo to make it work, well obviously I didn't everything because I can't make it to work, but I'm out of ideas, have no idea what's going on.
Could it maybe be systemd in combination with login manager which somehow makes this work ?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Thu Apr 25, 2019 12:00 pm    Post subject: Reply with quote

systemd does work with non-suid X, that's because systemd is effectively running as root.
Systemd is an effort at creating windows with a linux kernel, with all that that implies.

Doesn't really help those of us not running systemd.

Edit to add: quite frankly I've given up on non-root X and just have it installed suid.
Been that way since X started and there's been no real epidemic of problems because of it.
The whole push for non-suid X only started reaching a fever pitch when X started being hosted at freedesktop.org, which also *magically* hosts systemd and associated crapola.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Thu Apr 25, 2019 12:47 pm    Post subject: Reply with quote

It's not just about security, it bugs me that it doesn't work in Gentoo, more specifically with amd gpu cards.

btw Void linux is systemd free and there seems to be working too.
Scroll all the way to the bottom , Rootless xorg
https://wiki.voidlinux.org/Xorg
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Thu Apr 25, 2019 1:10 pm    Post subject: Reply with quote

I found a way, might not be ideal but it seems it's the only way.

All it takes is in make.conf
Code:
"elogind -consolekit"


None of that input group stuff and anything from Non root Xorg gentoo wiki isn't needed.
There's also no need for 'startx -- vt1', plain 'startx' works.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Apr 25, 2019 3:30 pm    Post subject: Reply with quote

what does startx gives you? login screen or desktop?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1165
Location: /run/user/1000

PostPosted: Thu Apr 25, 2019 3:53 pm    Post subject: Reply with quote

Desktop, actually window manager, dwm.
btw I'm not using login managers.
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8935

PostPosted: Thu Apr 25, 2019 3:57 pm    Post subject: Reply with quote

kajzer wrote:
I found a way, might not be ideal but it seems it's the only way.

Congratulations, you've went ahead with what will soon be the default in Gentoo as well (elogind instead of consolekit on desktop profile).
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Apr 25, 2019 4:12 pm    Post subject: Reply with quote

I wonder if there is a way to make it work with login managers
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Goto page 1, 2, 3, 4, 5, 6, 7, 8  Next
Page 1 of 8

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum