21

On previous installed version kubuntu 15.xx i added a line into /etc/rc.local - /home/diet/scripts/my-auto-mount-script which obviously referred to a script that if on home wifi network drives should be mounted.

This worked flawlessly on kubuntu 15.xx

After the upgrade it seems /etc/rc.local is being ignored on boot because running the command /etc/rc.local still seems to do the trick. The reason I think rc.local is being ignored is because the script it refers to should produce logs on script success but also on script fail, but there are no logs.

Can anyone give me some pointers on how to troubleshoot this matter?

PS : yes I know that putting stuff in /etc/fstab is also a way of mounting the drives, but when I'm not at home I hate it that I can see the drives on dolphin and have those little red crosses on them because the are not there. This way when I'm on the road (it is a laptop) people can't see what i have at home.

24

Ubuntu is now using systemd, and rc.local is now considered a service which is turned "off" by default. You can turn rc.local "on" by entering the following command and rebooting:

sudo systemctl enable rc-local.service
| improve this answer | |
  • Thank you very much for taking the time to provide me with a solution! i also found a solution that adding the script to ./.config/autostart-scripts/ also runs the script on startup! – Diet Bos May 14 '16 at 19:21
  • The sysemctl command works for me. Also note that this is different from user scripts in ~/.config/autostart-scripts as /etc/rc.local should run at boot time, before any user logs in. Note that any errors in the rc.local script may cause it to halt; scan /var/syslog for rc.local it it you think it does not work for you. – djb Sep 13 '16 at 16:38
  • 2
    And systemd doesn't support an "official way" to run scripts at startup? Like rc.local was? – Cirelli94 Oct 10 '16 at 8:59
4

only change this

chmod 755 /etc/init.d/rc.local

nano /etc/rc.local 

change this in first line

#!/bin/sh -e

to

#!/bin/bash 

save and enjoy!

| improve this answer | |
  • Perfect, the combo with the previous answer worked for me (16.04) – Yuriy Polezhayev Aug 3 '17 at 9:44
  • This answer worked for me instead of the previous, because Ubuntu 14.04 does not have systemctl – franksands Jul 18 '19 at 13:34

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.