You are not logged in.

#1 2017-04-28 08:08:28

Panadestein
Member
From: Lille, France
Registered: 2017-04-08
Posts: 51

Yet another GRUB and FreeBSD issue

Hello everyone.

I recently install FreeBSD 11.0 in my computer, which has two HDDs, one hosting Arch and the second one FreeBSD. I'm using the Arch's GRUB2 to boot, it does work with Arch but not with the BSD. I configured GRUB2 following this excellent article  https://wiki.archlinux.org/index.php/GRUB . I edited /etc/grub.d/40_custom, adding this entry (this is the current one):

menuentry 'FreeBSD' {
	insmod ufs2
	set root='hd0,1'
	kfreebsd /boot/kernel/kernel
	kfreebsd_loadenv /boot/device.hints
	set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s1a
	set kFreeBSD.vfs.root.mountfrom.options=rw
}

and also tried chainloading:

menuentry 'FreeBSD' {
	insmod ufs2
	set root='hd0,1'
	chainloader +1
}

but GRUB is telling me all time that the file /boot/kernel/kernel doesn't exist (which is not true, because I booted into FreeBSD changing the boot order in the BIOS), however, it does recognize that /boot is a directory and exist.

Any idea of what is happening here? Thanks a lot in advance.


python -c 'import this' | awk 'NR == 5'

Offline

#2 2017-04-28 09:16:56

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Yet another GRUB and FreeBSD issue

What's the output of

# fdisk -l

and

df -h

Offline

#3 2017-04-28 11:48:45

Panadestein
Member
From: Lille, France
Registered: 2017-04-08
Posts: 51

Re: Yet another GRUB and FreeBSD issue

With pleasure:

# fdisk -l
Disk /dev/sdb: 149 GiB, 160000000000 bytes, 312500000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe6cac964

Device     Boot     Start       End   Sectors Size Id Type
/dev/sdb1  *         2048 167774207 167772160  80G 83 Linux
/dev/sdb2       167774208 176162815   8388608   4G 82 Linux swap / Solaris
/dev/sdb3       176162816 312499999 136337184  65G  5 Extended
/dev/sdb5       176164864 312499999 136335136  65G 83 Linux


Disk /dev/sda: 149 GiB, 160000000000 bytes, 312500000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1  *       64 312475711 312475648  149G a5 FreeBSD

and

# df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             977M     0  977M   0% /dev
run             981M  644K  980M   1% /run
/dev/sdb1        79G   12G   64G  15% /
tmpfs           981M     0  981M   0% /dev/shm
tmpfs           981M     0  981M   0% /sys/fs/cgroup
tmpfs           981M   72K  981M   1% /tmp
/dev/sdb5        64G   13G   49G  21% /home
tmpfs           197M  8.0K  197M   1% /run/user/1000

additionally

# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0      2:0    1    4K  0 disk 
sda      8:0    0  149G  0 disk 
├─sda1   8:1    0  149G  0 part 
└─sda5   8:5    0    4G  0 part 
sdb      8:16   0  149G  0 disk 
├─sdb1   8:17   0   80G  0 part /
├─sdb2   8:18   0    4G  0 part [SWAP]
├─sdb3   8:19   0    1K  0 part 
└─sdb5   8:21   0   65G  0 part /home
sr0     11:0    1 1024M  0 rom  

python -c 'import this' | awk 'NR == 5'

Offline

#4 2017-04-28 18:06:40

Panadestein
Member
From: Lille, France
Registered: 2017-04-08
Posts: 51

Re: Yet another GRUB and FreeBSD issue

I have solved the problem, and I'm really confuse now. What I did was to change the HDD entry in the GRUB config file /etc/grub.d/40_custom, for this one:

menuentry 'FreeBSD' {
	insmod ufs2
	set root='hd1,1'
	chainloader +1
}

In my search on the internet I found a lot of outdated information and sometimes even contradictory, but I don't understand why in GRUB hd1 = /dev/sda and not hd0 = /dev/sda?


python -c 'import this' | awk 'NR == 5'

Offline

#5 2017-04-29 10:05:44

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Yet another GRUB and FreeBSD issue

I can only guess that for some reason, GRUB considers the FreeBSD disk as the second disk. What happens if you unplug the Arch HDD?

Offline

#6 2017-04-29 16:58:55

Panadestein
Member
From: Lille, France
Registered: 2017-04-08
Posts: 51

Re: Yet another GRUB and FreeBSD issue

Here I have a little bit of a problem, because both HDDs are identical (in the sense of vendor, branch etc) so I wouldn't know how to distinguish physically between them. This uncertainty is not self-inflicted: I received this old PC from a friend.


python -c 'import this' | awk 'NR == 5'

Offline

#7 2017-04-30 01:08:08

Texbrew
Member
From: The Lone Star State
Registered: 2016-02-09
Posts: 580

Re: Yet another GRUB and FreeBSD issue

With the PC powered off and its power cord unplugged, unplug one hard drive, power up and see what boots. I realize I may be stating the obvious.

Offline

#8 2017-09-24 06:38:20

sistematico
Member
From: Campo Grande / MS / Brasil
Registered: 2008-07-26
Posts: 97
Website

Re: Yet another GRUB and FreeBSD issue

Sorry for bumping and hijacking the thread, but i having same issue...
fdisk -l /dev/sda

[lucas@majestic ~]:$ LANG=C sudo fdisk -l /dev/sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5741527A-0C06-4C34-83CA-D864E2F07C62

Device          Start        End   Sectors   Size Type
/dev/sda1        2048    1001471    999424   488M EFI System
/dev/sda2     1001472  196313087 195311616  93.1G Linux filesystem
/dev/sda3   196313088 1172875263 976562176 465.7G Linux filesystem
/dev/sda4  1172875264 1180688383   7813120   3.7G Linux filesystem
/dev/sda5  1180688384 1180690431      2048     1M FreeBSD boot
/dev/sda6  1180690432 1334290431 153600000  73.2G FreeBSD UFS
/dev/sda7  1334290432 1945333759 611043328 291.4G FreeBSD UFS
/dev/sda8  1945333760 1953523711   8189952   3.9G FreeBSD swap

df -h

[lucas@majestic ~]:$ LANG=C df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             3.9G     0  3.9G   0% /dev
run             3.9G  1.1M  3.9G   1% /run
/dev/sda2        92G   11G   77G  12% /
tmpfs           3.9G   48K  3.9G   1% /dev/shm
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs            10G   14M   10G   1% /tmp
/dev/sda1       488M  132K  487M   1% /boot/efi
/dev/sda3       458G   27G  408G   7% /home
tmpfs           794M   20K  794M   1% /run/user/1000

lsblk

[lucas@majestic ~]:$ LANG=C sudo lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk 
|-sda1   8:1    0   488M  0 part /boot/efi
|-sda2   8:2    0  93.1G  0 part /
|-sda3   8:3    0 465.7G  0 part /home
|-sda4   8:4    0   3.7G  0 part [SWAP]
|-sda5   8:5    0     1M  0 part 
|-sda6   8:6    0  73.2G  0 part 
|-sda7   8:7    0 291.4G  0 part 
`-sda8   8:8    0   3.9G  0 part 

/etc/grub.d/40_custom

#!/bin/sh
exec tail -n +3 $0
# 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.

#59c724d264bff6db
#59c724d38a1cd125


menuentry "FreeBSD" --class freebsd --class bsd --class os {
#menuentry "FreeBSD" {
    insmod ufs2
    set root=(hd0,gpt5)
	search --fs-uuid --no-floppy --set=root 59c724d38a1cd125
	#search --fs-uuid --no-floppy --set=root 59c724d264bff6db
    kfreebsd /boot/loader
    #kfreebsd /boot/kernel/kernel
    #kfreebsd_loadenv /boot/device.hints
    #kfreebsd_module /boot/splash.bmp type=splash_image_data
    #set kFreeBSD.vfs.root.mountfrom=ufs:ad4s1a
}

Only progress i made is a very weird terminal with malformed buffer on top of the screen...

Any help is welcome.


Lucas Saliés Brum
blog | medium | vk | twitter | github | .share
Forgive the spelling and grammar, English is not my native language.

Offline

Board footer

Powered by FluxBB