# FreeBSD 9 and rc.conf



## Matty (Jan 9, 2012)

Hi,

I upgraded to 9 stable yesterday (from 8 stable). It seems my rc.conf is skipped for some parts. E.g.: the em0 interface gets the right IP address but the defaultrouter entry is skipped (no default gateway is added).

rc.conf has the record 
	
	



```
syslogd_enable="YES"
```
 but no syslogd is started after restart.

Could I have missed something during the upgrade?

Edit: problems seems to be the 
	
	



```
zfs_enable="YES"
```
 When commenting it out. the syslogd en defaultrouter seem to work just fine.

Error with zfs_enable is:

```
syslogd: bind: Can't assign requested address" exited with rc 1
route: writing to routing socket: Network is unreachable.
```
Can I add some kind of delay to the zfs script?


----------



## SirDice (Jan 10, 2012)

How did you upgrade? If you used the source way (building world), did you run mergemaster(8)?


----------



## Matty (Jan 10, 2012)

SirDice said:
			
		

> How did you upgrade? If you used the source way (building world), did you run mergemaster(8)?



Yeah I did follow UPDATING.
The problems is, as far as I can tell, the right sequence. 
1. the filesystems (root, critical, zfs) gets mounted. This take some time due to the number of fs in zfs.
2. the network interfaces waits till step 1 is done. But before netif is up syslogd and route tries to do their thing which fails.


----------



## kpa (Jan 10, 2012)

Try this trick that makes the rc(8) scripts that depend on network wait until the DHCP negotiation has really finished:


```
ifconfig_ifn="SYNCDHCP"
```

Where ifn is the name of the network interface.


----------



## Matty (Jan 10, 2012)

kpa said:
			
		

> Try this trick that makes the rc(8) scripts that depend on network wait until the DHCP negotiation has really finished:
> 
> 
> ```
> ...



Even with interfaces with fixed ip address?


----------



## kpa (Jan 10, 2012)

In that case you can use /etc/rc.d/netwait.


----------



## gkontos (Jan 10, 2012)

Could you please post your dmesg and rc.conf when the problem occurs?


----------



## Matty (Jan 10, 2012)

Netwait didn't do much. still the same problem.

Btw the /usr/local is a ZFS fs. 


rc.conf

```
# This file now contains just the overrides from /etc/defaults/rc.conf.
# Please make all changes to this file, not to /etc/defaults/rc.conf.

# Enable network daemons for user convenience.
# Created: Mon Jan  9 21:44:57 2012
# -- sysinstall generated deltas -- # Mon Jan  9 21:44:57 2012
ifconfig_em0="inet 192.168.2.3  netmask 255.255.255.0"
defaultrouter="192.168.2.1"
hostname="fb"
netwait_enable="YES"
netwait_ip="192.168.2.3"
# -- sysinstall generated deltas -- # Mon Jan  9 21:45:45 2012
#accounting_enable="YES"
zfs_enable="YES"
#netatalk_enable="YES"
#cnid_metad_enable="YES"
#afpd_enable="YES"
#sab_enable="YES"
keyrate="fast"
sshd_enable="YES"
#samba_enable="YES"
#defaultroute_carrier_delay="10"
```

dmesg

```
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.0-STABLE #1 r229819M: Mon Jan  9 00:22:41 CET 2012
    root@fb:/usr/obj/usr/src/sys/GENERIC amd64
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ (2412.41-MHz K8-class CPU)
  Origin = "AuthenticAMD"  Id = 0x20fb1  Family = f  Model = 2b  Stepping = 1
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x1<SSE3>
  AMD Features=0xe2500800<SYSCALL,NX,MMX+,FFXSR,LM,3DNow!+,3DNow!>
  AMD Features2=0x3<LAHF,CMP>
real memory  = 4294967296 (4096 MB)
avail memory = 4088647680 (3899 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table: <Nvidia AWRDACPI>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
ioapic0: Changing APIC ID to 2
ioapic0 <Version 1.1> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <Nvidia AWRDACPI> on motherboard
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, cfef0000 (3) failed
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pci0: <memory> at device 0.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
pci0: <serial bus, SMBus> at device 1.1 (no driver attached)
ohci0: <OHCI (generic) USB controller> mem 0xd6003000-0xd6003fff at device 2.0 on pci0
usbus0: <OHCI (generic) USB controller> on ohci0
ehci0: <NVIDIA nForce4 USB 2.0 controller> mem 0xfeb00000-0xfeb000ff at device 2.1 on pci0
usbus1: EHCI version 1.0
usbus1: <NVIDIA nForce4 USB 2.0 controller> on ehci0
atapci0: <nVidia nForce CK804 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xf000-0xf00f at device 6.0 on pci0
ata0: <ATA channel> at channel 0 on atapci0
ata1: <ATA channel> at channel 1 on atapci0
atapci1: <nVidia nForce CK804 SATA300 controller> port 0x9f0-0x9f7,0xbf0-0xbf3,0x970-0x977,0xb70-0xb73,0xd800-0xd80f mem 0xd6002000-0xd6002fff irq 20 at device 7.0 on pci0
ata2: <ATA channel> at channel 0 on atapci1
ata3: <ATA channel> at channel 1 on atapci1
atapci2: <nVidia nForce CK804 SATA300 controller> port 0x9e0-0x9e7,0xbe0-0xbe3,0x960-0x967,0xb60-0xb63,0xc400-0xc40f mem 0xd6001000-0xd6001fff irq 21 at device 8.0 on pci0
ata4: <ATA channel> at channel 0 on atapci2
ata5: <ATA channel> at channel 1 on atapci2
pcib1: <ACPI PCI-PCI bridge> at device 9.0 on pci0
pci5: <ACPI PCI bus> on pcib1
atapci3: <Promise PDC40718 SATA300 controller> port 0xa000-0xa07f,0xa400-0xa4ff mem 0xd4020000-0xd4020fff,0xd4000000-0xd401ffff irq 16 at device 6.0 on pci5
ata6: <ATA channel> at channel 0 on atapci3
ata7: <ATA channel> at channel 1 on atapci3
ata8: <ATA channel> at channel 2 on atapci3
ata9: <ATA channel> at channel 3 on atapci3
vgapci0: <VGA-compatible display> mem 0xd3000000-0xd3003fff,0xd5000000-0xd57fffff irq 17 at device 7.0 on pci5
xl0: <3Com 3c905C-TX Fast Etherlink XL> port 0xa800-0xa87f mem 0xd4021000-0xd402107f irq 18 at device 8.0 on pci5
miibus0: <MII bus> on xl0
ukphy0: <Generic IEEE 802.3u media interface> PHY 24 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto, auto-flow
xl0: Ethernet address: 00:0a:5e:3e:bc:39
nfe0: <NVIDIA nForce4 CK804 MCP9 Networking Adapter> port 0xb000-0xb007 mem 0xd6000000-0xd6000fff irq 22 at device 10.0 on pci0
miibus1: <MII bus> on nfe0
e1000phy0: <Marvell 88E1111 Gigabit PHY> PHY 1 on miibus1
e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow
nfe0: Ethernet address: 00:11:d8:a4:60:d3
pcib2: <ACPI PCI-PCI bridge> at device 11.0 on pci0
pci4: <ACPI PCI bus> on pcib2
pcib3: <ACPI PCI-PCI bridge> at device 12.0 on pci0
pci3: <ACPI PCI bus> on pcib3
em0: <Intel(R) PRO/1000 Network Connection 7.2.3> port 0x9000-0x901f mem 0xd1080000-0xd109ffff,0xd1000000-0xd107ffff,0xd10a0000-0xd10a3fff irq 16 at device 0.0 on pci3
em0: Using MSIX interrupts with 3 vectors
em0: Ethernet address: 00:1b:21:61:b0:01
pcib4: <ACPI PCI-PCI bridge> at device 13.0 on pci0
pci2: <ACPI PCI bus> on pcib4
pcib5: <ACPI PCI-PCI bridge> at device 14.0 on pci0
pci1: <ACPI PCI bus> on pcib5
amdtemp0: <AMD CPU On-Die Thermal Sensors> on hostb3
acpi_tz0: <Thermal Zone> on acpi0
attimer0: <AT timer> port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
atrtc0: <AT realtime clock> port 0x70-0x73 irq 8 on acpi0
Event timer "RTC" frequency 32768 Hz quality 0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
orm0: <ISA Option ROMs> at iomem 0xc0000-0xc7fff,0xc8000-0xcbfff,0xcc000-0xd0fff,0xd1000-0xd1fff,0xd2000-0xd27ff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
ppc0: cannot reserve I/O port range
powernow0: <Cool`n'Quiet K8> on cpu0
powernow1: <Cool`n'Quiet K8> on cpu1
ZFS filesystem version 5
ZFS storage pool version 28
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 480Mbps High Speed USB v2.0
ugen0.1: <nVidia> at usbus0
uhub0: <nVidia OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <nVidia> at usbus1
uhub1: <nVidia EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
uhub0: 10 ports with 10 removable, self powered
ata7: SIGNATURE: 00000101
ada0 at ata2 bus 0 scbus2 target 0 lun 0
ada0: <SAMSUNG HD103SJ 1AJ100E4> ATA-8 SATA 2.x device
ada0: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada0: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad4
ada1 at ata3 bus 0 scbus3 target 0 lun 0
ada1: <SAMSUNG HD103SJ 1AJ100E4> ATA-8 SATA 2.x device
ada1: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada1: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
ada1: Previously was known as ad6
ada2 at ata4 bus 0 scbus4 target 0 lun 0
ada2: <SAMSUNG HD103SJ 1AJ100E4> ATA-8 SATA 2.x device
ada2: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada2: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
ada2: Previously was known as ad8
ada3 at ata5 bus 0 scbus5 target 0 lun 0
ada3: <SAMSUNG HD103SJ 1AJ100E4> ATA-8 SATA 2.x device
ada3: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada3: 953869MB (1953525168 512 byte sectors: 16H 63S/T 16383C)
ada3: Previously was known as ad10
ada4 at ata7 bus 0 scbus7 target 0 lun 0
ada4: <WDC WD1200JD-00GBB0 02.05D02> ATA-6 SATA 1.x device
ada4: 150.000MB/s transfers (SATA 1.x, UDMA5, PIO 8192bytes)
ada4: 114473MB (234441648 512 byte sectors: 16H 63S/T 16383C)
ada4: Previously was known as ad14
SMP: AP CPU #1 Launched!
GEOM: ada4s1: geometry does not match label (255h,63s != 16h,63s).
Root mount waiting for: usbus1
Root mount waiting for: usbus1
uhub1: 10 ports with 10 removable, self powered
Trying to mount root from ufs:/dev/ada4s1a [rw]...
```


----------



## Matty (Jan 10, 2012)

I got a working rc.d now:

/etc/rc.d/FILESYSTEMS
Removed the REQUIRE: zfs

/etc/rc.d/zfs
Added # REQUIRE: NETWORKING 

copy of /etc/rc.d/ldconfig -> /etc/rc.d/ldconfig.zfs
added # REQUIRE: zfs

to rescan the /usr/local/lib to fix lib issues


It's not pretty but it does the job.


----------



## SirDice (Jan 10, 2012)

Matty said:
			
		

> /etc/rc.d/zfs
> Added # REQUIRE: NETWORKING


ZFS doesn't require networking to be active.


----------



## gkontos (Jan 10, 2012)

Is ada4s1 a UFS2 partition that you are booting from?

I suspect that there is something wrong there, could you also please post the output of:

[CMD=""]#gpart show [/CMD]

Just saw this now:


```
atapci3: <Promise [url=http://www.aisecure.net/2011/07/07/promise-pdc40718-sata300-junk/]PDC40718[/URL] SATA300 controller>
```

How is this controller being used ?


----------



## Matty (Jan 10, 2012)

SirDice said:
			
		

> ZFS doesn't require networking to be active.



I know but it does fix the problem. Zfs mount will wait until all the networkstuff is done.
It does break starting /usr/local/etc/rc.d though :/


----------



## Matty (Jan 10, 2012)

gkontos said:
			
		

> Is ada4s1 a UFS2 partition that you are booting from?
> 
> I suspect that there is something wrong there, could you also please post the output of:
> 
> [CMD=""]#gpart show [/CMD]



the motherboard has 4 sata's where the 4 samsung (zfs storage) disk are on. I bought a simple sata controller (ada4) to boot from.


```
gpafb# gpart show
=>       63  234441585  ada4  MBR  (111G)
         63   12578832     1  freebsd  [active]  (6G)
   12578895  221862753     2  freebsd  (105G)

=>       0  12578832  ada4s1  BSD  (6G)
         0    679936       1  freebsd-ufs  (332M)
    679936   3247406       2  freebsd-swap  (1.6G)
   3927342    811008       4  freebsd-ufs  (396M)
   4738350    497664       5  freebsd-ufs  (243M)
   5236014   7342818       6  freebsd-ufs  (3.5G)
```


It's a disk with ufs to boot from and the rest (p2) is zfs which has the /usr/local fs.



```
Filesystem             Size    Used   Avail Capacity  Mounted on
/dev/ada4s1a           321M    105M    190M    36%    /
devfs                  1.0k    1.0k      0B   100%    /dev
/dev/ada4s1e           235M     39M    176M    18%    /tmp
/dev/ada4s1f           3.4G    1.8G    1.3G    57%    /usr
/dev/ada4s1d           383M    129M    223M    37%    /var
storage                1.2T    864G    315G    73%    /storage
storage/conf           708G    393G    315G    55%    /storage/conf
storage/diskless        25G    2.2G     22G     9%    /storage/diskless
storage/foto           451G    136G    315G    30%    /storage/foto
storage/timemachine    350G    114G    235G    33%    /storage/timemachine
tank                    23G     30k     23G     0%    /tank
tank/clang              24G    1.5G     23G     6%    /usr/clang
tank/home               31G    8.3G     23G    26%    /usr/home
tank/local              24G    1.2G     23G     5%    /usr/local
tank/obj                23G     33k     23G     0%    /usr/obj
tank/ports              23G    484M     23G     2%    /usr/ports
tank/src.9              24G    1.4G     23G     6%    /usr/src
tank/src.8              23G    708M     23G     3%    /usr/src.8
tank/var/db             23G    112M     23G     0%    /var/db
```


----------



## gkontos (Jan 10, 2012)

Matty said:
			
		

> the motherboard has 4 sata's where the 4 samsung (zfs storage) disk are on. I bought a simple sata controller (ada4) to boot from.



I have done so much troubleshooting on that controller. Spoken with so many people over the mailing lists and not only. Their recommendation was toss it.

The only thing that might work for you is trying to change different SATA ports on that controller. Of course this would require you to perform changes in your fstab.

BTW like SirDice said, networking is not a requirement for ZFS. My (wild) guess is that the controller freaks out when the system is mounting the other DISKS, falsely reporting that the root fs has been mounted, thus your other services start coming up.


----------



## Matty (Jan 10, 2012)

I changed the rc.d file back to the original state. I copied routing and syslogd and rerun them a second time.


----------

