You are not logged in.

#1 2020-07-03 08:09:13

Doodle
New Member
Registered: 2017-12-08
Posts: 4

Launching nvidia-settings with root using jgmenu

I'm trying to make it so I can launch nvidia-settings as root from the menu, rather than opening a terminal, logging in as root, and then running the command. I used to have it working before on a previous version using gksudo, but when I try to do it with pkexec I just get errors.

In my jgmenu is

NVidia Settings,pkexec nvidia-settings,nvidia-settings

which does nothing. If I try it from the terminal I get

Unable to init server: Could not connect: Connection refused

ERROR: The control display is undefined; please run `/usr/bin/nvidia-settings
       --help` for usage information.

But if I run "echo $DISPLAY" it returns with :0.0.

I tried forcing it with

pkexec nvidia-settings --ctrl-display=:0.0

but that gives me

Unable to init server: Could not connect: Connection refused
No protocol specified

ERROR: Unable to find display on any available system

No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified
No protocol specified

ERROR: Unable to create nvidia-settings GUI; please run
       `/usr/bin/nvidia-settings --help` for usage information.

Offline

#2 2020-07-03 22:05:06

hhh
Meep!
Registered: 2015-09-17
Posts: 10,236
Website

Re: Launching nvidia-settings with root using jgmenu

I don't have Nvidia graphics, so I can't test. What does a terminal run of 'pkexec nvidia-settings' return?

Offline

#3 2020-07-03 22:28:57

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,902

Re: Launching nvidia-settings with root using jgmenu

You need to consider all information on and linked to from this section: https://wiki.archlinux.org/index.php/Ru … ns_as_root . This is about X11 server permissions, environment variable and X11 authorization cookie propagation. As noted there, pkexec is a deprecated way to do this, and man pkexec(1) notes:

The environment that PROGRAM will run it, will be set to a minimal known and safe environment in order to avoid injecting code through LD_LIBRARY_PATH or similar mechanisms. In addition the PKEXEC_UID environment variable is set to the user id of the process invoking pkexec. As a result, pkexec will not allow you to run X11 applications as another user since the $DISPLAY and $XAUTHORITY environment variables are not set. These two variables will be retained if the org.freedesktop.policykit.exec.allow_gui annotation on an action is set to a nonempty value; this is discouraged, though, and should only be used for legacy programs.

So you would need a custom pkexec policy in order to make it work with X11 applications. There's a link to an example which you could easily adopt on the wiki page.

The simplest way is likely to use kdesu. gksu/gksudo in contrast are abandonware and have been removed as of Debian Buster. LIke in Arch, kdesu is available from the kde-cli-tools package in Debian.

It would be great if nvidia-settings could be launched as non-root and then request just permissions when they are needed to make changes (privsep principle) but that's likely wishful thinking and likely hasn't been implemented that way.


Per aspera ad astra.

Offline

#4 2020-07-03 23:19:05

hhh
Meep!
Registered: 2015-09-17
Posts: 10,236
Website

Re: Launching nvidia-settings with root using jgmenu

@twoion, thanks for your input. I'm grasping at straws.

Offline

#5 2020-07-04 08:10:13

ohnonot
...again
Registered: 2015-09-29
Posts: 4,784
Website

Re: Launching nvidia-settings with root using jgmenu

It's been a while since I had an Nvidia card, but iirc it was never required, or even desired, to run nvidia-settings as root.
May I ask what you, Doodle, are hoping to accomplish with that?


BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
---
Thank you for posting direct image links!

Offline

#6 2020-07-05 02:12:06

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 958

Re: Launching nvidia-settings with root using jgmenu

trying to install that kde-cli-tools package brings in a goodly bit of the KDE desktop...all just for using kdesu. If pkexec and friends is being deprecated will there be any replacement for executing a graphical application "safely" as root?


Real Men Use Linux

Offline

#7 2020-07-05 08:19:29

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 560

Re: Launching nvidia-settings with root using jgmenu

DeepDayze wrote:

trying to install that kde-cli-tools package brings in a goodly bit of the KDE desktop...

It brings in some qt libraries, not "a goodly bit of the KDE-desktop"...

If pkexec and friends is being deprecated will there be any replacement for executing a graphical application "safely" as root?

Just because it never is totaly safe to run X-apps as root, is it more and more restricted.
But, I think that it is still possible in Buster/Lithium, to create a poolkit action to allow runing programs as root with pkexec. Have you created an policy file? See https://bbs.archlinux.org/viewtopic.php … 28#p999328

It is also still possible (I think) to circumvent restrixtions with Xhost or to start a new root terminal with sudo (in termina, logg in as root with sudo, loog out. Start new root terminal with sudo.)

But, you have not answered the question, why do you want to run the nvidia-settings as root. Are you chasing the ansver to wrong question?

Last edited by rbh (2020-07-05 08:21:20)


// Regards rbh

Offline

#8 2020-07-06 08:33:50

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 560

Re: Launching nvidia-settings with root using jgmenu

rbh wrote:

But, you have not answered the question, why do you want to run the nvidia-settings as root. Are you chasing the ansver to wrong question?

I found:

"nvidia-settings doesn't have to be launched as root as it saves the user's settings to ~/.nvidia-settings-rc (so as to have per user settings)."

https://bugs.launchpad.net/ubuntu/+sour … omments/25

Do you need to write xorg.conf? Can you not write that also in ~/ and as root move it to /etc/X11?

Is it on a laptop? you need to adjust for new attached second monitor? You can not use arandr?


// Regards rbh

Offline

Board footer

Powered by FluxBB