Ubuntu – Mounting encrypted LUKS partition from Live CD

bootfilesysteminitramfslukslvm

Error to begin with, can't boot

I had to do a hard reboot of my computer, and when booting up it (initramfs I think) gave an error:

mount: mounting /dev/mapper/ubuntu--vg-root on /root failed: Invalid argument
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory 

Target filesystem doesn't have requested /sbin/init.
No init found. Try passing init= bootarg. 

Trying to mount from Live-CD

I have very, very important data on it, so instead of trying to fix the boot system (or whatever I should call it), I would just like to mount it and copy the important files to a USB stick.

I have tried several guides without luck. The most straight forward seems to be Mount encrypted volumes from command line?. Here is what I've done:

ubuntu@ubuntu:~$ sudo cryptsetup luksOpen /dev/sda3 myvolume
Enter passphrase for /dev/sda3: 
ubuntu@ubuntu:~$ mkdir mountpoint
ubuntu@ubuntu:~$ sudo mount /dev/mapper/myvolume m
mount: unknown filesystem type 'LVM2_member'
ubuntu@ubuntu:~$ sudo mount -t ext4 /dev/mapper/myvolume mountpoint
mount: /dev/mapper/myvolume already mounted or mountpoint busy

The mountpoint folder is not busy, it's an empty folder that I can delete if I want. I believe /dev/mapper/myvolume is not mounted, well since I have not done it, and since the following returns nothing ubuntu@ubuntu:~$ mount -l | grep myvolume.

I don't know what information is relevant for the question. In my struggle I have learned the names of dozens of new commands, and it would be too much text to post the information from all of them. So please tell me what additional information is relevant.

Output of blkid

/dev/loop0: TYPE="squashfs" 
/dev/sda1: UUID="04BD-5CB0" TYPE="vfat" 
/dev/sda2: UUID="4b4af9b9-1290-431a-bfcb-3b8e24d52c54" TYPE="ext2" 
/dev/sda3: UUID="09e172eb-1080-4f68-80fb-1386ac0491b6" TYPE="crypto_LUKS" 
/dev/sdb1: UUID="369D-508C" TYPE="vfat" 
/dev/mapper/myvolume: UUID="0DkUPe-3S13-zNOA-5wi0-uzPb-CCB8-9m14C1" TYPE="LVM2_member" 
/dev/mapper/ubuntu--vg-swap_1: UUID="44b26e6d-cb85-4949-b0e8-9421ab515d03" TYPE="swap" 

Complete summary from Ubuntu Boot-Repair

I did not try to restore anything, I only used the tool to print a summary of relevant information. Tool used: https://help.ubuntu.com/community/Boot-Repair

Result: https://www.jottit.com/gvwbu/ (many pages)

Best Answer

  • Try this:

    You need to Boot into a Live DVD/USB environment and open up a terminal window:

    Press Applications --- Accessories--- Terminal

    Install required packages using the following commands:

    sudo apt-get update
    sudo apt-get install lvm2 cryptsetup
    

    Probe required module using the following command:

    sudo modprobe dm-crypt
    

    You find out which drive it was with the following command:

    sudo fdisk -l
    

    You must mount /dev/sda3 myvolume , You need to use cryptsetup:

    sudo cryptsetup luksOpen /dev/sde3 myvolume
    

    Now the device is accessible under /dev/mapper/myvolume

    Scan for LVM volumes and choose the right volume group name that you are looking for:

    sudo vgscan
    

    Suppose it is system, activate that volume:

    sudo vgchange -ay system
    

    To find out your root volume, use the following command:

    sudo lvs
    

    Suppose it is root system you can mount it with the following command:

    sudo mount /dev/system/root /mnt/
    

    To work in volume use the following commands

    sudo mount --bind /dev /mnt/dev 
    sudo mount --bind /dev/pts /mnt/dev/pts
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys
    sudo chroot /mnt
    
  • Related Question