1

I'm trying to recover my files from a now broken Antergos install, and have run into trouble because the user/non-boot partition is encrypted with LUKS encryption.

I'm booting from an Ubuntu 18.04 bootable USB drive so I can backup the directories where I had data I wanted, and didn't realize it was encrypted until I went to go view the partition in the file explorer, and it didn't show up. It was suggested to me that it may not be mounted, and after looking at GParted it's clear that that was the problem, and it seems like it wasn't mounted because it's encrypted (prior experiences with backing up before reinstalling or switching distros never involved any problems with the partition I was recovering files from not being mounted).

As some additional information:

  1. I have the password that was required in order to boot and get to the greeter. I'm operating under the assumption that that's my encryption key, but I may be mistaken, I'm rather out of my depth here.
  2. The partition/volume in question is sda3 (not sure which is the correct term) and in addition to being encrypted it uses LVM. I'm not sure how that impacts things, but the impression I've gotten from the reading I've been doing to try and resolve this seems to suggest that it matters Screenshot of GParted's details regarding sda3
  3. I initially tried to mount the partition via the command line trying two different methods, and both returned different errors. Unfortunately I let my computer die because I walked away from my computer for a while before trying again, and I can't find any of the pages I was referencing and attempting to follow along with, or commands I tried, or errors I got back. The error I can provide is that when I tried to follow this guide the command: "cryptsetup luksOpen /dev/sda3/ recoverytarget" returned: "Device /dev/sda3/ doesn't exist or access denied." I assume that I need to mount the partition before I can de-encrypt it, but again I may be mistaken Guide I was following and the terminal where I was following along

it's been a while since I worked on any of my Linux machines, and I'm not the most technically competent or linux experienced person in the world, so please forgive any instances where it's painfully clear I don't understand something

EDIT/UPDATE: The error I was getting was because I wasn't running the command with sudo in front, so now I officially feel stupid, but I'm now running into a different problem where "sudo mkdir /mnt/recoverytarget && mount /dev/mapper/recoverytarget /mnt/recoverytarget" returns: "mount: only root can do that"

closed as off-topic by G-Man, jasonwryan, sourcejedi, ilkkachu, tripleee May 25 '18 at 5:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – G-Man, jasonwryan, sourcejedi, ilkkachu, tripleee
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Try the command(s) with /dev/sda3, without the / at the end. – G-Man May 24 '18 at 1:44
  • turns out the problem described in the post initially was a result of the omission of sudo, rather than the usage of / – Christen Edmundson May 24 '18 at 2:04
  • && marks a separate command. Add sudo after && – sourcejedi May 24 '18 at 7:16
  • That's obviously sudo mount, because only root can do that. – AlexP May 24 '18 at 8:03
  • I'd suggest you get yourself a root shell and (very carefully) use that instead of having to remember to prefix everything with sudo. The command sudo -s will get you one of those. – roaima May 24 '18 at 20:56
1

To recover your files you will first need to open your LUKS container. This will make your LVM logical volumes accessible. Then, you can mount the appropriate logical volume to gain access to the files. I'll assume that once you have access to the files you'll know what to do.

Opening the LUKS container

To open the LUKS container run: sudo cryptsetup open /dev/sda3 luksrecoverytarget --type luks

Assuming you enter a valid passphrase, you'll now have the block device /dev/mapper/luksrecoverytarget; It's actually a symlink, but you can ignore that detail. That block device contains your LVM volume group. Next you need to determine which logical volume to mount.

Find the correct logical volume

Upon opening the LUKS container your OS should have scanned for LVM logical volumes. If not you can run sudo vgscan to get things synced up. To get a list of logical volumes run sudo lvdisplay. You'll see a list of one or more logical volumes. Hopefully you'll be able to tell which one you want to recover by looking at the LV Path.

Mount the logical volume

Once you know which logical volume to mount run:

sudo mkdir /mnt/recoverytarget
sudo mount LV_PATH_GOES_HERE /mnt/recoverytarget

Now you may do as you wish with the files.

Clean up

Once your done, you should un-mount the filesystem and close the LUKS container:

sudo umount /mnt/recoverytarget
sudo cryptsetup close luksrecoverytarget

Not the answer you're looking for? Browse other questions tagged or ask your own question.