Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for late resume #139

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Support for late resume #139

wants to merge 3 commits into from

Conversation

truffle0
Copy link

Adds a new late_resume parameter, which moves the trigger point from init_early to init_premount.
This allows cryptsetup and LVM to initialize before the system attempts to resume, making encrypted or otherwise non-trival-to-access swap partitions accessible.
In addition it will use allow using resume=UUID=* to specify the resume device, as any partitions that aren't directly on disk don't have a PARTUUID.

Which this option is safe in theory and I have been using it without issue for a few months, it is important to note that configurations that cause writes to the device before triggering resume run the risk of system instability and data loss.
I have purposefully used init_premount section to trigger before filesystems are mounted as the kernel shouldn't make any metadata changes (save for possibly LVM access times) before mounting filesystems.

I have also made sure to include warnings in the configuration docs and the output of ugrd when this option is enabled to make sure users understand the implications (including a link to the kernel docs that detail the risks).
I'm not sure whether the warning is overkill, as I believe this option is safe to use under normal encrypted swap and lvm setups, but to cater to potentially non-standard setups I think it's important to have.

controlled by the 'late_resume' parameter, will move the trigger point
for resume to after devices have been decrypted or discovered
allows resume from encrypted swap or devices requiring extra handling be visible to the kernel
@truffle0 truffle0 force-pushed the dev branch 2 times, most recently from 872fe17 to 6067efc Compare December 11, 2024 08:50
currently it's more of a rearrangment of the original code, with some
added safety/integrity checks
`resume` is now a separate function, the plan is to have the code for
actually resuming within this function and code for locating the device
outside.
in the more general case, if `late_resume` is enabled, the initram will
check at both the `init_early` and again at the `init_premount` stage
for the presence of the resume device. Once host-only is implemented
then it'll be able to determine at build time which state it'll need to
check at.
For safety checks, currently it checks whether the device is a
valid block device, whether resume has already been attempted previous
(based on the content of `/sys/power/resume`) & whether there are are
any other mounted block devices.
@desultory desultory force-pushed the dev branch 2 times, most recently from b86a171 to 80f9d3c Compare December 22, 2024 22:07
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.

1 participant