Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jun 2021 10:43:09 -0700
From:      "Thomas D. Dean" <tomdean@wavecable.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Grub Entry to Boot FreeBSD
Message-ID:  <f24f6c17-0b81-b341-6f5b-d7f7f44671c4@wavecable.com>
In-Reply-To: <61cf5297-d289-9356-62b1-feb577050d6e@wavecable.com>
References:  <61cf5297-d289-9356-62b1-feb577050d6e@wavecable.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6/1/21 9:10 PM, Thomas D. Dean wrote:
> I have a remote system with Linux and FreeBSD.  I want to select the 
> next boot OS at runtime and boot it.
> 
> I can do that with
>     grub-set-default 'Ubuntu'
>     -or-
>     grub-set-default 'FreeBSD'
> and reboot.
> 
> My problem is with the FreeBSD entry.  How do I write the entry?
> 
> The disks are:
>    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
> nvme0n1     259:0    0 931.5G  0 disk
> |-nvme0n1p1 259:4    0   512M  0 part /boot/efi
> `-nvme0n1p2 259:5    0   931G  0 part /
> nvme1n1     259:1    0 931.5G  0 disk
> `-nvme1n1p1 259:3    0 931.5G  0 part
> nvme2n1     259:2    0 931.5G  0 disk
> |-nvme2n1p1 259:6    0   512K  0 part
> |-nvme2n1p2 259:7    0   928G  0 part
> `-nvme2n1p3 259:8    0   3.5G  0 part
> 
> /dev/nvme0n1p2: UUID="55626001-0033-445b-bd2b-0bf4766e25bb" TYPE="ext4"
>     PARTUUID="2b247e80-cf2e-4be1-b6d7-61152af7132f"
> /dev/nvme0n1p1: UUID="7076-258D" TYPE="vfat" PARTLABEL="EFI System
>     Partition" PARTUUID="16a50609-64b2-47ad-8802-c3cbb4be263f"
> /dev/nvme1n1p1: UUID="e26e4bf7-6e65-4fac-b2b4-f84019f70c08" TYPE="ext4"
>     PARTUUID="beccec5f-01"
> /dev/nvme2n1p1: PARTUUID="3fed2b68-c26f-11eb-a073-18c04d84849a"
> /dev/nvme2n1p2: UUID="60b57d7bd4b24f00" TYPE="ufs"
>     PARTUUID="3fed7a4f-c26f-11eb-a073-18c04d84849a"
> /dev/nvme2n1p3: PARTUUID="3fedfa22-c26f-11eb-a073-18c04d84849a"
> 
> Device              Start        End    Sectors  Size Type
> /dev/nvme2n1p1         40       1063       1024  512K FreeBSD boot
> /dev/nvme2n1p2       1064 1946157095 1946156032  928G FreeBSD UFS
> /dev/nvme2n1p3 1946157096 1953525127    7368032  3.5G FreeBSD swap
> 
> Ubuntu  is on nvme0n1, or, I think hd0,1 in grub terms.
> FreeBSD is on nvme2n1, or, I think hd2,2
> 
> But, grub thinks hd2 is just hd2 or hd2,msdos1
> 
> I have
>  > cat /etc/grub.d/40_custom
> #!/bin/sh
> exec tail -n +3 $0
> # This file providesan easyway toadd custom menu entries.Simply type the
> # menu entries youwant toadd after this comment.Be careful not to change
> # the 'exec tail' line above.
> menuentry 'FreeBSD' {
>    insmod ufs2
>    set root=(hd2,2)
>    chainloader /boot/loader.elf
> }
> 
> I tried
> menuentry 'FreeBSD' {
>      insmod ufs2
>      set root=(hd2,1,a)
>      search --no-floppy -fs-uuid --set 3fed2b68-c26f-11eb-a073-18c04d84849a
>      kfreebsd /boot/loader
> }
> 
> When I reboot after grub-set-default 'FreeBSD', the remote system hangs. 
>   Grub can not find hd2.
> 

It seems impossible to boot FreeBSD with grub.  In grub, I can find the 
Freebsd /boot directory and load some files.  But, it will not boot.

I used Freebsd from 0.1 386bsd to FreeBSD 11. Then switched to linux for 
a major application.  Now, I have a couple applications to run on 
FreeBSD.  It did not seem so hard earlier...

There are many 'different' examples that turn up when I google.  But, 
none of them seem to work.

I give up.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f24f6c17-0b81-b341-6f5b-d7f7f44671c4>