LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-05-2013, 02:52 PM   #1
steak1987
Member
 
Registered: Jan 2012
Posts: 118

Rep: Reputation: Disabled
Question Run Daemon on start-up ?


Hey, the process im trying to run is "tpb" its an OSD for think pad buttons on linux.

http://www.thinkwiki.org/wiki/Tpb

https://wiki.archlinux.org/index.php/ThinkPad_OSD

http://rc98.net/x31install

However, all those guides are old and are not for linux mint (13).


Im trying to make the program Run on my PC so I get an OSD whenever I change my volume (which doesnt happen for some reason)

However, it doesnt work unless I sudo it.


http://i.imgur.com/n3nYm.png


Code:
XXXX@XXXX-ThinkPad-X60 ~ $ tpb
Unable to open device /dev/nvram: Permission denied
XXXX@XXXX-ThinkPad-X60 ~ $ sudo tpb
[sudo] password for XXXX: 
This process is currently running setuid or setgid.
GTK+ does not allow this therefore Qt cannot use the GTK+ integration.
Try launching your app using 'gksudo', 'kdesudo' or a similar tool.

See http://www.gtk.org/setuid.html for more information.
The OSD remains after closing the terminal window and only vanishes after a reboot. Im afraid of following the above guides because I'm afraid of mucking up my kernels. What are my options ?
 
Old 01-06-2013, 06:15 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Which part did you think might muck up your kernel? ArchWiki is generally very well maintained (and indeed up-to-date!), and nor does its article mention altering the kernel...

However, if 'sudo tpb' works as you want it to, then you don't even need to do the nvram part of the setup.

As for starting tpb, I believe Linux Mint uses Upstart, in which case you want to put the following into /etc/init/tpb.conf

Code:
description     "ThinkPad OSD"
author          "Snark1994 on LinuxQuestions"

start on stopped load-modules
stop on starting shutdown

exec /usr/bin/tpb -d
respawn
This is completely untested. I don't have Linux Mint, tpb, or upstart, so I claim no responsibility for anything that goes wrong

I used https://wiki.frugalware.org/index.php/Upstart_Job_HOWTO and http://upstart.ubuntu.com/cookbook/, which both seem to be good sources if you're interested in how things work.

Hope this helps,
 
1 members found this post helpful.
Old 01-06-2013, 10:04 AM   #3
steak1987
Member
 
Registered: Jan 2012
Posts: 118

Original Poster
Rep: Reputation: Disabled
The guide which got me paranoid about messing about with my kernel after setting up tpb was:

http://rc98.net/x31install

I tried following your comment, but the file at
Code:
/etc/init/tpb.conf
doesnt exist.

---------EDIT: I mentioned that the file doesnt exist, should I make the file, with the sole contents being what youve got quoted ? -------------

Is there any script or command that I can run, using the "Startup Applications Preferences" screen ? Either by an terminal command, or by pointing to a script which runs "sudo tpb" ?

http://i.imgur.com/ZKDZr.png?1

Thanks for your prompt reply though.

Last edited by steak1987; 01-06-2013 at 10:06 AM.
 
Old 01-07-2013, 04:51 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
I meant to make the file, but if there's a "Startup Applications Preferences" screen then that's probably an easier way to do it. What you'll need to do is click "Add" and then I'm guessing it will let you enter a command - choose "sudo tpb". You'll then need to allow yourself to run "sudo tpb" without entering your password, so add the following to you sudoers file:

Code:
steak1987 ALL= NOPASSWD: /bin/tpb
replacing "steak1987" with your local username and "/bin/tpb" with the actual location of "tpb" (use the full path). Afterwards just check that you can run "sudo tpb" in your terminal without entering your password. Also, consider using something like visudo to avoid messing up your sudoers file

Hope this helps,
 
1 members found this post helpful.
Old 01-07-2013, 06:58 AM   #5
alieblice
Member
 
Registered: Jul 2011
Posts: 80

Rep: Reputation: Disabled
maybe this way is easier :
put your command in /etc/rc.local
you don't need to put "sudo" on that file because command in there execute as root.
and put your command before "exit 0" line.
https://wiki.archlinux.org/index.php...etc.2Frc.local

you can also using your gui to do it . if you're using gnome theres "startup application" in its system setting that let you do this.
 
1 members found this post helpful.
Old 01-07-2013, 08:49 AM   #6
steak1987
Member
 
Registered: Jan 2012
Posts: 118

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by alieblice View Post
maybe this way is easier :
put your command in /etc/rc.local
you don't need to put "sudo" on that file because command in there execute as root.
and put your command before "exit 0" line.
https://wiki.archlinux.org/index.php...etc.2Frc.local

you can also using your gui to do it . if you're using gnome theres "startup application" in its system setting that let you do this.
I did the modification you suggested using a text editor:

Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

tpb


exit 0

Unfortunately, upon reboot, nothing happened. To avoid any issues and out of paranoia, I reverted back to the original file after that.


_________________

Quote:
Originally Posted by Snark1994 View Post
I meant to make the file, but if there's a "Startup Applications Preferences" screen then that's ........ sudoers file

Hope this helps,
Im fairly new to linux, so forgive me for my ineptitude or if I missed anything. Using google, I came upon the following guides:

http://www.linuxscrew.com/2007/08/29...ry-is-located/
http://www.garron.me/linux/visudo-co...lt-editor.html

Code:
XXXXXX@XXXXXX-ThinkPad-X60 ~ $ visudo
visudo: /etc/sudoers: Permission denied
visudo: /etc/sudoers: Permission denied
XXXXXX@XXXXXX-ThinkPad-X60 ~ $ whereis tpb
tpb: /usr/bin/tpb /usr/bin/X11/tpb /usr/share/man/man1/tpb.1.gz
XXXXXX@XXXXXX-ThinkPad-X60 ~ $ type tpb
tpb is /usr/bin/tpb
XXXXXX@XXXXXX-ThinkPad-X60 ~ $
So .... Now im stuck. I cant edit the sudoers file using visudo. Should I try opening it with gedit ?

---------EDIT:

Apparently, I need to run visudo as root. So I need to sudo visudo. Anyways, doing that opened up an text editor in terminal (which I would need to figure out how to work, doesnt seem too hard). Now the issue remains, what program location do I need to use ?

Last edited by steak1987; 01-07-2013 at 09:00 AM. Reason: New Details.
 
Old 01-07-2013, 10:22 AM   #7
alieblice
Member
 
Registered: Jul 2011
Posts: 80

Rep: Reputation: Disabled
put sudo before 'visudo'.
$ sudo visudo


try putting its full path in rc.local:
/usr/bin/tpb
 
1 members found this post helpful.
Old 01-07-2013, 12:38 PM   #8
steak1987
Member
 
Registered: Jan 2012
Posts: 118

Original Poster
Rep: Reputation: Disabled
Cheers, it all works perfectly now.

I used Snark1994's method, and I derived the full path from your post (even though I didnt use the rc.local method). So thanks to both of you, for helping me out.

Last edited by steak1987; 01-07-2013 at 12:42 PM.
 
Old 01-08-2013, 04:57 AM   #9
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Glad you got it sorted as you guessed, you need 'sudo' to run 'visudo'. Also:

Code:
$ whereis tpb
tpb: /usr/bin/tpb /usr/bin/X11/tpb /usr/share/man/man1/tpb.1.gz
tells you all the locations where source, binary and man pages are located for 'foo'. In this case, you wanted only the first path it printed out, which you can find by using

Code:
$ which tpb
/usr/bin/tpb
Regards,
 
1 members found this post helpful.
  


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
Who can run the daemon ? thomas2004ch Linux - Software 4 07-26-2012 09:13 PM
Bash script to verify the daemon is working if not, start the daemon kishoreru Linux - Newbie 7 09-23-2009 04:29 AM
run as daemon? bjh Suse/Novell 1 11-08-2008 12:56 PM
Enable daemon to run with service daemon start,etc baddah Programming 6 12-02-2007 05:51 PM
run as a daemon dellcom1800 Linux - Software 6 10-15-2004 07:38 AM


All times are GMT -5. The time now is 09:18 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration