Bug 843735 - /etc/rc.local does not get executed on sytem bootup
Summary: /etc/rc.local does not get executed on sytem bootup
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-27 08:24 UTC by vikram goyal
Modified: 2014-03-17 03:31 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-03-12 13:19:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description vikram goyal 2012-07-27 08:24:01 UTC
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 14:08:27 UTC
The script looks for /etc/rc.d/rc.local - is that not present?

Comment 2 vikram goyal 2012-08-03 10:38:51 UTC
[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 16:46:51 UTC
I assume if you link /etc/rc.d/rc.local to /etc/rc.local that it works?

Comment 4 vikram goyal 2012-08-13 07:33:16 UTC
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 18:16:32 UTC
What's your rc.local look like?

Comment 6 vikram goyal 2012-08-23 03:48:18 UTC
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 16:24:10 UTC
I assume you're using static networking configuration with /etc/init.d/network?

Comment 8 vikram goyal 2012-08-27 07:10:32 UTC
[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 19:59:56 UTC
I think this will work for you if you do 'systemctl enable NetworkManager-wait-online.service'.

Comment 10 vikram goyal 2012-09-01 06:06:41 UTC
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.