# rc.d startup order



## Ole (Dec 9, 2008)

Hello, 

From 5x RELEASE as i know, FreeBSD switched to rcorder/rc.subr (from NetBSD?) system which maintance startup script sequence

I get startup sequence in my system:

```
rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
/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/early.sh                                                       
.....
/etc/rc.d/tmp                                                            
/etc/rc.d/cleartmp                                                       
/usr/local/etc/rc.d/xfs                                                  
/etc/rc.d/accounting                                                     
/etc/rc.d/devfs                                                          
...
/etc/rc.d/virecover                                                      
/usr/local/etc/rc.d/gnugk                                                
/etc/rc.d/DAEMON                                                         
/usr/local/etc/rc.d/svnserve                                             
/usr/local/etc/rc.d/ssyncd.init                                          
/etc/rc.d/apm                                                            
...
/etc/rc.d/motd                                                           
/usr/local/etc/rc.d/fusefs                                               
...
/etc/rc.d/yppasswdd                                                      
/usr/local/etc/rc.d/isc-dhcpd                                            
/usr/local/etc/rc.d/nagios                                               
/usr/local/etc/rc.d/ndo2db                                               
/usr/local/etc/rc.d/npcd                                                 
/usr/local/etc/rc.d/nstatld.sh                                           
/usr/local/etc/rc.d/proftpd                                              
/usr/local/etc/rc.d/samba                                                
/usr/local/etc/rc.d/smartd                                               
/etc/rc.d/LOGIN                                                          
/usr/local/etc/rc.d/squid                                                
/usr/local/etc/rc.d/snmptrapd                                            
/usr/local/etc/rc.d/snmpd                                                
/usr/local/etc/rc.d/slapd                                                
/usr/local/etc/rc.d/slurpd                                               
/usr/local/etc/rc.d/slpd                                                 
/usr/local/etc/rc.d/samhain.sh                                           
/usr/local/etc/rc.d/rsyncd                                               
/usr/local/etc/rc.d/redir                                                
/usr/local/etc/rc.d/postgresql                                           
/usr/local/etc/rc.d/nrpe2                                                
/usr/local/etc/rc.d/nakenchat                                            
/usr/local/etc/rc.d/mysql-server                                         
/usr/local/etc/rc.d/mdnsd                                                
/usr/local/etc/rc.d/kqemu                                                
/usr/local/etc/rc.d/htcacheclean
/usr/local/etc/rc.d/dbus
rcorder: requirement `usbd' in file `/usr/local/etc/rc.d/hald' has no providers.
/usr/local/etc/rc.d/hald
/usr/local/etc/rc.d/ffserver
/etc/rc.d/sshd
/usr/local/etc/rc.d/ezjail.sh
/usr/local/etc/rc.d/cupsd
/usr/local/etc/rc.d/clamav-clamd
/usr/local/etc/rc.d/clamav-freshclam
/usr/local/etc/rc.d/bsdstats.sh
/usr/local/etc/rc.d/bacula-fd
/usr/local/etc/rc.d/avahi-daemon
/usr/local/etc/rc.d/avahi-dnsconfd
/usr/local/etc/rc.d/asterisk
/usr/local/etc/rc.d/arpwatch
/usr/local/etc/rc.d/apache22
/etc/rc.d/ypxfrd
/etc/rc.d/ypupdated
/etc/rc.d/ypset
/etc/rc.d/wpa_supplicant
/etc/rc.d/watchdogd
/etc/rc.d/syscons
/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/natd
/etc/rc.d/msgs
/etc/rc.d/moused
/etc/rc.d/mixer
/etc/rc.d/inetd
/etc/rc.d/idmapd
/etc/rc.d/hostapd
/etc/rc.d/geli2
/etc/rc.d/ftpd
/etc/rc.d/ftp-proxy
/etc/rc.d/dhclient
/etc/rc.d/bsnmpd
/etc/rc.d/bridge
/etc/rc.d/bluetooth
/etc/rc.d/bgfsck
```

I see that scripts from "/etc/rc.d/" and "/usr/local/etc/rc.d" in some place a interleaving.
Thats correct? Scripts executing by "parallel  mode", not order "first /etc/rc.d" and "/usr/local/etc/rc.d" after?
Thanks.


----------



## trasz@ (Dec 9, 2008)

Yes, seems to be ok.


----------



## kamikaze (Dec 9, 2008)

Scripts define dependencies that define the order in which they are run. This can be used to start a script from /usr/local/etc/rc.d early in the booting process and it removes the need for prefixes to specify a boot order.


----------



## nakal (Dec 9, 2008)

I have a question about the order of rc scripts, too. Thank you for pointing me at rcorder. I have already complained about syslogd starting too early before network is up on the stable mailing list, but noone could help me. With the rcorder tool, I can see the following problems:


```
[zelda] ~> rcorder /etc/rc.d/* /usr/local/etc/rc.d/* | less
rcorder: Circular dependency on provision `mountcritremote' in file `/etc/rc.d/devfs'.
rcorder: Circular dependency on provision `mountcritremote' in file `/etc/rc.d/mdconfig2'.
rcorder: Circular dependency on provision `mountcritremote' in file `/etc/rc.d/newsyslog'.
rcorder: Circular dependency on provision `mountcritremote' in file `/etc/rc.d/syslogd'.
rcorder: Circular dependency on provision `ldconfig' in file `/etc/rc.d/SERVERS'.
rcorder: Circular dependency on provision `mountcritremote' in file `/etc/rc.d/archdep'.
rcorder: Circular dependency on provision `mountcritremote' in file `/etc/rc.d/SERVERS'.
rcorder: Circular dependency on file `/etc/rc.d/devd'.
rcorder: Circular dependency on provision `network_ipv6' in file `/etc/rc.d/devd'.
rcorder: Circular dependency on provision `network_ipv6' in file `/etc/rc.d/mroute6d'.
rcorder: Circular dependency on provision `network_ipv6' in file `/etc/rc.d/route6d'.
rcorder: Circular dependency on provision `network_ipv6' in file `/etc/rc.d/NETWORKING'.
rcorder: requirement `usbd' in file `/usr/local/etc/rc.d/hald' has no providers.
/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/early.sh
/etc/rc.d/fsck
/etc/rc.d/root
/etc/rc.d/hostid
/etc/rc.d/mdconfig
/etc/rc.d/mountcritlocal
/etc/rc.d/zfs
/etc/rc.d/FILESYSTEMS
/etc/rc.d/var
/etc/rc.d/cleanvar
/etc/rc.d/devfs
/etc/rc.d/ipfilter
/etc/rc.d/addswap
/etc/rc.d/auto_linklocal
/etc/rc.d/sysctl
/etc/rc.d/hostname
/etc/rc.d/ipmon
/etc/rc.d/mdconfig2
/etc/rc.d/newsyslog
[color="Red"]/etc/rc.d/syslogd[/color]
/etc/rc.d/savecore
/etc/rc.d/archdep
/etc/rc.d/abi
/etc/rc.d/SERVERS
/etc/rc.d/named
/etc/rc.d/random
/etc/rc.d/adjkerntz
/etc/rc.d/atm1
/etc/rc.d/ipnat
/etc/rc.d/ipfs
/etc/rc.d/kldxref
/etc/rc.d/sppp
/etc/rc.d/serial
[color="Red"]/etc/rc.d/netif[/color]
/etc/rc.d/isdnd
/etc/rc.d/ppp
/etc/rc.d/ipfw
/etc/rc.d/nsswitch
.
.
.
```

Of course, syslogd tries to bind a socket, but netif configures networking. I get the following problem in this situation:


```
Dec  9 16:51:28 syslogd: bind: Can't assign requested address
Dec  9 16:51:28 syslogd: bind: Can't assign requested address
```

The root cause seems to be /usr/local/etc/rc.d/freenet6 script. When I move it away, the order problems disappear.

This is the freenet6 script head:

```
# PROVIDE: freenet6
# REQUIRE: NETWORKING netif named
# BEFORE: ip6addrctl
# KEYWORD: shutdown
```

Now I see the problem: BEFORE ip6addrctl and after NETWORKING is clearly wrong. Do you have an idea what correct dependencies freenet6 needs?


----------



## Ole (Dec 9, 2008)

On my machine netif starting before syslog:



> [root@ ~]# rcorder /etc/rc.d/*
> /etc/rc.d/dumpon
> /etc/rc.d/ddb
> /etc/rc.d/initrandom
> ...



May be you forget sync default /etc/* files after upgrade system? 
Try cvsup you /usr/src tree and


> mergemaster -a |tee /tmp/out.txt


and analyze /tmp/out.txt for string


> *** Beginning comparison
> 
> *** Checking /etc/rc.d for stale files
> 
> *** No stale files found


and 


> *** Files that remain for you to merge by hand:



May be you distribution of /etc out of date?


----------



## Ole (Dec 9, 2008)

Wow sorry! I forget install freenet6. Yes, my orders is mix up too where netif start after syslog. You can make send-pr for reports the problem


----------

