Machine doesn't boot after switching from Linux to FreeBSD

Chris Zumbrunn chris at zumbrunn.com
Sun Dec 5 03:24:37 PST 2004


I'm trying to switch a Linux system to FreeBSD. I have two existing  
FreeBSD boxes running on the same kind of hardware and my approach was  
to rsynch the disk contents from one of those existing configs and just  
change the IP configuration in /etc/rc.conf.

After fdisk, disklabel, and newfs for the disks and the rsync for the  
data I am left with a system that won't boot. When attempting to boot  
from the local disks I can't ping the system anymore, when net-booting  
back into rescue mode I see that nothing was written to  
/var/messages/log. So, I guess this looks like a bootstrapping problem.  
The FreeBSD config that I'm rsynching to the new box is FreeBSD  
4.9-RELEASE. Both the existing machine and the new machine have the  
same kind of disks in them:

ar0: 117246MB <ATA RAID1 array> [14946/255/63] status: READY subdisks:
  0 READY ad0: 117246MB <Maxtor 6Y120L0> [238216/16/63] at ata0-master  
PIO4
           1 READY ad2: 117246MB <Maxtor 6Y120L0> [238216/16/63] at  
ata1-master

The full dmesg output that I get after net-booting from the rescue disk  
I included on the very bottom of this message.


Here is what I did before expecting a bootable machine:

     #> dd if=/dev/zero of=/dev/ar0 bs=512 count=32
     #> fdisk -BI ar0
     #> dd if=/dev/zero of=/dev/ar0s1 bs=512 count=32
     #> disklabel -w -B ar0s1 auto
     #> disklabel -e ar0s1
     #> newfs ar0s1a
     #> mount /dev/ar0s1a /mnt
     ...followed by a rsync to /mnt/ from / of the existing machine
     ...followed by editing the IP configuration in /mnt/etc/rc.conf
     ...followed by attempting to boot from the local disks

But before I got that far I had some problems for which I found the  
following work-arounds:


Initial problem:

     #> fdisk -BI ar0
     fdisk: can't get disk parameters on /dev/ar0; supplying dummy ones
     ******* Working on device /dev/ar0 *******
     fdisk: invalid fdisk partition table found
     fdisk: /boot/mbr: length must be a multiple of sector size
     #> disklabel -w -B ar0s1 auto
     cylinders/unit 0
     #> disklabel -e ar0s1
     disklabel: ioctl DIOCGDINFO: Invalid argument


I created a fdisk.conf file as follows:

     g       c14946  h255    s63
     p       1       165     0       240107490
     p       2       0       0       0
     p       3       0       0       0
     p       4       0       0       0
     a       1

...and tried:

     #> fdisk -f ./fdisk.conf ar0
     fdisk: can't get disk parameters on /dev/ar0; supplying dummy ones
     ******* Working on device /dev/ar0 *******
     fdisk: invalid fdisk partition table found
     fdisk: /boot/mbr: length must be a multiple of sector size

I net-booted into the alternative Linux-based rescue disk and did the  
following with both fdisk /dev/hda and fdisk /dev/hdc in order to get  
rid of the existing Linux partitioning and setup:

Created a new empty DOS partition table:

     Disk /dev/hda: 255 heads, 63 sectors, 14946 cylinders
     Units = cylinders of 16065 * 512 bytes

        Device Boot    Start       End    Blocks   Id  System
     /dev/hda1             1     14946 120053713+  a5  FreeBSD

And created a bsd disklabel:

     Reading disklabel of /dev/hda1  at sector 64.
     /dev/hda1  contains no disklabel.
     Do you want to create a disklabel? (y/n) y
     # /dev/hda1 :
     type: ST506
     disk:
     label:
     flags:
     bytes/sector: 512
     sectors/track: 63
     tracks/cylinder: 255
     sectors/cylinder: 16065
     cylinders: 14946
     rpm: 3600
     interleave: 1
     trackskew: 0
     cylinderskew: 0
     headswitch: 0           # milliseconds
     track-to-track seek: 0  # milliseconds
     drivedata: 0
     4 partitions:
     #       start       end      size     fstype   [fsize bsize   cpg]
       c:        1*    14946     14945*    unused        0     0
       d:        1     14946     14946     unused        0     0


Then I net-booted back into the FreeBSD-based rescue mode and still got  
stuck first on "fdisk -BI ar0" but this time was able to do "fdisk -f  
./fdisk.conf ar0":


     #> dd if=/dev/zero of=/dev/ar0 bs=512 count=32
     dd: /dev/ar0: Read-only file system
     2+0 records in
     1+0 records out
     512 bytes transferred in 0.001042 secs (491415 bytes/sec)
     #> fdisk -BI ar0
     ******* Working on device /dev/ar0 *******
     fdisk: invalid fdisk partition table found
     #> fdisk -f ./fdisk.conf ar0
     ******* Working on device /dev/ar0 *******
     #> fdisk -BI ar0
     ******* Working on device /dev/ar0 *******
     #> dd if=/dev/zero of=/dev/ar0s1 bs=512 count=32
     dd: /dev/ar0s1: Read-only file system
     2+0 records in
     1+0 records out
     512 bytes transferred in 0.001049 secs (488064 bytes/sec)
     #> disklabel -w -B ar0s1 auto
     #> disklabel -e ar0s1

I edited the disklabel and changed it from:

     # /dev/ar0s1c:
     type: unknown
     disk: amnesiac
     label:
     flags:
     bytes/sector: 512
     sectors/track: 63
     tracks/cylinder: 255
     sectors/cylinder: 16065
     cylinders: 14945
     sectors/unit: 240107427
     rpm: 3600
     interleave: 1
     trackskew: 0
     cylinderskew: 0
     headswitch: 0           # milliseconds
     track-to-track seek: 0  # milliseconds
     drivedata: 0

     8 partitions:
     #        size   offset    fstype   [fsize bsize bps/cpg]
       c: 240107427        0    unused        0     0        # (Cyl. 0 -  
14945*)

...to the config I'm successfully using on other boxes:

     # /dev/ar0s1:
     type: ESDI
     disk: ar0s1
     label:
     flags:
     bytes/sector: 512
     sectors/track: 63
     tracks/cylinder: 255
     sectors/cylinder: 16065
     cylinders: 14945
     sectors/unit: 240107427
     rpm: 3600
     interleave: 1
     trackskew: 0
     cylinderskew: 0
     headswitch: 0           # milliseconds
     track-to-track seek: 0  # milliseconds
     drivedata: 0

     8 partitions:
     #        size   offset    fstype   [fsize bsize bps/cpg]
       a: 240107427        0    4.2BSD     2048  16384    89  # (Cyl. 0  
- 14945*)
       c: 240107427        0    unused        0      0        # (Cyl. 0  
- 14945*)

After that I was able to construct a new file system:

     #> newfs ar0s1a
     Warning: Block size and bytes per inode restrict cylinders per  
group to 89.
     Warning: 96 sector(s) in last cylinder unallocated
     /dev/ar0s1a:    240107424 sectors in 58620 cylinders of 1 tracks,  
4096 sectors
             117240.0MB in 659 cyl groups (89 c/g, 178.00MB/g, 22528 i/g)
     super-block backups (for fsck -b #) at:
     32, 364576, 729120, 1093664, 1458208, 1822752, 2187296, 2551840,  
2916384, 3280928, 3645472,
     4010016, 4374560, 4739104, 5103648, 5468192, 5832736, 6197280,  
6561824, 6926368, 7290912, 7655456,
     .....
     238047264, 238411808, 238776352, 239140896, 239505440, 239869984


And I was able to mount it and rsynch the disk contents from a matching  
existing freebsd machine (FreeBSD 4.9-RELEASE).

     #> mount /dev/ar0s1a /mnt
     .....
     #> ll /mnt
     total 8472
     -rw-r--r--   1 root  wheel      802 Oct 27  2003 .cshrc
     -rw-r--r--   1 root  wheel      251 Oct 27  2003 .profile
     -r--r--r--   1 root  wheel     4735 Oct 27  2003 COPYRIGHT
     drwxr-xr-x   2 root  wheel     1024 May 29  2004 bin
     drwxr-xr-x   3 root  wheel      512 May 29  2004 boot
     drwxr-xr-x   2 root  wheel      512 May 29  2004 cdrom
     lrwxrwxrwx   1 root  wheel       10 Dec  4 18:52 compat ->  
usr/compat
     drwxr-xr-x   3 root  wheel    18432 Sep 12 14:19 dev
     drwxr-xr-x   2 root  wheel      512 May 29  2004 dist
     drwxr-xr-x  16 root  wheel     2048 Nov 30 09:10 etc
     lrwxrwxrwx   1 root  wheel        9 Dec  4 19:53 home -> /usr/home
     -r-xr-xr-x   1 root  wheel  4264923 Jun  9 09:55 kernel
     -r-xr-xr-x   1 root  wheel  4264923 Jun  9 09:55 kernel.GENERIC
     drwxrwxrwt   2 root  wheel      512 Jul  2 17:28 lost+found
     drwxr-xr-x   2 root  wheel      512 Oct 27  2003 mnt
     drwxr-xr-x   2 root  wheel     4096 Jul  2 15:55 modules
     dr-xr-xr-x  60 root  wheel     1024 Dec  4 19:51 proc
     drwxr-xr-x   3 root  wheel      512 Aug 19 18:40 root
     drwxr-xr-x   2 root  wheel     2048 May 29  2004 sbin
     drwxr-xr-x   4 root  wheel     1024 May 29  2004 stand
     lrwxrwxrwx   1 root  wheel       11 Dec  4 19:54 sys -> usr/src/sys
     drwxrwxrwt   5 root  wheel     2048 Dec  4 17:30 tmp
     drwxr-xr-x  21 root  wheel      512 Oct 30 18:46 usr
     drwxr-xr-x  21 root  wheel      512 Nov 29 08:54 var

I edited /mnt/etc/rc.conf to change the ifconfig to the different IP  
address.

But attempting to boot from the local disks fails. I can't ping the  
machine anymore and don't know where it is hanging since I only have  
remote access. After net-booting back into the rescue mode it doesn't  
look like anything was written to /mnt/var/log/messages during the  
local boot attempt.


How do I verify that the bootstrapping is configured right? Or where  
else am I going wrong?

Thanks for any tips!

Chris



dmesg output after net-booting from the rescue disk:

Copyright (c) 1992-2003 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 4.9-STABLE #0: Sat May 29 16:12:36 CEST 2004
     mw at mailstore02.vianetworks.ch:/data/src/sys/compile/NFSROOT
Timecounter "i8254"  frequency 1193182 Hz
CPU: Intel(R) Pentium(R) 4 CPU 2.80GHz (2790.72-MHz 686-class CPU)
   Origin = "GenuineIntel"  Id = 0xf29  Stepping = 9
    
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE 
,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
real memory  = 1073479680 (1048320K bytes)
avail memory = 1039429632 (1015068K bytes)
Preloaded elf kernel "kernel" at 0xc054c000.
Warning: Pentium 4 CPU: PSE disabled
Pentium Pro MTRR support enabled
md0: Malloc disk
Using $PIR table, 11 entries at 0xc00f28c0
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Intel 82845 Host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
agp0: <Intel 82845 host to AGP bridge> mem 0xf8000000-0xfbffffff at  
device 0.0 on pci0
pcib1: <Intel 82845 PCI-PCI (AGP) bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pcib2: <Intel 82801BA/BAM (ICH2) Hub to PCI bridge> at device 30.0 on  
pci0
pci2: <PCI bus> on pcib2
fxp0: <Intel 82550 Pro/100 Ethernet> port 0xdf00-0xdf3f mem  
0xfeaa0000-0xfeabffff,0xfeafe000-0xfeafefff irq 11 at device 12.0 on  
pci2
fxp0: Ethernet address 00:11:11:15:a7:ce
inphy0: <i82555 10/100 media interface> on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp1: <Intel 82550 Pro/100 Ethernet> port 0xde80-0xdebf mem  
0xfea80000-0xfea9ffff,0xfeafd000-0xfeafdfff irq 10 at device 13.0 on  
pci2
fxp1: Ethernet address 00:11:11:15:a7:d2
inphy1: <i82555 10/100 media interface> on miibus1
inphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
pci2: <ATI Mach64-GR graphics accelerator> at 15.0 irq 11
isab0: <Intel 82801BA/BAM (ICH2) PCI to LPC bridge> at device 31.0 on  
pci0
isa0: <ISA bus> on isab0
atapci0: <Intel ICH2 ATA100 controller> port 0xffa0-0xffaf at device  
31.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
uhci0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> port  
0xef40-0xef5f irq 10 at device 31.2 on pci0
usb0: <Intel 82801BA/BAM (ICH2) USB controller USB-A> on uhci0
usb0: USB revision 1.0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
pci0: <unknown card> (vendor=0x8086, dev=0x2443) at 31.3 irq 9
uhci1: <Intel 82801BA/BAM (ICH2) USB controller USB-B> port  
0xef80-0xef9f irq 6 at device 31.4 on pci0
usb1: <Intel 82801BA/BAM (ICH2) USB controller USB-B> on uhci1
usb1: USB revision 1.0
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
orm0: <Option ROMs> at iomem  
0xc0000-0xc7fff,0xc8000-0xc8fff,0xc9000-0xc9fff,0xca000-0xcafff on isa0
pmtimer0 on isa0
fdc0: cannot reserve interrupt line
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on  
isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
ar0: 117246MB <ATA RAID1 array> [14946/255/63] status: READY subdisks:
  0 READY ad0: 117246MB <Maxtor 6Y120L0> [238216/16/63] at ata0-master  
PIO4
           1 READY ad2: 117246MB <Maxtor 6Y120L0> [238216/16/63] at  
ata1-master PIO4
          Sending DHCP Discover packet from interface fxp0  
(00:11:11:15:a7:ce)
Sending DHCP Discover packet from interface fxp1 (00:11:11:15:a7:d2)
Sending DHCP Discover packet from interface faith0  
(00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00)
Received DHCP Offer packet on fxp0 from X.X.X.12 (accepted) (no root  
path)
Received DHCP Offer packet on fxp0 from X.X.X.12 via X.X.X.1 (ignored)  
(no root path)
Received DHCP Offer packet on fxp0 from X.X.X.12 via X.X.X.2 (ignored)  
(no root path)
Sending DHCP Request packet from interface fxp0 (00:11:11:15:a7:ce)
Received DHCP Ack packet on fxp0 from X.X.X.12 (accepted) (got root  
path)
Received DHCP Ack packet on fxp0 from X.X.X.12 via X.X.X.1 (accepted)  
(got root path)
Received DHCP Ack packet on fxp0 from X.X.X.12 via X.X.X.2 (accepted)  
(got root path)
DHCP timeout for interface fxp1
DHCP timeout for interface faith0
fxp0 at X.X.X.237 server X.X.X.12 via gateway X.X.X.2 boot file pxeboot
subnet mask 255.255.255.240 router X.X.X.225 rootfs  
X.X.X.12:/export/bsdroot/X.X.X.237 hostname deployzone2
Adjusted interface fxp0
Shutdown interface fxp1
Shutdown interface faith0
Mounting root from nfs:X.X.X.12:/export/bsdroot/X.X.X.237
missing device name
setrootbyname failed
NFS ROOT: X.X.X.12:/export/bsdroot/X.X.X.237
arplookup X.X.X.12 failed: host is not on local network



More information about the freebsd-questions mailing list