Subject: port-i386/29646: Cannot boot when the first DOS partition is not the boot partition
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <juan@xtraeme.nopcode.org>
List: netbsd-bugs
Date: 03/10/2005 06:24:00
>Number:         29646
>Category:       port-i386
>Synopsis:       Cannot boot when the first DOS partition is not the boot partition
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 10 06:24:00 +0000 2005
>Originator:     Juan RP
>Release:        NetBSD 2.99.16
>Organization:
oi!
>Environment:
System: NetBSD Mandylion 2.99.16 NetBSD 2.99.16 (GATEWAY_) #1: Mon Mar 7 21:10:18 CET 2005 juan@Mandylion:/home/juan/build/obj/sys/arch/i386/compile/GATEWAY_ i386
Architecture: i386
Machine: i386
>Description:
	My current DOS partition table is:

Partition table:
0: NTFS, OS/2 HPFS, QNX2 or Advanced UNIX (sysid 7)
    start 63, size 30234267 (14763 MB, Cyls 0-1882)
1: Extended partition (sysid 5)
    start 132648705, size 27437823 (13397 MB, Cyls 8257-9964/236/1)
2: Primary DOS with 32 bit FAT - LBA (sysid 12)
    start 91682955, size 40965750 (20003 MB, Cyls 5707-8257)
3: NetBSD (sysid 169)
    start 30234330, size 61448625 (30004 MB, Cyls 1882-5707), Active
Extended partition table:
E0: NetBSD (sysid 169)
    start 132648768, size 8193087 (4001 MB, Cyls 8257-8767)

	My NetBSD system lives in the partition 3, and partition 1 was empty,
	so I created a new partition with ID 169 (NetBSD) to play with Xen,
	all worked fine, except when booting.

	I'm using GNU Grub to boot multiple systems, when the partition 1
	was a normal NetBSD type (ID 169), the system cannot boot, it just hangs.
	After reinstalling the bootstrap code with installboot(8) into
	wd0a, a message appeared: "not a bootxx image".

	When I created the extended partition, the system booted correctly.
	Looks like the boot code tries to use the first NetBSD partition on the
	disk (not really useful in this case).

>How-To-Repeat:
>Fix:
	Rewrite the boot code to find the correct boot partition, and not
	the first NetBSD partition in the DOS partition table.