Ask Your Question

rc-local.service cannot enable

asked 2013-12-25 05:03:56 -0500

FreedomKnight gravatar image

I want to use rc-local to start my script.

My step:

sudo touch /etc/rc.d/rc.local
sudo chmod 755 /etc/rc.d/rc.local

My script rc.local:

echo "hello"

I can use sudo systemctl start rc-local.service but i can't enable it by sudo systemctl enable rc-local.service

the error mesage:

The unit files have no [Install] section. 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, ...).

How should i do to enable it?

BTW, I use Fedora 20

edit retag flag offensive close merge delete


@Ahmad Samir So, I just do nothing and it will run /etc/rc.d/rc.local automatically?

FreedomKnight gravatar imageFreedomKnight ( 2013-12-25 07:21:30 -0500 )edit

Exactly. As long as /etc/rc.d/rc.local is executable it should work.

Ahmad Samir gravatar imageAhmad Samir ( 2013-12-26 00:27:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-12-25 06:51:19 -0500

Ahmad Samir gravatar image

rc-local.service is a static service, you can't enable/disable such services (if you want to disable/enable a static service you'd have to mask/unmask it respectively).

rc-local.service will execute '/etc/rc.d/rc.local start' if /etc/rc.d/rc.local exists and is executable.

edit flag offensive delete link more

Question Tools


Asked: 2013-12-25 05:03:56 -0500

Seen: 13,609 times

Last updated: Dec 25 '13