nic*_*ier 5 encryption boot grub2
我升级并以某种方式丢失了启动分区上的内核。
我已经设法恢复了大部分内容(通过启动旧的 14、安装加密分区并 chroot 到其中 - 因此是下面的 /mnt),但我仍然无法启动。它从不询问我的根分区密码并卡在 initramfs shell 中。
我尝试将其添加到 /etc/default/grub
GRUB_CMDLINE_LINUX="cryptdevice=/dev/disk/by-uuid/8711af09-1c70-414a-af43-e859ddabf09f:cryptroot root=/dev/mapper/cryptroot"
Run Code Online (Sandbox Code Playgroud)
该 UUID 位于我的 /etc/crypttab 中:
sda5_crypt UUID=8711af09-1c70-414a-af43-e859ddabf09f none luks,discard
Run Code Online (Sandbox Code Playgroud)
但是当我这样做并运行 grub-install 时,如下所示:
grub-install --boot-directory=/mnt/boot /dev/sda1
Run Code Online (Sandbox Code Playgroud)
我明白了:
Installing for i386-pc platform.
grub-install: error: attempt to install to encrypted disk without cryptodisk enabled. Set `GRUB_ENABLE_CRYPTODISK=1' in file `/etc/default/grub'..
Run Code Online (Sandbox Code Playgroud)
据我所知,GRUB_ENABLE_CRYPTODISK 仅适用于加密整个磁盘的情况 - 我不是。我在 /boot(或 USB 启动机器上的 /mnt/boot)上安装了一个单独的 EXT2 启动分区。
当我打开该选项时:
GRUB_ENABLE_CRYPTODISK=y
Run Code Online (Sandbox Code Playgroud)
并运行 grub-install,我得到:
Installing for i386-pc platform.
grub-install: warning: Filesystem `ext2' doesn't support embedding.
grub-install: error: embedding is not possible, but this is required for RAID and LVM install.
Run Code Online (Sandbox Code Playgroud)
我能找到的所有示例似乎都是针对整个光盘安装的,似乎没有人在谈论这种情况。
请帮忙!
据我所知,您不需要设置GRUB_CMDLINE_LINUX
您的加密块设备。相反,请确保以下内容正常:
我推荐以下干净的方法(从 liveUSB 或救援磁盘):
sudo -i
cryptsetup open /dev/sda5 my_encrypted_device
mount /dev/mapper/my_encrypted_device /mnt
mount --bind /dev/ /mnt/dev && mount --bind /dev/pts /mnt/dev/pts && mount --bind /proc /mnt/proc && mount --bind /sys /mnt/sys
mount /dev/<YOUR_BOOT_PARTITION> /mnt/boot
chroot /mnt
apt purge --auto-remove grub-pc
按 Enter 键确认删除。
apt install grub-pc
在终端内,使用空格键选择安装 grub 的位置,按 Tab 键然后输入。
目标 SOURCE_DEVICE KEY_FILE 选项
(例如 my_encrypted_device /dev/sda5 无 luks)
请记住,密钥文件参数none
要求用户以交互方式提供密钥文件
update-initramfs -u -k all
您现在应该可以正常启动了。
注意:GRUB 可以按照您所说安装在您的加密设备上
归档时间: |
|
查看次数: |
15058 次 |
最近记录: |