Thanks John for the detailed report and patch.
I've reproduced this on Ubuntu 26.04 (arm64, ec2-hibinit-agent
1.0.9-0ubuntu1): validate_system_requirements() computes the RAM-based
target size, while SwapInitializer.__init__() allocates only target-
size-mb (4000 MiB), causing the swap file to be deleted, recreated, and
GRUB regenerated on every boot.
Looks likt this is a regression upstream introduced in aws/amazon-
ec2-hibinit-agent commit 071688ed42 ("Refactoring agent for legibility &
changing service type to simple (#40)"), which shipped in v1.0.8 and
v1.0.9. It was later fixed fixed it in commit 3700a58fb7 ("Fix swap
allocation bug (#48)"), available in tags v1.0.9-1 and v1.0.10-2:
https://github.com/aws/amazon-ec2-hibinit-agent/commit/3700a58fb7
I also noticed that both the proposed patch and upstream's
calc_target_swap_size(): when touch-swap = True (the default on XFS),
SwapInitializer.pretouch_swap() writes in 1 MiB O_DIRECT blocks, which
extends a non-1-MiB-aligned swap file up to the next 1 MiB boundary. If
that overshoot exceeds MAX_SWAP_SIZE_OFFSET_ALLOWED - SWAP_RESERVED_SIZE
(86016 bytes), validate_system_requirements() will still treat it as
oversized and recreate it on the next boot. Rounding the target swap
size up to a 1 MiB boundary avoids this.
Looking into bringing the upstream fix into the Ubuntu package (and
SRUing it to 26.04), and upstreaming the fix to their fix.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2178491
Title:
ec2-hibinit-agent 1.0.9 ignores percentage-of-ram when allocating
hibernation swap file
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ec2-hibinit-agent/+bug/2178491/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs