Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-24-2012, 04:03 PM
|
#1
|
Member
Registered: Apr 2011
Location: Philadelphia
Posts: 165
Rep:
|
Sudo with "nvidia-settings" not working, getting error?
Hey All,
I'm trying to create a "custom launcher" on the "GNOME Panel" so that I can launch the "nvidia-settings" GUI a bit quicker, and in order to save to the xorg.conf file I need to run it as root.
For some reason when I try the following I get an error... (I added command to "/etc/sudoers" too)
Code:
> sudo /usr/bin/nvidia-settings
ERROR: The control display is undefined; please run `/usr/bin/nvidia-settings --help` for usage information.
Anyone ever run into this problem, and know a way around it?
I've also tried it through a bash script and an expect script but couldn't get it to work.
B.T.W. Just so it's clear if I do a "su -" login as root, then run the "nvidia-settings" command, it all works just fine.
Any suggestions would be great..!
Thanks in Advance,
Matt
|
|
|
04-24-2012, 08:09 PM
|
#2
|
Senior Member
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
|
Perhaps it's not passing your DISPLAY variable through to the sudo environment. Try the following.
Code:
sudo env DISPLAY=$DISPLAY /usr/bin/nvidia-settings
Not sure why that would matter, but it's worth a try.
SAM
|
|
|
04-24-2012, 08:28 PM
|
#3
|
Senior Member
Registered: Mar 2012
Posts: 1,882
|
use gksu instead of sudo for gui apps in gnome environment.
|
|
|
04-25-2012, 08:56 AM
|
#4
|
Member
Registered: Apr 2011
Location: Philadelphia
Posts: 165
Original Poster
Rep:
|
Hey sag47, thanks for the reply.
I tried running your command and I get the following:
Code:
> sudo env DISPLAY=$DISPLAY /usr/bin/nvidia-settings
Invalid MIT-MAGIC-COOKIE-1 key
ERROR: The control display is undefined; please run `/usr/bin/nvidia-settings --help` for usage information.
If I echo $DISPLAY, it does show that it is defined:
Code:
> echo $DISPLAY
:0.0
So I'm not really sure why "sudo" wouldn't be working?
Is there anyway to make the "nvidia-settings" command run as root no matter what?
descendant_command, thanks for the reply.
I don't seem to have "gksu":
Code:
> gksu nvidia-settings
If 'gksu' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf gksu
I checked to see if it was something that I can install from Software Manager but no luck.
Think it's something that I should look for online somewhere... Or if I don't already have it then it's probably not going to be compatible..?
Thanks in Advance,
Matt
|
|
|
04-25-2012, 09:38 AM
|
#5
|
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,311
Rep: 
|
Try gksudo.
|
|
|
04-25-2012, 09:43 AM
|
#6
|
Member
Registered: Apr 2011
Location: Philadelphia
Posts: 165
Original Poster
Rep:
|
Hey brian L, thanks for the reply...
Na, no "gksudo" either... Is that weird, should I have that already?
Thanks Again,
Matt
|
|
|
04-25-2012, 10:02 AM
|
#7
|
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,311
Rep: 
|
Quote:
Originally Posted by mrm5102
Na, no "gksudo" either... Is that weird, should I have that already?
Thanks Again,
Matt
|
Yeah. Strange. When I've had Debian or Ubuntu on in the past, I've used gksu or gksudo successfully for GUI applications as root. Have you tried this:
Code:
> gksu nvidia-settings
If 'gksu' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf gksu
or:
|
|
|
04-25-2012, 11:50 AM
|
#8
|
Member
Registered: Apr 2011
Location: Philadelphia
Posts: 165
Original Poster
Rep:
|
Hummmm...... Got that Expect Script working!!
Not sure what I did wrong the first go-around, but got it going this time.
Basically I just wanted to create a "Custom Application Launcher" on the "The GNOME Panel 2.32.1" to launch the
nvidia-settings control panel GUI without having to launch a terminal sign in as root and then issue the nvidia-settings command.
Now I just need to click my "Launcher" and am good to go.
Thanks for all your suggestions. I'll post the code if anyone wants it, thanks...
I am curious to know why I don't have the "gksu" and the "gksudo" commands? Because this isn't the first post
where I was suggested to use that instead of just plain old "su" and "sudo".
If this makes a difference, here's my specs:
Code:
> uname -a
Linux localhost 2.6.37.6-0.11-default #1 SMP 2011-12-19 23:39:38 +0100 i686 i686 i386 GNU/Linux
> cat /etc/SuSE-release
openSUSE 11.4 (i586)
VERSION = 11.4
CODENAME = Celadon
But anyway, thanks again for your posts!
Thanks,
Matt
|
|
|
04-25-2012, 11:54 AM
|
#9
|
Member
Registered: Apr 2011
Location: Philadelphia
Posts: 165
Original Poster
Rep:
|
BrainL,
Yeah, I tried that and still no luck...
Code:
mmartin:/etc # cnf gksu
gksu: command not found
mmartin:/etc # cnf gksudo
gksudo: command not found
mmartin:/etc # which gksu
which: no gksu in (/usr/lib/mpi/gcc/openmpi/bin:/home/mmartin/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin)
mmartin:/etc # which gksudo
which: no gksudo in (/usr/lib/mpi/gcc/openmpi/bin:/home/mmartin/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin)
Thanks Again,
Matt
|
|
|
04-30-2012, 08:35 AM
|
#10
|
Member
Registered: Apr 2011
Location: Philadelphia
Posts: 165
Original Poster
Rep:
|
I think I found the command that would be the equivalent of what you guys were telling me about...
Is it gnomesu:
Code:
> gnomesu --help
Usage:
gnomesu [OPTION...]
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options
Application Options:
-c, --command=COMMAND Pass the command to execute as one single string.
-u, --user=USERNAME Run as this user instead of as root.
--display=DISPLAY X display to use
I haven't really gotten a chance to test it yet, but it seems like it should do the trick
Thanks,
Matt
|
|
|
All times are GMT -5. The time now is 03:47 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|