使用单独的 /boot 分区将 Ubuntu 启动项添加到 Fedora 33 Grub2

使用单独的 /boot 分区将 Ubuntu 启动项添加到 Fedora 33 Grub2

我使用 Ubuntudebootstrap并将其安装chroot到以下分区中,

├─nvme0n1p4                                   259:4    0   2.3G  0 part  /run/media/ignor/a62e0718-10c6-4224-8097-3a3f6c780070/boot
└─nvme0n1p5                                   259:5    0  52.2G  0 part  
  └─luks-03d97a82-4ec5-4824-8fc3-a3b5eb38d4f9 253:1    0  52.2G  0 crypt /run/media/ignor/a62e0718-10c6-4224-8097-3a3f6c780070

我尝试使用 Grub2 添加这个 ubuntu 分区,但模仿现有的条目,

[root@localhost boot]# cat /boot/loader/entries/c4c41f9ff04f4b2ab6b1e1667737970d-5.11.12-200.fc33.x86_64.conf 
title Fedora (5.11.12-200.fc33.x86_64) 33 (Workstation Edition)
version 5.11.12-200.fc33.x86_64
linux /vmlinuz-5.11.12-200.fc33.x86_64
initrd /initramfs-5.11.12-200.fc33.x86_64.img
options root=UUID=3b76b920-f5f8-40a9-b6f1-c16d3e6e5c9a ro rd.luks.uuid=luks-e5359785-6f0f-4d59-a3a3-1a6a4828e5fc rhgb quiet 
grub_users $grub_users
grub_arg --unrestricted
grub_class kernel

并创建了这个 Ubuntu 条目,但我/boot为 Ubuntu 使用了单独的分区。

[root@localhost boot]# cat /boot/loader/entries/ubuntu-5.8.0-49-generic.conf 
title Ubuntu (5.8.0-49-generic)
version 5.8.0-49-generic
linux /vmlinuz-5.8.0-49-generic
initrd /initrd.img-5.8.0-49-generic
options root=UUID=a62e0718-10c6-4224-8097-3a3f6c780070 ro rd.luks.uuid=luks-03d97a82-4ec5-4824-8fc3-a3b5eb38d4f9 rhgb quiet 
grub_users $grub_users
grub_arg --unrestricted
grub_class kernel

我如何让它使用 ubuntu/boot/分区中的内核?

答案1

您可以添加自定义 grub 条目/etc/grub.d/40_custom,然后通过运行以下命令使用此条目重新配置 grub:grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

相关内容