I have(had) the following setup: Full disk encryption with LUKS and a separately encrypted /home partition. Made the mistake to delete my /root but caught early enough so only changes to the partition table where made. Now I'm left with the following:
sudo hexdump -C /dev/nvme0n1 |grep LUKS
3e900000 4c 55 4b 53 ba be 00 01 61 65 73 00 00 00 00 00 |LUKS....aes.....|
That means that LUKS header is still intact (phew)
Then I create a loop device on that offset
sudo losetup -o 0x3e900000 -r -f /dev/nvme0n1
and mount it with
sudo cryptsetup luksOpen /dev/loop1 luksrecover
so far it works great, things get mounted properly I can see my files and with a few more commands I can get my separate /home back.
However, since I do have an operating system intact I'd like it back. Only problem as it seems, there is no grub to call the initial Xubuntu LUKS decrypter.
Now, since I see that there is a significant offset in my partitioning, I guess that's where grub used to live
So, what can I do about getting my OS back? As far as I understand I must somehow mark bytes 0 - $offset as grub and install grub there and the rest as something else. So I tried grub-install /dev/nvme0n1 and it complained about aufs
grub-install: error: failed to get canonical path of `aufs'.
then tried the same in a chroot in the LUKS system that was mounted but it that filesystem is read-only and of course it never had grub to begin with.
So what can I do to get grub to sit in the empty space before LUKS and decrypt LUKS on start?