linux如何覆盖安装gpt4:windwos11 覆盖了 manjaro linux 的启动引导 grub 硬核推荐

 

互联网无处没有在,影响着我们的生活方方面面。从最近的新闻中,我们可以看到互联网正以1种令人难以置信的速度发展,让我们1起看看有哪些令人兴奋的故事。

date: 2022-048lastmod: 2022-048问题为何发生以往整 linux 我都是双系统或者虚拟机,但是后来觉得可以没有再使 windows 了,就完全把 windows 删除了。

有啥跑没有起来的整 wine 或者 虚拟机,但是直到更新 BIOS,wine 或者 虚拟机都没有办法,想着旧版 BIOS 也行,但是直到最近联想爆出 BIOS 存在重大隐患紧急更新了1批 BIOS,到驱动页面真的发现了新版的 BIOS,没想到啥好办法,只好装个 windows。

双系统中1般都推荐先装 windows 再装 linux,因为顺序反过来的话 windows 会覆盖掉 linux 的启动引导,就很恶心,而 linux 没有会覆盖其它系统的启动引导,检测到其它系统会将其添加到启动选项里边。

怎么办在 manjaro forum搜索了1波没找到很满意的答案,bing 搜索出来的答案也没有是十全十美,wiki 里搜索了 grub,找到这两 - GRUBGRUB/Restore the GRUB Bootloader

总的来说,先用安装盘进入 liveSystem,然后修复引导吐槽1下,windows 的安装盘没有 live,反倒是 linux 的大都有 live 可以先体验后安装在高低载了 manjaro-kde1.2.6-minimal20416-linux510.iso 发现无论用啥驱动都没法进去 live,这才想起第1次安装 manjaro 也是这样,就下了 manjaro-kde1.2.620416-linux515.iso,这个时候进去 live 易如反掌,也没有知道是啥原因。

工具U盘:存放系统安装文件Ventory:给 U 盘加上装系统的功能系统镜像:到下,manjaro-cd 现在没有提供同步了从 grub 进入 linux 系统这个以前自己遇到过:解决Deepin启动时无法进入系统出现grub>的问题

用 manjaro-kde1.2.6-minimal20416-linux510.iso 是没法进入 live,但是可以按 C 进入 grub 命令行模式先用 ls 查看所有盘及其分区,再逐个检验哪1个是 linux 所在的主分区,然后设置引导分区位置,再用 normal 启动。

用这个办法我确实启动了原有的 manjro

manjaro安装引导界面

Detect efi 的部门结果Detect efi bootloaders 的结果我都尝试了1下,发现还是进没有去,后面 grub 的尝试也说明了为何会失败,因为没有是 gpt1 而是 gpt4.上面按下 C 进入 grub 界面

boot with driver1的启动错误

boot with driver2的启动错误 没法进入 live 只好尝试1下 grub 了

从grub启动manjaro进去以后就直接重新生成引导(sudo grub-mkconfig -o /boot/grub/grub.cfg),然后想起以前用过的 sudo efibootmgr -v 查看了1下没有 manjaro,也没有好到底有没有百分之百的把握完全成功,重启以后发现进入的还是 win11,而且这1招从 grub 进入 manjaro 没有能重现了,敲 normal 启动以后1直黑屏,尝试了几次还是黑屏。

(长摁电源键可强制关机)接下来尝试过 BCDEdit 命令行选项、bcdedit,但是没查到怎么用这玩意添加 manjaro 启动项遂只好下 manjaro-kde1.2.620416-linux515.iso 去尝试进入 live了。

livsOS 修复 grub失败的修复$ sudo nano /etc/default/grub # 编辑配置文件,非必须(我之前把 menu 设置成 hidden 了,现在多系统要改回去) $ sudo grub-mkconfig -o /boot/grub/grub.cfg

# 重新生成引导,奇怪的是上面没有发现 win11 Generating grub configuration file ... Found theme: /usr/share/grub/themes/manjaro/theme.txt Found linux image: /boot/vmlinuz.15-x86_64 Found initrd image: /boot/amd-ucode.img /boot/initramfs.15-x86_64.img Found initrd fallback image: /boot/initramfs.15-x86_64-fallback.img Found linux image: /boot/vmlinuz.10-x86_64 Found initrd image: /boot/amd-ucode.img /boot/initramfs.10-x86_64.img Found initrd fallback image: /boot/initramfs.10-x86_64-fallback.img 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. Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi Adding boot menu entry

for UEFI Firmware Settings ... Found memtest86+ image: /boot/memtest86+/memtest.bin /usr/bin/grub-probe: warning: unknown device

type nvme0n1. done $ sudo efibootmgr -v BootCurrent: 0017 Timeout: 0 seconds BootOrder: 0000,0013,0014,0015,0016,0017,0018,0019 Boot0000* Windows Boot Manager HD

(1,GPT,171ffb3ec37801b11ba3cea2e27a,0x800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.

=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a................ Boot0010 Setup FvFile

(721c8b6626ce86e99457c46ab0b9) Boot0011 Boot Menu FvFile(864884401bb2c73ac50fbf7766bf

) Boot0012 UEFI Diagnostics FvFile(f8397897-e203a62-b977e7e5d94d91b) Boot0013* NVMe: WDC PC SN730 SDBPNTY12G101 PciRoot

(0x0)/Pci(0x2,0x4)/Pci(0x0,0x0)/NVMe(0x1,00B4B6A-ABF)....2.LN........ Boot0014* ATA HDD: VenMsg

(bc7838d2-0f82d60316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600) Boot0015* ATA HDD1: VenMsg

(bc7838d2-0f82d60316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f601) Boot0016* ATAPI CD: VenMsg

(bc7838d2-0f82d60316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354) Boot0017* USB HDD: SMI USB DISK PciRoot

(0x0)/Pci(0x8,0x1)/Pci(0x0,0x3)/USB(1,0)/USB(1,0)3.!..3.G..A..... Boot0018* USB FDD: VenMsg(bc7838d2-0f82d60316-c068ee79d25b,6ff015a28830b543a8b8641009461e49

) Boot0019* USB CD: VenMsg(bc7838d2-0f82d60316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55

)# 新增1个引导,说实话 -p 后面跟 1 还是 4 我没有太理解,我都试验过了,发现 1 可以删除用(删除 0001 为例): sudo efibootmgr -b 0001 -B $ sudo efibootmgr -c -w -L Manjaro -d /dev/nvme0n1 -p 。

1 -l /mnt/boot/efi/EFI/Manjaro/grubx64.efi 启动以后没有行,进入了 win11 并开始了 windows 的自动修复晒晒我的 grub 配置(/etc/default/grub)。

GRUB_DEFAULT=saved GRUB_TIMEOUT=3#GRUB_TIMEOUT_STYLE=hiddenGRUB_TIMEOUT_STYLE=menu GRUB_DISTRIBUTOR="Manjaro"

#GRUB_CMDLINE_LINUX_DEFAULT="quiet udev.log_priority=3"GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"GRUB_CMDLINE_LINUX

=""成功的修复次要操作和 GRUB/Restore the GRUB Bootloader 1致,没有的地方在于 efibootmgr 添加引导,路径和分区整的我都混乱了,所以这里的添加引导顺序、路径啥的我也没有记得哪个是对的了

$ lsblk -o PATH,PTTYPE,PARTTYPE,FSTYPE,PARTTYPENAME PATH PTTYPE PARTTYPE FSTYPE PARTTYPENAME /dev/loop0 squashfs /dev/loop1 squashfs /dev/loop2 squashfs /dev/loop3 squashfs /dev/sda dos /dev/sda1 dos 0x7 exfat HPFS/NTFS/exFAT /dev/sda2 dos 0xef vfat EFI

(FAT2/16/32) /dev/mer/ventoy dos iso9660 /dev/nvme0n1 gpt /dev/nvme0n1p1 gpt c12a7328-f81f1d2-ba4b-00a0c93ec93b vfat EFI System /dev/nvme0n1p2 gpt e3c9e316-0b5cdb817d-f92df00215ae Microsoft reserved /dev/nvme0n1p3 gpt 0fc63daf483772e79d69d8477de4 ext4 Linux filesystem /dev/nvme0n1p4 gpt 0fc63daf483772e79d69d8477de4 ext4 Linux filesystem /dev/nvme0n1p5 gpt ebd0a0a2-b9e54337c08b6b72699c7 ntfs Microsoft basic data /dev/nvme0n1p6 gpt ebd0a0a2-b9e54337c08b6b72699c7 ntfs Microsoft basic data

# 清楚的记得我的硬盘 /dev/nvme0n1,从 EFI System 就可以知道 UEFI 装在这个盘里 $ sudo fdisk -l /dev/nvme0n1 Disk /dev/nvme0n1: 476.94 GiB,

512110190592 bytes, 1000215216 sectors Disk model: WDC PC SN730 SDBPNTY12G101 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: 614A2A42-ED51C2DF82-A1F3105BA07D Device Start End Sectors Size Type /dev/nvme0n1p1

2048534527532480 260M EFI System /dev/nvme0n1p2 53452856729532768 16M Microsoft reserved /dev/nvme0n1p3

616448494850047494233600 235.7G Linux filesystem /dev/nvme0n1p4 494850048746508287251658240 120G Linux filesystem /dev/nvme0n1p5

746508288861851647115343360 55G Microsoft basic data /dev/nvme0n1p6 8618516481000212479138360832 66G Microsoft basic data $ sudo su

# pamac install manjaro-tools-base Error: target not found: manjaro-tools-base # 没有找到这个实属意外,但是实测没有影响接下来的操作

# manjaro-chroot -a==> Mounting (ManjaroLinux)[/dev/nvme0n1p4] --> mount: [/mnt] --> mount: [/mnt/boot/efi

]# pacman -Syu grub# grub-install --force --target=i386-pc --recheck --boot-directory=/boot /dev/nvme0n1

Installing for i386-pc platform. grub-install: warning: this GPT partition label contains no BIOS Boot Partition

; embedding won\t be possible. grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.. Installation finished. No error reported.

# grub-mkconfig -o /boot/grub/grub.cfg enerating grub configuration file ... Found theme: /usr/share/grub/themes/manjaro/theme.txt Found linux image: /boot/vmlinuz.15-x86_64 Found initrd image: /boot/amd-ucode.img /boot/initramfs.15-x86_64.img Found initrd fallback image: /boot/initramfs.15-x86_64-fallback.img Found linux image: /boot/vmlinuz.10-x86_64 Found initrd image: /boot/amd-ucode.img /boot/initramfs.10-x86_64.img Found initrd fallback image: /boot/initramfs.10-x86_64-fallback.img 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. Adding boot menu entry

for UEFI Firmware Settings ... Found memtest86+ image: /boot/memtest86+/memtest.bin /usr/bin/grub-probe: warning: unknown device

type nvme0n1. done# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck

Installing for x86_64-efi platform. Installation finished. No error reported. # grub-mkconfig -o /boot/grub/grub.cfg

Generating grub configuration file ... Found theme: /usr/share/grub/themes/manjaro/theme.txt Found linux image: /boot/vmlinuz.15-x86_64 Found initrd image: /boot/amd-ucode.img /boot/initramfs.15-x86_64.img Found initrd fallback image: /boot/initramfs.15-x86_64-fallback.img Found linux image: /boot/vmlinuz.10-x86_64 Found initrd image: /boot/amd-ucode.img /boot/initramfs.10-x86_64.img Found initrd fallback image: /boot/initramfs.10-x86_64-fallback.img 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. Adding boot menu entry

for UEFI Firmware Settings ... Found memtest86+ image: /boot/memtest86+/memtest.bin /usr/bin/grub-probe: warning: unknown device

type nvme0n1. done最后成功进入了原来的 manjaro,又重新生成了1次 grub,这次就找到了 win11参考[Succeed]rEFind安装之在Deepin上的1番折腾~怀疑联想~Could not prepare Boot variable: No space left on device. Kearney. 2021-029。

本文使用 Zhihu On VSCode 创作并发布

"这篇文章是我内心的倾诉,希望能你建立1种默契。如果你喜欢这份共鸣,记得关注收藏点赞哦!"

为您推荐

linux如何覆盖安装gpt4:windwos11 覆盖了 manjaro linux 的启动引导 grub 硬核推荐

linux如何覆盖安装gpt4:windwos11 覆盖了 manjaro linux 的启动引导 grub 硬核推荐

date: 2022-04-28lastmod: 2022-04-28问题为什么发生以往整 linux 我都是双系统或者虚拟机,但是后来觉得可以...

2023-06-16 栏目:科技派

当前非电脑浏览器正常宽度,请使用移动设备访问本站!