Search code examples
archlinuxgrubnetbsd

Found unknown Linux distribution on /dev/sdb2: grub configuration dual boot Arch Linux and NetBSD-7.0


I have Arch Linux on /dev/sdb1 and NetBSD-7.0 on /dev/sdb2.

On Arch Linux when I run sudo grub-mkconfig -o /boot/grub/grub.cfg I get a message like Found unknown Linux distribution on /dev/sdb2 but when I reboot, there is no grub option for that unknown Linux distribution which I know it is NetBSD-7.0.

How can I add NetBSD-7.0 to my grub menu option when rebooting.

There is a similar post, currently looking into it.

UPDATE: I mounted NetBSD partition with sudo mount -t ufs -o ro,ufstype=ufs2 /dev/sdb2 /mnt/ (ufstype=44bsd did not work) and then ran grub-mkconfig -o /boot/grub/grub.cfg but yet the issue persists.

UPDATE: Rebooted and pressed c to get the grub command line. Following commands booted the NetBSD-7.0:

ls

Ran ls to see the correct name of disks and partitions, /dev/sdb2 on Linux was (hd0,gpt2) on Grub. Then ran the following:

insmod ufs2
set root=(hd0,gpt2)
knetbsd /netbsd
boot

And NetBSD-7.0 booted.

To add NetBSD option to Grub menu, modified file /etc/grub/40_custom on Arch Linux like below:

menuentry "NetBSD-7.0"{
insmod ufs2
set root=(hd0,gpt2)
knetbsd /netbsd
}

However, after modifying 40_custom like above, NetBSD option does not appear on Grub menu. I don't know why.


Solution

    • Unless you have a typo, it looks like the 40_custom file is in the wrong directory. it should be located at /etc/grub.d/40_custom, notice the .d.

    • If your /boot is located on a separate partition, make sure that it is mounted with mount /boot before generating the grub.cfg. Otherwise your new grub.cfg won't be used.

    • Check which partition grub is loading the configuration from by running echo ${prefix} within the grub command line. It's possible that grub is loading the configuration from a partition that you don't expect.

    • Verify that netbsd was added to the config with grep -i netbsd /boot/grub/grub.cfg before rebooting to avoid some frustration after generating grub.cfg