LVM encrypted install hosed, now I can’t even erase disk and reinstall

So I newly installed Ubuntu MATE 20.04 to a laptop using the LVM encryption option. (“Erase disk and install Ubuntu MATE,”
with LVM and encryption selected under “advanced features”; see https://ubuntu-mate.community/t/i-want-to-have-an-encrypted-home-directory-in-ubuntu-mate-20-04/24319.) It resulted in two encrypted volumes, one for root and one for swap. The setup worked, but I wanted more swap space. So, I tried using KDE’s Partition Manager (see here) from my live USB to decrease the size of the root partition and increase the size of the swap partition, but each operation gave me a vague error (though the operations seemed to have the intended effect anyway, hence why I could do each in turn).
So, I started up the laptop again, and… now, after booting up and entering the encryption passphrase, I get dumped to a BusyBox prompt. I figured the whole thing must be toast now, so I tried going back to the live USB and installing Ubuntu MATE all over again, same method as before, and every time I try I now get an error! (“An error occurred while configuring encrypted volumes. The configuration has been aborted.”) If I try doing a plan “erase disk and install” installation, without LVM or encryption, I get another error: “Error informing the kernel about modifications to partition /dev/sda5 — Device or resource busy. That means Linux won’t know about any changes you made to /dev/sda5 until you reboot — so you shouldn’t mount it or use it in any way before rebooting.”
Now I have no idea what to do. How do I get a working system again? (Remember, this is a new installation, so there’s no data I need to keep, hence why I was so willing to go for the nuclear option of “erase disk and install”… and I figured that was guaranteed to work.)

I would boot into the installation media (probably USB) and instead of installing MATE I would choose to try it. This will put you into a MATE session. Look for the application called "Disks" under Accessories and fire it up.

You should be able to see the laptop drive and the USB drive. Highlight the laptop disk and it should show you the partitions. Highlight each partition and press the minus ( - ) icon to delete the partition.

If all goes well, you should now be able to install.

I've never played with LVM and encryption so I can't vouch for the above to work, but this is what I would try.

Best of luck.

3 Likes

Hello TinaRussel

This is one of the main reasons why I never encrypt drives. If all else fails, I personally would replace the drive with a fresh one and chalk up the cost of a new drive to "experience". Hopefully someone here will be able to give you the information you need to get installing again. :slightly_smiling_face:

Yes I am guessing you need to be root to wipe an encrypted drive. By running as root of a USB drive OS you should be able to wipe the drive.
One other thing you could try it to boot into recovery mode, drop to the terminal and reset the root password. You can reset a root password in recovery mode without knowing the previous root password.
$ sudo passwd root

You should be able to use GParted, (from a live CD, USB or another operating system or whatever), to simply blow away your partitions and start again.

The thing with LUKS encrypted LVM, it's like an egg inside an egg inside another egg and so on.
You can't, (or shouldn't), just resize the partitions without first resizing the file system inside the logical volume inside the volume group in the physical volume in the partition on your disk.
Your Ubuntu MATE installer doesn't 'know' you don't have valuable data in there but it is detecting something's a bit 'off' so it's trying to protect you.

LUKS encryption and LVM are great, but it's hard for people to learn to manage LUKS and LVM and the operating system all at the same time. It's a good idea to practice a bit and experiment with just a plain LUKS encrypted data partition first, (with junk example data that you don't care about). It's also good to play around with LVM by itself without the LUKS file system encryption if you can get a spare drive or more than one drive you can play with, and read a few tutorials. Then it's okay to combine LUKS and LVM when you are ready for it and then try installing an operating system in it.

The main thing is not to give up, just keep on learning.

Regards from Herman

EDIT: Another option if you want to restore it to a working system would be to use 'testdisk', it's in the repositories, (sudo apt install testdisk), from a live CD, USB, Gnu-Linux operating system in another disk etc. Testdisk can detect where your partitions were before and revert the changes you made with the partition editor. They have an excellent how-to on their website.