Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

  1. #1

    Default GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    My laptop is UEFI-booted from a GPT-partitioned internal SSD. I have two Linux systems on it. openSUSE Tumbleweed is my main production system, while another Linux is available as an emergency operating system in case something happens to Tumbleweed. This concept has helped me a lot a few times. For a long time, I had Linux Mint Cinnamon as the 2nd OS. I decided now to try something else in order to get away from the trodden Ubuntu path of outdated software versions and the need for PPAs. After extensive research into Linux distros, I am now trying Manjaro (rolling release concept, up-to-date software, and - putting it simplistically - Arch without the Arch pains).

    Tumbleweed shall remain my main production system. Among other things, this means Tumbleweed is responsible for maintaining the GRUB2 bootloader and its configuration as well as boot menu by running
    Code:
    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    every time anything OS-related changes in either of my two systems.

    Unfortunately, Tumbleweed currently does not generate correct GRUB2 menu entries for Manjaro via the os-prober.

    When I use the Manjaro entries as written from Tumbleweed's grub2-mkconfig script to /boot/grub2/grub.cfg, booting into Manjaro simply results in Kernel Panic (failure message s.th. like "can't load VFS file system"; I don't remember precisely, could reproduce it, but it's not necessary at this point in time since I know what's wrong - cf. next paragraph).

    By simply comparing the grub.cfg file as written from within Tumbleweed to the one that was written by Manjaro ("for itself"), it is obvious what is going wrong:

    /boot/grub/grub.cfg by Manjaro for itself:
    Code:
    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7b00f0cc-307f-40a2-bff2-a1f767ee15f5' {
        savedefault
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  7b00f0cc-307f-40a2-bff2-a1f767ee15f5
        else
          search --no-floppy --fs-uuid --set=root 7b00f0cc-307f-40a2-bff2-a1f767ee15f5
        fi
        echo    'Loading Linux 4.14.16-1-MANJARO x64 ...'
        linux    /boot/vmlinuz-4.14-x86_64 root=UUID=7b00f0cc-307f-40a2-bff2-a1f767ee15f5 rw  quiet resume=UUID=d0e52c5d-112b-47dc-aa2c-7e1e31e38323
        echo    'Loading initial ramdisk ...'
        initrd    /boot/intel-ucode.img /boot/initramfs-4.14-x86_64.img
    }
    /boot/grub2/grub.cfg by Tumbleweed's os-prober for Manjaro:
    Code:
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'Manjaro Linux (17.1.4) (auf /dev/sda2)' --class manjarolinux --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-7b00f0cc-307f-40a2-bff2-a1f767ee15f5' {
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  7b00f0cc-307f-40a2-bff2-a1f767ee15f5
        else
          search --no-floppy --fs-uuid --set=root 7b00f0cc-307f-40a2-bff2-a1f767ee15f5
        fi
        linuxefi /boot/vmlinuz-4.14-x86_64 root=UUID=7b00f0cc-307f-40a2-bff2-a1f767ee15f5 rw quiet resume=UUID=d0e52c5d-112b-47dc-aa2c-7e1e31e38323
        initrdefi /boot/intel-ucode.img
    }
    The crucial erroneous statement is the last initrd line. Tumbleweed's os-prober is missing the /boot/initramfs-4.14-x86_64.img after /boot/intel-ucode.img. Just adding the missing piece in the various places both in the main and advanced GRUB2 menu sections results in everything working fine.

    Remark: I am not sure about the differences between linux versus linuxefi as well as initrd versus initrdefi. My PC doesn't have Secure Boot in its UEFI. Whatever the reason was for Manjaro to use linux and initrd only instead of linuxefi and initrdefi (Tumbleweed), I checked that both do work.

    Remark 2: My laptop is an HP EliteBook 8560w dating back to 2011. At that time, HP merely had a half-baked UEFI implementation. This requires a /boot/efi/EFI/BOOT/bootx64.efi as the bootloader code (original Microsoft Win 8 style), which is achieved by simply copying and renaming the grubx64.efi files created by the various operating system as /boot/efi/EFI/os-name/grubx64.efi to /boot/efi/EFI/BOOT/bootx64.efi as desired.

    My question to the community is: Since it is both undesirable and "forbidden" to edit the /boot/grub.cfg file manually, I would like to get help on how I can get Tumbleweed's grub2-mkconfig script and the templates from /etc/grub.d as well as the settings from /etc/default/grub to generate correct os-prober entries for Manjaro.

    Thanks a lot in advance!

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,685
    Blog Entries
    3

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Firstly, on the difference between "linux" and "linuxefi".

    If you are not using secure-boot, then it usually won't matter. Basically, "linuxefi" loads the kernel at its EFI stub (whatever that means), and is needed for checking signatures on signed kernels. I'm assuming that you have secure-boot disabled.

    Secondly: here's what I do. I add some entries to "/etc/grub.d/40_custom" to boot other linux versions.

    Here's an example:
    Code:
    ### Entry to boot openSUSE 42.2 on sdb2
    menuentry "configfile for openSUSE 42.2 on /dev/sdb2"  {
            set bootdir='hd2,gpt2'
            search --fs-uuid --set=bootdir ce14101d-f8d6-483a-948b-ee2b631c1bbc
            configfile (${bootdir})/grub2/grub.cfg
    }
    The "set bootdir=" part doesn't really do anything. The search for UUID finds the boot partition for the secondary linux. And it then uses the "configfile" command to boot it.

    The huge benefit of this, is that if I do a kernel update on the secondary linux, it still works. I don't have to run "grub2-mkconfig" on my primary linux, because it is directly using the boot configuration of the secondary linux. I actually turn os-prober off (in "/etc/default/grub") unless there's a Windows partition that I want it to pick up.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  3. #3

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Thanks, sounds like a good concept. I will turn to it tomorrow - eager to see it!

  4. #4

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    @nrickert: Thanks a lot again for this concept. Unfortunately, it seems I am unable yet to make it work. Moreover, I don't have my fat Linux book (Kofler) with me right now.

    First, the os-prober is disabled in both the primary and the secondary Linux by having a line like
    Code:
    GRUB_DISABLE_OS_PROBER="true"
    in both their /etc/default/grub files. Probably this is the default, so this line actually might be unneccessary.

    Second, both the /boot/grub2/grub.cfg for Tumbleweed and the /boot/grub/grub.cfg for Manjaro, respectively, now have the full set of sections except for the 30_os-prober's being blank. The sections are:
    00_header (long standard stuff)
    00_tuned (set 2 tuned_X to "")
    10_linux (their respective complete menu entries)
    20_linux_xen, 30_os-prober (empty)
    40_custom (cf. below)
    41_custom (cf. below)
    80_suse_btrfs_snapshot (Tumbleweed, empty)
    90_persistent (empty)
    95_textmode (standard stuff)

    On the primary OS, Tumbleweed, my 40_custom now reads
    Code:
    #!/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.
    
    ### Entry to boot Manjaro Linux on sda2
    menuentry "Boot Entries for Manjaro Linux on /dev/sda2" {
        set bootdir='hd0,gpt2'
        search --fs-uuid --set=bootdir 7b00f0cc-307f-40a2-bff2-a1f767ee15f5
        configfile (${bootdir})/grub/grub.cfg
    }
    It is meant to boot into the secondary OS, Manjaro. Manjaro's root partition is /dev/sda2, and thus I am assuming this 40_custom should have
    • 'hd0,gpt2',
    • the UUID of /dev/sda2, i.e. 7b00f0cc-307f-40a2-bff2-a1f767ee15f5,
    • and ($bootdir)/grub/grub.cfg, since Manjaro's grub.cfg sits in Manjaro's /boot/grub directory (not in a /boot/grub2).

    nrickert, please confirm or correct my assumptions. In fact, I am deviating from your example given yesterday, where you say to have the secondary OS on /dev/sdb2, but have a 'hd2,gpt2' statement.

    On the secondary OS, Manjaro, its /boot/grub/grub.cfg has all the things originally written by Manjaro, i.e. all sections, 'hd0,gpt2' as well as the UUID 7b00f0cc-307f-40a2-bff2-a1f767ee15f5 of /dev/sda2.

    On my part, I don't understand what the 41_custom as per the original Tumbleweed and Manjaro templates do.

    Now, the issue is: Hitting the new GRUB2 menu entry "Boot Entries for Manjaro Linux on /dev/sda2" just doesn't do anything except for a flicker of the screen (maybe an error message is flashed), whereafter it jumps right back and highlights the standard default menu entry called "Tumbleweed".

    nrickert, it would be great if you please could check this and let me know what I am missing. (Remark: I also did try to be in line with your example by reluctantly putting an 'hd1,gpt2' into my 40_custom, but that didn't work either.)

    Thanks a lot in advance!

  5. #5
    Join Date
    Jun 2008
    Location
    UK
    Posts
    5,500

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Quote Originally Posted by 111MilesToGo View Post
    @nrickert: Thanks a lot again for this concept. Unfortunately, it seems I am unable yet to make it work.
    Indeed, neat concept, but initially had same negative result as you have with the example code (modified). Changed same parts as in your example, except os-prober is NOT disabled here, for Win 7 still present. Changes were: 'hd0,msdos10'; different UUID; and Manjaro's /grub/grub.cfg. However the latter change was incomplete and needs to be:
    Code:
    configfile (${bootdir})/boot/grub/grub.cfg
    Now it works! The clue for me was was in your post at:
    and ($bootdir)/grub/grub.cfg, since Manjaro's grub.cfg sits in Manjaro's /boot/grub directory (not in a /boot/grub2).
    and
    On the secondary OS, Manjaro, its/boot/grub/grub.cfg has all the things originally written by Manjaro...
    Thanks very much for starting this thread. Before this solution, and to overcome Tumbleweed's failure to boot Manjaro, I used Manjaro as primary OS by switching Boot flag (usiing Gparted) to its partition instead of Tumbleweed's. Manjaro's grub worked perfectly for booting other OS's, but with overheads of running Manjaro's "update-grub" for Tumbleweed's too frequent kernel upgrades.
    Leap 42.3 (ext4, KDE Plasma 5.8.7) ~ stable
    Manjaro (ext4, Xfce) ~ rolling updates
    Tumbleweed (ext4, KDE Plasma5) ~ managed updates via "Tumbleweed Snapshots" service.

  6. #6

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Thanks a lot for stepping in, consused, and providing the solution by correcting /grub/grub.cfg to read /boot/grub/grub.cfg. In fact, I have just been doing that very same change and saw it working.

    And, BTW, consused, since you are using Manjaro as I am: I found that I still need to work on making Tumbleweed the initial default GRUB menu entry again, since Manjaro seems to have captured that position. Work in progress, maybe you know right away how to do that.

    Thanks again. Always happy to start a thread that turns out to be sharing know-how in the community.

  7. #7
    Join Date
    Jun 2008
    Location
    UK
    Posts
    5,500

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Quote Originally Posted by 111MilesToGo View Post
    And, BTW, consused, since you are using Manjaro as I am: I found that I still need to work on making Tumbleweed the initial default GRUB menu entry again, since Manjaro seems to have captured that position. Work in progress, maybe you know right away how to do that.
    Head not totally around this yet... suspecting answer probably lies in "/etc/default/grub" file.

    Manjaro's GRUB appears to remember "last booted menu entry". I think Tumbleweed usually defaults to the first (top) menu entry (here that is also the Tumbleweed entry).

    Booting with primary Tumbleweed's GRUB, now manually selecting custom "configfile" as last menu entry, boots to secondary Manjaro. Restarting from Manjaro returns to Tumbleweed's GRUB menu with the custom menu entry now preselected. That "last booted menu entry" appears to be saved somewhere.

    On Leap 42.3 right now, assuming same default as Tumbleweed, looking in "/etc/default/grub", I see:
    Code:
    # Uncomment to automatically save last booted menu entry in GRUB2 environment
    
    # variable `saved_entry'
    # GRUB_SAVEDEFAULT="true"
    I'm guessing therefore Manjaro activates similar code, and you might deactivate it to achieve your goal (if that is what you meant to achieve?), also remembering to run "update-grub" after changes.
    Leap 42.3 (ext4, KDE Plasma 5.8.7) ~ stable
    Manjaro (ext4, Xfce) ~ rolling updates
    Tumbleweed (ext4, KDE Plasma5) ~ managed updates via "Tumbleweed Snapshots" service.

  8. #8
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,685
    Blog Entries
    3

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Quote Originally Posted by 111MilesToGo View Post
    First, the os-prober is disabled in both the primary and the secondary Linux by having a line like
    Code:
    GRUB_DISABLE_OS_PROBER="true"
    in both their /etc/default/grub files. Probably this is the default, so this line actually might be unneccessary.
    The default (for openSUSE) is to have that line there, but commented out. So removing the "#" at the beginning, so it is not a comment, stops os-prober from being automatically run.

    On the primary OS, Tumbleweed, my 40_custom now reads[CODE]#!/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.

    ### Entry to boot Manjaro Linux on sda2
    menuentry "Boot Entries for Manjaro Linux on /dev/sda2" {
    set bootdir='hd0,gpt2'
    search --fs-uuid --set=bootdir 7b00f0cc-307f-40a2-bff2-a1f767ee15f5
    configfile (${bootdir})/grub/grub.cfg
    }
    From here, that looks okay.

    Note, however: If manjaro has a separate "/boot" partition, then you need the UUID of "/boot" there.

    If it does not have a separate "/boot", then you would need: (${bootdir})/boot/grub/grub.cfg

    I've run into that from time to time. As far as I know, "${bootdir}" is just a name that I picked. It turns out that some names such as $prefix and $root have special significance to grub. So I avoided those.

    It is meant to boot into the secondary OS, Manjaro. Manjaro's root partition is /dev/sda2, and thus I am assuming this 40_custom should have
    • 'hd0,gpt2',
    • the UUID of /dev/sda2, i.e. 7b00f0cc-307f-40a2-bff2-a1f767ee15f5,
    • and ($bootdir)/grub/grub.cfg, since Manjaro's grub.cfg sits in Manjaro's /boot/grub directory (not in a /boot/grub2).
    You will need
    ($bootdir)/boot/grub/grub.cfg
    there. Here $bootdir is the directory you found with the UUID. Since that is the root directory, you need that "/boot" in the path.

    nrickert, please confirm or correct my assumptions. In fact, I am deviating from your example given yesterday, where you say to have the secondary OS on /dev/sdb2, but have a 'hd2,gpt2' statement.
    The "gpt2" is because this is a GPT partitioned disk. Otherwise, try "msdos". But, honestly, it doesn't do anything. If you get the UUID wrong, it will be used. But the partition number is unreliable.

    On my system, that "hd2,gpt2" refers to a partition on my second hard drive. But if there is a USB device plugged in, then it needs to be "hd3" rather than "hd2". And it is "hd2" rather than "hd1" because it is seeing the DVD as "hd1". Even if I move the SATA connectors around, the DVD still is "hd1". It has to do with how the BIOS numbers things. So it is not reliable, and the UUID is what really does the work. If you get the UUID right, then the disk number doesn't matter.

    On my part, I don't understand what the 41_custom as per the original Tumbleweed and Manjaro templates do.
    I have never used 41_custom. It looks to me as if I am not supposed change it. It looks in "/boot/grub2" to see if there is a file "custom.cfg", and imports that into the configuration.

    I think what you have is good, except for that missing "/boot" part of the path.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  9. #9

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Thanks, nrickert, for your comprehensive explanations. All set now, works fine so far. I am just left with figuring out how to pick one GRUB menu (the Tumbleweed primary one) entry as default and make it stick. Manjaro is doing s.th. of its own, I want to get rid of that default.

  10. #10
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,685
    Blog Entries
    3

    Default Re: GRUB2 os-prober does not generate correct entries for booting Manjaro as 2nd operating system

    Quote Originally Posted by 111MilesToGo View Post
    I am just left with figuring out how to pick one GRUB menu (the Tumbleweed primary one) entry as default and make it stick.
    The one that "sticks" is the one that the BIOS uses.

    For UEFI, this depends on the NVRAM entries, and might keep changing (depending on firmware). For legacy booting, it probably depends on whether grub is installed in the MBR or in a partition.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •