LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 04-24-2012, 05:03 PM   #1
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Rep: Reputation: 3
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
 
Old 04-24-2012, 09:09 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,831
Blog Entries: 36

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
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
 
Old 04-24-2012, 09:28 PM   #3
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,380

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
use gksu instead of sudo for gui apps in gnome environment.
 
Old 04-25-2012, 09:56 AM   #4
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
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
 
Old 04-25-2012, 10:38 AM   #5
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
Try gksudo.
 
Old 04-25-2012, 10:43 AM   #6
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
Hey brian L, thanks for the reply...
Na, no "gksudo" either... Is that weird, should I have that already?

Thanks Again,
Matt
 
Old 04-25-2012, 11:02 AM   #7
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
Quote:
Originally Posted by mrm5102 View Post
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:
Code:
cnf gksudo
 
Old 04-25-2012, 12:50 PM   #8
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
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
 
Old 04-25-2012, 12:54 PM   #9
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
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
 
Old 04-30-2012, 09:35 AM   #10
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo to solve this error "tar: Error exit delayed from previous errors" ? xombboxer Linux - Newbie 7 03-13-2012 03:26 AM
Is there any config tool for xf86-video-intel like "nvidia-settings"? Mr. Alex Linux - Newbie 1 12-08-2010 10:45 AM
Error installing No-IP Client, "sudo make install" not working ACSUSA Ubuntu 2 06-27-2008 09:06 AM
sudo stopped working: "must be setuid root" quincy_the_penquin Linux - Software 4 04-30-2007 07:37 AM
Compiling "nvidia-settings" an keeping FreeBSD up-to-date dabang *BSD 4 12-31-2005 05:20 PM


All times are GMT -5. The time now is 04:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration