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

Live CD: Trim ISO image size #35

Closed
4 tasks done
yveszoundi opened this issue Jan 2, 2023 · 3 comments
Closed
4 tasks done

Live CD: Trim ISO image size #35

yveszoundi opened this issue Jan 2, 2023 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@yveszoundi
Copy link
Member

yveszoundi commented Jan 2, 2023

Background

The current Live CD ISO image is roughly 800 MB. As functionality gets added, the ISO image size will grow.

For the Live CD, there's a correlation between the RAM allocated to the virtual machine and free space

  • 75% of the RAM is allocated as free space on the Live CD (grub boot parameters: ramdisk-size, etc.)
  • With 1 GB of RAM allocated to a virtual machine, the application still runs pretty well. The intent is to keep RAM requirements as low as possible.

Request

Reduce the ISO image size as much as possible while keeping it functional. Pay attention to aarch64/arm64 support to ensure that the ISO image doesn't hang as noticed in early testing stages.

Overall changes

References

@yveszoundi yveszoundi added the enhancement New feature or request label Jan 2, 2023
@yveszoundi yveszoundi added this to the 0.3.1 milestone Jan 2, 2023
@yveszoundi
Copy link
Member Author

yveszoundi commented Jan 4, 2023

Thoughts for the future

  • Build the CD on top of another distros
  • Replace systemd by something lighter such as openrc, s6 if the Linux distribution supports it
    • We mostly care about SSH, the Entrusted server and possibly some audit components
    • By default, we don't need NetworkManager or assisted systemd features
      • Internet connectivity is disabled by default anyway via iptables rules
      • If users want to intermittently connect to the internet, we can make sure that there are DHCP and WiFi tools installed (i.e. dhcpcd, wpa_supplicant, etc.)
  • Use a different file system than squashfs for the Live CD data, if both the resulting ISO size and read times compromises are worth it. Few candidates include erofs and dwarfs.
  • Copy only the parts of Debian live-boot that are nice/useful, if switching to a different distribution (i.e. when not using Alpine with its default "tar.gz overlay" approach)

yveszoundi added a commit that referenced this issue Jan 12, 2023
- Use Grub in both UEFI and BIOS boot modes
- Use zstd compression for the live squashfs filesystem and the initramfs
- Update kernel configuration for built-in modules
- Update GitHub actions workflow to reflect script changes
@yveszoundi
Copy link
Member Author

yveszoundi commented Jan 12, 2023

Results are promising so far with a significant size reduction, we're now standing at roughly 680 MB.

  • This is ~100 MB less since the last release (0.3.0)
  • This is ~250 MB less since the initial availability of the live CD (0.0.2)

The exact size for amd64 as of January 22nd is 675 MB, this will be roughly the same for aarch64 too.

du -hsm images/entrusted-livecd/entrusted-livecd.iso  
675     images/entrusted-livecd/entrusted-livecd.iso

There are couple of kernel options that are not required for this application and that can likely be disabled (NFS and several other modules). This would require more testing, but I suspect that with aggressive optimizations the ISO image size can get down to 650 MB and even lower.

yveszoundi added a commit that referenced this issue Jan 13, 2023
@yveszoundi
Copy link
Member Author

It is tricky to configure a custom kernel and still guarantee that it will work for most machines while keeping the size small. This is key to significantly reducing the ISO image size to the bare minimum possible without unused drivers or features.

A dedicated issue will be created for providing a custom kernel.

yveszoundi added a commit that referenced this issue Jan 16, 2023
- Switch from mg to nano for general familiarity/convenience
- Custom kernel configuration will be addressed in separate ticket
  - Comment custom kernel compilation
  - Switch back to stock kernel image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant