screwing over a fucked bootloader

problem:

 u got grub, lilo or something in your partitions but the shit doesnt boot

solution:

 fuck the harddisks MBR over to get a bootmenu that boots any fuckin partition, regardless of whats inside

how-to-repeat:


DISCLAIMER: if you wipe your harddisk(s) trying this its your dogdamn own fault.
also, dos partition labels only. no idea if this works on gpt.

NOTE: this snippet was almost finished but got fucked up on the way. it prolly sounded nicer before.

entering:

some FreeBSD bootmedium (ie. a freesbie image if that works for you or maybe something more recent: a CD, Stick etc)

boot the thing and get root.

make your mind up about which disk you want to replace the MBR of.
if there is just one disk in the box, and this is a PATA disk connected as master on the first bus, the bios will likely call it 0x80 (0x81 for the 2nd etc.).
also, in this case the os will likely call it ad0.

knowing the disks name in terms of bios and OS numbering will help in hitting the right disk.

making the mbr writable:

  sysctl kern.geom.debugflags=0x10

write a new mbr without affecting the partitions on it:

  boot0cfg -B -v -d 0x80 ad0

if everything went well, on next reboot you'll be greeted with a little chooser for booting.