Skip to content

Conversation

@imlk0
Copy link
Collaborator

@imlk0 imlk0 commented Jan 31, 2026

Summary

This PR implements atomic initialization check using the cryptsetup subsystem feature. The changes ensure that a volume is considered initialized only after both LUKS2 creation and mkfs are completed successfully.

Changes

  • Add --subsystem cryptpilot option to cryptsetup luksFormat in cryptpilot-convert.sh
  • Implement direct binary LUKS2 header parsing to read subsystem field
  • Add mark_volume_as_initialized function to set subsystem after successful initialization
  • Modify is_initialized function to check for cryptpilot subsystem
  • Call mark_volume_as_initialized after mkfs in init, open, and before_sysroot stages

Motivation

This provides atomic initialization semantics: a volume is considered initialized only after both LUKS2 creation and mkfs are completed, preventing partially initialized volumes from being recognized as fully initialized.

- Add --subsystem cryptpilot option to cryptsetup luksFormat in cryptpilot-convert.sh
- Implement direct binary LUKS2 header parsing to read subsystem field
- Add mark_volume_as_initialized function to set subsystem after successful initialization
- Modify is_initialized function to check for 'cryptpilot' subsystem
- Call mark_volume_as_initialized after mkfs in init, open, and before_sysroot stages
- Ensure atomicity: only fully initialized volumes (with subsystem set) are recognized as initialized

This provides atomic initialization semantics: a volume is considered
initialized only after both LUKS2 creation and mkfs are completed.

Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
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.

2 participants