You are not logged in.
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
I don't have Nvidia graphics, so I can't test. What does a terminal run of 'pkexec nvidia-settings' return?
I don't care what you do at home. Would you care to explain?
Offline
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.
Offline
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?
Offline
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
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
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline
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
Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu
Offline