xubuntu - How to repair /boot on LUKS encrypted harddrive? - Ask Ubuntu


i have laptop xubuntu installed.

at install chose full disk encryption option.

but yesterday accidentally dd-ed dsl image sda1 (/boot partition) instead sdb1 (pendrive).

how can repair /boot ?

hello tested following commands in laptop - yeah deleted in /dev/sda1 , got working again - here is:

  • get live-image , boot it.

  • first lets clean /dev/sda1 - open gparted; reformat /dev/sda1 ext2 , don't forget set "boot"-flag (right click on partition , select appropriate option) , confirm changes.

  • now prepare chroot installed system , switch it: sudo cryptsetup luksopen /dev/sda5 sda5_crypt sudo vgscan --mknodes sudo vgchange -ay sudo mount /dev/mapper/ubuntu--vg-root /mnt sudo mount /dev/sda1 /mnt/boot in /dev /dev/pts /proc /sys /run; sudo mount -b $i /mnt$i; done sudo chroot /mnt

  • okay let's delete , reinstall grub: apt purge grub-common (have terminal in fullscreen-mode due ncurses), might ask if shall delete - select yes; lets reinstall apt install grub-pc here select /dev/sda when asked.

  • lastly need reinstall kernel needed initrd*- , vmlinuz*-images /boot/ . installed kernels apt list --installed linux-image-* , reinstall kernel apt install linux-image-[version-numbers]-generic --reinstall - don't forget exchange brackets actual version number.

  • almost done; exit chroot ctrl-d , reboot!

used resources:

https://ubuntuforums.org/archive/index.php/t-1432656.html

https://help.ubuntu.com/community/grub2/installing


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User