Udo*_*Udo 7 linux grub boot grub2 uefi
由于某种原因,硬盘 WDC WD40EJRX-89A 上的 GRUB 消失了。也许原因是我物理上更改了 SATA 驱动器/电缆,并且不确定是否将 SATA 电缆插入相同的插槽中。
\n我尝试使用 live cd 重新安装 GRUB 但它没有安装
\n root@debian:~# fdisk -l\nDisk /dev/sdc: 232.89 GiB, 250059350016 bytes, 488397168 sectors\nDisk model: Samsung SSD 850 \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nI/O size (minimum/optimal): 512 bytes / 512 bytes\nDisklabel type: gpt\n\n\nDevice Start End Sectors Size Type\n/dev/sdc1 2048 1085439 1083392 529M Windows recovery environment\n/dev/sdc2 1085440 1290239 204800 100M EFI System\n/dev/sdc3 1290240 1323007 32768 16M Microsoft reserved\n/dev/sdc4 1323008 185296895 183973888 87.7G Microsoft basic data\n/dev/sdc5 185296896 488394751 303097856 144.5G Microsoft basic data\n\n\nDisk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors\nDisk model: WDC WD40EJRX-89A\nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 4096 bytes\nI/O size (minimum/optimal): 4096 bytes / 4096 bytes\nDisklabel type: gpt\n\n\nDevice Start End Sectors Size Type\n/dev/sdb1 2048 1050623 1048576 512M EFI System\n/dev/sdb2 1050624 4956159 3905536 1.9G Linux filesystem\n/dev/sdb3 4956160 5669019647 5664063488 2.6T Linux filesystem\n/dev/sdb4 5669019648 5669224447 204800 100M EFI System\n/dev/sdb5 5669224448 5669257215 32768 16M Microsoft reserved\n/dev/sdb6 5669257216 5882199868 212942653 101.5G Microsoft basic data\n/dev/sdb7 5882200064 5883518975 1318912 644M Windows recovery environment\n/dev/sdb8 5883521024 5883725823 204800 100M EFI System\n/dev/sdb9 5883725824 5883930623 204800 100M EFI System\n\n\nDisk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors\nDisk model: ST1000VX000-1ES1\nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 4096 bytes\nI/O size (minimum/optimal): 4096 bytes / 4096 bytes\nDisklabel type: dos\n\nDevice Boot Start End Sectors Size Id Type\n/dev/sda1 * 2048 6053887 6051840 2.9G 83 Linux\n/dev/sda2 336230400 1953521663 1617291264 771.2G 7 HPFS/NTFS/exFAT\n/dev/sda3 6055934 336230399 330174466 157.4G 5 Extended\n/dev/sda5 6055936 336230399 330174464 157.4G 83 Linux\n\nPartition 3 does not start on physical sector boundary.\nPartition table entries are not in disk order.\n\n\nDisk /dev/sdd: 7.5 GiB, 8056209408 bytes, 15734784 sectors\nDisk model: Transcend 8GB \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nI/O size (minimum/optimal): 512 bytes / 512 bytes\nDisklabel type: dos\n\nDevice Boot Start End Sectors Size Id Type\n/dev/sdd1 * 0 4938303 4938304 2.4G 0 Empty\n/dev/sdd2 1496 6721 5226 2.6M ef EFI (FAT-12/16/32)\n\n\nDisk /dev/loop0: 2.08 GiB, 2237280256 bytes, 4369688 sectors\nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical/physical): 512 bytes / 512 bytes\nI/O size (minimum/optimal): 512 bytes / 512 bytes\n\nroot@debian:~# cryptsetup luksOpen /dev/sdb3 home_sdb3\nEnter passphrase for /dev/sdb3: \nroot@debian:~# vgchange -ay\n 2 logical volume(s) in volume group "User-PC-vg" now active\nroot@debian:~# vgscan\n Found volume group "User-PC-vg" using metadata type lvm2\nroot@debian:~# vgscan -ay \nvgscan: invalid option -- 'a'\n Error during parsing of command line.\nroot@debian:~# vgchange -ay\n 2 logical volume(s) in volume group "User-PC-vg" now active\nroot@debian:~# lvscan\n ACTIVE '/dev/User-PC-vg/root' [<55.88 GiB] inherit\n ACTIVE '/dev/User-PC-vg/home' [2.58 TiB] inherit\nroot@debian:~# mount /dev/User-PC-vg/root /mnt\nroot@debian:~# modprobe efivars\nmodprobe: FATAL: Module efivars not found in directory /lib/modules/5.10.0-10-amd64\nroot@debian:~# mount /dev/sdb1 /mnt/boot/efi\nmount: /mnt/boot/efi: mount point does not exist.\nroot@debian:~# mount /dev/User-PC-vg/root /mnt\nmount: /mnt: /dev/mapper/User--PC--vg-root already mounted on /mnt.\nroot@debian:~# mount /dev/sdb1 /mnt/boot/efi^C\nroot@debian:~# umount /mnt\nroot@debian:~# mkdir /media/linux\nroot@debian:~# mount /dev/User-PC-vg/root /media/linux/\nroot@debian:~# modprobe efivars\nmodprobe: FATAL: Module efivars not found in directory /lib/modules/5.10.0-10-amd64\nroot@debian:~# mount /dev/sdb1 /media/linux/boot/efi\nmount: /media/linux/boot/efi: mount point does not exist.\nroot@debian:~# mount --bind /dev /media/linux/dev/\nroot@debian:~# mount --bind /dev/pts /media/linux/dev/pts\nroot@debian:~# mount --bind /proc /media/linux/proc\nroot@debian:~# mount --bind /sys /media/linux/sys\nroot@debian:~# chroot /media/linux\nroot@debian:/# mount /dev/sdb1 /boot/efi\nmount: /boot/efi: mount point does not exist.\nroot@debian:/# mount /dev/sdb2 /boot\n\n\nroot@debian:~# chroot /media/linux\nroot@debian:/# mount /dev/sdb1 /boot/efi\nroot@debian:/# mount /dev/sdb2 /boot\nmount: /boot: /dev/sdb2 already mounted on /boot.\n\nroot@debian:/etc/apt/sources.list.d# apt-get install --reinstall grub-efi-amd64\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\n0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.\nNeed to get 39.8 kB of archives.\nAfter this operation, 0 B of additional disk space will be used.\nGet:1 http://deb.debian.org/debian bullseye/main amd64 grub-efi-amd64 amd64 2.04-20 [39.8 kB]\nFetched 39.8 kB in 0s (271 kB/s) \nPreconfiguring packages ...\n(Reading database ... 169682 files and directories currently installed.)\nPreparing to unpack .../grub-efi-amd64_2.04-20_amd64.deb ...\nUnpacking grub-efi-amd64 (2.04-20) over (2.04-20) ...\nSetting up grub-efi-amd64 (2.04-20) ...\nInstalling for x86_64-efi platform.\ngrub-install: warning: EFI variables are not supported on this system..\nInstallation finished. No error reported.\nGenerating grub configuration file ...\nFound background image: /usr/share/images/desktop-base/desktop-grub.png\nFound linux image: /boot/vmlinuz-5.10.0-11-amd64\nFound initrd image: /boot/initrd.img-5.10.0-11-amd64\nFound linux image: /boot/vmlinuz-5.10.0-10-amd64\nFound initrd image: /boot/initrd.img-5.10.0-10-amd64\ngrub-probe: error: cannot find a GRUB drive for /dev/sdd1. Check your device.map.\ndone\nProcessing triggers for shim-signed:amd64 (1.38+15.4-7) ...\nroot@debian:/etc/apt/sources.list.d# apt-get install --reinstall grub-efi\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nThe following NEW packages will be installed:\n grub-efi\n0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 2,536 B of archives.\nAfter this operation, 16.4 kB of additional disk space will be used.\nGet:1 http://deb.debian.org/debian bullseye/main amd64 grub-efi amd64 2.04-20 [2,536 B]\nFetched 2,536 B in 0s (13.6 kB/s) \nSelecting previously unselected package grub-efi.\n(Reading database ... 169682 files and directories currently installed.)\nPreparing to unpack .../grub-efi_2.04-20_amd64.deb ...\nUnpacking grub-efi (2.04-20) ...\nSetting up grub-efi (2.04-20) ...\nroot@debian:/etc/apt/sources.list.d# update-grub\nGenerating grub configuration file ...\nFound background image: /usr/share/images/desktop-base/desktop-grub.png\nFound linux image: /boot/vmlinuz-5.10.0-11-amd64\nFound initrd image: /boot/initrd.img-5.10.0-11-amd64\nFound linux image: /boot/vmlinuz-5.10.0-10-amd64\nFound initrd image: /boot/initrd.img-5.10.0-10-amd64\ngrub-probe: error: cannot find a GRUB drive for /dev/sdd1. Check your device.map.\ndone\nroot@debian:/etc/apt/sources.list.d# cat /boot/grub/device.map \ncat: /boot/grub/device.map: No such file or directory\nroot@debian:/etc/apt/sources.list.d# grub-mkdevicemap\nroot@debian:/etc/apt/sources.list.d# lsblk\nNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\nloop0 7:0 0 2.1G 1 loop \nsda 8:0 0 931.5G 0 disk \n\xe2\x94\x9c\xe2\x94\x80sda1 8:1 0 2.9G 0 part \n\xe2\x94\x9c\xe2\x94\x80sda2 8:2 0 771.2G 0 part \n\xe2\x94\x9c\xe2\x94\x80sda3 8:3 0 1K 0 part \n\xe2\x94\x94\xe2\x94\x80sda5 8:5 0 157.4G 0 part \nsdb 8:16 0 3.6T 0 disk \n\xe2\x94\x9c\xe2\x94\x80sdb1 8:17 0 512M 0 part /boot/efi\n\xe2\x94\x9c\xe2\x94\x80sdb2 8:18 0 1.9G 0 part /boot\n\xe2\x94\x9c\xe2\x94\x80sdb3 8:19 0 2.6T 0 part \n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80home_sdb3 253:0 0 2.6T 0 crypt \n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80User--PC--vg-root 253:1 0 55.9G 0 lvm /\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80User--PC--vg-home 253:2 0 2.6T 0 lvm \n\xe2\x94\x9c\xe2\x94\x80sdb4 8:20 0 100M 0 part \n\xe2\x94\x9c\xe2\x94\x80sdb5 8:21 0 16M 0 part \n\xe2\x94\x9c\xe2\x94\x80sdb6 8:22 0 101.5G 0 part \n\xe2\x94\x9c\xe2\x94\x80sdb7 8:23 0 644M 0 part \n\xe2\x94\x9c\xe2\x94\x80sdb8 8:24 0 100M 0 part \n\xe2\x94\x94\xe2\x94\x80sdb9 8:25 0 100M 0 part \nsdc 8:32 0 232.9G 0 disk \n\xe2\x94\x9c\xe2\x94\x80sdc1 8:33 0 529M 0 part \n\xe2\x94\x9c\xe2\x94\x80sdc2 8:34 0 100M 0 part \n\xe2\x94\x9c\xe2\x94\x80sdc3 8:35 0 16M 0 part \n\xe2\x94\x9c\xe2\x94\x80sdc4 8:36 0 87.7G 0 part \n\xe2\x94\x94\xe2\x94\x80sdc5 8:37 0 144.5G 0 part \nsdd 8:48 1 7.5G 0 disk \n\xe2\x94\x9c\xe2\x94\x80sdd1 8:49 1 2.4G 0 part \n\xe2\x94\x94\xe2\x94\x80sdd2 8:50 1 2.6M 0 part \nroot@debian:/etc/apt/sources.list.d# grub-install /dev/sdb\nInstalling for x86_64-efi platform.\ngrub-install: warning: EFI variables are not supported on this system..\nInstallation finished. No error reported.\nroot@debian:/etc/apt/sources.list.d# cat /boot/grub/device.map \n(hd0) /dev/disk/by-id/lvm-pv-uuid-kgnDO4-VKw7-Vw8c-71N3-ez6U-GoGj-T9lueq\n(hd1) /dev/disk/by-id/ata-ST1000VX000-1ES162_Z4YE5K37\n(hd2) /dev/disk/by-id/ata-WDC_WD40EJRX-89AKWY0_WD-WX32D21CZ08S\n(hd3) /dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S2R6NB0H926126V\n(hd4) /dev/disk/by-id/usb-JetFlash_Transcend_8GB_64E2V0LU-0:0\n
Run Code Online (Sandbox Code Playgroud)\n
tel*_*coM 15
当绑定安装/sys
chroot 时,使用--rbind
代替--bind
,即
mount --rbind /sys /media/linux/sys
Run Code Online (Sandbox Code Playgroud)
或者,在 chroot 后手动挂载efivarfs
虚拟文件系统:/sys/firmware/efi/efivars
mount -t efivarfs none /sys/firmware/efi/efivars
Run Code Online (Sandbox Code Playgroud)
grub-install
将需要该文件系统来操作 EFI 启动变量。mount --rbind
包括原始的任何子安装座,而常规则--bind
忽略它们。
如果efivarfs
文件系统似乎不可用,请确保您已在 UEFI 模式下启动实时媒体。如果您不小心在旧版 BIOS 模式下启动了实时媒体,则用于操作 EFI 启动变量的固件 API(由efivarfs
)将不可用。
归档时间: |
|
查看次数: |
15924 次 |
最近记录: |