User Tools

Site Tools


linux:luks-repair-boot

LUKS boot repair

https://gist.github.com/samuelcolvin/43c5ed2807e7db004b1058d0c9bfb068

Guides:
* https://stephentanner.com/restoring-grub-for-an-encrypted-lvm.html
* https://askubuntu.com/questions/719409/how-to-reinstall-grub-from-a-liveusb-if-the-partition-is-encrypted-and-there-i
* https://help.ubuntu.com/community/Grub2/Installing

cryptsetup luksOpen /dev/sdb3 home_sdb3
vgchange -ay
lvscan
mkdir /media/linux
mount /dev/ubuntu-vg/root /media/linux/
mount -o bind /proc /media/linux/proc
mount -o bind /dev /media/linux/dev
mount -o bind /sys /media/linux/sys

**OR**
mount -o rbind /proc /media/linux/proc
mount -o rbind /dev /media/linux/dev
mount -o rbind /sys /media/linux/sys


chroot /media/linux /bin/bash
> fdisk -l:

Disk /dev/sdb: 238.5 GiB, 256060514304 bytes, 500118192 sectors
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: ED00E611-2AA0-40CB-BA69-97B8FAD3303E

Device       Start       End   Sectors   Size Type
/dev/sdb1     2048   1050623   1048576   512M EFI System
/dev/sdb2  1050624   2050047    999424   488M Linux filesystem
/dev/sdb3  2050048 500117503 498067456 237.5G Linux filesystem
mount /dev/sdb2 /boot
mount /dev/sdb1 /boot/efi
grub-install /dev/sdb
**OR** update-grub

umount /boot/efi
umount /boot

leave chroot

    exit 
umount /media/linux/boot/efi
umount /media/linux/boot
umount -l /media/linux
vgchange -an
cryptsetup luksClose home_sdb3
linux/luks-repair-boot.txt · Last modified: 2024/10/21 21:20 by Wulf Rajek