Você pode tentar executar o script abaixo no LiveCD (possivelmente versões atualizadas no link). O script tenta automatizar parcialmente o processo para você. Ele foi escrito e testado para uma unidade NVMe, portanto, talvez seja necessário alterar um pouco as coisas se você estiver usando uma unidade SATA / IDE com um caminho /dev/sd*
. Se você não estiver usando o EFI, poderá excluir qualquer linha contendo efi
ou EFI
executando sed -i -e '/efi/d' -e '/EFI/d' crypt-fix.sh
após salvar o script no computador. Terá que adicionar alguma lógica de detecção para isso eventualmente.
crypt-fix.sh
#!/bin/bash
# Call with 'sudo bash DEBUG=1 ./crypt-fix.sh' for verbose output
[ -n "$DEBUG"] && set -x
# Prompt user for device from /dev/sd* /dev/nvme* /dev/mmc* prefixes?
# For /dev/sda probably sda1 is EFI and sda2 is boot and sda3 is encrypted
DEVICE=/dev/nvme0n1
EFIPATH="${DEVICE}p1"
BOOTPATH="${DEVICE}p2"
CRYPTPATH="${DEVICE}p3"
TARGETPATH=/mnt
# Need root for mounting stuff
if ! (( $EUID == 0 )); then echo "Please run with 'sudo $0'"; fi
clear_mounts () {
# Clears mounts in case of interrupt or upon exit to allow running script multiple times
umount $TARGETPATH/boot/efi
umount $TARGETPATH/boot
umount $TARGETPATH/proc
umount $TARGETPATH/dev
umount $TARGETPATH
vgchange -an
cryptsetup close temp_name
cryptsetup close $CRYPTNAME
set +x
}
trap clear_mounts INT EXIT
cryptsetup open $CRYPTPATH temp_name
vgchange -ay
# Can't get this until LVM devices are scanned above
ROOTPATH=$(ls /dev/mapper/* | grep root)
# Make sure nothing else is mounted on our $TARGETPATH
umount $TARGETPATH
wait
mount $ROOTPATH $TARGETPATH
# Find the name that is required for 'update-initramfs' to properly update things
CRYPTNAME=$(cat $TARGETPATH/etc/crypttab | awk '{ print $1 }')
umount $TARGETPATH
vgchange -an
cryptsetup close temp_name
# This proper name is required for 'update-initramfs' to properly update things
cryptsetup open $CRYPTPATH $CRYPTNAME
wait
vgchange -ay
ROOTPATH=$(ls /dev/mapper/* | grep root)
mount $ROOTPATH $TARGETPATH
mount $BOOTPATH $TARGETPATH/boot
mount $EFIPATH $TARGETPATH/boot/efi
mount -t proc proc $TARGETPATH/proc
mount -o bind /dev $TARGETPATH/dev
# Have also seen people mounting dev/pts and run and sys, they don't appear to be necessary
chroot $TARGETPATH update-initramfs -c -k all
echo "Completed crypt-fix, try rebooting and you should get prompted for your passphrase after grub"