LUKS encrypted Manjaro i3 broken after update


#1

I am using Manjaro i3 and am updating the packages once every week. Unfortunately, after I updated my system ( sudo pacman -Syyu --needed --noconfirm) last Sunday December the 30th 2018, it is no longer bootable.
The error I get is: mount: /openswap_keymount: Invalid argument.
Refer to the attached screen for further details: openswap_keymount-error.jpg

Could you please advise on how to recover my system? In order to LUKS encrypt I used the installer’s built-in encryption functionality and am not sure of the exact steps. I also don’t have much time to try and recover it and if it’s too much of a trouble then I will have to simply recover some files and re-install an operating system on the drive.


#2

I’ve never setup an encrypted root, so I’m not positive on what to do. What I would recommend is boot up on a liveCD, mount the root partition with something like:

sudo cryptsetup luksOpen /dev/sda3 root
sudo mount /dev/mapper/root /mnt

Which will mount the encrypted drive under /mnt. If you have /openswap_keymount backed up somewhere it might be as simple as copying that file back to /mnt. If you don’t, you are going to need to track down the device with UUID=“809a9af1…” and see what happen to it. lsblk -f is very handy to display all the partitions along with the UUID.

You might need to change your grub configuration to point at the “new” UUID if it changed for some weird reason. More likely I’m guessing some partition is not be decrypted correctly and you will need to track that down and why…


#3

Thank you very much for your recommendation!

Thanks to your recommendation I have recovered my system pretty quickly.

The problem wasn’t related to the operating system or distro, rather than a change that I have unintentionally made inside /etc/default/grub. Subsequently, when I updated Manjaro, my erroneous change propagated to the initramfs without me even realising. This explains the fact that I couldn’t find a reported error for the issue. Just for the history, my /etc/default/grub was updated by an ansible playbook which was intended for a remote system but I accidentally run it on my local system.

Following are the steps I used to recover my system.

Boot from archlinux-2019.01.01-x86_64.iso

Start SSH daemon

systemctl start sshd

Setup a root password which is needed for an SSH connection, since the default Arch password for root is empty:

passwd

Connect to machine via SSH (very handy for copy-pasting)

ssh root@192.168.1.135

Unlock the LUKS device and mount it at /dev/mapper/lvm

cryptsetup luksOpen /dev/sda2 lvm

Mount the encrypted logical volume (LUKS rootfs)

mount /dev/mapper/lvm /mnt

Change root

arch-chroot /mnt

Configure the EFI partition (I also run grub-install /dev/sda, not sure which one saved the day)

mount /dev/sda1 /boot/efi
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck

Determine the UUID of the LUKS rootfs

lsblk -f
NAME     FSTYPE      LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINT
loop0    squashfs                                                           0   100% /run/archiso/sfs/airootfs
sda
├─sda1   vfat                    2BAE-8948                               299M     0% /mnt/boot/efi
├─sda2   crypto_LUKS             06b76452-dfc8-4a01-9b4d-9d9a2f915aff
│ └─root ext4                    809a9af1-93e4-470e-8cf5-2e55e7cbd744  233.5G    69% /mnt
└─sda3   crypto_LUKS             219149b4-4fba-46fd-9888-174044811a09
sdb      iso9660     ARCH_201812 2018-12-01-10-17-30-00
├─sdb1   iso9660     ARCH_201812 2018-12-01-10-17-30-00                     0   100% /run/archiso/bootmnt
└─sdb2   vfat        ARCHISO_EFI F938-A458

Configure GRUB

Edit the GRUB_CMDLINE_LINUX_DEFAULT inside /etc/default/grub as follows

GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=UUID=06b76452-dfc8-4a01-9b4d-9d9a2f915aff:luks-06b76452-dfc8-4a01-9b4d-9d9a2f915aff root=/dev/mapper/luks-06b76452-dfc8-4a01-9b4d-9d9a2f915aff resume=/dev/mapper/luks-06b76452-dfc8-4a01-9b4d-9d9a2f915aff"

Generate a new grub.cfg

grub-mkconfig -o /boot/grub/grub.cfg

Unmount, reboot

exit
umount -a
reboot