Bug 26039

Summary: rc-local.service has no no installation config
Product: Mageia Reporter: Bit Twister <bittwister2>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal    
Version: 7   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: systemd-241-8.4.mga7.src.rpm CVE:
Status comment:

Description Bit Twister 2020-01-08 21:18:03 CET
Description of problem: mga7

# 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:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.



Version-Release number of selected component (if applicable):


How reproducible: Always


Steps to Reproduce:
1.  systemctl enable rc-local.service

Suggested fix, add the following to end of
/usr/lib/systemd/system/rc-local.service

[Install]
WantedBy=multi-user.target
Comment 1 David Walser 2020-01-09 00:33:45 CET
This is probably invalid.  It's not meant to be enabled that way.  If you create /etc/rc.d/rc.local, make it executable, and make sure it starts with #!/bin/sh or #!/bin/bash, then it should be automatically enabled.
Comment 2 Bit Twister 2020-01-09 05:38:17 CET
(In reply to David Walser from comment #1)
> This is probably invalid.  It's not meant to be enabled that way.  If you
> create /etc/rc.d/rc.local, make it executable, and make sure it starts with
> #!/bin/sh or #!/bin/bash, then it should be automatically enabled.

Ok, I'll close it.

I recommend that users should create their own service file with any
desired directives.

The service as is, does not correctly emulate old methodology.
Case in point, running systemctl stop rc-local, does not run the script.

Example:
$ cat /etc/rc.d/rc.local
#!/bin/bash
echo "Running $0 with $1 "| systemd-cat -t rc.local -p info

# systemctl start rc-local
# systemctl stop rc-local
# journalctl --no-hostname | grep rc.local
Jan 08 22:07:34 systemd[1]: Started /etc/rc.d/rc.local Compatibility.
Jan 08 22:07:34 rc.local[8661]: Running /etc/rc.d/rc.local with start
Jan 08 22:21:30 systemd[1]: rc-local.service: Succeeded.
Jan 08 22:21:30 systemd[1]: Stopped /etc/rc.d/rc.local Compatibility.

Note that there is no
     xxxxx  rc.local[8661]: Running /etc/rc.d/rc.local with stop
indicating /etc/rc.d/rc.local was not executed.

I opened this bug because of https://bugs.mageia.org/show_bug.cgi?id=24189                                                                 
and the resulting rant/thread in
Newsgroups: alt.os.linux.mageia                                                                               
Subject: Re: rc.local again                                                                                   
On Sun, 5 Jan 2020 12:47:35 +1100, Doug Laidlaw 

Closing as wontfix, works as designed.

Resolution: (none) => WONTFIX
Status: NEW => RESOLVED

Comment 3 David Walser 2020-01-09 12:59:43 CET
Indeed it is working as it was meant to.

Resolution: WONTFIX => INVALID