Mounting encrypted Linux partitions from a Live Disc

Summary

I’m running Manjaro and recently had some issues booting. I have encrypted partitions and haven’t ever had to figure out how to mount them manually from a Live Disc environment. This blog is a braindump of notes I used to get things working. I think I’m using dm-crypt directly, but could be wrong about that.

FIXME this probably needs editing/expanding /

Once chroot-ed in, you can read the most recent boot logs

journalctl -b

…and if that gives

-- No entries --

…then you can find the right boot with:

journalctl --list-boots
journalctl -b -1

Have to scroll back past shutdown stuff, but found

Jan 08 18:14:58 tom-x1eg2 lightdm[3003]: Traceback (most recent call last):
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:   File "/sbin/prime-offload", line 33, in <module>
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:     sys.exit(load_entry_point('optimus-manager==1.4', 'console_scripts', 'prime-offload')())
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:   File "/sbin/prime-offload", line 22, in importlib_load_entry_point
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:     for entry_point in distribution(dist_name).entry_points
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:   File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 919, in distribution
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:     return Distribution.from_name(distribution_name)
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:   File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 518, in from_name
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]:     raise PackageNotFoundError(name)
Jan 08 18:14:58 tom-x1eg2 lightdm[3003]: importlib.metadata.PackageNotFoundError: No package metadata was found for optimus-manager
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]: Traceback (most recent call last):
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:   File "/sbin/prime-switch", line 33, in <module>
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:     sys.exit(load_entry_point('optimus-manager==1.4', 'console_scripts', 'prime-switch')())
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:   File "/sbin/prime-switch", line 22, in importlib_load_entry_point
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:     for entry_point in distribution(dist_name).entry_points
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:   File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 919, in distribution
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:     return Distribution.from_name(distribution_name)
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:   File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 518, in from_name
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]:     raise PackageNotFoundError(name)
Jan 08 18:15:00 tom-x1eg2 lightdm[3005]: importlib.metadata.PackageNotFoundError: No package metadata was found for optimus-manager

Can verify with

optimus-manager --status

…which gets the same error.

The fix is to reinstall this package, which you could try with:

$ yay -S optimus-manager # WON'T WORK!!!
 -> error fetching optimus-manager: System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down 
	 context: exit status 1

…but that won’t work because it’s just a chroot. Instead, boot into a “no GUI” session and reinstall there. Then restart.

Mounting partitions

Enabling grub menu

Boot to text-only mode

Check boot logs

journalctl -b | less

comments powered by Disqus