我已经使用非 UEFI 安装了 ArchLinux(自上次编辑以来,它现在是 UEFI)在 /dev/sda4使用包含两个逻辑卷的 LVM2 进行分区(/vgarch/arch_root 和 /vgarch/arch_home)因为我已经在 Ubuntu 22.04 上安装了 GRUB2,所以我想配置它来检测 ArchLinux,安装/dev/vgarch/arch_root并运行update-grub
(否则 os-prob 将不会检测,我不知道为什么)给了我以下输出
$ sudo update-grub
[sudo] password for ya22y:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.2.0-33-generic
Found initrd image: /boot/initrd.img-6.2.0-33-generic
Found linux image: /boot/vmlinuz-6.2.0-26-generic
Found initrd image: /boot/initrd.img-6.2.0-26-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
/usr/sbin/grub-probe: error: unknown filesystem.
Found Arch Linux on /dev/mapper/vgarch-arch_root
/usr/sbin/grub-probe: error: unknown filesystem.
Adding boot menu entry for UEFI Firmware Settings ...
done
GRUB 显示 ArchLinux 条目,但是当我启动时出现错误
错误:未找到文件“/vmlinuz-linux-lts”
但是内核已经安装好了。(并尝试从实时环境重新安装它)
$ sudo mount /dev/vgarch/arch_root /mnt
$ sudo chroot /mnt
[root@IYB /]# ls /boot
initramfs-linux-lts-fallback.img initramfs-linux-lts.img vmlinuz-linux-lts
尝试通过将以下脚本添加到 / 来手动添加 ArchLinux 条目等/grub.d/40_custom
menuentry 'Arch Linux' {
#UUID of /dev/vgarch/arch_root partition
search --no-floppy --fs-uuid --set=root 394db06d-01e3-43a3-bf84-22f7bca2cc0c
linux /boot/vmlinuz-linux-lts root=UUID=394db06d-01e3-43a3-bf84-22f7bca2cc0c rw
initrd /boot/initramfs.linux-lts.img }
启动‘Arch Linux’得到以下结果:
错误:未知文件系统
额外细节
/dev/sda
Disk /dev/sda: 238,47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: LITEON LMH-256V2
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7B055726-9B69-4E1B-9DD6-4762B556617D
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 1054719 1050624 513M EFI System
/dev/sda3 1054720 233877503 232822784 111G Linux filesystem
/dev/sda4 233877504 500117503 266240000 127G Linux LVM
逻辑卷
$ sudo lvdisplay
--- Logical volume ---
LV Path /dev/vgarch/arch_root
LV Name arch_root
VG Name vgarch
LV UUID yhsMld-G8Zp-h6au-pfZw-k3V1-EkuT-Wgyf5A
LV Write Access read/write
LV Creation host, time archiso, 2023-09-19 23:22:59 +0100
LV Status available
# open 0
LV Size 16,00 GiB
Current LE 4096
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vgarch/arch_home
LV Name arch_home
VG Name vgarch
LV UUID cwlwYH-FXu4-zU3n-yHsL-DkSo-Gsl8-uRkuLE
LV Write Access read/write
LV Creation host, time archiso, 2023-09-19 23:24:11 +0100
LV Status available
# open 0
LV Size <110,95 GiB
Current LE 28403
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
Arch 中的 /boot 目录
ya22y@IYB:~$ sudo mount /dev/vgarch/arch_root /mnt
ya22y@IYB:~$ sudo chroot /mnt
[root@IYB /]# ls /boot
initramfs-linux-lts-fallback.img initramfs-linux-lts.img vmlinuz-linux-lts
Arch 目录 /etc/mkinitcpio.conf
添加 lvm2 后,我运行了 mkinitcpio -P。
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block lvm2 filesystems fsck)
编辑
我已经将 grub 从 ArchLinux 安装到 ESP 分区(又名)/dev/sda2
,并使用 进行更新grub-mkconfig
。现在我有两个启动选项,ubuntu_grub 和 arch_grub。但是与 ubuntu 或 arch 关联的 grub 似乎都无法检测到其他操作系统。(os-prober 已启用)。
从 ubuntu_grub 启动..
Ubuntu 操作系统出现了,我可以启动它,但是进入 grub 救援模式并ls (lvm/vgarch-arch_root)
尝试
从 arch_grub 启动..
它直接让我进入 grub 救援模式,但是尝试ls (lvm/vgarch-arch_root)
并且ls (hd,gpt3)
似乎识别两个操作系统文件系统。
“没有已知的文件系统”。
启动修复启动信息摘要:
============================== Boot Info Summary ===============================
=> Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 2048
of the same hard drive for core.img. core.img is at this location and
looks for (,gpt3)/boot/grub. It also embeds following components:
modules
---------------------------------------------------------------------------
fshelp ext2 part_gpt biosdisk
---------------------------------------------------------------------------
sda1: __________________________________________________________________________
File system: BIOS Boot partition
Boot sector type: Grub2's core.img
Boot sector info:
sda2: __________________________________________________________________________
File system: vfat
Boot sector type: FAT32
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /efi/BOOT/fbx64.efi /efi/BOOT/mmx64.efi
/efi/grub_arch/grubx64.efi /efi/ubuntu/grubx64.efi
/efi/ubuntu/mmx64.efi /efi/ubuntu/shimx64.efi
/efi/ubuntu/grub.cfg
sda3: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 22.04.3 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
/boot/grub/i386-pc/core.img
sda4: __________________________________________________________________________
File system: LVM2_member
Boot sector type: -
Boot sector info:
sdb: ___________________________________________________________________________
File system: iso9660
Boot sector type: Grub2 (v1.99-2.00)
Boot sector info: Grub2 (v1.99-2.00) is installed in the boot sector of
sdb and looks at sector 0 of the same hard drive for
core.img, but core.img can not be found at this
location.
Mounting failed: mount: /mnt/BootInfo/FD/sdb: /dev/sdb already mounted or mount point busy.
================================ 2 OS detected =================================
OS#1: Ubuntu 22.04.3 LTS on sda3
OS#2: Arch Linux (rolling) on mapper/vgarch-arch_root
================================ Host/Hardware =================================
CPU architecture: 64-bit
Video: Haswell-ULT Integrated Graphics Controller from Intel Corporation
Live-session OS is Ubuntu 64-bit (Ubuntu 22.04.3 LTS, jammy, x86_64)
===================================== UEFI =====================================
BIOS/UEFI firmware: A17(65.17) from Dell Inc.
The firmware is EFI-compatible, and is set in EFI-mode for this live-session.
SecureBoot disabled (confirmed by mokutil).
BootCurrent: 000F
Timeout: 2 seconds
BootOrder: 000C,000A,000B,000D,000E,0001,0000,0002,0009,000F
Boot0000* ubuntu HD(2,GPT,b6110742-692a-45ec-9745-393729ff51e2,0x1000,0x100800)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* GRUB PciRoot(0x0)/Pci(0x1f,0x2)/Sata(1,65535,0)/HD(2,GPT,b6110742-692a-45ec-9745-393729ff51e2,0x1000,0x100800)/File(\EFI\ubuntu\grubx64.efi)
Boot0002* grub_arch HD(2,GPT,b6110742-692a-45ec-9745-393729ff51e2,0x1000,0x100800)/File(\EFI\grub_arch\grubx64.efi)
Boot0009* UEFI: LITEON LMH-256V2M-11 MSATA 256GB PciRoot(0x0)/Pci(0x1f,0x2)/Sata(1,65535,0)/HD(2,GPT,b6110742-692a-45ec-9745-393729ff51e2,0x1000,0x100800)AMBO
Boot000A* Diskette Drive BBS(Floppy,Diskette Drive,0x0)AMBO
Boot000B* Internal HDD BBS(HD,P1: LITEON LMH-256V2M-11 MSATA,0x0)AMBO
Boot000C* USB Storage Device BBS(USB,ADATA USB Flash Drive 0.00,0x0)AMBO
Boot000D* CD/DVD/CD-RW Drive BBS(CDROM,CD/DVD/CD-RW Drive,0x0)AMBO
Boot000E* Onboard NIC BBS(Network,IBA GE Slot 00C8 v1550,0x0)AMBO
Boot000F* UEFI: ADATA USB Flash Drive 0.00 PciRoot(0x0)/Pci(0x14,0x0)/USB(2,0)/HD(2,GPT,f45e2fa1-c5a6-4d79-876d-c8245af921e0,0x95f864,0x2754)AMBO
a9c517741ac31962d7feb152948ad1ee sda2/BOOT/fbx64.efi
a660182adef313615746a665966d2ccc sda2/BOOT/mmx64.efi
3ef1fbaf89bb4141a06ee06b1db9ca8f sda2/grub_arch/grubx64.efi
5ddf997e8b025bfbc2009e85b32f60dc sda2/ubuntu/grubx64.efi
a660182adef313615746a665966d2ccc sda2/ubuntu/mmx64.efi
64349b3622c65f495a99dbf6102496e3 sda2/ubuntu/shimx64.efi
64349b3622c65f495a99dbf6102496e3 sda2/BOOT/BOOTX64.efi
============================= Drive/Partition Info =============================
Disks info: ____________________________________________________________________
sda : is-GPT, hasBIOSboot, has---ESP, not-usb, not-mmc, has-os, no-wind, 2048 sectors * 512 bytes
Partitions info (1/3): _________________________________________________________
mapper/vgarch-arch_root : is-os, 64, pacman, no-docgrub, grub2, grub-install, grubenv-ok, grub-mkconfig -o /boot/grub, not-far
mapper/vgarch-arch_home : no-os, 64, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sda2 : no-os, 64, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sda3 : is-os, 64, apt-get, signed grub-pc grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
Partitions info (2/3): _________________________________________________________
mapper/vgarch-arch_root : isnotESP, fstab-without-efi, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
mapper/vgarch-arch_home : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda2 : is---ESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda3 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
Partitions info (3/3): _________________________________________________________
mapper/vgarch-arch_root : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, sda
mapper/vgarch-arch_home : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda2 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda3 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, sda
fdisk -l (filtered): ___________________________________________________________
Disk sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk identifier: 7B055726-9B69-4E1B-9DD6-4762B556617D
Start End Sectors Size Type
sda1 2048 4095 2048 1M BIOS boot
sda2 4096 1054719 1050624 513M EFI System
sda3 1054720 233877503 232822784 111G Linux filesystem
sda4 233877504 500117503 266240000 127G Linux LVM
Disk mapper/vgarch-arch_root: 16 GiB, 17179869184 bytes, 33554432 sectors
Disk mapper/vgarch-arch_home: 110.95 GiB, 119130816512 bytes, 232677376 sectors
Disk sdb: 7.24 GiB, 7775191040 bytes, 15185920 sectors
Disk identifier: F45E2FA1-C5A6-4D79-876F-C8245AF921E0
Start End Sectors Size Type
sdb1 64 9828451 9828388 4.7G Microsoft basic data
sdb2 9828452 9838519 10068 4.9M EFI System
sdb3 9838520 9839119 600 300K Microsoft basic data
sdb4 9842688 15185856 5343169 2.5G Linux filesystem
parted -lm (filtered): _________________________________________________________
sda:256GB:scsi:512:512:gpt:ATA LITEON LMH-256V2:;
1:1049kB:2097kB:1049kB:::bios_grub;
2:2097kB:540MB:538MB:fat32:EFI System Partition:boot, esp;
3:540MB:120GB:119GB:ext4::;
4:120GB:256GB:136GB:::lvm;
sdb:7775MB:scsi:512:512:gpt:ADATA USB Flash Drive:;
1:32.8kB:5032MB:5032MB::ISO9660:hidden, msftdata;
2:5032MB:5037MB:5155kB::Appended2:boot, esp;
3:5037MB:5038MB:307kB::Gap1:hidden, msftdata;
4:5039MB:7775MB:2736MB:ext4::;
mapper/vgarch-arch_home:119GB:dm:512:512:loop:Linux device-mapper (linear):;
1:0.00B:119GB:119GB:ext4::;
mapper/vgarch-arch_root:17.2GB:dm:512:512:loop:Linux device-mapper (linear):;
1:0.00B:17.2GB:17.2GB:ext4::;
blkid (filtered): ______________________________________________________________
NAME FSTYPE UUID PARTUUID LABEL PARTLABEL
sda
├─sda1 0b56d3c5-5f49-4918-b03e-a74ac1b4a646
├─sda2 vfat BD1A-71EF b6110742-692a-45ec-9745-393729ff51e2 EFI System Partition
├─sda3 ext4 e5d44bf3-db5f-40ff-bd31-ca7c932bc706 617bf50b-b498-48b2-857d-9537226c4a72
└─sda4 LVM2_member JWq8ac-3jR4-Ey1E-2mw0-EmPJ-YPVe-dPVeR8 763ae511-8ba2-400a-8cca-0e4126bfa1a0
├─vgarch-arch_root ext4 394db06d-01e3-43a3-bf84-22f7bca2cc0c
└─vgarch-arch_home ext4 12ca58df-3d30-436e-95ff-cc4c42c6e7a2
sdb iso9660 2023-08-08-01-19-05-00 Ubuntu 22.04.3 LTS amd64
├─sdb1 iso9660 2023-08-08-01-19-05-00 f45e2fa1-c5a6-4d79-876e-c8245af921e0 Ubuntu 22.04.3 LTS amd64 ISO9660
├─sdb2 vfat F7DB-4D56 f45e2fa1-c5a6-4d79-876d-c8245af921e0 ESP Appended2
├─sdb3 f45e2fa1-c5a6-4d79-876c-c8245af921e0 Gap1
└─sdb4 ext4 913a515f-213d-4b90-954b-51e9103431ed 424ba32d-f6fd-a74e-87e0-cb7c55af8ef6 writable
Mount points (filtered): _______________________________________________________
Avail Use% Mounted on
/dev/disk/by-label/writable[/install-logs-2023-09-23.0/crash] 2.3G 0% /var/crash
/dev/disk/by-label/writable[/install-logs-2023-09-23.0/log] 2.3G 0% /var/log
/dev/mapper/vgarch-arch_home 103.1G 0% /mnt/boot-sav/mapper/vgarch-arch_home
/dev/mapper/vgarch-arch_root 12.7G 14% /mnt/boot-sav/mapper/vgarch-arch_root
/dev/sda2 505.7M 1% /mnt/boot-sav/sda2
/dev/sda3 84.5G 17% /mnt/boot-sav/sda3
/dev/sdb1 0 100% /cdrom
Mount options (filtered): ______________________________________________________
============================== ls -R /dev/mapper/ ==============================
/dev/mapper:
control
vgarch-arch_home
vgarch-arch_root
===================== sda2/efi/ubuntu/grub.cfg (filtered) ======================
search.fs_uuid e5d44bf3-db5f-40ff-bd31-ca7c932bc706 root hd0,gpt3
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
====================== sda3/boot/grub/grub.cfg (filtered) ======================
Ubuntu e5d44bf3-db5f-40ff-bd31-ca7c932bc706
Ubuntu, with Linux 6.2.0-33-generic e5d44bf3-db5f-40ff-bd31-ca7c932bc706
Ubuntu, with Linux 6.2.0-26-generic e5d44bf3-db5f-40ff-bd31-ca7c932bc706
### END /etc/grub.d/30_os-prober ###
UEFI Firmware Settings uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###
Arch Linux
========================== sda3/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=e5d44bf3-db5f-40ff-bd31-ca7c932bc706 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=BD1A-71EF /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
======================= sda3/etc/default/grub (filtered) =======================
GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_SAVEDEFAULT="false"
GRUB_DISABLE_OS_PROBER="false"
==================== sda3: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
78.407356262 = 84.189257728 boot/grub/grub.cfg 1
2.705089569 = 2.904567808 boot/grub/i386-pc/core.img 1
9.759067535 = 10.478718976 boot/vmlinuz 2
10.729740143 = 11.520970752 boot/vmlinuz-6.2.0-26-generic 1
9.759067535 = 10.478718976 boot/vmlinuz-6.2.0-33-generic 2
10.729740143 = 11.520970752 boot/vmlinuz.old 1
15.446777344 = 16.585850880 boot/initrd.img 1
4.538490295 = 4.873166848 boot/initrd.img-6.2.0-26-generic 2
15.446777344 = 16.585850880 boot/initrd.img-6.2.0-33-generic 1
4.538490295 = 4.873166848 boot/initrd.img.old 2
===================== sda3: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 18683 Dec 18 2022 10_linux
-rwxr-xr-x 1 root root 43031 Dec 18 2022 10_linux_zfs
-rwxr-xr-x 1 root root 14387 Dec 18 2022 20_linux_xen
-rwxr-xr-x 1 root root 13369 Dec 18 2022 30_os-prober
-rwxr-xr-x 1 root root 1372 Dec 18 2022 30_uefi-firmware
-rwxr-xr-x 1 root root 700 May 17 05:35 35_fwupd
-rwxr-xr-x 1 root root 467 Sep 20 18:47 40_custom
-rwxr-xr-x 1 root root 215 Dec 18 2022 41_custom
drwxr-xr-x 4 root root 4096 Sep 19 23:23 backup
========================== sda3/etc/grub.d/40_custom ===========================
#!/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
menuentry 'Arch Linux' {
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 394db06d-01e3-43a3-bf84-22f7bca2cc0c
linux /boot/vmlinuz-linux-lts root=UUID=394db06d-01e3-43a3-bf84-22f7bca2cc0c rw
initrd /boot/initramfs.linux-lts.img
}
==================== blkid (filtered) before lvm activation ====================
/dev/mapper/vgarch-arch_root: UUID="394db06d-01e3-43a3-bf84-22f7bca2cc0c" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vgarch-arch_home: UUID="12ca58df-3d30-436e-95ff-cc4c42c6e7a2" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="BD1A-71EF" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="b6110742-692a-45ec-9745-393729ff51e2"
/dev/sda3: UUID="e5d44bf3-db5f-40ff-bd31-ca7c932bc706" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="617bf50b-b498-48b2-857d-9537226c4a72"
/dev/sdb1: BLOCK_SIZE="2048" UUID="2023-08-08-01-19-05-00" LABEL="Ubuntu 22.04.3 LTS amd64" TYPE="iso9660" PARTLABEL="ISO9660" PARTUUID="f45e2fa1-c5a6-4d79-876e-c8245af921e0"
/dev/sdb4: LABEL="writable" UUID="913a515f-213d-4b90-954b-51e9103431ed" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="424ba32d-f6fd-a74e-87e0-cb7c55af8ef6"
/dev/sdb2: SEC_TYPE="msdos" LABEL_FATBOOT="ESP" LABEL="ESP" UUID="F7DB-4D56" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Appended2" PARTUUID="f45e2fa1-c5a6-4d79-876d-c8245af921e0"
/dev/sda4: UUID="JWq8ac-3jR4-Ey1E-2mw0-EmPJ-YPVe-dPVeR8" TYPE="LVM2_member" PARTUUID="763ae511-8ba2-400a-8cca-0e4126bfa1a0"
/dev/sdb3: PARTLABEL="Gap1" PARTUUID="f45e2fa1-c5a6-4d79-876c-c8245af921e0"
/dev/sda1: PARTUUID="0b56d3c5-5f49-4918-b03e-a74ac1b4a646"
================================ LVM activation ================================
modprobe dm-mod
vgscan --mknodes
Found volume group "vgarch" using metadata type lvm2
vgchange -ay
2 logical volume(s) in volume group "vgarch" now active
lvscan
ACTIVE '/dev/vgarch/arch_root' [16.00 GiB] inherit
ACTIVE '/dev/vgarch/arch_home' [<110.95 GiB] inherit
blkid -g
Suggested repair: ______________________________________________________________
The default repair of the Boot-Repair utility would purge (in order to fix packages) and reinstall the grub-efi of
mapper/vgarch-arch_root,
using the following options: sda2/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file
Final advice in case of suggested repair: ______________________________________
Please do not forget to make your UEFI firmware boot on the Arch Linux (rolling) entry (sda2/efi/****/grub****.efi (**** will be updated in the final message) file) !
答案1
显然,从 arch 端运行 os-prober 检测到了 ubuntu,操作方法如下:
-从 Live CD 启动 Arch Linux 并连接到网络。使用iwctl
- 在我的情况下,挂载包含根系统的逻辑卷的分区/dev/vgarch/arch_root
。
$mount /dev/vgarch/arch_root /mnt
-chroot 到已安装的分区
$arch-chroot /mnt
-使用以下方式在系统上安装 grub 包pacman -S grub dosfstools os-prober mtools
-现在将 ESP 分区挂载到/启动/EFI目录(如果不存在则使用创建一个mkdir /boot/EFI
)
$mount /dev/sda2 /boot/EFI
-在 EFI 分区上安装 grub
rub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=ARCH --recheck
-确保 os-prober 已启用并更新 grub
grub-mkconfig -o /boot/grub/grub.cfg
-退出 chroot 并重新启动,然后从 ARCH 条目启动,新安装的 grub 将检测 ubuntu 操作系统,您可以根据启动顺序优先级将其设为默认引导加载程序。