Hey, I have some weird problem with the rc.local file which is located in /etc/rc.local the thing is that it is not always running when I boot up the laptop. Maybe every second time, I haven't counted. Anyway when that happens I have to manually go to terminal and type sudo /etc/init.d/rc.local start, which kinda kills the purpose of having this script. Anyone know what the problem could be?


Since this wasn't obvious. This is an issue where I make a fresh boot up. Which mean I have shut down the computer. And next time when I boot up the computer, the rc.local file is randomly deciding whether it will automatically start or not.

Here's a copy of what my rc.local file contains

echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 
echo level 2 > /proc/acpi/ibm/fan
touch /home/starcorn/Desktop/foo

rfkill block bluetooth
exit 0
  • 2
    There are two issues here; you have to make sure that you perform a boot, not a wake from hibernation. And, it depends on what you have in rc.local. How are you sure that rc.local did not run? You can add at the front of rc.local to 'touch /tmp/RCLOCAL.did.run.txt' – user4124 Jan 25 '11 at 15:26
  • I have a line in rc.local touch to create a file to the desktop upon boot up. And it is a boot up, it is not a hibernation or a suspend. It is a shut down and then push on the on button to boot up. Stuff that I have in the rc.local relates to make some adjustment to the fan speed and trackpoint speed. – starcorn Jan 25 '11 at 15:47
  • Are you sure it does not run, or is it maybe just delayed because some conditions it is waiting on is not given yet. – txwikinger Jan 25 '11 at 16:54
  • @txwikinger - I'm quite sure it isn't run because I always have to go to terminal and manually run rc.local to make the changes happen – starcorn Jan 25 '11 at 17:30
  • Are you sure that the file is marked as executable? – papukaija Jan 25 '11 at 21:06

Place the touch on the first line, and make sure it touches a file in a directory where everyone has write access.

Then, log any errors, for example like:

echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 2> /your/log/file
echo level 2 > /proc/acpi/ibm/fan 2> /your/log/file
touch /home/starcorn/Desktop/foo >> /your/log/file 2>&1

rfkill block bluetooth >> /your/log/file 2>&1
exit 0

The >> logfile 2&>1 tells the shell to log error messages to the same file as normal output. The 2> logfile only logs the errors.

What happens with these changes?

  • I couldn't use 2>&1 >> /your/log/file for the two lines which modifies the fan speed and trackpoint sensitivity. Upon boot up only the touch and rfkill would be executed. – starcorn Jan 25 '11 at 17:28
  • @starcorn: You're right, I've edited the answer to redirect only the error output. You could add lines like cat /proc/acpi/ibm/fan > /your/log/file to write values to the log file for troubleshooting. – Andomar Jan 25 '11 at 17:33
  • 2
    2>&1 >> logfile does not redirect stdout and stderr to logfile; stderr will go to the terminal and stdout to the logfile. >> logfile 2>&1 however, will redirect both stdout and stderr to the logfile. See mywiki.wooledge.org/BashFAQ/055 – geirha Jan 25 '11 at 22:15
  • @geirha: I didn't know that. Thanks for the link! – Andomar Jan 25 '11 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.