Score:1

Kubuntu 20.04 (UEFI) grub-update doesn't find system of a different drive (Fedora 34 KDE)

br flag

I have multiple systems installed; first, chronologically, Windows 10, then Kubuntu 20.04, then Fedora 34 KDE, and then KaOS. Fedora is alone on a second drive, with its separate EFI, but shares that with KaOS.

The configuration is thus:

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    739327    737280   360M EFI System
/dev/nvme0n1p2    739328   1001471    262144   128M Microsoft reserved
/dev/nvme0n1p3   1001472 457750527 456749056 217,8G Microsoft basic data
/dev/nvme0n1p4 457750528 459757567   2007040   980M Windows recovery environment
/dev/nvme0n1p5 459757568 500107263  40349696  19,2G Microsoft basic data
/dev/nvme0n1p6 500107264 644737022 144629759    69G Linux filesystem
/dev/nvme0n1p7 644737023 976773134 332036112 158,3G Linux filesystem



Device          Start        End    Sectors   Size Type
/dev/sda1        2048    1230847    1228800   600M EFI System
/dev/sda2   251660288 1258293247 1006632960   480G Linux filesystem
/dev/sda3  1258293248 1875384319  617091072 294,3G Microsoft basic data
/dev/sda4     1230848    3327999    2097152     1G Linux filesystem
/dev/sda5     3328000  251660287  248332288 118,4G Linux filesystem

enter image description here

enter image description here

/dev/nvme0n1p1 is the EFI partition for Windows (installed on /dev/nvme0n1p2 to 5) and Ubuntu (installed on nvme0n1p6), /dev/sda1 is the EFI for Fedora (/dev/sda4 and 5) and KaOS (/dev/nvme0n1p7)

This odd choice is related to the fact that past installation of a other Linux, beside Kubuntu, using the same EFI as Windows, has resulted in corruption of Windows boot; that was fixed by re-installing Kubuntu, which added Windows to its boot menu; I wanted to avoid such interference with Windows and therefore I have installed Fedora on a separate drive with its own EFI, and then, when I have installed KaOS on the same drive as Windows, I have selected to use the EFI from the other drive, sharing it with Fedora.

After installing KaOS its boot menu (run by systems-boot, not grub) didn't show the other systems.

Fedora's and Ubuntu's boot menus were hidden in the Firmware UEFI interface. Fedora's included all systems. kUbuntu's boot menu included all except Fedora.

I have used boot repair trying to make Fedora's boot menu the default one because it was the most complete (by installing grub on sda1) but there wasn't a option to "boot first" Fedora: so, I selected Kubuntu. This resulted in Kubuntu's boot menu becoming the default, missing only Fedora.

Given that Kubuntu grub is now in control I would like to use that and just add Fedora to it. Updating grub does not help.


EDIT-1, after comments by @oldfred:

boot-repair report on pastebin -also HERE (asked in comments)

EDIT-2, after answer by @oldfred:

I have looked up the Kubuntu grub.cfg files and found that the Kubuntu boot list is determined by the file boot/grub/grub.cfg by adding a menuentry there.

Looking at Fedora’s own grub.cfg file that I could find: there, Fedora entries are missing, only the rest of the systems are listed. Only these are also seen in Grub Customizer on Fedora: Fedora entries in its own boot list seem determined by the separate files in /loader/entries/ from its 1 GB root ext4 partition (sda4). Copying those on Kubuntu’s /boot/efi/loader/entries/ has no effect.

Being without Fedora’s own model for an entry in Kubuntu’s boot/grub/grub.cfg, I have copied and modified the lines that I find there for KaOS — by adding Fedora’s specifications, namely the UUID. I am not sure the formatting is correct, it is exactly that for KaOS in that file, with only the name of distribution and UUID adjusted:

menuentry 'Fedora 34 KDE' --class Fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-4834b108-13c9-406c-8a7b-a9c53440283c' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod fat
    set root='hd0,gpt1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  F4F4-1172
    else
      search --no-floppy --fs-uuid --set=root F4F4-1172
    fi
    echo    'Loading Linux linux ...'
    linux   /vmlinuz-linux root=UUID=4834b108-13c9-406c-8a7b-a9c53440283c rw  quiet
    echo    'Loading initial ramdisk ...'
    initrd  /initramfs-linux.img
}

In this way Fedora name is added to the boot list of course, but doesn’t work:

with the UUID of the bfrs partition (sda5) I get the message:

mount: new/-root: unknown filesystem type ‘btrfs’

I have tried, just in case, with the UUID of the “root” Fedora partition (sda4), and I get the message:

Error: root device mounted successfully but sbin/init does not exist

The correct way to go is, I think, to add the UUID of the sda5 partition; that it is the one specified in all three files aforementioned on Fedora’s /loader/entries/

It seems grub doesn’t recognize btrfs.

I have installed all “btrfs” related files that I could find using Apper, about 30 packages, but the same happens.


EDIT-3

From farther comments I understand I must not edit boot/grub/grub.cfg but edit the file etc/grub.d/40_custom and copy there parts of other files. But I don't understand what files should I use. I couldn't find on Fedora's own partitions something related to its own boot and its own entry in the boot list other than files in ext4 - /loader/entries. So is it from one of those that I should copy?

Is it something like this copied from /media/root/651b659a-8fc5-46d6-b291-22b3b523ebaf/loader/entries/a037a4898b9540bfbc52f3f377b2ff4d-5.13.19-200.fc34.x86_64.conf (that is from Fedora's 1GB ex4 partition sda4):

title Fedora (5.13.19-200.fc34.x86_64) 34 (KDE Plasma)
version 5.13.19-200.fc34.x86_64
linux /vmlinuz-5.13.19-200.fc34.x86_64
initrd /initramfs-5.13.19-200.fc34.x86_64.img
options root=UUID=4834b108-13c9-406c-8a7b-a9c53440283c ro rootflags=subvol=root rhgb quiet 
grub_users $grub_users
grub_arg --unrestricted
grub_class kernel

Or is it something like the entry for KaOS in Kubununtu's file boot/grub/grub.cfg posted under EDIT-2 above?

us flag
Does `sudo update-grub` help?
br flag
@ArchismanPanigrahi - It finds only Windows and KaOS (that are on the same drive).
oldfred avatar
cn flag
Lets see details, use ppa version with your live installer (2nd option) or any working install, not Boot-Repair ISO: Please copy & paste the pastebin link to the Boot-info summary report ( do not post report), do not run the auto fix till reviewed. https://help.ubuntu.com/community/Boot-Repair I would think os-prober would find the ESP on sda. But if Fedora using LVM, you need to install the lvm2 driver in Kubuntu & mount Fedora's LVM. You can change boot order with efibootmgr. Or in UEFI settings (not menu). http://askubuntu.com/questions/485261/change-boot-order-using-efibootmgr
br flag
@oldfred - What procedure should I initiate with the ppa boot-repair? the automatic/default one, or some specific choices? I will try that as soon as possible.
oldfred avatar
cn flag
Just the report so we can see your configuration. Then someone reviewing report can make better suggestion on fixes. I might add lvm2 driver to Kubuntu first.
br flag
@oldfred - Fedora uses btrfs for system partition as seen in image.
oldfred avatar
cn flag
Report would show that and many more details, so we know what to suggest.
br flag
@oldfred - Please see edit with link.
Score:0
cn flag

I had installed Fedora once, but before it used btrfs. But my grub entry in Ubuntu chainloaded or configfile to the UEFI boot entry. I added these to 40_custom in Ubuntu's grub. The UUIDs are unique and you need to change to your install's UUIDs. To boot direct to grub

menuentry "Fedora UEFI" {
  search --file --no-floppy --set=root F496-1330
  chainloader (${root})/efi/fedora/grub.cfg
}

You often can just copy a boot stanza for grub from one install to another. That is what os-prober is doing. You may need additional drivers (btrfs) or grub2's .mod files (like btrfs.mod) to have it recognize different formats or configurations. If using rEFInd you have to translate grub stanza to refind.conf. A configfile is a link to another file that is grub or has grub type boot stanzas.

menuentry "Fedora UEFI" {
search.fs_uuid a9bd9a65-bc8c-41b1-95b1-2dceb66b2652 root hd1,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
}

Using 40_custom & Custom menu

https://help.ubuntu.com/community/Grub2/CustomMenus

Configfile:

https://www.gnu.org/software/grub/manual/grub/grub.html#Multi_002dboot-manual-config

https://ubuntuforums.org/showthread.php?t=2076205&page=54&p=13788092#post13788092

br flag
It seems grub doesn’t recognize btrfs. Please see in question body EDIT-2.
oldfred avatar
cn flag
In 40_custom boot stanza add `insmod btrfs.mod` before the boot stanza for Fedora. http://www.gnu.org/software/grub/manual/grub/html_node/insmod.html#insmod Your grub.cfg may have similar entries for NTFS or gpt or similar. Grub builds in many drivers, but has the insmod to add more.
br flag
It was simpler to me copying the KaOS menuentry part for Fedora in `boot/grub/grub.cfg`, as I don't understand what exactly to put in the `40_custom` - and what I did put didn't work. So, now I added `insmod btrfs` along similar entries under Fedora menuentry in `grub.cfg`: now I get the message `/boot/grub/x86_64-efi/btrfs.mod not found`. But that file is there.
oldfred avatar
cn flag
You do not edit grub.cfg as it gets rewritten with every grub, kernel or sudo update-grub. You add boot stanza to 40_custom. And it should be just a copy like you did. Post your boot stanza that you are copying. Its not shown in Boot-Repair's report. Are you use a Fedora stanza from Fedora or KaOS? I might copy both into 40_custom
br flag
Fedora entries of its own boot list (which I can access in Firmware Interface) are determined by separate files in `/loader/entries/` (from its 1 GB root ext4 partition sda4) as I said in EDIT-2. I'll post them in a new edit and please tell me if I could add that content to `40_custom` - or what exactly should I add there. Is `40_custom` accepting menuentries in the form grub.conf does? (like the one I have posted already? that one is copied from the Kubuntu grub.conf relating to KaOS).
br flag
Please see EDIT-3 in question.
oldfred avatar
cn flag
Your edit 2 is a grub boot stanza. But if Ubuntu is on hd0, that is boot drive and then you need to change all the hd0 to hd1 as that is then second drive. It really should find ESP on sda by the UUID, but I have often had to manually edit the hdX entry while booting with grub's edit. The edit3 stanza are typical of syslinux, systemD or rEFInd, but I do not know those well. You can translate from one to the other as both have all the same info, just different format. I thought os-prober could do the translate if it finds that style .conf file, but obvious not workiing for you.
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.