Page MenuHomePureOS Tracker

lvm2: package marked for autodeletion despite being used
Open, LowPublic

Description

Summary

My system became unbootable after using sudo apt remove gnome-boxes and sudo apt autoremove as a result of the lvm2 package being removed. I use LVM groups, and upon restarting after the autoremove, my system no longer booted properly. Manually reinstalling lvm2 with sudo apt install lvm2 before restarting averts the problem.

The disk partitioning scheme I use is based on LVM on LUKS scheme described on the Arch Wiki. I have an unencrypted boot drive, and then an encrypted LUKS partition. Unlocking the LUKS partition yields a single LVM physical volume which has a single LVM volume group with 3 volumes: one for swap, one for the root partition mounted at /, and one for the home partition mounted at /home.

Steps to Reproduce

I tried using the Calamares installer to configure everything, but the installer crashes when trying to create the volume group, so I instead turned to a combination of GNOME Disks and the command line.

Initial Disk Configuration using GNOME Disks

  1. Delete all partitions on the drive
  2. Format the disk and choose a GPT partition table
  3. Create a /boot partition
    • Size: 1 GB
    • Volume Name: boot
    • Type: ext4
  4. Create the primary partition
    • Size: Remainder of disk
    • Volume Name: main
    • Type: Other-->No Filesystem (encrypted/LUKS)
  5. Lock the LUKS volume so that we have some control over the mount names in the next section.

Command Line

  1. Run this command to unlock the LUKS volume and set the name to cryptlvm
sudo cryptsetup open /dev/nvme0n1p2 cryptlvm
  1. Create the physical volume
sudo pvcreate /dev/mapper/cryptlvm
  1. Create a volume group, in this case called system
sudo vgcreate system /dev/mapper/cryptlvm
  1. Now establish the LVM scheme
sudo lvcreate -L 16GB system -n swap
sudo lvcreate -L 50GB system -n root
sudo lvcreate -l 100%FREE system -n home
sudo mkswap /dev/system/swap
sudo mkfs.ext4 /dev/system/root
sudo mkfs.ext4 /dev/system/home
  1. There is a bug in Calamares that requires a workaround to have the LVM volumes persist/stay mounted (see GitHub Issue), so the workaround steps are:
sudo mkdir /mnt/root
sudo mkdir /mnt/home
sudo mount /dev/system/root /mnt/root
sudo mount /dev/system/home /mnt/home

Then, in one terminal window, run cd /mnt/root and in another terminal window, run cd /mnt/home and leave those windows open while the installer runs.

Installation and Subsequent Boots

Proceed through the installer and choose to mount the boot partition at /boot, /dev/system/root at /, and /dev/system/home at /home.

After restarting and booting into the freshly installed system, run

sudo apt remove gnome-boxes
sudo apt autoremove

This will remove the lvm2 package, despite it being in use with the LVM volumes mounted at / and /home. Reboot again, and after decrypting the disk, you are dropped into Busybox with a bit of a messed up system.

Event Timeline

wctaylor triaged this task as Low priority.Jan 26 2023, 14:55
wctaylor created this task.