Subject: bootinstall fails to install bootstrap
To: NetBSD users <netbsd-users@NetBSD.org>
From: Ivan Kanis <cake@tadpolecomputer.co.uk>
List: netbsd-users
Date: 01/12/2006 15:01:33
Hello,

I am writing a script to network install a load of NetBSD on our
machines. It is an automatic install so I can't use sysinst.

I am having a problem with the bootinstall program. I expect it to
write the primary boostrap file bootxx_ffsv1 somewhere between sector
2 and 63 of the hard disk.

I have put a script to reproduce the problem. The script will ouptut a
hexdump of the first 64 sectors and you should see that the primary
bootstrap is missing.

After the script I have pasted the dump of a system setup with
sysinst. Note the chunk that starts with <.NetBSD20 should be missing
with the script.

I can't figure out why it's not working. Any help or suggestions would
be greatly appreciated! Thank you.

#!/bin/ksh
set -x

if [ -z "$1" ]; then
	echo Please specify hard disk you want to install to:
	echo install wd0
	exit
fi

dd if=/dev/zero of=/dev/wd0d count=64
# install MBR, make first partition active
fdisk -a -i $1 <<EOF
y
0
y
y
y
EOF

# size first partition to take the whole disk
fdisk -0 -u $1 <<EOF
n
169
63


y
EOF

# 
disklabel -I -i $1 <<EOF
b
swap
63
400M
a
4.2BSD
b
$
c
unused
63
$
d
unused
0
$
W
y
Q
EOF

# install first stage boot loader
installboot -v /dev/r$1a /usr/mdec/bootxx_ffsv1

dd if=/dev/wd0d count=64 | hexdump -C | less
exit


# dd if=/dev/wd0d count=64 | hexdump -C
00000000  31 c0 8e d0 bc 00 7c 8e  c0 8e d8 89 e6 bf 00 06  |1.....|.........|
00000010  b9 00 01 f3 a5 b9 00 02  f3 ab ea 1f 06 00 00 80  |................|
00000020  fa 8f 7e 02 b2 80 52 52  be 1f 07 e8 4a 01 bb 94  |..~...RR....J...|
00000030  07 8d af 2a 00 8a 46 04  84 c0 74 0a 80 7e 00 80  |...*..F...t..~..|
00000040  75 04 89 2e 84 0b 83 c5  10 83 c3 09 80 fb b8 75  |u..............u|
00000050  e4 b8 e1 00 c1 e0 02 89  c6 8b b4 00 08 85 f6 75  |...............u|
00000060  19 b8 2f 07 be 15 07 e8  14 01 89 c6 e8 09 01 5a  |../............Z|
00000070  31 c0 cd 13 cd 18 fb f4  eb fc 66 8b 6c 08 f6 06  |1.........f.l...|
00000080  91 07 04 75 43 5a 52 b4  08 cd 13 8b 44 02 50 c0  |...uCZR.....D.P.|
00000090  e8 06 86 c4 c1 ea 08 42  f7 e2 8a 54 01 01 d0 83  |.......B...T....|
000000a0  e1 3f f7 e1 5a 83 e2 3f  01 d0 48 39 e8 74 47 bb  |.?..Z..?..H9.tG.|
000000b0  aa 55 b4 41 5a 52 cd 13  b8 67 07 72 a7 81 fb 55  |.U.AZR...g.r...U|
000000c0  aa 75 a1 f6 c1 01 74 9c  66 89 2e 0d 07 be 05 07  |.u....t.f.......|
000000d0  b4 42 5a 52 cd 13 b8 43  07 72 89 a0 00 7c 84 c0  |.BZR...C.r...|..|
000000e0  74 03 a1 fe 7d 3d 55 aa  b8 53 07 0f 85 75 ff 66  |t...}=U..S...u.f|
000000f0  89 ee 5a e9 0a 75 5a 8a  74 01 8b 4c 02 bb 00 7c  |..Z..uZ.t..L...||
00000100  b8 01 02 eb ce 10 00 01  00 00 7c 00 00 00 00 00  |..........|.....|
00000110  00 00 00 00 00 45 72 72  6f 72 20 00 0d 0a 00 4e  |.....Error ....N|
00000120  65 74 42 53 44 20 4d 42  52 20 62 6f 6f 74 00 4e  |etBSD MBR boot.N|
00000130  6f 20 61 63 74 69 76 65  20 70 61 72 74 69 74 69  |o active partiti|
00000140  6f 6e 00 44 69 73 6b 20  72 65 61 64 20 65 72 72  |on.Disk read err|
00000150  6f 72 00 4e 6f 20 6f 70  65 72 61 74 69 6e 67 20  |or.No operating |
00000160  73 79 73 74 65 6d 00 49  6e 76 61 6c 69 64 20 43  |system.Invalid C|
00000170  48 53 20 72 65 61 64 00  e8 03 00 be 1c 07 60 ac  |HS read.......`.|
00000180  b4 0e bb 01 00 cd 10 ac  84 c0 75 f4 61 c3 00 00  |..........u.a...|
00000190  1c 80 b6 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 e1 b5 80 01  |................|
000001c0  01 00 a9 fe ff ff 3f 00  00 00 c1 52 a8 04 00 00  |......?....R....|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
64+0 records in
64+0 records out
00007e00  eb 3c 90 4e 65 74 42 53  44 32 30 89 e6 bf 00 06  |.<.NetBSD20.....|
32768 bytes transferred in 0.094 secs (348595 bytes/sec)
00007e10  b9 00 01 f3 a5 b9 00 02  f3 ab ea 1f 06 00 00 80  |................|
00007e20  fa 8f 7e 02 b2 80 52 52  be 1f 07 e8 4a 01 bb 94  |..~...RR....J...|
00007e30  07 8d af 2a 00 8a 46 04  84 c0 74 0a 80 7e 31 c0  |...*..F...t..~1.|
00007e40  8e d8 8e c0 8e d0 bc fc  ff 52 cd 13 5a b9 01 00  |.........R..Z...|
00007e50  88 ee e8 f2 00 66 31 ed  66 8b 07 66 3b 06 00 7c  |.....f1.f..f;..||
00007e60  74 70 66 31 db 66 31 c9  bf be 07 8a 45 04 66 8b  |tpf1.f1.....E.f.|
00007e70  6d 08 66 03 2e a3 7d 3c  a9 75 0a 66 85 f6 74 54  |m.f...}<.u.f..tT|
00007e80  66 39 ee 74 4f 3c 05 74  08 3c 0f 74 04 3c 85 75  |f9.tO<.t.<.t.<.u|
00007e90  04 66 8b 4d 08 83 c7 10  81 ff fe 07 75 cd 67 e3  |.f.M........u.g.|
00007ea0  15 66 85 db 75 03 66 87  d9 66 01 d9 66 89 0e a3  |.f..u.f..f..f...|
00007eb0  7d e8 84 00 eb af 66 85  f6 b8 77 7d 74 4c 66 31  |}.....f...w}tLf1|
00007ec0  f6 66 89 36 a3 7d e9 37  ff 8a 75 01 8b 4d 02 e8  |.f.6.}.7..u..M..|
00007ed0  75 00 eb 4e 66 89 2e a3  7d 66 85 db 75 41 52 b4  |u..Nf...}f..uAR.|
00007ee0  08 cd 13 8b 45 02 50 c0  e8 06 86 c4 c1 ea 08 42  |....E.P........B|
00007ef0  f7 e2 8a 55 01 01 d0 83  e1 3f f7 e1 5a 83 e2 3f  |...U.....?..Z..?|
00007f00  01 d0 48 5a 39 e8 74 c1  eb 15 50 be 50 7d e8 7a  |..HZ9.t...P.P}.z|
00007f10  00 5e e8 76 00 be 57 7d  e8 70 00 fb f4 eb fc e8  |.^.v..W}.p......|
00007f20  16 00 66 81 3e 04 0a d1  b6 86 78 b8 64 7d 75 da  |..f.>.....x.d}u.|
00007f30  66 89 ee ea 00 0a 00 00  60 be 9b 7d b4 42 cd 13  |f.......`..}.B..|
00007f40  61 b8 5a 7d 72 c4 c3 bb  00 06 60 b8 0f 02 eb ee  |a.Z}r.....`.....|
00007f50  45 72 72 6f 72 20 00 0d  0a 00 44 69 73 6b 20 72  |Error ....Disk r|
00007f60  65 61 64 00 4e 6f 74 20  61 20 62 6f 6f 74 78 78  |ead.Not a bootxx|
00007f70  20 69 6d 61 67 65 00 4e  6f 20 4e 65 74 42 53 44  | image.No NetBSD|
00007f80  20 70 61 72 74 69 74 69  6f 6e 00 60 ac b4 0e bb  | partition.`....|
00007f90  01 00 cd 10 ac 84 c0 75  f4 61 c3 10 00 0f 00 00  |.......u.a......|
00007fa0  06 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00007fb0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 80 01  |................|
00007fc0  01 00 a9 fe ff ff 3f 00  00 00 c1 52 a8 04 00 00  |......?....R....|
00007fd0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00007ff0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00008000
# 
-- 
Ivan Kanis
Senior Software Developer
Tadpole Computer Limited
Tel: +44 (0) 870 432 4161

  "Life is not about finding our limitations, it's about finding our
infinity."
    -- Herbie Hancock