Mastodon Skip to content

Thinking like a distribution

Making a custom image is similar to making a distribution. You modify the system defaults themselves. You make configuration changes in /usr/etc/ and /usr/lib/, not /usr/local/ or ~/.config/. You have to think about what to include and what not to include in the image you are building,

This documentation will use “you” to refer to the creator of the custom image, and “the user” to refer to its users. If you are making an image only for yourself, you are both parties, and can get away with more things.

Resist the urge to add the entire universe

Systems like this are designed for a small, lean, mean, maintainable, and performant core. Remember that updates to the base image require a reboot, so ideally you want that surface area to be small - let Flatpak and other user-space tools handle the rest. For example, you can also build a toolbox image that contains software and configuration not needed on the base image but useful to the image’s user.

Also remember that these systems are atomic, you don’t need to manually clean up an old decision, the user will just get a new pristine image (ideally every day), so if you need to add a bunch of packages to get the desired outcome then you can always trim it down later - just remember that you need to account for the user’s data!

What is and isn’t possible

When making a custom image, it isn’t possible to do things that require a booted system, like creating user accounts and groups or writing to /var/ where the user’s files are stored. Instead, you should write to system directories like /usr/bin/ and /usr/etc/, which is the proper place for default system configuration that is applied to the /etc/ directory when the image is booted.

Some RPM packages might have issues because they try to create users or user groups. The easiest workaround in these cases is to manually layer them on the booted image.