LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   rc-local.service not working in Debian Stable9 (https://www.linuxquestions.org/questions/debian-26/rc-local-service-not-working-in-debian-stable9-4175609266/)

rng 07-05-2017 09:49 PM

rc-local.service not working in Debian Stable9
 
I know rc.local is not encouraged, but for sake of simplicity I want to use it. I have a simple /etc/rc.local file on my Debian Stable System. But when I try following command, it does not work:

Code:

$ sudo systemctl enable rc-local.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
  instance name specified.

Subsequent status check shows:

Code:

$ sudo systemctl status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
  Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
          └─debian.conf
  Active: failed (Result: exit-code) since Thu 2017-07-06 07:39:07 IST; 39min ago

Jul 06 07:39:07 debian-netinst systemd[1]: Starting /etc/rc.local Compatibility...
Jul 06 07:39:07 debian-netinst rc.local[716]: rm: cannot remove '/home/abcde/.thumbnails/normal/*.png': No such file or directory
Jul 06 07:39:07 debian-netinst systemd[1]: rc-local.service: Control process exited, code=exited status=1
Jul 06 07:39:07 debian-netinst systemd[1]: Failed to start /etc/rc.local Compatibility.
Jul 06 07:39:07 debian-netinst systemd[1]: rc-local.service: Unit entered failed state.
Jul 06 07:39:07 debian-netinst systemd[1]: rc-local.service: Failed with result 'exit-code'.

Where is the problem and how can it be solved? Thanks for your help.

norobro 07-06-2017 09:10 PM

"rm" will fail if the directory is empty. Try using "rm -f".

rng 07-06-2017 09:23 PM

I think it will also work if I create a file in that folder so that it is never found empty:

Code:

touch /home/abcde/.thumbnails/normal/temp.png
rm /home/abcde/.thumbnails/normal/*.png



All times are GMT -5. The time now is 01:35 PM.