Score:0

ubuntu grub not finding centos on another hard drive

ao flag

I have installed Centos Stream 9 on a new hard drive. After running sudo update-grub from my ubuntu 20.04 system, an entry got created in the grub. However when i try to select the entry from the startup menu it gives me error error file /boot/linuz-xx not found you need to load kernel first

From the grub menu when I run the command ls (hd0,gpt3) it gives me no known file system detected. However I am able to see all the other folders of other OS (manjaro) on other drives.

When I change the Boot order in BIOS and set the Centos HDD as the first one I am able to login without issues.

Is there a way I can fix this issue?

below is the output of command lsblk -f

sda
├─sda1      vfat                 
├─sda2      xfs                  
└─sda3      LVM2_member          
  ├─cs-swap swap                 
  ├─cs-home xfs                  
  └─cs-root xfs                  
sdb
├─sdb1      vfat        
└─sdb2      ext4        
nvme1n1
├─nvme1n1p1 ntfs        
├─nvme1n1p2 vfat        
├─nvme1n1p3
└─nvme1n1p4 ntfs        
nvme0n1
├─nvme0n1p1 vfat        
└─nvme0n1p2 ext4
guiverc avatar
cn flag
You've not provided any *file-system* details; as some are much harder for other OSes to pick up & correctly deal with (*is the file-system ext4? zfs? btrfs? etc - it matters, and that is likely your issue & thus how to fix it; at least in my experience*)
mac_new avatar
ao flag
Added output of lsblk command @guiverc
Jeff avatar
mx flag
I don't think GRUB identifies other operating systems by default. That's what the BIOS is for.
Score:-1
gn flag

I think you may be able to fix this issue using OS-Prober.

As This article explains, open a Terminal and do

sudo apt install os-prober

(it should be preinstalled but I suggest you do it anyways), followed by a

sudo os-prober

. You should get a message that a centos partition was found in /dev/xxx. Then simply mount that partition by using

sudo mkdir /mnt/centos
sudo mount /dev/xxx /mnt/centos

. Now just update your GRUB config by using

sudo grub-mkconfig -o /path/to/your/grub/config (for example /boot/grub/grub.cfg)

and reboot.

I hope I could help you with this one.

Greetings, Eric

oldfred avatar
cn flag
Grub is turning off os-prober for a secuity reason. Os-prober now turned off by default Dec 2021 https://ubuntuforums.org/showthread.php?t=2469993 You probably need lvm2 driver in Ubuntu and if encrypted `sudo apt-get update && sudo apt-get install lvm2 cryptsetup` Then mount lvm before running os-prober. Or copy boot stanza from centos' grub to 40_custom in Ubuntu. You still need drivers. Or use configfile https://askubuntu.com/questions/344125/how-to-add-a-grub2-menu-entry-for-booting-installed-ubuntu-on-a-usb-drive/344359#344359
mac_new avatar
ao flag
Thanks everyone. The problem was as stated by @guiverc. I reinstalled the OS, this time manually setting the file system to ext4. Ran grub-update from Ubuntu without any errors and now the newly generated menu entry works perfectly.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.