Skip to content

Commit d70f205

Browse files
committed
Wait for LUKS configfs API to be ready
Partially resolves: #109 On Fedora 42, LUKS-encrypted volumes fail to be unlocked in the crash kernel because somehow the volume keys are yet to be available. Wait for the API to be ready before triggering restoring volume keys so that later the keys will be available for cryptsetup to unlock the volumes. Fixes: d9677e1 ("Support dumping to a LUKS-encrypted target") Signed-off-by: Coiby Xu <[email protected]>
1 parent a8f245d commit d70f205

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
11
#!/bin/sh
22
#
3-
echo true > /sys/kernel/config/crash_dm_crypt_keys/restore
3+
LUKS_CONFIGFS_RESTORE=/sys/kernel/config/crash_dm_crypt_keys/restore
4+
RESTORED=1
5+
MAX_WAIT_TIME=10
6+
wait_time=0
7+
8+
while [ $wait_time -lt $MAX_WAIT_TIME ]; do
9+
[ -e $LUKS_CONFIGFS_RESTORE ] && break
10+
sleep 1
11+
wait_time=$((wait_time + 1))
12+
done
13+
14+
if [ $wait_time -ge $MAX_WAIT_TIME ]; then
15+
echo "$LUKS_CONFIGFS_RESTORE isn't ready after ${MAX_WAIT_TIME}s, something wrong!"
16+
exit 1
17+
fi
18+
19+
if ! grep -q "$RESTORED" "$LUKS_CONFIGFS_RESTORE"; then
20+
echo $RESTORED > $LUKS_CONFIGFS_RESTORE
21+
fi

0 commit comments

Comments
 (0)