[linux|运维] Deepin系统efi引导丢失解决办法

马凡
2023-12-01

系统环境说明

系统:Deepin V20 社区版(1010)
平台:amd64

导致deepin系统efi引导丢失的原因

进入BOIS将设置恢复成默认设置,导致linux的引导丢失,windows的引导正常。

处理办法

  1. 使用deepin系统ISO中的启动盘制作工具制作deepin系统U盘启动盘;
  2. 使用U盘启动,待进入系统安装界面,按Ctrl+Alt+F1进入命令按界面
  3. 使用efibootmgr命令查看efi启动信息
╰─$ efibootmgr 
BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0001,0000,0010,0011,0012,0013,0014,0018,0019,001A,001B,001C,001D,001E,001F,0020,0021
Boot0000* Windows Boot Manager
Boot0010  Setup
Boot0011  Boot Menu
Boot0012  Diagnostic Splash Screen
Boot0013  Lenovo Diagnostics
Boot0014  Regulatory Information
Boot0015  Startup Interrupt Menu
Boot0016  Rescue and Recovery
Boot0017  MEBx Hot Key
Boot0018* USB CD
Boot0019* USB FDD
Boot001A* NVMe0
Boot001B* NVMe1
Boot001C* ATA HDD0
Boot001D* ATA HDD1
Boot001E* USB HDD
Boot001F* PXE BOOT
Boot0020  Other CD
Boot0021  Other HDD
Boot0022* IDER BOOT CDROM
Boot0023* IDER BOOT Floppy
Boot0024* ATA HDD
Boot0025* ATAPI CD
  1. 查找系统启动文件,每个系统都会在EFI分区建立自己的启动文件。
╰─$ sudo fdisk -l
Disk /dev/nvme0n1: 953.9 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: SAMSUNG MZVLB1T0HBLR-000L7              
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: 9481CFCB-1CAD-42D9-955A-675CAEE17DA3

Device              Start        End   Sectors   Size Type
/dev/nvme0n1p1       2048     534527    532480   260M EFI System
/dev/nvme0n1p2     534528     567295     32768    16M Microsoft reserved
/dev/nvme0n1p3     567296  237080575 236513280 112.8G Microsoft basic data
/dev/nvme0n1p4  237080576 1056280575 819200000 390.6G Microsoft basic data
/dev/nvme0n1p5 1998360576 2000408575   2048000  1000M Windows recovery environment
/dev/nvme0n1p6 1056280576 1220120575 163840000  78.1G Linux filesystem
/dev/nvme0n1p7 1220120576 1253675007  33554432    16G Linux swap
/dev/nvme0n1p8 1253675008 1262063615   8388608     4G Linux filesystem
/dev/nvme0n1p9 1262063616 1998356479 736292864 351.1G Linux filesystem

Partition table entries are not in disk order.

  1. 挂载EFI分区
sudo mount /dev/nvme0n1p1 /mnt/      #挂载EFI分区到/mnt目录
  1. 进入EFI分区
cd /mnt/EFI
  1. 查看EFI下各目录内容
╰─$ ls -la *
Boot:
总用量 4076
drwxr-xr-x 2 root root    4096 Nov  7 20:28 .
drwxr-xr-x 6 root root    4096 Nov  7 20:28 ..
-rwxr-xr-x 1 root root 1169992 Nov  7 20:28 bootx64.efi
-rwxr-xr-x 1 root root 1527816 Nov  7 20:28 bootx64.efi-1604752105.bak
-rwxr-xr-x 1 root root     112 Nov  7 20:28 grub.cfg
-rwxr-xr-x 1 root root 1067896 Nov  7 20:28 grubx64.efi
-rwxr-xr-x 1 root root  379992 May 14  2015 LenovoBT.EFI
-rwxr-xr-x 1 root root    1523 Jun 18  2012 License.txt
-rwxr-xr-x 1 root root      74 Aug  6  2012 ReadMe.txt

Microsoft:
总用量 20
drwxr-xr-x  4 root root 4096 Jul  6  2020 .
drwxr-xr-x  6 root root 4096 Nov  7 20:28 ..
drwxr-xr-x 40 root root 8192 Jul  6  2020 Boot
drwxr-xr-x  2 root root 4096 Jul  6  2020 Recovery

ubuntu:
总用量 1056
drwxr-xr-x 2 root root    4096 Nov  7 20:28 .
drwxr-xr-x 6 root root    4096 Nov  7 20:28 ..
-rwxr-xr-x 1 root root     112 Nov  7 20:28 grub.cfg
-rwxr-xr-x 1 root root 1067896 Nov  7 20:28 grubx64.efi

UOS:
总用量 3416
drwxr-xr-x 2 root root    4096 Nov  7 20:28 .
drwxr-xr-x 6 root root    4096 Nov  7 20:28 ..
-rwxr-xr-x 1 root root   72144 Nov  7 20:28 fbx64.efi
-rwxr-xr-x 1 root root     112 Nov  7 20:28 grub.cfg
-rwxr-xr-x 1 root root 1067896 Nov  7 20:28 grubx64.efi
-rwxr-xr-x 1 root root 1168464 Nov  7 20:28 mmx64.efi
-rwxr-xr-x 1 root root 1169992 Nov  7 20:28 shimx64.efi

  1. 添加Deepin启动项,我的Deepin安装在/dev/nvme0n1p8,注意路径
sudo efibootmgr -c -w -L "UOS" -d /dev/nvme0n1p8 -p 1 -l \\EFI\\UOS\\grubx64.efi
  1. 删除启动项的命令
sudo efibootmgr -b 0001 -B      #删除刚才添加的Deepin启动项,对应的编号为0001

参考文献地址用efibootmgr管理UEFI启动项,添加丢失的启动项

 类似资料: