This is a duplicate problem, but I don't believe that it's a duplicate question as none of the given answers for people suffering the same problem work for me.

rc.local does not run on startup. It is very simple and contains the following:

# 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.

sleep 10

echo "this was written by rc.local" > /home/simon/start_text

exit 0

The "sleep 10" is there as it was given as a possible solution to the problem in another question.

The "#!/bin/sh" has had the "-e" removed as that was also a suggested solution.

/etc/rc.local is executable and is owned by root.

-rwxrwxrwx 1 root root 396 Jan 24 06:06 rc.local

Running startup scripts manually work fine, e.g. "/etc# ./rc.local" or ":/etc/init.d# ./rc.local start". Both of these will result in the test file (start_text) being written.

I'm running 12.04 in Virtualbox, I'm not sure if that should make any difference.

I can't think of what to check next. Ideas please.

  • could you post the output of 'ls -al /bin/sh'?
    – aFoP
    Jan 24, 2015 at 8:37
  • Strangely, it just started working. I hadn't changed anything, just got bored and done something else for a few hours. I wonder if this has anything to do with my running it as a VM, I can't think of any other reason. Jan 24, 2015 at 12:39
  • The output of ls -al /bin/sh is lrwxrwxrwx 1 root root 4 Jan 22 11:41 /bin/sh -> dash Jan 24, 2015 at 12:41

1 Answer 1


According to this Ubuntu documentation, the default system shell in Ubuntu is Dash, instead of Bash, while the default login shell is Bash. The output of ls -al /bin/sh shows you whether /bin/sh is a symlink of Dash (most probable), or Bash. In my case it is Bash:

lrwxrwxrwx 1 root root 4 Apr 8 2014 /bin/sh -> bash

Dash will not be able to interpret echo "this was written by rc.local" > /home/simon/start_text in /etc/rc.local, so you need to specify to use Bash to interpret the command like this

/bin/bash echo "this was written by rc.local" > /home/simon/start_text .

You can change the default system shell to Bash but it is not recommended via deleting and re-creating the symlinks:

rm -f /bin/sh

sudo ln -s /bin/bash /bin/sh

Or back to Dash:

rm -f /bin/sh

sudo ln -s /bin/dash /bin/sh

  • and you should remove "sleep 10" and add "-e" again in rc.local...
    – aFoP
    Jan 24, 2015 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .