0
I am attempting to restore GRUB to my SSD after accidentally over-writing it by installing a Linux OS to another disk (not the same SSD). To attempt the grub repair, I'm using a Live version of the OS distribution from a USB stick.
Once inside the live distribution, I can see the disk where my OS installation and original GRUB reside:
Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 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: 0A88BA3C-EF26-4291-AD41-EF9331042E6D
Device Start End Sectors Size Type
/dev/sda1 40 409639 409600 200M EFI System
/dev/sda2 409640 23845871 23436232 11.2G Apple HFS/HFS+
/dev/sda3 23846912 24319999 473088 231M Linux filesystem
/dev/sda4 24320000 488396799 464076800 221.3G Linux filesystem
/dev/sda1
is the EFI partition that contains EFI configuration for both MacOS and my linux distribution.
/dev/sda2
is a MacOS installation and is of no relevance to the issue here.
/dev/sda3
contains efi and grub information:
-rw-r--r-- 1 root root 186567 May 7 2018 config-4.9.0-6-amd64
drwxr-xr-x 2 root root 1024 Jun 16 2018 efi
drwxr-xr-x 5 root root 1024 Apr 18 23:12 grub
-rw-r--r-- 1 root root 28489619 Feb 23 15:59 initrd.img-4.9.0-6-amd64
drwx------ 2 root root 12288 Jun 16 2018 lost+found
-rw-r--r-- 1 root root 3190138 May 7 2018 System.map-4.9.0-6-amd64
-rw-r--r-- 1 root root 4224800 May 7 2018 vmlinuz-4.9.0-6-amd64
/dev/sda4
is the encrypted partition with user data.
I used the following guides as a reference:
https://ubuntuforums.org/showthread.php?t=2266650
https://stephentanner.com/restoring-grub-for-an-encrypted-lvm.html
https://blog.sleeplessbeastie.eu/2015/11/16/how-to-mount-encrypted-lvm-logical-volume/
I can open the encrypted partition:
$ cryptsetup luksOpen /dev/sda4 sda4_crypt
Enter passphrase for /dev/sda4:
$
I enter the password and the encrypted drive is automatically mounted to /media/user/475cac44-f48a-4d17-8659-611a06e1f961.
However, when I attempt to scan for volume groups:
$ vgscan
Reading all physical volumes. This may take a while…
$
$ vgdisplay
$
nothing is returned.
The same occurs when attempting to scan for logical volumes:
$ sudo lvscan
$
I can see the contents of the mounted, encrypted partition:
$ ls -la /media/user/475cac44-f48a-4d17-8659-611a06e1f961/
total 112
drwxr-xr-x 22 root root 4096 Jul 4 2018 .
drwxr-x---+ 4 root root 80 Apr 18 08:57 ..
drwxr-xr-x 2 root root 4096 Mar 9 17:16 bin
drwxr-xr-x 2 root root 4096 Jun 16 2018 boot
drwxr-xr-x 5 root root 4096 Feb 20 20:46 dev
drwxr-xr-x 131 root root 12288 Apr 17 08:23 etc
drwxr-xr-x 3 root root 4096 Jun 16 2018 home
lrwxrwxrwx 1 root root 29 Jun 16 2018 initrd.img -> boot/initrd.img-4.9.0-6-amd64
lrwxrwxrwx 1 root root 29 Jun 16 2018 initrd.img.old -> boot/initrd.img-4.9.0-6-amd64
drwxr-xr-x 18 root root 4096 Apr 13 12:20 lib
drwxr-xr-x 2 root root 4096 Jun 16 2018 lib64
drwx------ 2 root root 16384 Jun 16 2018 lost+found
drwxr-xr-x 4 root root 4096 Apr 17 08:23 media
drwxr-xr-x 6 root root 4096 Nov 25 14:41 mnt
drwxr-xr-x 4 root root 4096 Sep 8 2018 opt
drwxr-xr-x 2 root root 4096 Feb 23 2018 proc
drwx------ 12 root root 4096 Apr 17 01:35 root
drwxr-xr-x 3 root root 4096 Feb 20 20:46 run
drwxr-xr-x 2 root root 12288 Apr 17 03:30 sbin
drwxr-xr-x 2 root root 4096 Apr 28 2018 srv
drwxr-xr-x 2 root root 4096 Feb 23 2018 sys
drwxrwxrwt 8 root root 4096 Apr 17 08:23 tmp
drwxr-xr-x 10 root root 4096 Jun 16 2018 usr
drwxr-xr-x 11 root root 4096 Jun 16 2018 var
lrwxrwxrwx 1 root root 26 Jun 16 2018 vmlinuz -> boot/vmlinuz-4.9.0-6-amd64
lrwxrwxrwx 1 root root 26 Jun 16 2018 vmlinuz.old -> boot/vmlinuz-4.9.0-6-amd64
But without seeing/knowing the volume group, how can I mount the correct directories in order to repair grub?