2.6. Switching from an existing rpm-ostree installation to image mode for RHEL 9.6
You can use image mode for RHEL on your existing RHEL for Edge system by using the bootc switch command.
When switching between different host builds, you can use the bootc switch command to migrate your existing deployed system to a bootc based system.
Some user and group IDs differ between rhel-bootc images and RHEL for Edge. This affects several groups and users, such as ssh_keys. As a consequence, the private keys belong to a group with a misconfigured ID, and you will not be able to use public keys to access the edge system.
The Image Mode system uses altfiles to manage users at /user/lib/passwd and groups at /user/lib/group. To workaround this, you must extract the groups and users information of the existing RHEL for Edge system and fixating them as part of the Containerfile. Configure the Containerfile to copy a local lib/group file to the container image.
You can manually change the permissions of private keys, the /etc folder is mutable in edge systems. However, it does not solve the problem, because after running the bootc switch command, the Image Mode based system has the ssh_keys group configured with the ID 999. This value comes from the RHEL bootc base image, and this drift from ID 101 to ID 999 left the edge system unreachable through SSH. To fix this issue, follow the steps:
Prerequisites
-
An existing RHEL for Edge
rpm-ostreebased system. - You have a subscribed RHEL 9 system. For more information, see Getting Started with RHEL System Registration documentation.
- You have a container registry. You can create your registry locally or create a free account on the Quay.io service. To create the Quay.io account, see Red Hat Quay.io page.
- You have a Red Hat account with either production or developer subscriptions. No cost developer subscriptions are available on the Red Hat Enterprise Linux Overview page.
- You have authenticated to registry.redhat.io. For more information, see Red Hat Container Registry Authentication article.
Procedure
Extract the information of users and groups from the RHEL for Edge system.
$ mkdir -p ./usr/lib $ ssh admin@192.168.100.50 'cat /lib/passwd' > ./usr/lib/passwd $ ssh admin@192.168.100.50 'cat /lib/group' > ./usr/lib/groupInclude the missing RHEL for Edge packages in the bootc based system by specifying them in a Containerfile. Additionally, use the COPY command to include the
groupandpasswdcontent that was extracted from the RHEL for Edge system. The following is an example:FROM registry.redhat.io/rhel9/rhel-bootc WORKDIR /tmp RUN dnf -y install ModemManager \ NetworkManager-wifi \ NetworkManager-wwan \ audit \ checkpolicy \ clevis \ clevis-dracut \ clevis-luks \ clevis-pin-tpm2 \ clevis-systemd \ containernetworking-plugins \ dnsmasq \ dracut-config-generic \ fdo-client \ fdo-owner-cli \ firewalld \ firewalld-filesystem \ greenboot \ greenboot-default-health-checks \ grubby \ ignition \ ignition-edge \ ipset \ iwl100-firmware \ iwl1000-firmware \ iwl105-firmware \ iwl135-firmware \ iwl2000-firmware \ iwl2030-firmware \ iwl3160-firmware \ iwl5000-firmware \ iwl5150-firmware \ iwl6050-firmware \ iwl7260-firmware \ libsecret \ pinentry \ policycoreutils-python-utils \ python3-distro \ python3-setools \ rsync \ setools-console \ tmux \ traceroute \ usbguard \ usbguard-selinux \ wireless-regdb \ wpa_supplicant COPY etc /etc # You can find the passwd and group content that were extracted from the RHEL for Edge system usr/lib/ in your current working directory. You can copy the content into the container image with the following step: COPY usr /usrBuild the bootc image and push it to the registry:
$ podman build -f Containerfile -t quay.io/<namespace>/<image>:<tag> . $ podman push quay.io/<namespace>/<image>:<tag>Run the
bootc switchcommand to the newly created bootable container image.$ ssh admin@192.168.100.50 $ sudo bootc switch quay.io/<namespace>/<image>:<tag> $ sudo reboot
Verification
After rebooting the edge system into the bootable container image, confirm that the contents of /lib/passwd and /lib/group match the content that was extracted from the OSTree system.
Check the content of
/lib/passwd.$ cat /lib/passwdCheck the content of
/lib/group.$ cat /lib/group
Use an existing 9.6 RHEL for Edge that you installed by using a raw image to switch to image mode for RHEL .
Prerequisites
- An existing 9.6 RHEL for Edge installed with a raw image.
Procedure
- Update your image. See Updating RHEL for Edge images.
Switch your existing image from RHEL image builder to image mode.
Build an image from rhel-bootc. For example:
$ cat Containerfile FROM registry.redhat.io/rhel9/rhel-bootc:latest RUN dnf install -y \ clevis \ clevis-dracut \ clevis-luks \ fdo-client \ fdo-owner-cli
Build the <image> image by using
Containerfilein the current directory:$ podman build -t quay.io/<namespace>/<image>:<tag> .Push the image to a registry
$ podman push quay.io/<namespace>/<image>:_<tag>_Run
bootc switchon the device.$ bootc switch quay.io/<namespace>/<image>:_<tag>_Run
systemctl reboot.$ sudo systemctl reboot
Verification
Connect to your RHEL for Edge system and use
bootc status:# bootc status
Use an existing 9.6 RHEL for Edge that you installed by using a simplified-installer image.
Prerequisites
-
An existing 9.6 RHEL for Edge installed with a
simplified-installerimage.
Procedure
Check if
bootcis installed:$ rpm -qa | bootcUpdate your image to the latest
rpm-ostreeinstallation. See Updating RHEL for Edge images.Build an image from
rhel-bootc. For example:$ cat Containerfile FROM registry.redhat.io/rhel9/rhel-bootc:latest RUN dnf install -y \ clevis \ clevis-dracut \ clevis-luks \ fdo-client \ fdo-owner-cli
Build the <image> image by using
Containerfilein the current directory:$ podman build -t quay.io/<namespace>/<image>:<tag> .Push the image to a registry.
$ podman push quay.io/<namespace>/<image>:_<tag>_Run
bootc switchto switch the device to the image you pushed to the registry.$ bootc switch quay.io/<namespace>/<image>:_<tag>_Run systemctl reboot.
$ sudo systemctl reboot
Verification
Connect to your RHEL for Edge system and use
bootc status:# bootc status