Build a stripped down install.img file to be used exclusively for server text/kickstart network installs

seaninspace 2734499900 updates 2 maanden geleden
99-generic-pxe 6d1b7184c6 update 2 maanden geleden
99-generic-vendor 21dbef609a updates 2 maanden geleden
COPYING 3ad658bc22 license 2 maanden geleden
README.md 2734499900 updates 2 maanden geleden

README.md

Create a Slimmed Down, Text Only EL9 Installer with Lorax

Repo Contents

  • 99-generic-pxe: Contains the changes needed for the reduced install.img file
  • 99-generic-vendor: The stock generic template from the lorax-templates-generic package, EL9 version 34.9.25-1.0.1.

[!] If you use the templates in this repository, you must boot the installer with selinux=0 for it to work [!]

Problem

We needed to upgrade a significant amount of machines over exclusively the network that had less than 2.5GB of RAM.

The stock EL9 installer from any distro in the family will fail when loading the inst.stage2 file, install.img, with "no space left on device" on hosts with less than 3GB of RAM.

install.img sizes:

  • AlmaLinux 9.4: 858 MB
  • Rocky Linux 9.4: 819.2 MB
  • OracleLinux 9.4 885 MB

Interestingly, Fedora's is much smaller:

  • F40: 589M

The upstream lorax repository does have a lot of similar changes, so maybe in future releases this 3GB requirement will be reduced in EL.

Workarounds

The Anaconda installer has many neat ways of interacting with it. The inst.stage2 file is able to be sourced from many different locations, so if you had a spare partition to spare, the installer could be downloaded there and Anaconda could be instructed to look there via inst.stage2=hd:LABEL=$LABELNAME. More possibilities can be found here

In our scenario, we wanted to be able to fallback to the working OS on disk as we didn't have immediate access to any of the machines and we were using XFS; installing over the network was the most efficient way of doing this rather large upgrade in a reasonable amount of time.

The CentOS 7 installer did work, so we could reinstall and repartition to fascilitate this, but that would double the amount of time required and take a lot more electricity. What I did to get constrained netinstalls working was not very elegant, but thanks to Brian Lane of Red Hat for pointing out lorax's abilities to me, as well as the rest of the Anaconda folks for being so helpful.

Changes to the Installer

Additions

Vendoring

Vendoring your installer is really easy with Lorax! Just install your vendor's "release" and "logos" packages in runtime-installer.tmpl, and it will "become" the installer of that vendor.

ISO GRUB2 Kernel Parameters

You can also set the kernel parameters in GRUB2 on the resulting ISO in case you need to output to serial or something specific for the installer. The constraint on space was so extreme that we needed to remove selinux support from the installer, and being able to add selinux=0 to the kernel parameters allowed that to work.

Removals

Most of the removals come from rm'ing firmware provided by the linux-firmware package. It's a very useful package! But unfortunately the wireless, GPU, and tablet drivers take up a significant amount of space.

The other most notable change is the locale's. Installing a single language pack saves around ~200 MB of space alone.

Other removals are:

  • oscap and related packages
  • font and theme packages
  • xorg/GUI/icon related packages
  • selinux support
  • rpm-ostree
  • VNC
  • plymouth
  • yelp/-xsl

To Build

I removed all other template directories in /usr/share/lorax/templates.d/ just to be certain mine was chosen. I'm sure I could specify :)

At least ONE of the repositories listed must include the Anaconda packages!

For OL9, they are in the AppStream repository so we must inclde that as a source

Oracle Linux 9.4

lorax -p "Oracle Linux" -v 9 -r 4 -s https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/x86_64 -s https://yum.oracle.com/repo/OracleLinux/OL9/appstream/x86_64 /path/to/output

Results

In the case of the Oracle Linux 9.4 installer, we can reduce the size of the install.img file by ~50%!

Vendor (OracleLinux 9.4):
-rw-r--r-- 1 root root 102M May 10 06:41 initrd.img
-rw-r--r-- 1 root root 885M May 10 06:41 install.img
-rwxr-xr-x 1 root root  13M May 10 06:41 vmlinuz

Customized (OracleLinux 9.4):
-rw-r--r-- 1 root root  70M Aug 19 11:43 initrd.img
-rw-r--r-- 1 root root 493M Aug 19 11:43 install.img
-rwxr-xr-x 1 root root  13M Aug 19 11:43 vmlinuz

Additional Notes

  • [i] The amount of repositories you use during installation matters when you have so little RAM. Using just BaseOS and AppStream worked, but adding EPEL and/or other things pushed the usage up too much.

  • [!] If you try to install one flavor via a different one (ex: use the AlmaLinux installer with OracleLinux repositories) on UEFI it will fail. While this does work with legacy BIOS, the installer has hardcoded values for certain UEFI features and will fail looking for strings that are not there. TODO: figure out where this happens


Retrospective

Documentation and References

A really good resource I should have started with is Red Hat's own Customizing Anaconda page.