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.
Bookmarks