Skip to content

Conversation

@rgarcia
Copy link
Contributor

@rgarcia rgarcia commented Jul 22, 2025

syncing up with the approach used in the headless image

this should reduce memory usage


TL;DR

Switched the Chromium headful unikernel to use EROFS for its root filesystem, aligning it with the headless image and reducing memory usage.

Why we made these changes

To reduce memory consumption for the Chromium headful image and standardize its root filesystem approach with the existing headless image, improving overall efficiency.

What changed?

  • Chromium Headful Image:
    • Updated Kraftfile to use idle scale-to-zero policy, increased cooldown, and pointed rootfs to ./initrd.
    • Modified build-unikernel.sh to generate the initrd using mkfs.erofs from Docker-extracted contents.
  • Shared Utilities:
    • Introduced shared/erofs-utils.sh with functions to check for and install mkfs.erofs.
    • Refactored chromium-headless/build-unikernel.sh to utilize these new shared utility scripts, removing duplicated logic.

Validation

  • Chromium headful unikernel builds successfully.
  • Headful image boots and functions as expected.
  • Memory usage is reduced compared to the previous build.
  • Scale-to-zero and cooldown policies in Kraftfile behave correctly.

syncing up with the approach used in the headless image
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Changed

This PR updates the chromium-headful image to use an EROFS-based initrd for its root filesystem, aligning its build process with the chromium-headless image. This is expected to reduce memory usage. Key changes include:

  • Modifying images/chromium-headful/build-unikernel.sh to create the EROFS filesystem.
  • Updating images/chromium-headful/Kraftfile to use the generated initrd.
  • Introducing a new shared script, shared/erofs-utils.sh, to manage the erofs-utils dependency across different environments.
  • Refactoring the chromium-headless build script to leverage this new shared utility, which reduces code duplication.

Risks / Concerns

This is a great change. It not only brings a performance improvement to the headful image but also improves the overall codebase by refactoring shared logic into a common utility script. The changes are clear and follow an established pattern within the project. Well done!

4 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings

@rgarcia rgarcia requested a review from Sayan- July 22, 2025 16:27
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@Sayan- Sayan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code changes lgtm. I'd like to understand how we want to verify the mem footprint savings but maybe it's a ship it and see situation

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Sudo Usage Inconsistency Across Build Scripts

Inconsistent sudo usage for the mkfs.erofs command between the chromium-headful (uses sudo) and chromium-headless (does not use sudo) build scripts. Both scripts utilize the --all-root flag, which typically requires elevated privileges. This inconsistency can lead to build failures or differing file permission behaviors depending on the environment's sudo configuration.

images/chromium-headful/build-unikernel.sh#L24-L25

https://github.com/onkernel/kernel-images/blob/d11b02e9dbea9670b30c399c2f1ed9fee6086e9e/images/chromium-headful/build-unikernel.sh#L24-L25

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@rgarcia rgarcia merged commit aed5e9d into main Jul 23, 2025
2 checks passed
@rgarcia rgarcia deleted the erofs-for-headful branch July 23, 2025 18:48
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.

3 participants