Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am struggling to figure out why rc.local won't be executed at boot time.
The file itself is executable, it is called from /etc/rc2.d
Also the file when from command line won't return any errors.
Any ideas what else to check to figure out why is not run?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Since you say that rc.local executes properly when you run it manually, the two things that immediately come to mind are:

  • Something is going wrong at boot time but works when you run it yourself. Perhaps you're trying to run a program that's not in the PATH at boot time.
  • /etc/rc.local really isn't being run at boot.

In both cases, the first thing I'd do is put something like

/usr/bin/printenv > /var/tmp/rc.local-$(date +%T)

as the very first line of rc.local after the #!/bin/sh line. That'll print the environment variables to a timestamped file every it is run. (Don't write the file to /tmp because that's emptied at boot.) Run /etc/rc.local manually and take a quick look at the resulting file (it'll be named something like /var/tmp/rc.local-21:14:35). Then reboot your system.

You should have two files in /var/tmp (or wherever) that you can compare. If you only the first file, /etc/rc.local isn't really getting called. If you have two files, compare them. The later one will have a very sparse environment and PATH. Look through your rc.local script and see if there's anything you're trying to run that depends on some variable or some component of PATH that's not in the boot-time environment. If you find something, add the necessary initialization to rc.local.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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