Solved [Re: delete first partition XP and reformat as ufs -> kernel not found]

Dorin H bj93542 at yahoo.com
Tue Dec 16 09:23:09 PST 2003


--- Dan Strick <strick at covad.net> wrote:
> On Mon, 1 Dec 2003, Dorin H <bj93542 at yahoo.com>
> wrote:
<snip>
> > If no RTFM is available, point me to the source
> files.
> > I am not familiar with the FreeBSD kernel sources,
> but
> > I'll have no problem reading some code.
> >>
> 
<snip>
> This may not be exactly correct.  See the section 8
> man page for boot.
> (i.e. Do "man boot".)  The source is in
> /usr/src/sys/boot/i386.
> 

The information is there (boot(8)). Thank you for
reminding me that 10 minutes spent reading the whole
man page saves some hours of hair-pulling struggle.

> 
> If I understand this and your previous emails on
> this subject,
> you began with this MBR partition/slice table
> arrangement:
> 
> 	ad0s1  XP
> 	ad0s2  FreeBSD
> 
> and everything worked fine.
> Then you changed the MBR partitions to:
> 
> 	ad0s1  XP
> 	ad0s2  Debian swap
> 	ad0s3  Debian /
> 	ad0s4  FreeBSD
> 
> and FreeBSD would not boot correctly because the
> file /etc/fstab,
> created during the initial FreeBSD installation
> process, still had
> "/dev/ad0s2" where it now needed to have
> "/dev/ad0s4" because you
> renumbered its MBR partition.  Then you fixed that
> and everything
> seemed to work fine until you decided to reuse the
> XP partition
> for more FreeBSD disk space.  So you changed your
> MBR partition
> table to:
> 
> 	ad0s1  FreeBSD  (addtitional file system space)
> 	ad0s2  Debian swap
> 	ad0s3  Debian /
> 	ad0s4  FreeBSD  (the operating system)
> 
> and FreeBSD would no longer boot.  This might be due
> to boot1
> confusion.  Each partition in the MBR has a flag
> byte and a type
> byte.  The 0x80 bit in the flag byte marks the
> partition as "active".
> Normally at most one partition has the active bit
> set.
> A non-interactive MBR bootstrap program typically
> boots whichever
> partition has the active bit set.
> 

I couldn't present it better. And yes, the problem was
due to order of partitions marked as bootable:

BOOTABLE ad0s1  FreeBSD  (not used)
         ad0s2  Debian swap
         ad0s3  Debian /
BOOTABLE ad0s4  FreeBSD  (the operating system)

Trying to boot ad0s1 failed of course.
At the promp:

>> FreeBSD/i386 BOOT
Default: 0:ad(0,a)/kernel
boot:

I did again the experiment:
1. marked ad0s1 as bootable
2. reboot
3. again the promt (from which the slice info is
missing ! that tricked me)

Supplying this solve the booting problem!
             |        
            vvv
boot: 0:ad(0,4,a)/kernel 

(Still pending: I have to see how can I make it find
the loader.conf also :)  )

> The FreeBSD boot1 program, the program loaded by the
> MBR bootstrap,
> is not hardwired with the number of the MBR
> partition in which it was
> installed (perhaps it ought to be).  
> Instead it uses
> the first MBR
> partition of FreeBSD type with the active bit set. 
> If no FreeBSD MBR
> partition has the active bit set, the boot1 program
> chooses the first
> FreeBSD MBR partition.  This normally works
> correctly even if you have
> more than one bootable FreeBSD MBR partition because
> the FreeBSD boot0
> MBR program normally rewrites the MBR record with
> the appropriate
> active bit set before it invokes the FreeBSD boot1
> program.
> 
> You say that you are using Debian lilo for your MBR
> bootstrap program
> rather than the FreeBSD boot0 program.  

Totally new to FreeBSD boot process, so using Debian
LILO felt "safer" at that time.

> I don't know
> much about lilo,
> but I am guessing that it does not set the active
> partition in the MBR
> partition table before it boots a partition.  Then
> the boot1 program
> tries to load the boot2 program from ad0s1 instead
> of ad0s4.

I will try investigate the problem. Though I remember
reading something like this somewhere... I can't find
the source to mention it here.

> 
> Workaround: you can make ad0s4 the only active
> FreeBSD partition with
> the fdisk program.  If nothing else changes that,
> boot1 will correctly
> boot ad0s4.

Yes, the workaround is correct. It was the solution.

Thank you for your explanations,
/Dorin.

PS. It is so nice to be able to compile again the
ports stuff on my machine :)
(ad0s1a = /usr/ports, ad0s1d=/usr/src ;) )


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/


More information about the freebsd-questions mailing list