Stored LUKS passphrase for SD Card lost after crash

I use a LUKS encrypted SD card on my laptop running Fedora 30.
I set the passphrase for the SD card a long time ago and I never had to type it since: Fedora remembered it and automatically unlocked the SD card at startup or whenever inserted. I thought I also remembered the passphrase, but apparently I was wrong.

Today Fedora froze for a few seconds while using Firefox (probably because the memory usage was too high) and downloading a file into the SD card (the hard-drive is near full). After this short freeze, the system started working again but Firefox closed and the SD card was no longer mounted. When I tried to remount it I was asked for the passphrase (this normally never happens) and my best guess did not work.

Is there any way to recover the stored LUKS passphrase? After all my Gnome knew it until earlier today.
Why would Gnome suddenly forget the password? Is it possible that the SD card filesystem is damaged?

Hi @msitcn , and welcome to ask.fedora.

The first thing I would try is to see whether seahorse, that is the application frontend to gnome-keyring storing your passwords, still remembers the password for the resource.

Start it, check the stored passwords, and report back please.

Hi @florian, thanks for the quick reply.
I don’t see the password in seahorse. I see passwords for a different USB drive and other services, but not for this SD drive.

Using the same user? Do you happen to have a backup of your home dir from where you could import the password?

Yes, with the same user. No, I don’t have a backup of my home directory.

That seems weird to me.
I know you said it but let me ask: Are you sure that among “the saved passwords for USB drives” there isn’t the pw for the SD?

You are running Gnome, right?

Seems unrelated to Seahorse storing a password (or not), but still… the SD is recognized, right? lsblk shows you the drive and the LVM VG/partitions. Have you tried to cryptsetup open ... the SD card manually? (of course you need to know your passphrase).

You should make backups if there is anything on that machine that is important to you (that includes passphrases that unlock other storage devices).

1 Like

You noted that firefox was downloading (writing) to the SD card when the system froze, and that firefox died with the freeze. It is possible that the interrupted write to the sd card corrupted the card. I hope that is not the case and that you can recover it. Just be aware that files (and even drives) can get corrupted if a write does not complete normally.

This extra does not directly answer your problem, but I see 2 major problems with what you said here, both of which could seriously affect your system and maybe caused the issue.

  1. “memory usage too high” and
  2. “hard drive nearly full”

If you have little enough memory that the system stalls/halts/crashes then you either need more memory or more swap space or both. Filling up memory can quickly cause major errors or stalls and maybe total crashes. Especially if the system is trying to swap and can’t because either the program requires too much memory or swap space is too small.
I personally have 16G memory and even with running my system at almost 100% cpu usage 100% of the time it very seldom swaps. 10G swap space is almost never touched.
Top can give you a lot of stats about memory, processes in use, cpu usage, etc.

Having the hard drive almost full, depending on which file systems are on the full drive. can cause lockups as well when unable to write to the drive.
In the past it was common practice to put the /var file system on its own partition since that file system is dynamic and can cause a system crash if part of the root (/) file system and the partition became too full. Using LVM now with adequate sized physical drives makes it easy to adjust partition sizes on-the-fly so you are never plagued by full file systems.
Hard drives are cheap nowadays and a 3 TB drive can easily be gotten for < $100. Having a hard drive that is full enough that you need to do downloads to an SD or flash drive should encourage you to upgrade that old and full system or to offload a lot of stuff that you do not use regularly.

Just my 2 cents advice about keeping a system happy and reliable.