Shouldn't rc.local be executed last?

Hello,

I have this problem:

iSCSI target should be running and then the LUNs should be presented on the same machine. So the istgt is starting on normal startup in /usr/local/etc/rc.d/istgt. But the iSCSI initiator is started from /etc/rc.local:

Code:
#!/bin/sh
/sbin/iscontrol -c /etc/iscsi.conf -n idisk1
/sbin/iscontrol -c /etc/iscsi.conf -n idisk2
/usr/local/bin/ntfs-3g /dev/da0s1 /mnt/D
/usr/local/bin/ntfs-3g /dev/da1s1 /mnt/E

But this is the startup:
Code:
Creating and/or trimming log files.
Starting syslogd.
Clearing /tmp (X related).
Starting proftpd.
Starting openvpn.
tap0: Ethernet address: 00:bd:d5:4e:00:00
tap0: link state changed to UP
bridge0: link state changed to UP
tap0: promiscuous mode enabled
[B]Starting local daemons:[/B]
re1: link state changed to UP         #
[I]errno=61                              #
connect: Connection refused           #
errno=61                              #
connect: Connection refused           # Here I press Ctrl+C, so the rc.local execution
Script /etc/rc.d/local interrupted[/I]   # stop and other daemons will continue startup
Updating motd:.
fusefs is already running.
Starting ntpd.
Jan  1 15:51:46 sentinel ntpd[1467]: bind() fd 29, family AF_INET6, port 123, scope 11, addr fe80::21e:e5ff:fee8:d46d, mcast=0 flags=0x11 fails: Can't assign requested address
Jan  1 15:51:46 sentinel ntpd[1467]: unable to create socket on wlan0 (9) for fe80::21e:e5ff:fee8:d46d#123
Starting powerd.
Starting dhcpd.
Internet Systems Consortium DHCP Server 4.1-ESV-R7
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 9 leases to leases file.
Listening on BPF/bridge0/02:74:c6:6d:ec:00/192.168.1.0/24
Sending on   BPF/bridge0/02:74:c6:6d:ec:00/192.168.1.0/24
Sending on   Socket/fallback/fallback-net
[B]Starting istgt.[/B]
istgt version 0.5 (20121028)
normal mode
using kqueue
using host atomic
LU1 HDD UNIT
LU1: LUN0 file=/dev/mirror/gm0, size=493921238528
LU1: LUN0 964689919 blocks, 512 bytes/block
LU1: LUN0 459.9GB storage for Sentinel.unixhomenet.com:Mirror-Protected-Disk
LU1: LUN0 serial 10000001
LU1: LUN0 read cache enabled, write cache enabled
LU1: LUN0 command queuing enabled, depth 255
LU2 HDD UNIT
LU2: LUN0 file=/dev/ada0p8, size=104152956928
LU2: LUN0 203423744 blocks, 512 bytes/block
LU2: LUN0 97.0GB storage for Sentinel.unixhomenet.com:RAW-Disk
LU2: LUN0 serial 10000001
LU2: LUN0 read cache enabled, write cache enabled
LU2: LUN0 command queuing enabled, depth 255
Starting nrpe2.
Configuring syscons: blanktime.
Starting sshd.
Starting cron.
Looks like rc.local is executed before istgt, so lots of stuff hangs because the LUNs are not mounted. Is this normal?

Thank you.
 
Hello,

This is the output.
Code:
root@sentinel:/root # rcorder  /etc/rc.d/* /usr/local/etc/rc.d/*
/etc/rc.d/sysctl
/etc/rc.d/hostid
/etc/rc.d/zvol
/etc/rc.d/dumpon
/etc/rc.d/ddb
/etc/rc.d/initrandom
/etc/rc.d/geli
/etc/rc.d/gbde
/etc/rc.d/encswap
/etc/rc.d/ccd
/etc/rc.d/swap1
/etc/rc.d/fsck
/etc/rc.d/root
/etc/rc.d/mdconfig
/etc/rc.d/hostid_save
/etc/rc.d/mountcritlocal
/etc/rc.d/zfs
/etc/rc.d/FILESYSTEMS
/etc/rc.d/kldxref
/etc/rc.d/kld
/etc/rc.d/addswap
/etc/rc.d/var
/etc/rc.d/random
/etc/rc.d/adjkerntz
/etc/rc.d/atm1
/etc/rc.d/hostname
/etc/rc.d/ip6addrctl
/etc/rc.d/netoptions
/etc/rc.d/sppp
/etc/rc.d/ipfilter
/etc/rc.d/ipnat
/etc/rc.d/ipfs
/etc/rc.d/serial
/etc/rc.d/cleanvar
/etc/rc.d/netif
/etc/rc.d/devd
/etc/rc.d/ipsec
/etc/rc.d/atm2
/etc/rc.d/pfsync
/etc/rc.d/pflog
/etc/rc.d/pf
/etc/rc.d/stf
/etc/rc.d/ppp
/etc/rc.d/faith
/etc/rc.d/routing
/etc/rc.d/mroute6d
/etc/rc.d/nsswitch
/etc/rc.d/rtsold
/etc/rc.d/static_ndp
/etc/rc.d/static_arp
/etc/rc.d/bridge
/etc/rc.d/resolv
/etc/rc.d/route6d
/etc/rc.d/mrouted
/etc/rc.d/routed
/etc/rc.d/defaultroute
/etc/rc.d/ipfw
/etc/rc.d/NETWORKING
/etc/rc.d/netwait
/etc/rc.d/mountcritremote
/etc/rc.d/accounting
/etc/rc.d/ldconfig
/etc/rc.d/devfs
/etc/rc.d/ipmon
/etc/rc.d/mdconfig2
/etc/rc.d/newsyslog
/etc/rc.d/syslogd
/etc/rc.d/watchdogd
/etc/rc.d/savecore
/etc/rc.d/archdep
/etc/rc.d/abi
/etc/rc.d/SERVERS
/etc/rc.d/named
/etc/rc.d/ntpdate
/etc/rc.d/rpcbind
/etc/rc.d/nfsclient
/etc/rc.d/nisdomain
/etc/rc.d/ypserv
/etc/rc.d/ypbind
/etc/rc.d/ypset
/etc/rc.d/amd
/etc/rc.d/atm3
/etc/rc.d/auditd
/etc/rc.d/tmp
/etc/rc.d/cleartmp
/etc/rc.d/dmesg
/etc/rc.d/hastd
/etc/rc.d/ipxrouted
/etc/rc.d/kerberos
/etc/rc.d/kadmind
/etc/rc.d/keyserv
/etc/rc.d/kpasswdd
/etc/rc.d/nfsuserd
/etc/rc.d/gssd
/etc/rc.d/quota
/etc/rc.d/mountd
/etc/rc.d/nfsd
/etc/rc.d/statd
/etc/rc.d/lockd
/etc/rc.d/pppoed
/etc/rc.d/pwcheck
/etc/rc.d/virecover
/etc/rc.d/DAEMON
/usr/local/etc/rc.d/proftpd
/usr/local/etc/rc.d/openvpn
/etc/rc.d/apm
/etc/rc.d/apmd
/etc/rc.d/bootparams
/etc/rc.d/hcsecd
/etc/rc.d/bthidd
/etc/rc.d/local
/etc/rc.d/lpd
/etc/rc.d/motd
/usr/local/etc/rc.d/fusefs
/etc/rc.d/mountlate
/etc/rc.d/nscd
/etc/rc.d/ntpd
/etc/rc.d/powerd
/etc/rc.d/rarpd
/etc/rc.d/rctl
/etc/rc.d/sdpd
/etc/rc.d/rfcomm_pppd_server
/etc/rc.d/rtadvd
/etc/rc.d/rwho
/etc/rc.d/timed
/etc/rc.d/ugidfw
/etc/rc.d/yppasswdd
/usr/local/etc/rc.d/isc-dhcpd
/usr/local/etc/rc.d/istgt
/etc/rc.d/LOGIN
/usr/local/etc/rc.d/nrpe2
/etc/rc.d/ypxfrd
/etc/rc.d/ypupdated
/etc/rc.d/wpa_supplicant
/etc/rc.d/ubthidhci
/etc/rc.d/syscons
/etc/rc.d/sshd
/etc/rc.d/sendmail
/etc/rc.d/cron
/etc/rc.d/jail
/etc/rc.d/localpkg
/etc/rc.d/securelevel
/etc/rc.d/power_profile
/etc/rc.d/othermta
/etc/rc.d/nfscbd
/etc/rc.d/natd
/etc/rc.d/msgs
/etc/rc.d/moused
/etc/rc.d/mixer
/etc/rc.d/inetd
/etc/rc.d/hostapd
/etc/rc.d/gptboot
/etc/rc.d/geli2
/etc/rc.d/ftpd
/etc/rc.d/ftp-proxy
/etc/rc.d/dhclient
/etc/rc.d/bsnmpd
/etc/rc.d/bluetooth
/etc/rc.d/bgfsck
root@sentinel:/root #
The strange think is that few days ago, before I setup most of the stuff on the server, I think mounting LUNs worked fine from rc.local. So something I touched mixed the startup order. But I don't know how is that possible, because all I did was installing from ports and then putting *_enable="YES" in rc.conf.

Thank you.
 
/etc/rc.d/local is not guaranteed to be executed as last, nothing in the rc(8) manual page suggests so. Also the the script doesn't require anything else but the DAEMON pseudo target so the order is undefined between the scripts after DAEMON.


However you can solve this problem by creating your own start up script in /usr/local/etc/rc.d that requires (the REQUIRES keyword) the service provided by net/istgt (the PROVIDES keyword in the start up script). That guarantees that your custom script is executed after /usr/local/etc/rc.d/istgt.
 
Hello,

Thank you for the response.

I was thinking to make it more simple, because I will not use rc.local for anything else. So in Monday, when I get to work I am going to try putting REQUIRES in the /etc/rc.d/local script. Hope this will not mess things up.

I'll post the results.

Thank you.
 
Back
Top