LUKS Encryption in SirrOS
SirrOS implements full disk encryption using LUKS (Linux Unified Key Setup) to protect your data on the PinePhone Pro. LUKS is an industry-standard encryption method that uses strong cryptographic algorithms to secure the entire filesystem. By default, SirrOS sets up the root filesystem with a default LUKS password, which is s1rr0s.
The encryption parameters used in SirrOS are designed for strong security:
-
LUKS version 2 for modern encryption and key management.
-
AES-XTS with a 512-bit key size and
plain64sector IV mode. -
SHA-512 as the hash algorithm used by LUKS for its key material and digests.
-
Argon2id as the password-based key derivation function (PBKDF).
-
512 MiB of memory allocated to Argon2id (
524288KiB). -
Two parallel threads used during key derivation.
-
A 3000 ms target processing time to slow down password-guessing attacks.
These settings ensure that even if someone gains physical access to the device, the encrypted data cannot be read without the correct password.
How LUKS Keys Work: Volume Key vs. Passphrase
To understand why SirrOS does what it does on first boot, it helps to know that LUKS uses two different kinds of secrets.
The volume key
The volume key (also called the master key) is a random 512-bit key generated when the volume is created. It is the key that actually encrypts every sector of the disk with AES-XTS. You never type it and it never leaves the device in clear form: while the phone is unlocked it lives only in kernel memory, inside the dm-crypt mapping /dev/mapper/root.
Keyslots and passphrases
Your passphrase does not encrypt your data directly. Instead, the LUKS header contains keyslots. Each keyslot holds a copy of the volume key, encrypted with a key derived from a passphrase:
passphrase --Argon2id (512 MiB, 3 s)--> slot key --decrypts--> volume key --AES-XTS--> your data
When you unlock the phone at boot, LUKS runs Argon2id on what you typed, uses the result to open a keyslot, recovers the volume key, and checks it against a digest stored in the header. Argon2id is deliberately slow and memory-hungry, so every password guess is expensive for an attacker.
Why changing the passphrase is not enough
This design has an important consequence: changing the passphrase only re-wraps the same volume key. Adding a new keyslot and deleting the old one (which is what any password change does, SirrLuks included) leaves the volume key, and therefore the encryption of every sector, exactly as it was.
For a normal installation that is fine, because the volume key was generated randomly on your own machine. For a release image it is not. SirrOS images are encrypted when the image is built, so every phone flashed from the same image starts with the same volume key, protected by the same public passphrase s1rr0s. Anyone can download the image, unlock its header with the factory passphrase, and read that volume key. If your phone still uses it, that person could decrypt a copy of your disk even after you changed your password, because the password change never touched the volume key.
The only fix is to re-encrypt the disk with a brand-new, randomly generated volume key that exists only on your phone. That is what the SirrOS first-boot re-key does.
The First-Boot Re-key
SirrOS ships a one-time service, sirros-rekey.service, which regenerates the LUKS2 volume key in the background after your first login. It relies on LUKS2 online re-encryption: the disk stays mounted and the phone stays usable while every sector is rewritten under the new key.
What happens, step by step
- You unlock the disk at boot with unl0kr, as usual. The service never asks for anything at this stage and never delays boot or Phosh.
- It waits for your Phosh session and for you to unlock the lock screen, so the work starts only once you are actually using the phone.
- It lets the desktop settle for about 30 seconds.
- It checks the power. It starts only if the battery is at 30% or more, or the charger is connected.
- It makes the encrypted volume fill the whole partition. On first boot the root partition is grown to the full eMMC. SirrOS resizes the encrypted mapping and the filesystem first, so the whole disk ends up under the new key.
- It re-encrypts the disk with
cryptsetup reencrypt, generating a fresh random volume key (--use-random, AES-XTS-512, SHA-512). It uses the factory passphrase automatically, so there is nothing to type. It runs at the lowest CPU and I/O priority, so you can keep using the phone. - It verifies the result. It compares a fingerprint of the LUKS key digest before and after. Only if it changed does it mark the job as done (
/var/lib/sirros/rekey.done), and the service never runs again.
While it runs, a single Phosh notification shows the progress and is updated every minute:
Securing your disk 43%
▰▰▰▰▰▱▱▱▱▱▱▱ 43% (0:20:00)
Keep the phone on the charger while the new encryption key is created.
When it finishes you will see “Your disk is secured”.
Safe by design
- Crash and power-loss safe. Re-encryption uses
--resilience checksum: progress is recorded in the LUKS header, so after an interruption it resumes where it stopped on the next boot. - Low battery. If the battery drops below 15% without a charger, SirrOS pauses cryptsetup cleanly. It continues by itself when you plug the charger in.
- Shutdown. If the phone is turned off, cryptsetup saves its progress and resumes at the next login.
Checking progress and logs
Everything the re-key does is logged with timestamps, with no serial cable needed:
sirros-rekey-status # state, last progress and the latest log lines
sirros-rekey-status -f # follow the log live
cat /var/lib/sirros/rekey.log
sudo journalctl -t sirros-rekey -b
A successful run ends with:
[rekey] key digest fingerprint: f0a1aca0d537a0b1 -> 7c2e...
[rekey] OK: volume key regenerated
Let it finish
Please let the re-key finish before you rely on the phone for sensitive data:
- Keep the phone on the charger during the first session after installing. Re-encrypting the whole disk takes a while, from tens of minutes to a few hours depending on its size.
- Avoid powering off or rebooting until the “Your disk is secured” notification appears. An interruption is safe and the re-key resumes later, but until it completes, part of your disk is still encrypted with the shared factory key.
- Do not change the LUKS password until the re-key has finished. The service unlocks the disk with the factory passphrase. If you change it first, the re-key cannot run and the log will say so. If that happens, it can still be run by hand with
sudo sirros-rekey --passfile FILE, where FILE contains your current passphrase.
Why Change the Default Password
The re-key replaces the volume key, but it keeps the factory passphrase: the keyslot is still opened with s1rr0s. Using that default password is extremely risky:
-
Anyone who knows the default password can unlock your encrypted disk.
-
Leaving the default password exposes all sensitive data stored on the device.
-
Default passwords are a common target for automated attacks or social engineering.
The two steps protect against different things, and you need both:
| Step | Protects against |
|---|---|
| Re-key (automatic) | someone who has the public image and its shared volume key |
| New passphrase (SirrLuks) | someone who knows the default password s1rr0s |
So the recommended order is: first let the re-key finish, then change the password with SirrLuks.
SirrLuks: Change LUKS Passphrase
To make password changes easy, SirrOS provides SirrLuks, a command-line tool that allows you to:
-
Add a new password to the LUKS keyslot.
-
Remove the old password.
-
Ensure the new password matches confirmation input to prevent mistakes.
-
Safely manage the encrypted device while it is mounted.
Example Usage
First, check that the re-key has finished:
sirros-rekey-status
# state: DONE (volume key regenerated ...)
Then run SirrLuks from the Phosh menu, or from the CLI with this command:
sudo sirrluks
The tool will interactively prompt you for:
Current password: # The default password or your current password
New password: # New password
Confirm new password: # Confirm password
Once executed, SirrLuks securely adds the new key and removes the old one, reporting the status:
Adding new LUKS key...
Removing old LUKS key...
LUKS password successfully changed
Choose a long passphrase. Argon2id makes every guess slow, but it cannot save a short or common password.
Limits Worth Knowing
- The re-key changes the volume key, not the passphrase. Changing the passphrase is still up to you.
- Flash storage uses wear-leveling, so old copies of blocks written under the factory key may survive physically on the eMMC until they are overwritten. For maximum protection, re-key and change the password before storing sensitive data on the phone.
Summary
LUKS protects your PinePhone Pro with strong parameters, but security depends on two secrets: the volume key that encrypts the data and the passphrase that unlocks it. Because release images share one volume key, SirrOS automatically re-encrypts the disk with a new, unique volume key after your first login. Keep the phone charged and let it finish. Then replace the default password with SirrLuks. After both steps, your data is protected by a key that exists only on your device and a password only you know.