How do I restore deleted rc.local file?

12,167

The solution is to create a new rc.local through:

gksudo gedit /etc/rc.local

paste the code:

#!/bin/sh -e
#
#
# 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.

exit 0

Make it executable:

sudo chmod +x /etc/rc.local
Share:
12,167

Related videos on Youtube

Venem
Author by

Venem

Open source advocate

Updated on September 18, 2022

Comments

  • Venem
    Venem over 1 year

    I have recently inserted some strings into a script to be loaded on startup through /etc/rc.local. One of them was: xbacklight -set 50. This led to Ubuntu refusing to go past login screen so I was forced to remove both files- the script and rc.local.

    The question is how do I restore the rc.local file in order to be able to start over with the script?

    I am running Ubuntu 12.10 with kernel 3.7.8.

    • catalesia
      catalesia about 11 years
      By default rc.local does nothing. To restore it you might simply create rc.local in /etc containing exit 0 only. This will restore the default rc.local Quote: #!/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. exit 0 This actually leads to a notion that perhaps your script does not exit with 0 or any other error?