Results 1 to 4 of 4

Thread: Dualboot with 2nd Linux distro (EFI + Grub)

  1. #1
    Join Date
    Sep 2021
    Beans
    1

    Dualboot with 2nd Linux distro (EFI + Grub)

    Hi,

    I have a laptop that came preinstalled with Ubuntu on an encrypted LVM volume. Now, I want to add a 2nd Linux distribution (Arch Linux) so I can select to boot either Ubuntu or Arch Linux during boot.

    My idea is to have a new logical volume inside the existing volume group, so the same password is used both for Ubuntu and Arch Linux. But so far, I have had no success because the /boot/grub/grub.cfg file generated by grub-mkconfig is not correct. If you can suggest any tutorials, please let me know. This is what I have tried so far:

    - The config of grub was changed so that the grub menu appears for 30 seconds during boot, so I can select which OS to boot.

    - LVM volumes have been adapted to make room for a third logical volume, which I have named system-root--archlinux. Here's the output of lsblk:
    Code:
    NAME                         MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
    nvme0n1                      259:0    0 931,5G  0 disk
    ├─nvme0n1p1                  259:1    0   512M  0 part  /boot
    ├─nvme0n1p2                  259:2    0   512M  0 part  /boot/efi
    └─nvme0n1p3                  259:3    0 930,5G  0 part
      └─crypt_dev_nvme0n1p3      253:0    0 930,5G  0 crypt
        ├─system-root            253:1    0   300G  0 lvm   /
        ├─system-swap            253:2    0     8G  0 lvm   [SWAP]
        └─system-root--archlinux 253:3    0 180,3G  0 lvm
    - ArchLinux has been installed on system-root--archlinux. During the installation of ArchLinux, I have mounted /dev/nvme0n1p1 on /boot and /dev/nvme0n1p2 on /boot/efi (just like on Ubuntu), so that I now have different kernels lying on /dev/nvme0n1p1 (both for Ubuntu and ArchLinux)

    - With Ubuntu booted, I have modified /etc/default/grub by adding the line
    Code:
    GRUB_DISABLE_OS_PROBER=false
    so that grub-mkconfig detects a 2nd operating system.

    I ran

    Code:
    grub mkconfig -o /boot/grub/grub.cfg
    and the output of that command included the following:

    Found Arch Linux on /dev/mapper/system-root--archlinux
    However, the command seems to have created a faulty menuentry for Ubuntu. This is the new menuentry for Ubuntu:

    Code:
    menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a50719c8-4978-4b75-8cae-1cfe6fc7efb2' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='hd0,gpt1'  13f8547c-f4ac-4553-ae1c-4dbda14b9cc0
        else
          search --no-floppy --fs-uuid --set=root 13f8547c-f4ac-4553-ae1c-4dbda14b9cc0
        fi
        linux    /vmlinuz-linux root=/dev/mapper/system-root ro  quiet splash xhci_hcd.quirks=1073741824 $vt_handoff
        initrd    /initramfs-linux.img
    }
    The problems are the last two lines in the menuentry section (linux and initrd): The files vmlinuz-linux and initramfs-linux.img were created by ArchLinux. Ubuntu should instead use the 5.11 kernel and initrd image. Prior to running `grub mkconfig`, the last two lines were:
    Code:
        linux    /vmlinuz-5.11.0-34-generic root=/dev/mapper/system-root ro  quiet splash xhci_hcd.quirks=1073741824 $vt_handoff
        initrd    /initrd.img-5.11.0-34-generic
    Unfortunately, I didn't find any documentation about grub-mkconfig, so I'm not sure how I should tell this tool to use one kernel for Arch Linux and a different kernel for Ubuntu.

    Any ideas what I should be doing differently to generate correct menuentries? If possible, I would like to avoid to manually edit the file and instead generate it with grub-mkconfig.

  2. #2
    Join Date
    May 2008
    Beans
    3,983
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Dualboot with 2nd Linux distro (EFI + Grub)

    Quote Originally Posted by jcdenton251 View Post
    The config of grub was changed so that the grub menu appears for 30 seconds during boot, so I can select which OS to boot.
    With two Linux Systems, Grub from the last installation usually takes care of identifying both systems.
    What was wrong here if you can select either OS?

    Do you want Ubuntu to control Grub?

  3. #3
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Dualboot with 2nd Linux distro (EFI + Grub)

    I know with Ubuntu you cannot share a /boot partition.
    Not sure with other distributions, but issue is that kernels may not be unique or it tries to configure wrong one.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  4. #4
    Join Date
    Jun 2007
    Location
    Arizona U.S.A.
    Beans
    5,739

    Re: Dualboot with 2nd Linux distro (EFI + Grub)

    Quote Originally Posted by jcdenton251 View Post
    ...the [grub mkconfig] command seems to have created a faulty menuentry for Ubuntu. Any ideas what I should be doing differently to generate correct menuentries?
    These incorrect menuentries happen when the distros are not closely related and one probes the other to make a grub menuentry. Two Ubuntu-based distros would likely not do this.

    Solution
    With UEFI, you can instead have each distro boot using it's own grub version if you chainload the bootloader of the second OS from the grub menu of the first. This requires a custom menuentry that you construct yourself.

    Process Outline:

    START UP
    Boot to the Arch Linux Grub Menu.
    EITHER
    Select the custom menuentry to chainload to the Ubuntu boot loader which is inside the EFI system partition and thus reach the Ubuntu Grub menu,
    OR
    Select the Arch Menuentry and boot Arch.

    I don't use encryption, so you must solve how you incorporate encryption into this process.

Bookmarks

Posting Permissions

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