Use automatic recovery in image mode for RHEL systems

To use automatic recovery for {product-title} on RHEL image-based systems, you can embed the 10-auto-recovery.conf and microshift-auto-recovery.service files in your Containerfile and rebuild the bootc image.

Important

You must include the entire auto-recovery process for image mode for RHEL systems that use systemd in the container file.

Prerequisites
  • You created a Containerfile as instructed in Building the bootc image.

  • You created the 10-auto-recovery.conf and microshift-auto-recovery.service files as explained in the "Using auto-recovery in RPM systems" section.

    Important

    The location of the 10-auto-recovery.conf and microshift-auto-recovery.service files must be relative to the Containerfile.

    For example, if the path to the Containerfile is /home/microshift/my-build/Containerfile, the systemd files need to be adjacent for proper embedding. The following paths are correct for this example:

    • /home/microshift/my-build/auto-rec/10-auto-recovery.conf

    • /home/microshift/my-build/auto-rec/microshift-auto-recovery.service

    • /home/microshift/my-build/auto-rec/microshift-auto-recovery

  • You created the microshift-auto-recovery script as explained in the "Using auto-recovery in RPM systems" section.

Procedure
  1. Use the following example snippet to update the container file that you use to prepare the image mode for RHEL image.

    RUN mkdir -p /usr/lib/systemd/system/microshift.service.d
    COPY ./auto-rec/10-auto-recovery.conf /usr/lib/systemd/system/microshift.service.d/10-auto-recovery.conf
    COPY ./auto-rec/microshift-auto-recovery.service /usr/lib/systemd/system/
    COPY ./auto-rec/microshift-auto-recovery /usr/bin/
    RUN chmod +x /usr/bin/microshift-auto-recovery
    Important

    Podman uses the host subscription information and repositories inside the container when building the container image. If the rhocp and fast-datapath repositories are not available on the host, the build fails.

  2. Rebuild your local bootc image by running the following image build command:

    PULL_SECRET=~/.pull-secret.json
    USER_PASSWD=<your_redhat_user_password>
    IMAGE_NAME=microshift-4.18-bootc
    
    sudo podman build --authfile "${PULL_SECRET}" -t "${IMAGE_NAME}" \
        --build-arg USER_PASSWD="${USER_PASSWD}" \
        -f Containerfile
    Note

    Secrets are used during the image build in the following ways:

    • The podman --authfile argument is required to pull the base rhel-bootc:9.4 image from the registry.redhat.io registry.

    • The build USER_PASSWD argument is used to set a password for the redhat user.

Verification
  • Verify that the local bootc image was created by running the following command:

    $ sudo podman images "${IMAGE_NAME}"
    Example output
    REPOSITORY                       TAG         IMAGE ID      CREATED        SIZE
    localhost/microshift-4.18-bootc  latest      193425283c00  2 minutes ago  2.31 GB