Managing package installations in a deployed Fedora Bootc system requires an understanding of its immutable infrastructure and the tools designed to handle modifications without compromising system stability. Fedora Bootc leverages rpm-ostree and containerization technologies like Toolbox to facilitate package management in a read-only environment. This guide provides an in-depth, step-by-step approach to installing packages in a Fedora Bootc deployment, ensuring persistence, system integrity, and ease of management.
Fedora Bootc employs an immutable system model, where the core filesystem is mounted as read-only. This design enhances system reliability and security by preventing unintended changes to critical system components. The rpm-ostree tool plays a pivotal role in managing this immutable infrastructure by enabling package layering and system updates in a controlled manner. Unlike traditional package managers like dnf
, rpm-ostree modifies the system image rather than altering files directly on the live filesystem.
For scenarios requiring isolated environments or development tools, Fedora Bootc integrates Toolbox, a container-based solution. Toolbox allows users to create and manage containerized environments where packages can be installed and modified without affecting the host system. This approach is particularly beneficial for development workflows, offering flexibility while maintaining the integrity of the immutable base system.
Package layering with rpm-ostree is the primary method for installing and persisting packages in a Fedora Bootc environment. This process involves creating a new deployment that includes the desired packages, ensuring that changes are maintained across system reboots and updates.
Before making any changes, check the current status of the system to understand the existing deployment:
sudo rpm-ostree status
This command provides information about the current deployment, including the base version and any layered packages.
Creating a new deployment ensures that modifications do not inadvertently affect the original system state:
sudo rpm-ostree rebase fedora-bootc:latest
This command rebases the system to the latest Fedora Bootc image, effectively creating a new deployment slate.
Use rpm-ostree to layer additional packages onto the existing system image. This ensures that the packages are included in the new deployment:
sudo rpm-ostree install package1 package2 package3
Replace package1 package2 package3
with the names of the packages you wish to install. This command fetches the specified RPM packages and their dependencies, adding them to the deployment.
After layering the packages, a system reboot is necessary to activate the new deployment:
sudo systemctl reboot
Upon reboot, the system will boot into the updated deployment that includes the newly installed packages.
# Check current system status
sudo rpm-ostree status
# Create a new deployment by rebasing
sudo rpm-ostree rebase fedora-bootc:latest
# Install multiple packages
sudo rpm-ostree install cockpit cockpit-podman cockpit-storaged cockpit-ws cockpit-pcp cockpit-machines cockpit-selinux bash-completion borgbackup bwm-ng cups cups-browsed ethtool firewalld git lm_sensors nfs-utils nss-mdns pcp pcp-selinux samba sysstat tftp-server tuned wget
# Reboot to apply changes
sudo systemctl reboot
By following these steps, the system remains immutable, and all changes are managed through rpm-ostree
, ensuring consistency and reliability [Fedora Docs].
While the standard rpm-ostree approach requires a reboot to apply changes, it's possible to apply certain package installations live without rebooting, depending on the package's nature:
sudo rpm-ostree install --apply-live package-name
This command attempts to apply the package immediately. However, not all packages support live application, so it's essential to consult the package documentation or test compatibility beforehand [Fedora Discussion].
Toolbox offers a flexible way to manage packages within containerized environments, ideal for development purposes or when isolation is required:
If Toolbox is not already installed, add it using rpm-ostree and reboot:
sudo rpm-ostree install toolbox
sudo systemctl reboot
Create a new Toolbox container to isolate package installations:
toolbox create
Access the containerized environment:
toolbox enter
Use dnf
to install packages as you would on a standard Fedora system:
sudo dnf install package-name
After installing the necessary packages, exit the container:
exit
# Create a new Toolbox container
toolbox create
# Enter the Toolbox container
toolbox enter
# Install vim within the container
sudo dnf install vim
# Exit the Toolbox container
exit
Packages installed within a Toolbox container are isolated from the host system, allowing for safe experimentation and development without affecting the immutable base [Computing for Geeks].
For deployed Bootc systems, especially in production environments, it's recommended to create custom container images that include the desired packages. This method ensures that package installations are incorporated into the system image from the outset, maintaining system immutability and reliability.
Define a Dockerfile that specifies the base image and the packages to install:
FROM quay.io/fedora/fedora-bootc:41
RUN dnf install -y package1 package2 package3 && dnf clean all
Use Docker or a compatible container builder to build the new image:
docker build -t your-registry/your-image:tag .
Upload the newly built image to your chosen container registry:
docker push your-registry/your-image:tag
Apply the updated container image to the deployed Fedora Bootc system, ensuring that the new packages are included in the deployment [Fedora Docs].
Multi-Stage Builds: Use multi-stage builds in Dockerfiles to compile software, reducing the final image size and improving build efficiency [Fedora Bootc Building Containers].
Linting Containers: Run bootc container lint
as a final stage during container builds to ensure compliance with best practices and system compatibility [Fedora Bootc Building Containers].
Locking Package Versions: To maintain consistency, lock package versions in your Dockerfile. This prevents unexpected changes due to floating repositories [Fedora Bootc Building Containers].
To remove previously layered packages, use the following rpm-ostree command:
sudo rpm-ostree uninstall package-name
This action creates a new deployment without the specified package, maintaining the system's immutable state.
If you need to install packages temporarily without persisting them across reboots, consider using transient sessions with tools like dnf
. However, be cautious as these changes will not survive a system reboot and are not specific to Bootc's methodologies.
Directly using dnf -y update
or dnf upgrade
on a deployed Fedora Bootc system is strongly discouraged. Such operations can lead to inconsistencies, especially with kernel and bootloader updates, potentially rendering the system unbootable [Fedora Bootc Storage]. Always use rpm-ostree or containerized methods for package management.
rpm-ostree update
, followed by a reboot to apply changes [Fedora rpm-ostree Documentation].After installing packages, whether through rpm-ostree or Toolbox, it's essential to verify their installation:
rpm -qa | grep package-name
to confirm installation.package-name --version
or similar commands to verify functionality.Package Installation Fails: Ensure that the package name is correct and that the repositories are properly configured. Use sudo rpm-ostree install --allow-inactive
if necessary.
Dependencies Not Met: Use sudo dnf download --resolve package-name
to identify and download necessary dependencies before layering.
System Not Rebooting Correctly: Verify that the new deployment was correctly created and that the system is set to boot into the latest deployment using sudo rpm-ostree status
.
Toolbox Container Issues: If a Toolbox container fails to launch, ensure that Toolbox is correctly installed and that the container image is not corrupted. Recreate the container if necessary.
Installing packages in a deployed Fedora Bootc environment necessitates adherence to its immutable infrastructure principles. By utilizing tools like rpm-ostree for system-wide package layering and Toolbox for containerized environments, administrators can maintain system integrity while achieving the necessary flexibility for package management. Building and deploying custom container images further allows for tailored system configurations that align with organizational policies and operational requirements. Following best practices and leveraging the comprehensive resources provided ensures a stable, secure, and maintainable Fedora Bootc deployment.