PDA

View Full Version : [ubuntu] Grub 2 problem with FreeBSD-8.0



leftys
December 14th, 2010, 06:23 PM
I just installed FreeBSD-8.0 in a partition where I used to have Windows 7(the installation did not harm the MBR). After the setup, I rebooted and logged-in Ubuntu from the Grub menu. I went to /boot/grub/grub.cfg to add an entry for FreeBSD:



menuentry "freebsd 8.0" {
set root=(hd0,2,a)
chainloader +1
}


Rebooted, and to my great surprise the Grub menu wouldn't appear. Only a blinking '_' for a few seconds, and then the computer booted in Ubuntu. So I run

#update-grub to restore grub.cfg to it's previous condition. But the menu would not appear again.

Here is my RESULTS.txt from running boot info script:


Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #2 for (,msdos2)/boot/grub.

sda1: __________________________________________________ _______________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sda5: __________________________________________________ _______________________

File system: swap
Boot sector type: -
Boot sector info:

sda2: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 10.10
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda3: __________________________________________________ _______________________

File system: ufs
Boot sector type: Unknown
Boot sector info:
Mounting failed:
mount: wrong fs type, bad option, bad superblock on /dev/sda3,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so


=========================== Drive/Partition Info: =============================

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 2,046 3,905,535 3,903,490 5 Extended
/dev/sda5 2,048 3,905,535 3,903,488 82 Linux swap / Solaris
/dev/sda2 3,905,536 193,486,859 189,581,324 83 Linux
/dev/sda3 * 193,486,860 234,441,647 40,954,788 a5 FreeBSD


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda10 ufs
/dev/sda1: PTTYPE="dos"
/dev/sda2 8335f55f-e323-4dd9-9538-2d540d2386e4 ext4
/dev/sda3 ufs
/dev/sda5 5c5aab13-974c-4769-9277-3b46527685e0 swap
/dev/sda6 ufs
/dev/sda8 ufs
/dev/sda9 ufs
/dev/sda: PTTYPE="dos"

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sda2 / ext4 (rw,errors=remount-ro,commit=0)


=========================== sda2/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 8335f55f-e323-4dd9-9538-2d540d2386e4
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 8335f55f-e323-4dd9-9538-2d540d2386e4
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 8335f55f-e323-4dd9-9538-2d540d2386e4
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=8335f55f-e323-4dd9-9538-2d540d2386e4 ro quiet splash
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 8335f55f-e323-4dd9-9538-2d540d2386e4
echo 'Loading Linux 2.6.35-23-generic ...'
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=8335f55f-e323-4dd9-9538-2d540d2386e4 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-23-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 8335f55f-e323-4dd9-9538-2d540d2386e4
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 8335f55f-e323-4dd9-9538-2d540d2386e4
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

=============================== sda2/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda2 during installation
UUID=8335f55f-e323-4dd9-9538-2d540d2386e4 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=5c5aab13-974c-4769-9277-3b46527685e0 none swap sw 0 0

=================== sda2: Location of files loaded by Grub: ===================


23.6GB: boot/grub/core.img
47.3GB: boot/grub/grub.cfg
18.4GB: boot/initrd.img-2.6.35-23-generic
23.7GB: boot/vmlinuz-2.6.35-23-generic
18.4GB: initrd.img
23.7GB: vmlinuz
=========================== Unknown MBRs/Boot Sectors/etc =======================

Unknown BootLoader on sda3

00000000 eb 3c 00 00 00 00 00 00 00 00 00 00 02 00 00 00 |.<..............|
00000010 00 00 00 00 00 00 00 00 12 00 02 00 00 00 00 00 |................|
00000020 00 00 00 00 00 16 1f 66 6a 00 51 50 06 53 31 c0 |.......fj.QP.S1.|
00000030 88 f0 50 6a 10 89 e5 e8 c0 00 8d 66 10 cb fc 31 |..Pj.......f...1|
00000040 c9 8e c1 8e d9 8e d1 bc 00 7c 89 e6 bf 00 07 fe |.........|......|
00000050 c5 f3 a5 be ee 7d 80 fa 80 72 2c b6 01 e8 60 00 |.....}...r,...`.|
00000060 b9 01 00 be be 8d b6 01 80 7c 04 a5 75 07 e3 19 |.........|..u...|
00000070 f6 04 80 75 14 83 c6 10 fe c6 80 fe 05 72 e9 49 |...u.........r.I|
00000080 e3 e1 be a2 7d eb 4b 31 d2 89 16 00 09 b6 10 e8 |....}.K1........|
00000090 2e 00 bb 00 90 8b 77 0a 01 de bf 00 c0 b9 00 ae |......w.........|
000000a0 29 f1 f3 a4 fa 49 74 14 e4 64 a8 02 75 f7 b0 d1 |)....It..d..u...|
000000b0 e6 64 e4 64 a8 02 75 fa b0 df e6 60 fb e9 50 13 |.d.d..u....`..P.|
000000c0 bb 00 8c 8b 44 08 8b 4c 0a 0e e8 5a ff 73 2a be |....D..L...Z.s*.|
000000d0 9d 7d e8 1c 00 be a7 7d e8 16 00 30 e4 cd 16 c7 |.}.....}...0....|
000000e0 06 72 04 34 12 ea 00 00 ff ff bb 07 00 b4 0e cd |.r.4............|
000000f0 10 ac 84 c0 75 f4 b4 01 f9 c3 2e f6 06 b0 08 80 |....u...........|
00000100 74 22 80 fa 80 72 1d bb aa 55 52 b4 41 cd 13 5a |t"...r...UR.A..Z|
00000110 72 12 81 fb 55 aa 75 0c f6 c1 01 74 07 89 ee b4 |r...U.u....t....|
00000120 42 cd 13 c3 52 b4 08 cd 13 88 f5 5a 72 cb 80 e1 |B...R......Zr...|
00000130 3f 74 c3 fa 66 8b 46 08 52 66 0f b6 d9 66 31 d2 |?t..f.F.Rf...f1.|
00000140 66 f7 f3 88 eb 88 d5 43 30 d2 66 f7 f3 88 d7 5a |f......C0.f....Z|
00000150 66 3d ff 03 00 00 fb 77 9d 86 c4 c0 c8 02 08 e8 |f=.....w........|
00000160 40 91 88 fe 28 e0 8a 66 02 38 e0 72 02 b0 01 bf |@...(..f.8.r....|
00000170 05 00 c4 5e 04 50 b4 02 cd 13 5b 73 0a 4f 74 1c |...^.P....[s.Ot.|
00000180 30 e4 cd 13 93 eb eb 0f b6 c3 01 46 08 73 03 ff |0..........F.s..|
00000190 46 0a d0 e3 00 5e 05 28 46 02 77 88 c3 52 65 61 |F....^.(F.w..Rea|
000001a0 64 00 42 6f 6f 74 00 20 65 72 72 6f 72 0d 0a 00 |d.Boot. error...|
000001b0 80 90 90 90 90 90 90 90 90 90 90 90 90 90 00 00 |................|
000001c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 |................|
000001f0 01 00 a5 fe ff ff 00 00 00 00 50 c3 00 00 55 aa |..........P...U.|
00000200



And here are the results of dmesg|tail:

#sudo dmesg | tail
[ 1010.308083] Skipping EDID probe due to cached edid
[ 1010.665115] Skipping EDID probe due to cached edid
[ 1214.828102] Skipping EDID probe due to cached edid
[ 1215.156083] Skipping EDID probe due to cached edid
[ 1798.989239] You didn't specify the type of your ufs filesystem
[ 1798.989241]
[ 1798.989242] mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextste p|nextstep-cd|openstep ...
[ 1798.989244]
[ 1798.989245] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
[ 1798.989592] ufs_read_super: bad magic number

leftys
December 15th, 2010, 01:50 PM
19 hours bump. C'mon, anyone? In my days this community used to be helpful...

drs305
December 15th, 2010, 02:02 PM
If it were a grub2 problem you would most likely have a "grub" or "grub-rescue" prompt. Prior to grub2, a "no system" message of some sort.

What has probably happened is that G2 has passed control to the kernel and you have a video problem. Hold the SHIFT key down during boot and see if the G2 menu displays. If so, add nomodeset to the end of the "linux" line after "quiet splash" and press CTRL-x to boot.

If it boots to the Desktop: System, Administration, Additional Drivers and add the driver for your video card.

leftys
December 15th, 2010, 02:14 PM
Been there, done that. Holded down the Shift key on boot and it didn't work. Neither did ESC. Is it me, or does Grub 2 generally suck?

drs305
December 15th, 2010, 02:45 PM
I don't know FreeBSD nor ufs, but some observations:

The FreeBSD menuentry doesn't exist since you added it to grub.cfg but then ran 'update-grub', which would overwrite it. You may know that...

Is the computer booting into Ubuntu now? If so, the reason there is no menu displayed is that it sees only one OS. G2 doesn't by default show a menu on single OS computers. If it is booting, place a comment symbol at the start of this line in /etc/default/grub:

#GRUB_HIDDEN_TIMEOUT=0
Save the file and then run update-grub and the menu may display for the designated timeout period. If this doesn't work there is another way we can force the menu display.

There are several combinations of G2 settings which will exclude the keystatus check from being run but it shows in your grub.cfg and should be accomplished if you hold down the SHIFT key from the start of the boot process.

I also don't know where your system is getting instructions to mount the ufs partition. It's not in fstab, and wherever the instructions are coming from your system doesn't appear to like them very much.

Do you have an nvidia card? That has been a common cause of the blinking cursor the past several weeks. If we can get the menu to display you can accomplish the 'nomodeset' solution.

leftys
December 15th, 2010, 03:44 PM
You were right, the G2 menu did not appear because it only saw Ubuntu. I mounted the BSD ufs2 partition:


sudo mount -t ufs -r -o ufstype=ufs2 /dev/sda3 /mnt/FreeBSD
ran update-grub and it returned:


Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-23-generic
Found initrd image: /boot/initrd.img-2.6.35-23-generic
Found memtest86+ image: /boot/memtest86+.bin
Found unknown Linux distribution on /dev/sda3
done


Now the G2 menu appears but still I have no access to FreeBSD. It only shows the ubuntu kernels and memtests. In addition to that, I have to mount the ufs2 partition every time I log in Ubuntu. How can I do this automatically each time I log in?

And how can I configure G2 to add a menuentry for BSD? The fellows in the FreeBSD forums recommended adding this to /boot/grub/grub.cfg:

menuentry "freebsd 8.0" {
set root=(hd0,2,a)
chainloader +1
}


But this is probably not a good idea, as grub.cfg will reset every time I run update-grub. What else can I do?

drs305
December 15th, 2010, 04:00 PM
Now the G2 menu appears but still I have no access to FreeBSD. It only shows the ubuntu kernels and memtests. In addition to that, I have to mount the ufs2 partition every time I log in Ubuntu. How can I do this automatically each time I log in?


You can put the ufs entry in fstab:

gksu gedit /etc/fstab

I think these options will work but you may have to tweak them. The examples I saw mounted it read-only. Don't know if that's required or not.

/dev/sda3 /mnt/FreeBSD ufs ufstype=ufs2,ro 0 2
If you can add a label to sda3, a better entry would substitute LABEL=labelname for /dev/sda3


You are correct about not adding the menuentry to grub.cfg. Add it to /etc/grub.d/40_custom. Add this to the existing lines:


menuentry "freebsd 8.0" {
set root=(hd0,2,a)
chainloader +1
}

Save the file and update grub.
Again, I can't attest to the validity of the entry, but that is how you can get it into the menu.

oldfred
December 15th, 2010, 06:44 PM
Are you sure the sample was not for grub legacy as hd0,2 is sda3 in grub legacy but sda2 in grub2?

I might then try, but I did not know grub accepted the extra parameter which I assume FreeBSD needs.

menuentry "freebsd 8.0" {
set root=(hd0,3,a)
chainloader +1
}