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

Adding a new zram-generator package #1772

Merged
merged 4 commits into from
Mar 25, 2024
Merged

Conversation

george-angel
Copy link
Contributor

@george-angel george-angel commented Mar 20, 2024

Adding sys-apps/zram-generator package

This resolves flatcar/Flatcar#905 . Issue explains the advantages of adding this package, but it effectively minimises the amount of config / setup a user needs to do as well as allowing for "dynamic" sizing of swap.

How to use

Create an image that contains this package and follow instructions at: https://wiki.gentoo.org/wiki/Zram#Using_systemd_zram-generator to use it.

Testing done

Built an image (based off current stable Flatcar) that includes sys-apps/zram-generator. Running with QEMU created the following config:

# /etc/systemd/zram-generator.conf

[zram0]
zram-size = min(ram, 8192)

Followed by:

$ sudo systemctl daemon-reload
$ sudo systemctl start dev-zram0.swap

And verified the swap was created:

$ zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle       962M   4K   80B   12K       6 [SWAP]

Big thanks to @jepio with a lot of hand holding that was needed.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@jepio
Copy link
Member

jepio commented Mar 20, 2024

We need to add a keyword for arm64 to the profile, i can provide you a path tomorrow. Also a changelog entry would be nice.

Copy link

github-actions bot commented Mar 20, 2024

@jepio jepio self-assigned this Mar 21, 2024
@jepio jepio self-requested a review March 21, 2024 08:36
The ebuild is keyworded ~arm64, align the two arches.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
@jepio
Copy link
Member

jepio commented Mar 21, 2024

I pushed the extra profile keywords. There's a followup required because gentoo rust ebuilds don't handle cross-compilation, the followup is in #1780.

Will merge this if the tests run as expected (there is an expected failure from the tang/tpm tests).

@ader1990
Copy link
Contributor

Hello,

a mantle CI test might be useful to make sure this new feature has proper regression validation?
Also, I see an addition of static built binaries in the /boot partition, maybe a check on the size increase of the initrd/boot partition would be nice.

Thanks.

@jepio
Copy link
Member

jepio commented Mar 25, 2024

Hello,

a mantle CI test might be useful to make sure this new feature has proper regression validation? Also, I see an addition of static built binaries in the /boot partition, maybe a check on the size increase of the initrd/boot partition would be nice.

Thanks.

Are you sure? I only see this:

diff --git a/tmp/3909.0.0+nightly-20240314-2100-Ztgf0S b/tmp/.-I9wx8L
index 48c3a53899..d89eab3d35 100644
--- a/tmp/3909.0.0+nightly-20240314-2100-Ztgf0S
+++ b/tmp/.-I9wx8L
@@ -20854,6 +20854,7 @@
 /usr/lib/systemd/system-generators/systemd-run-generator
 /usr/lib/systemd/system-generators/systemd-system-update-generator
 /usr/lib/systemd/system-generators/systemd-veritysetup-generator
+/usr/lib/systemd/system-generators/zram-generator
 /usr/lib/systemd/system-preset
 /usr/lib/systemd/system-preset/99-default.preset
 /usr/lib/systemd/system-shutdown
@@ -21350,6 +21351,7 @@
 /usr/lib/systemd/system/systemd-userdbd.socket
 /usr/lib/systemd/system/systemd-vconsole-setup.service
 /usr/lib/systemd/system/systemd-volatile-root.service
+/usr/lib/systemd/system/systemd-zram-setup@.service
 /usr/lib/systemd/system/tcsd.service
 /usr/lib/systemd/system/time-set.target
 /usr/lib/systemd/system/time-sync.target

Re mantle: lets take care of this separately because it would be a lot of work for a first time contributor and the arm64 package doesn't work yet.

…/2024-03-21-zram-generator.md

Co-authored-by: Mathieu Tortuyaux <mathieu.tortuyaux@gmail.com>
@ader1990
Copy link
Contributor

Hello,
a mantle CI test might be useful to make sure this new feature has proper regression validation? Also, I see an addition of static built binaries in the /boot partition, maybe a check on the size increase of the initrd/boot partition would be nice.
Thanks.

Are you sure? I only see this:

diff --git a/tmp/3909.0.0+nightly-20240314-2100-Ztgf0S b/tmp/.-I9wx8L
index 48c3a53899..d89eab3d35 100644
--- a/tmp/3909.0.0+nightly-20240314-2100-Ztgf0S
+++ b/tmp/.-I9wx8L
@@ -20854,6 +20854,7 @@
 /usr/lib/systemd/system-generators/systemd-run-generator
 /usr/lib/systemd/system-generators/systemd-system-update-generator
 /usr/lib/systemd/system-generators/systemd-veritysetup-generator
+/usr/lib/systemd/system-generators/zram-generator
 /usr/lib/systemd/system-preset
 /usr/lib/systemd/system-preset/99-default.preset
 /usr/lib/systemd/system-shutdown
@@ -21350,6 +21351,7 @@
 /usr/lib/systemd/system/systemd-userdbd.socket
 /usr/lib/systemd/system/systemd-vconsole-setup.service
 /usr/lib/systemd/system/systemd-volatile-root.service
+/usr/lib/systemd/system/systemd-zram-setup@.service
 /usr/lib/systemd/system/tcsd.service
 /usr/lib/systemd/system/time-set.target
 /usr/lib/systemd/system/time-sync.target

Re mantle: lets take care of this separately because it would be a lot of work for a first time contributor and the arm64 package doesn't work yet.

looks good to me:

File    Size  Used Avail Use% Type
/boot   127M   62M   65M  49% vfat
/usr   1016M  463M  443M  52% btrfs
/       2.0G   36K  1.8G   1% ext4
SUM     3.1G  524M  2.3G  19% -

I will add the Mantle test to check if any PR goes beyond the 50% usage in /boot in the following days, so that we won't need to verify manually each time.

@jepio jepio enabled auto-merge March 25, 2024 12:52
@jepio jepio disabled auto-merge March 25, 2024 12:52
@jepio jepio merged commit bf0ea52 into flatcar:main Mar 25, 2024
@jepio
Copy link
Member

jepio commented Mar 25, 2024

Thanks for the contribution @george-angel

@george-angel george-angel deleted the zram-generator branch March 26, 2024 03:31
pothos added a commit to flatcar/flatcar-website that referenced this pull request Apr 16, 2024
With the generator added in flatcar/scripts#1772
we don't need the manual setup anymore.
pothos added a commit to flatcar/flatcar-website that referenced this pull request Apr 16, 2024
With the generator added in flatcar/scripts#1772
we don't need the manual setup anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
5 participants