LinHES Forums
http://forum.linhes.org/

How to run commands as root during KnoppMyth booting?
http://forum.linhes.org/viewtopic.php?f=11&t=6742
Page 1 of 1

Author:  g.kallqvist [ Wed Nov 02, 2005 1:20 pm ]
Post subject:  How to run commands as root during KnoppMyth booting?

I've been searching the net for a solution to this problem, but in vain. Hopefully someone can help me here.
I want to acheive two things:
- start all LUN:s on SCSI during bootup. I've tried to send an option to LILO as suggested in a forum, but it doesn't work for me for some reason. I do not want to recompile the kernel. I can get them started from CLI (using echo "scsi add-single-device..." > /proc/scsi/scsi") But when I try to do that in bootmisc.sh or local (in /etc/init.d) it doesn't work.
- start lirc late in the boot process, since when I try to start it the default way, it doesn't work (my remote is connected to /dev/bus/input/event? and the event? changes from one boot to the next, so I have to read it dynamically and it obviously has to be done late during booting). And the same thing applies here, it has to be done as root. I've tried using bootmisc.sh and local here too. Doesn't work :cry: ...
So, anyone, how do I run commands as root during booting?

Author:  Xsecrets [ Wed Nov 02, 2005 4:14 pm ]
Post subject: 

search the forums here and over on the wiki for sudo, once that is setup properly then you should be able to run things as root from a script. though I thought that bootmisc ran with root privileges, though I could be completely wrong on that account.

Author:  Greg Frost [ Wed Nov 02, 2005 5:01 pm ]
Post subject: 

I thought bootmisc ran as root too, but I think what he is saying is that the event? thing has not been set up by the time bootmisc runs.

Author:  g.kallqvist [ Thu Nov 03, 2005 2:15 pm ]
Post subject: 

No, bootmisc can't be running as root, at least I can't write to /proc/scsi/scsi from bootmisc, nor can I run /etc/init.d/lirc.
I've tried sudo, but it didn't work. I'll look through the wiki again, to see how I set it up.
Btw, what I mean is that "the event? thing" isn't set up when I try to run my script from inside "lirc start" during the "ordinary" booting (in rc.d and rcS).

Author:  g.kallqvist [ Fri Nov 18, 2005 12:04 pm ]
Post subject: 

OK, I've got sudo and sudoers right, so I can run 'sudo /etc/init.d lirc' from bootmisc.sh. Unfortunately that doesn't help me :cry: . lirc is still started with wrong /dev/input/event? (and the error logs gets written full with errors until I stop lirc).
My next step is trying to start lirc in KnoppMyth-run, just before the frontend is started.
I feel it to be a kludge, but what is a poor man to do? ;-) And I don't know if it works.
Could the problem with lirc being assigned wrong /dev/input/event? be that dvb-usb is initializing the AVerMedia USB device two times? If the second initializing is done after the boot process is ready, the device could get another /dev/input/event? than the one used during booting (and that's why lirc gets the wrong /dev/input/event-number).
If so, why initialize the USB device twice? And could the second initializing (if it's necessary) be done before booting is ready - or at least before bootmisc.sh is run?

Author:  g.kallqvist [ Sat Nov 19, 2005 10:44 am ]
Post subject: 

Finally, it works! The trick was to put 'sudo /etc/init.d/lirc start' in ~./fluxbox/apps as [startup]{sudo...}, just before the startup of KnoppMyth-run.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/