Skip to content

Don't write encryption keyfiles to an unencrypted root partition#4349

Merged
svartkanin merged 1 commit intoarchlinux:masterfrom
dylanmtaylor:fix-keyfile-unencrypted-root
Apr 1, 2026
Merged

Don't write encryption keyfiles to an unencrypted root partition#4349
svartkanin merged 1 commit intoarchlinux:masterfrom
dylanmtaylor:fix-keyfile-unencrypted-root

Conversation

@dylanmtaylor
Copy link
Copy Markdown
Contributor

Fixes #1856

When encrypting partitions like /home but not /, the keyfiles were written to the unencrypted root filesystem in plaintext, defeating the purpose of the encryption.

Now keyfiles are only generated when root is also encrypted. Otherwise, systemd-cryptsetup will prompt for the passphrase at boot instead.

@dylanmtaylor
Copy link
Copy Markdown
Contributor Author

dylanmtaylor commented Mar 31, 2026

This might be as straightforward as it seems, needs tested still, so in draft. I suspect we will run into an issue because we still need a crypttab entry but with none as the keyfile so systemd prompts for the passphrase.

Edit: This is the case, I updated the PR to address ^^

@dylanmtaylor dylanmtaylor force-pushed the fix-keyfile-unencrypted-root branch from 7bc3274 to a7e00dc Compare April 1, 2026 00:26
@dylanmtaylor dylanmtaylor force-pushed the fix-keyfile-unencrypted-root branch from a7e00dc to 56566fa Compare April 1, 2026 01:25
@dylanmtaylor
Copy link
Copy Markdown
Contributor Author

dylanmtaylor commented Apr 1, 2026

Testing:

Manual partitioning:
Screenshot From 2026-03-31 20-58-48
Encryption enabled on just /home
Screenshot From 2026-03-31 21-01-03
/etc/crypttab contains home partition with "none" set
image
/etc/cryptsetup-keys.d does NOT have the key for home:
image
home password prompt on boot;
image

@dylanmtaylor dylanmtaylor marked this pull request as ready for review April 1, 2026 02:02
@dylanmtaylor dylanmtaylor requested a review from Torxed as a code owner April 1, 2026 02:02
@dylanmtaylor
Copy link
Copy Markdown
Contributor Author

dylanmtaylor commented Apr 1, 2026

This is tested and confirmed to work correctly. ^^

After entering the /home password, I was able to log into the system normally.

@svartkanin svartkanin merged commit 29b7330 into archlinux:master Apr 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encrypting /home but not / leads to keyfile being written unencrypted to disk

2 participants