Can't Boot After Autoremove...Aarrrrgghhh!!

Or known as “What the Fu@k!?!? ... Fu@k! Fu@k! Fu@k!”

System Failure

So we talked about the golden rule, Patch Patch Patch. Even went as far to write a nifty article on the 3 simple commands to make you a patching fool! But then disater strikes! As mentioned in that article the two commands you should pay attention to apt-get autoremove & apt-get autoclean.

So in all faireness this has been fixed as of two days ago. But it's still worth walking through. So what is it we are talking about? It's the fact that direct dependencies of ubiquity should not be autoremovable!.

In a clean install of Xubuntu 18.10, if an unsuspecting user (ME!) runs 'apt autoremove', it will remove 'cryptsetup' and 'lvm2' making the system non-bootable at next restart if an encrypted(LUKS+LVM) root partition was selected during the ubiquity installer wizard:

$    sudo apt update && sudo apt --auto-remove full-upgrade && cat /run/reboo*
     The following packages will be REMOVED:
     cryptsetup cryptsetup-bin cryptsetup-initramfs cryptsetup-run dmeventd 
     libdevmapper-event1.02.1 liblvm2app2.2 liblvm2cmd2.02 libreadline5 lvm2

This will make the system non-bootable upon restart if LUKS+LVM are active on the root partition. This would, by extension, make any auto-mounted partitions(home, etc.) unavailable after boot as well!

And it sure did and it sure sucks! So with a little help from my friend SearX. I was able to recover, the article linked about goes into a lot more detail, and outlines a fair number of steps. I only had to do a portion of those to get back in working order.

When boot failed I can reboot and see the boot options menu. At this point I select the Advanced Options and boot off the old kernel. Score! As I am able to unlock my drive and boot the system. Great but I want to use the new Kernel! And here is how we do it....

Run the following commands in this order...

Install lvm 2

$ sudo apt install lvm2

dpkg: error processing package lvm2 (--configure):
installed lvm2 package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.130ubuntu3) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-22-generic
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Remove lvm2

$ sudo apt remove lvm2

Purge lvm 2

$ sudo apt purge lvm2

Install lvm2 again

$ sudo apt install lvm2
Reading package lists... Done
Building dependency tree 
Reading state information... Done
Suggested packages:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 929 kB of archives.
After this operation, 3.391 kB of additional disk space will be used.
Get:1 bionic/main amd64 lvm2 amd64 2.02.176-4.1ubuntu3 [929 kB]
Fetched 929 kB in 5s (195 kB/s)
Selecting previously unselected package lvm2.
(Reading database ... 186578 files and directories currently installed.)
Preparing to unpack .../lvm2_2.02.176-4.1ubuntu3_amd64.deb ...
Unpacking lvm2 (2.02.176-4.1ubuntu3) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up lvm2 (2.02.176-4.1ubuntu3) ...
update-initramfs: deferring update (trigger activated)
Created symlink /etc/systemd/system/ → /lib/systemd/system/blk-availability.service.
Created symlink /etc/systemd/system/ → /lib/systemd/system/lvm2-monitor.service.
Created symlink /etc/systemd/system/ → /lib/systemd/system/lvm2-lvmetad.socket.
Created symlink /etc/systemd/system/ → /lib/systemd/system/lvm2-lvmpolld.socket.
Processing triggers for systemd (237-3ubuntu10) ...
Processing triggers for man-db (2.8.3-2) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for initramfs-tools (0.130ubuntu3) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-22-generic

Reboot and enjoy your system! You'll be back to normal. Again I can't stress enough to be cautious when using automated routines. And be prepared to do some work especially if you wing it. Which I still think is part of the fun. But not when you only have one system, so being cautious can save you a little grief. As mentioned earlier this has now be fixed as of 2/26/2019, but if you are like me you didn't have all the new bits when you firedaway. So I hope this helps you if you find yourself in a similar situation.

So with that reboot and enjoy! If you have questions SearX them. :–) Or you can reach me on 🤓

G. Love #Linux #Xubuntu #HowTo

— G. Love