Bug 843735 - /etc/rc.local does not get executed on sytem bootup
/etc/rc.local does not get executed on sytem bootup
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-27 04:24 EDT by vikram goyal
Modified: 2014-03-16 23:31 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-03-12 09:19:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description vikram goyal 2012-07-27 04:24:01 EDT
Description of problem:
/etc/rc.local is the script within whihc if any commands are found should get executed on bootup, but is not happening on Fedora 17

Version-Release number of selected component (if applicable):
initscripts-9.37.1-1.fc17.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:
The file should be executed on bootup, if found executable as per documentation of Release Notes of Fedora 17.

Additional info:
Even though the /etc/rc.local is marked as executable by chmod +x command, the contents , basically the commands written within rc.local do not get executed on bootup. It has to be executed through user root from commandline separatly.
Comment 1 Bill Nottingham 2012-07-27 10:08:27 EDT
The script looks for /etc/rc.d/rc.local - is that not present?
Comment 2 vikram goyal 2012-08-03 06:38:51 EDT
[root@mail2 etc]# find /etc/ -name rc.local
/etc/rc.local


[root@mail2 etc]# ls /etc/rc.d/
init.d  rc0.d  rc1.d  rc2.d  rc3.d  rc4.d  rc5.d  rc6.d


[root@mail2 etc]# ll /etc/rc.local 
-rwxr-xr-x. 1 root root 739 Jul 16 13:25 /etc/rc.local


[root@mail2 etc]# ll -Z /etc/rc.local 
-rwxr-xr-x. root root system_u:object_r:etc_t:s0       /etc/rc.local


[root@mail2 etc]# rpm -qf /etc/rc.local 
file /etc/rc.local is not owned by any package


This is a fresh F17 install.
Comment 3 Bill Nottingham 2012-08-03 12:46:51 EDT
I assume if you link /etc/rc.d/rc.local to /etc/rc.local that it works?
Comment 4 vikram goyal 2012-08-13 03:33:16 EDT
I created a link as told. Pls see:
_________________________________
[root@mail2 ~]# ll -l /etc/rc.d/rc.local 
lrwxrwxrwx. 1 root root 13 Aug  9 00:56 /etc/rc.d/rc.local -> /etc/rc.local
--------------------------------------------------------------------------------
After that I got these messages:
_______________________________
[root@mail2 ~]# grep rc.local /var/log/messages
Aug 13 20:19:18 mail2 rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2 rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2 rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2 rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2 rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2 rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2 systemd[1]: rc-local.service: control process exited, code=exited status=7
Aug 13 20:19:18 mail2 systemd[1]: Unit rc-local.service entered failed state.
--------------------------------------------------------------------------------
[root@mail2 ~]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
          Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
          Active: failed (Result: exit-code) since Mon, 13 Aug 2012 20:19:18 +0530
         Process: 652 ExecStart=/etc/rc.d/rc.local start (code=exited, status=7)
          CGroup: name=systemd:/system/rc-local.service

Aug 13 20:19:18 mail2.smcindiaonline.com rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2.smcindiaonline.com rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2.smcindiaonline.com rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2.smcindiaonline.com rc.local[652]: SIOCADDRT: No such process
Aug 13 20:19:18 mail2.smcindiaonline.com rc.local[652]: SIOCADDRT: No such process
--------------------------------------------------------------------------------
[root@mail2 ~]# systemctl start rc-local.service
[root@mail2 ~]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
          Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
          Active: active (exited) since Mon, 13 Aug 2012 12:54:26 +0530; 36s ago
         Process: 16907 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/rc-local.service
--------------------------------------------------------------------------------


So it seems it is still (after creating the link) not starting successfully at boot time but gets done from commandline.
Comment 5 Bill Nottingham 2012-08-13 14:16:32 EDT
What's your rc.local look like?
Comment 6 vikram goyal 2012-08-22 23:48:18 EDT
Of cource, I could put the same in ifcg files but since I added that in a hurry & it did not get executed, I wanted to bring the same to your notice.

[root@mail2 ~]# cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

# Gateway
/sbin/route add -net 192.168.4.249 netmask 255.255.255.255 gw 172.16.0.249
# Machine on 1st Floor
/sbin/route add -net 192.168.4.54  netmask 255.255.255.255 gw 172.16.0.249
# Machines in Pratap Nagar
/sbin/route add -net 10.0.0.225    netmask 255.255.255.255 gw 172.16.0.30
/sbin/route add -net 10.0.0.226    netmask 255.255.255.255 gw 172.16.0.30
# Gateways
/sbin/route add -net 172.16.31.1   netmask 255.255.255.255 gw 172.16.0.30
/sbin/route add -net 172.16.31.2   netmask 255.255.255.255 gw 172.16.0.30
Comment 7 Bill Nottingham 2012-08-23 12:24:10 EDT
I assume you're using static networking configuration with /etc/init.d/network?
Comment 8 vikram goyal 2012-08-27 03:10:32 EDT
[root@mail2 ~]# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

ipsec           0:off   1:off   2:off   3:off   4:off   5:off   6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:off   3:off   4:off   5:off   6:off
spice-vdagentd  0:off   1:off   2:off   3:off   4:off   5:on    6:off
tcsd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
------------------------------------------------------------------------------
[root@mail2 network-scripts]# ls ifcfg-*
ifcfg-eth1  ifcfg-lo  ifcfg-p17p1

[root@mail2 network-scripts]# cat ifcfg-p17p1 
UUID="f8ebb077-3bd4-428d-9353-7936f9fe62f4"
NM_CONTROLLED="yes"
BOOTPROTO=none
DEVICE="p17p1"
ONBOOT="yes"
TYPE=Ethernet .... And So On

[root@mail2 network-scripts]# cat ifcfg-eth1 
UUID="9beaefff-0ae8-47af-ac3d-f0dbaf6ac2c2"
NM_CONTROLLED="yes"
HWADDR="00:60:08:14:54:70"
BOOTPROTO="dhcp"
DEVICE="eth1"
ONBOOT="no"

No, I am using Network-Manager. network daemon is switched off & ethernet interfaces are managed by NM only.
Comment 9 Bill Nottingham 2012-08-27 15:59:56 EDT
I think this will work for you if you do 'systemctl enable NetworkManager-wait-online.service'.
Comment 10 vikram goyal 2012-09-01 02:06:41 EDT
Hi,

Yes, that did the trick, so it wasn't a bug afterall but a different way of boot up process.

I understand, lots of changes have been done to make booting process faster & that includes not waiting for a particular services ( depending on the service, of cource ) to properly be up but listen on the sockets etc for a proper up response and this adding of routes in the routing table was not getting executed beacuse maybe the lan connecction was not properly up by the time rc.local was executed & rc.local is a local hack by the system user.

I have a suggestion which will help people for not been taken by surprise, like I went in for, is that a comment stanza maybe added to stock rc.local mentioning that in case of failure of rc.local service the NetworkManager-wait-online.service
be enabled & tested for rc.local successful start at bootup, else the problem is in the commands in rc.local of cource. A line may also be added that by enabling
NetworkManager-wait-online.service, the bootup process might take longer than otherwise.

This will mitigate surprises for people who sometimes do not have GUI available & hack the rc.local for their end.

Thanks

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