linux + freebsd + grub2 = utter failure

American_Peanut

New Member


Messages: 6

Hi. I did it in the past and everything worked seemlessly. Just upgraded grub syntax to grub2 and didn't even copy my 40_custom file, cos I thought it was so easy. But no luck this time around. The only difference is I now squeezed 2 distros (kubuntu and opensuse) on my extended partition. FreeBSD is on 4th slice. The partition layout:

Code:
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8f70365b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              13       52217   419328000    7  HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3           52217      146763   759434241    f  W95 Ext'd (LBA)
Partition 3 does not end on cylinder boundary.
/dev/sda4   *      146763      186056   315621328   a5  FreeBSD
Partition 4 does not end on cylinder boundary.
/dev/sda5           52217       53001     6290432   82  Linux swap / Solaris
/dev/sda6           53001       62138    73399296   83  Linux
/dev/sda7           62139       81719   157283328   83  Linux
/dev/sda8           81720       88247    52427776   83  Linux
/dev/sda9           88247       89551    10480640   83  Linux
/dev/sda10          89552      104434   119546880   83  Linux
/dev/sda11         104435      109414    39999488   83  Linux
/dev/sda12         109414      126844   139999232   83  Linux
/dev/sda13         126844      131823    39999488   83  Linux
/dev/sda14         131823      134313    19998720   83  Linux
/dev/sda15         134313      146763    99998720   83  Linux
Now, the old grub entry was:
Code:
title           FreeBSD
rootnoverify    (hd0,a)
chainloader +1
The grub2 entry looks sth like:
Code:
 menuentry "FreeBSD 8.2" {
  insmod part_msdos
  insmod ext2
  set root=(hd0,msdos4,bsd1)[color="Red"]<--partition not recognised[/color] or set root=(hd0,4)[color="Red"]<---cannot find kernel[/color]
  chainloader +1
During FreeBSD install I chose "don't install any bootloader" option. Does it mean chainloading is not possible? I'm pretty sure I did this last time to and everything worked ok. But I may be wrong. What if I install FreeBSD bootloader, will it wipe out Windoze bootloader? How do I install bootloader without affecting MBR? I read that FreeBSD is supposed to be natively supported in grub2. If so, why isn't it recognised?
 

francis

Member

Reaction score: 37
Messages: 90

Hi, I see that you have Linux, Windows and now FreeBSD. As always with similar situations and problems with grub, especially version 2, I recommend EasyBCD which will help you to control of your bootloader and you should be able to setting up and configuring a dual-boot between Linux, Windows and BSD systems.
I hope that it will help you somehow. Good luck!
 
OP
OP
A

American_Peanut

New Member


Messages: 6

Thanks for your response. I'm not interested in commercial bootloaders, especially that grub and grub2 have already proven to be able to boot FreeBSD. The problem is I've just forgotten what settings I used. Does anybody know whether I need to install FreeBSD bootloader to be able to chainload FreeBSD?
 

francis

Member

Reaction score: 37
Messages: 90

If it is about EasyBCD - as you wish. Chainloader is a "clasical" way to boot. In this way we can load almost every system. With the FreeBSD bootloader, we let GRUB to "catch" partitions and load located there /boot/loader.
When it comes to your question - I also think that it is better to set None option (during install, responsible for leave MBR untouched) especially if you want to load FreeBSD via GRUB used by your already installed Linux distribution. But I could be wrong. Just for example;

Chainloader
Code:
menuentry "FreeBSD (chainloader)" {
	set root=(hd0,2,a)
	chainloader +1
}
FreeBSD bootloader
Code:
menuentry "FreeBSD (/boot/loader)" {
	insmod ufs2
	set root=(hd0,2,a)
	kfreebsd /boot/loader
}
In this example, FreeBSD is on the partition /dev/sda2 (in Linux nomenclature). GRUB2 defines it as (hd0,2). FreeBSD main partition is /dev/ad4s2a, which in GRUB2 is (hd0,2,a). In this example, whole configuration is done by adding an entry to the 40_custom file (at the end of file), and of course run # sudo update-grub

More info can be found Boot FreeBSD using GRUB, Setup and use GNU/Grub bootloader, and Trouble chainloading FreeBSD with GRUB2. Maybe you will find out, how you did it last time? Good luck!
 
OP
OP
A

American_Peanut

New Member


Messages: 6

Ok, to my logic it seems chainloading can't work if there is no FreeBSD bootloader to call. I tried everything so far to no avail. I think I have no option but to reinstall FreeBSD together with interactive bootloader then setup grub and that should work. Hopefully that won't murder Windows. Any last ditch advice?
 
OP
OP
A

American_Peanut

New Member


Messages: 6

Wait a sec, what would be if during FreeBSD install I set up FreeBSD partition as bootable (active)? Would it make other systems non-bootable? Would it alter MBR?
 
OP
OP
A

American_Peanut

New Member


Messages: 6

Ok, the failure got even utterer ;-) I setup grub from OpenSUSE 11.4 and everything went smoothly without errors, but now my PC freezes at grub command line. Splendid! Thanks for all the help. I'll get back to it next week.
 
OP
OP
A

American_Peanut

New Member


Messages: 6

Ok, solved. For some reason FreeBSD wouldn't boot when its slice was located after an extended partition with 15 logical partitions. When the extended p. is the last p. then everything is fine. Although that didn't make any difference with only 6 logical partitions, hence my initial confusion.
 

user0

Member

Reaction score: 3
Messages: 88

Not working for me.

My Linux is on a SATA HDD in port 1 and FreeBSD is on a SATA HDD in port 2.

Linux thinks its hdd is sda and that FreeBSD is sdb.
I tried this menu entry:

Code:
menuentry "FreeBSD 10.0"{
    insmod ufs2
    # search --no-floppy --file /boot/loader
    set root=(hd1,gpt2) # also tried (hd1,2) and playing with the numbers
    kfreebsd /boot/loader
}
but every time it says 'invalid hdd' or 'invalid signature'.
 

TiberiusDuval

Member

Reaction score: 6
Messages: 71

Why you don't use good old chainloader system? At least for me it still works like charm. Grub is ubuntu's Grub2, and BSD system is PC-BSD 10. I think it should work with normal FreeBSD also.
 

user0

Member

Reaction score: 3
Messages: 88

I would if it worked! But I tried configs from the google seraches containing chainloader + as the last line and none worked with the exact same errors: invalid disk, invalid signature...
What config would you suggest in my case (2nd hdd, default partitioning: 1 boot, 2 root, 3 swap)?
 

TiberiusDuval

Member

Reaction score: 6
Messages: 71

My Ubuntu's Grub2 uses this in /etc/grub.d/40_custom:
Code:
menuentry "PC-BSD 10.0" {
set root='(hd1,1)'
chainloader +1
}
As you see PC-BSD is on second hard disk. There is single zpool using whole disk, ZFS version is that used in FreeBSD 10, and grub launches FreeBSD's own BTX loader.
 

user0

Member

Reaction score: 3
Messages: 88

Yeah, that's one of the configs I tried. Does not work, and playing with the numbers in root directive did not help. Always invalid disk/invalid signature. Does this have to do with lack of kernel module for UFS in Fedora 19? Or grub2 does not need a kernel UFS module?
 

TiberiusDuval

Member

Reaction score: 6
Messages: 71

Where does it fail? Does Grub give you error message, or is it FreeBSD's boot loader? I once managed to break that one after upgrading zfs to newest supported version.
 

user0

Member

Reaction score: 3
Messages: 88

Grub says 'invalid disk' or 'invalid signature' depending on what is the number after comma.
When I use 2 as / partition is 2nd on the disk it says invalid signature, for all other values it says invalid disk drive or something like that.
 

TiberiusDuval

Member

Reaction score: 6
Messages: 71

Does FreeBSD start when you set it's hd as first booting device? By the way seems to me that lot of people are having similar problems with Fedora.
 

user0

Member

Reaction score: 3
Messages: 88

Oh, yes, it starts just fine if I use F12 key in BIOS to get into the boot menu instead of Fedora's grub2.
 
Top