Bug 1876905 - rc.local is never executed despite existing and being executable
Summary: rc.local is never executed despite existing and being executable
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-08 13:25 UTC by Lukáš Czerner
Modified: 2023-08-25 16:09 UTC (History)
13 users (show)

Fixed In Version: systemd-245.8-2.fc32 systemd-243.9-1.fc31
Clone Of:
Environment:
Last Closed: 2020-09-23 17:12:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Lukáš Czerner 2020-09-08 13:25:30 UTC
Description of problem:

/etc/rc.local is never executed despite file existing and being executable. This is how I understand it from man systemd-rc-local-generator the only requisite to run rc.local during boot.

# ls -la /etc/rc.local 
-rwxr-xr-x. 1 root root 74 Sep  8 13:08 /etc/rc.local

Yet, the script is not executed

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

Name         : systemd
Version      : 245.7
Release      : 1.fc32


Steps to Reproduce:
1. Create a script to run during boot
2. Copy the script to /etc/rc.local
3. chmod 755 /etc/rc.local

Actual results:

The /etc/rc.local script is never run.

Expected results:

The /etc/rc.local is run during boot.

Additional information:

# systemctl status rc-local
● rc-local.service - /etc/rc.d/rc.local Compatibility
     Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor p>
     Active: inactive (dead)
       Docs: man:systemd-rc-local-generator(8)

# systemctl enable rc-local
[  951.624470] systemd-rc-local-generator[952]: /etc/rc.d/rc.local is not marked executable, skipping.
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.

Comment 1 Zbigniew Jędrzejewski-Szmek 2020-09-08 13:54:42 UTC
Do you have both /etc/rc.d/rc.local and /etc/rc.local?

Comment 2 Lukáš Czerner 2020-09-08 19:25:16 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> Do you have both /etc/rc.d/rc.local and /etc/rc.local?

I tried every combination, only /etc/rc.local, only /etc/rc.d/rc.local and both. None works.

-Lukas

Comment 3 Villy Kruse 2020-09-13 10:20:55 UTC
(In reply to Lukáš Czerner from comment #2)
> (In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> > Do you have both /etc/rc.d/rc.local and /etc/rc.local?
> 
> I tried every combination, only /etc/rc.local, only /etc/rc.d/rc.local and
> both. None works.
> 
> -Lukas

On Fedora the file name is /etc/rc.d/rc.local and NOT /etc/rc.local.   

man systemd-rc-local-generator should be corrected for the actual name of rc.local.

Also, the error messages says that /etc/rc.d/rc.local is not executable.

Comment 4 Lukáš Czerner 2020-09-14 07:18:33 UTC
(In reply to Villy Kruse from comment #3)
> (In reply to Lukáš Czerner from comment #2)
> > (In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> > > Do you have both /etc/rc.d/rc.local and /etc/rc.local?
> > 
> > I tried every combination, only /etc/rc.local, only /etc/rc.d/rc.local and
> > both. None works.
> > 
> > -Lukas
> 
> On Fedora the file name is /etc/rc.d/rc.local and NOT /etc/rc.local.   
> 
> man systemd-rc-local-generator should be corrected for the actual name of
> rc.local.
> 
> Also, the error messages says that /etc/rc.d/rc.local is not executable.

As I said in comment 2 I did try every combination, none of which works. However after disabling selinux it works fine.

-Lukas

Comment 5 Villy Kruse 2020-09-14 09:36:55 UTC
(In reply to Lukáš Czerner from comment #4)


> 
> As I said in comment 2 I did try every combination, none of which works.
> However after disabling selinux it works fine.
> 
> -Lukas


rc.local works fine with SELinux, as long it is labeled correctly:

$ ls -lZ /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root system_u:object_r:initrc_exec_t:s0 474 Feb  8  2015 /etc/rc.d/rc.local
$

It has worked perfectly since 2015 with SELinux enabled.

If you can, change the bug description to fix the manual page referring to /etc/rc.d/rc.local instead pf /etc/rc.local.

Comment 6 Zbigniew Jędrzejewski-Szmek 2020-09-15 15:59:28 UTC
Villy, thanks. See https://github.com/systemd/systemd/pull/17067.

Lukáš: please verify that it works correctly if the selinux label is set.

Comment 7 Villy Kruse 2020-09-15 18:13:01 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #6)
> Villy, thanks. See https://github.com/systemd/systemd/pull/17067.
> 
> Lukáš: please verify that it works correctly if the selinux label is set.

Just remember, that whenever SELinux has been disabled, you must re-enable it in permisive mode and relabel everything.

Comment 8 Lukáš Czerner 2020-09-17 09:50:44 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #6)
> Villy, thanks. See https://github.com/systemd/systemd/pull/17067.
> 
> Lukáš: please verify that it works correctly if the selinux label is set.

Yes, it is working correctly.

-Lukas

Comment 9 Zbigniew Jędrzejewski-Szmek 2020-09-17 09:57:07 UTC
Thanks for checking. Once the documentation patch is applied, we can consider this resolved.

Comment 10 Fedora Update System 2020-09-20 13:20:28 UTC
FEDORA-2020-0d29e88946 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-0d29e88946

Comment 11 Fedora Update System 2020-09-20 13:22:38 UTC
FEDORA-2020-dc4f0fb907 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-dc4f0fb907

Comment 12 Fedora Update System 2020-09-20 23:55:23 UTC
FEDORA-2020-0d29e88946 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-0d29e88946`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-0d29e88946

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2020-09-21 00:39:18 UTC
FEDORA-2020-dc4f0fb907 has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-dc4f0fb907`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-dc4f0fb907

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2020-09-21 08:01:26 UTC
FEDORA-2020-0d29e88946 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-0d29e88946

Comment 15 Fedora Update System 2020-09-21 14:28:28 UTC
FEDORA-2020-0d29e88946 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-0d29e88946`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-0d29e88946

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2020-09-23 17:12:50 UTC
FEDORA-2020-0d29e88946 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2020-10-05 18:34:50 UTC
FEDORA-2020-dc4f0fb907 has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 Ariaan 2023-08-25 16:09:02 UTC
Hopefully this will help

As far as I know, I've always had this issue.

Fedora Linux 38 (Server Edition)

This is what Cockpit shows me:

Service logs
August 25, 2023
6:02 PM
Failed to start rc-local.service - /etc/rc.d/rc.local Compatibility.
systemd
6:02 PM
rc-local.service: Failed with result 'exit-code'.
systemd
6:02 PM
rc-local.service: Control process exited, code=exited, status=203/EXEC
systemd
6:02 PM
rc-local.service: Failed at step EXEC spawning /etc/rc.d/rc.local: Exec format error
(rc.local)
6:02 PM
rc-local.service: Failed to execute /etc/rc.d/rc.local: Exec format error
(rc.local)
6:02 PM
Starting rc-local.service - /etc/rc.d/rc.local Compatibility...
systemd


Note You need to log in before you can comment on or make changes to this bug.