How to boot live USB, decrypt LUKS partition, chroot, and fix your system

create live USB

  • download {ISO} and put it in a folder in Downloads
  • download matching SHA256 checksum file and put it in a folder in Downloads
  • sha256sum path/to/{checksum_file}

  • lsblk # to find USB device and partition for ISO setup

  • sudo dd bs=4M if=/path/to/{ISO} of=/dev/{usb_partition} status=progress

plug in live USB and Librem key and boot from USB

find LUKS (crypto) partition

lsblk -f # will be /dev/nvme0n1p2 on Librem 14

verify that gpg finds Librem key

gpg --card-status

verify that pcscd is running

systemctl status pcscd
systemctl start pcscd

unlock LUKS partition with Librem key passphrase that you wrote down before

sudo cryptsetup luksOpen /dev/nvme0n1p2 <crypt_root>
when asked for passphrase, enter it

mount decrypted LUKS partition

sudo mount /dev/mapper/<crypt_root> /mnt

mount other required devices

sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo mount --bind /run /mnt/run
#change root into /mnt
sudo chroot /mnt

you are now in the LUKS as root

%

fix the system

in my case I had to reinstall two packages I had removed

sudo apt upgrade
sudo apt update
sudo apt install xdg-dektop-portal
sudo apt install xdg-desktop-portal-gtk

but this didn’t fix the problem, so I reinstalled all the related packages I could find

sudo apt reinstall [pureos-desktop-settings; pureos-flatpak-defaults; pureos-gnome; pureos-gnome-settings; gdm3]

that seemed to do it

after applying fixes; leave chroot env, cleanup, and reboot

leave chroot env

exit

unmount those five points

sudo umount -f /dev /mnt/dev
sudo umount -f /dev/pts /mnt/dev/pts
sudo umount -f /proc /mnt/proc
sudo umount -f /sys /mnt/sys
sudo umount -f /run /mnt/run

end

reboot

exercise caution when mucking around in chroot environment. apt should work fine, but when you look at the /home folders, the ownership will reflect the live USB environment and not the LUKS part. environment. You can edit other config files that are causing your specific problem.

3 Likes

Finally got a response from Purism Support. Great people, excellent ideas. One thing they mentioned that would have allowed me to fix the problem in an instant was:

At broken login screen, press CTL+ALT+F3 and drop into a terminal session

Login

>sudo apt [re]install pureos-gnome #this is the fix for my particular problem

>reboot

and Bob’s your uncle

2 Likes

Fair enough but it’s still useful to know how to do all of the things in your first post. :+1:

Note the typo

1 Like