Subject: Re: netbsd 2.0 no operating system
To: None <netbsd-users@netbsd.org>
From: None <oliverfuchs@onlinehome.de>
List: netbsd-users
Date: 04/08/2005 21:55:02
On Wed, 06 Apr 2005, Nenad Crnko wrote:

> On 04/05/2005 Oliver Fuchs wrote:
> > This whole thing is driving me crazy - I cannot install netbsd on
> > my disk and boot it.

Hi,
first of all I want to say THANK YOU to all who have answered and
spent their time/knowledge on this.
Finally I made it and maybe you are interested in it.
I have two hard disk system with wd0= windowsxp and wd1=netbsd 2.0.
My first harddrive (40G) is set in the BIOS via automode (master) and
the second one via automode (slave).
Before I originally installed on wd1 netbsd 1.6.1 I had FreeBSD 5.3
running on it. In the sysinst of netbsd 1.6.1 I selected the option to
use the whole disk and edited the partitions per custom.
Perfectly working (even the bootselector on wd0).
Now I wanted to do a fresh install with netbsd 2.0 and deleted netbsd
1.6.1 on wd1: and that was a big mistake. I really tried everything
that was here suggested but I could not get the system to be booted
(see below). Finally I ran  sysinstall from the FreeBSD 5.3 install cd
to partition the wd1 again (with a FreeBSD partition) and saved the
configration to the disk.
After that I installed 1.6.1 again - and it worked. After that I did a
upgrade to netbsd 2.0: And here I am - it is running.
Strange: But according to an earlier message I want to give my new
datas og disklabel wd1a and sysctl machdep.diskinfo:
1) disklabel wd1a:
# /dev/rwd1d:
type: unknown
disk: mydisk
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 156301488
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0		# microseconds
track-to-track seek: 0	# microseconds
drivedata: 0 
16 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:   2048193        63     4.2BSD   1024  8192    86  # (Cyl.      0*-   2031)
 b:   1051344   2048256       swap                     # (Cyl.   2032 -   3074)
 c: 156301425        63     unused      0     0        # (Cyl.      0*- 155060)
 d: 156301488         0     unused      0     0        # (Cyl.      0 - 155060)
 e:   2047248   3099600     4.2BSD   1024  8192    86  # (Cyl.   3075 -   5105)
 f:   2048256   5146848     4.2BSD   1024  8192    86  # (Cyl.   5106 -   7137)
 g:  71679888   7195104     4.2BSD   1024  8192    86  # (Cyl.   7138 -  78248)
 h:  77426496  78874992     4.2BSD   1024  8192    86  # (Cyl.  78249 - 155060)

2) sysctl machdep.diskinfo:

machdep.diskinfo: 80:78156225(1024/255/63),2 81:156296385(1024/255/63),2  wd0:80 wd1:81

> Something went wrong with your installation or subsequent setup.
> NetBSD is perfectly capable of booting from any disk sufficiently
> supported by BIOS.
> 
> Before doing anything described below make sure that you have a
> reliable backup of anything you can not miss from either of the
> disks. A finger slippage or other force majeure may cause complete
> loss of all the data from both disks.
 I did a tar on the whole system do wd0 - that was no problem to get
 the datas back.

> Let's make sure all the ingredients are in place. On wd0 you will
> neeed a boot selector that comes from /usr/mdec/mbr_bootsel, and on
> disk wd1 "standard boot sector", disklabel, and bootblocks matching
> your file system in NetBSD partition "a". If you have or plan to
> have more than one OS on wd1 you will need the bootselector on wd1
> as well.
> 
> Step 1: Initialize the bootselector in mbr on disk wd0. The subject
> is described in man (8) mbr and in man (1) fdisk. Note that the
> following will not change partition information, which is located in
> last 4 * 16 + 2 bytes of sector 0.
> 
>            # fdisk -i wd0
>   >>>      Update the bootcode from /usr/mdec/mbr? [n] y<CR>
> 
>            We haven't written the MBR back to disk yet.  This is
>            your last chance.
>   >>>      Should we write new partition table? [n] y<CR>
> 
>         This replaces the mbr boot code in sector 0 with standard
>         bootloader.

I have done it exactly how you describe it.

> Step 2: Reinstall bootselector from /usr/mdec/mbr_bootsel:
> 
>            # fdisk -B wd0
> 
>            Installed bootfile doesn't support required options.
>   >>>      Update the bootcode from /usr/mdec/mbr_bootsel? [n] y<CR>
> 
>            Boot selector configuration: Timeout value (0 to 3600
>            seconds, -1 => never): [-1..3600 default: 10] Select the
>            default boot option. Options are:
> 
>            0: The first active partition 1: Harddisk 0 2: Harddisk 1
>            3: Harddisk 2
>   >>>      Default boot option: [0..3 default: 0] 2<CR>
> 
>            We haven't written the MBR back to disk yet.  This is
>            your last chance.
>   >>>      Should we write new partition table? [n] y<CR>
> 
>         The selection causes default boot from disk wd1.

The same here - exactly what I did

> Step 3: Examine or update the boot menu entries appearing during
> boot. Leave any partition geometry numbers unchanged:
> 
>            # fdisk -u wd0 Disk: /dev/rwd0d NetBSD disklabel disk
>            geometry: cylinders: 79656, heads: 16, sectors/track: 63
>            (1008 sectors/cylinder) total sectors: 80293248
> 
>            BIOS disk geometry: cylinders: 1024, heads: 255,
>            sectors/track: 63 (16065 sectors/cylinder) total sectors:
>            80293248
> 
>            Do you want to change our idea of what BIOS thinks? [n] 
> 
>            Partition table: 0: Primary DOS with 32 bit FAT (sysid
>            11) start 63, size 2104452 (1028 MB, Cyls 0-131) 1:
>            <UNUSED> 2: <UNUSED> 3: <UNUSED> Bootselector enabled,
>            timeout 10 seconds.
>   >>>      Which partition do you want to change?: [none] 0<CR>
>            The data for partition 0 is: Primary DOS with 32 bit FAT
>            (sysid 11) start 63, size 2104452 (1028 MB, Cyls 0-131)
>            sysid: [0..255 default: 11] start: [0..4998cyl default:
>            63, 0cyl, 0MB] size: [0..4998cyl default: 2104452,
>            131cyl, 1028MB] 
>   >>>      bootmenu: [] Win98
> 
>            Partition table: 0: Primary DOS with 32 bit FAT (sysid
>            11) bootmenu: Win98 start 63, size 2104452 (1028 MB, Cyls
>            0-131) 1: <UNUSED> 2: <UNUSED> 3: <UNUSED> Bootselector
>            enabled, timeout 10 seconds.  Which partition do you want
>            to change?: [none] 
> 
>            We haven't written the MBR back to disk yet.  This is
>            your last chance.  Partition table: 0: Primary DOS with
>            32 bit FAT (sysid 11) bootmenu: Win98 start 63, size
>            2104452 (1028 MB, Cyls 0-131) 1: <UNUSED> 2: <UNUSED> 3:
>            <UNUSED> Bootselector enabled, timeout 10 seconds.
>            Should we write new partition table? [n] y
> 
>         Note that the "bootmenu" line now appears for partition 0
>         You can examine the information at any time with "fdisk wd0"
>         Now you are done with disk wd0.
> 
>         Once this is accomplished, you can change boot parameters at
>         any time by "fdisk -B wd0"

Yep - that was also tried.

> Step 4: Make sure setup on disk wd1 is ok:
> 
>           # fdisk -i wd1 Update the bootcode from
>           /usr/mdec/mbr_bootsel? [n] y
> 
>           We haven't written the MBR back to disk yet.  This is your
>           last chance.  Should we write new partition table? [n] y
> 
> Step 5: From your message
> http://mail-index.netbsd.org/netbsd-users/2005/04/05/0003.html it
> appears that NetBSD disklabel is at least selfconsistent and likely
> to be correct.  So just make sure that bootblocks are in order - see
> man (8) installboot (assuming that type of the file system on wd1a
> is ffsv1):
> 
>           # cp /usr/mdec/boot /boot # installboot /dev/rwd0a
           # cp /usr/mdec/boot /boot # installboot /dev/rwd1a
	   # (corrected by your later mail)
>           /usr/mdec/bootxx_ffsv1
> 
>         This should be enough to make wd1 bootable.

And here is a point where I cannot follow: I am running sysinst of
netbsd2.0 and I expect that it can install a running netbsd system
without doing this procedure of installboot.
In any case I did the installboot and ended up with nothing (as far as
I can remember the installboot failed with "it is not supported" when
I "mnt dev/wd1a mnt2". So ...

> Step 6: Make sure /etc/fstab has correct entries, at least the
> following two:
> 
>         /dev/wd1a / ffs rw 1 1 /dev/wd1b none swap sw 0 0
>         
>         Note that the device names in your setup should refer to
>         wd1.
> 
>         Also make sure /dev/ is populated, otherwise do # cd /dev/ #
>         ./MAKEDEV all
> 
> 
> If disk wd1 is setup correctly and wd0 is not, you should still be
> able to boot from the installation cd, interrupt the loader and #
> boot hd1a:
> 
> I hope this helps.

That was a great description and howto - a lot of work and time you
spent here - ans a lot of thanks back to you. Sadly that it was not
working - a last thought: could it be that the mbr was writen wrong?

Oliver
-- ... don't touch the bang bang fruit