LinuxCommandLibrary

bootc-switch

Switch bootable bootc operating system deployments

TLDR

Change the base OS to a new container image from a registry

$ sudo bootc switch [image]
copy

Change the base OS to a new container image from the local image storage of the root user
$ sudo bootc switch --transport containers-storage [image]
copy

Change the base OS to a new container image stored in a tarball
$ sudo bootc switch --transport oci-archive [path/to/image.tar.gz]
copy

SYNOPSIS

bootc switch [OPTIONS] IMAGE

PARAMETERS

IMAGE
    The container image to switch to, specified as a container image reference (e.g., quay.io/example/os:latest). This image should already be present on the system via bootc pull.

--reboot
    Automatically reboot the system after switching to the new image.

--now
    Same as --reboot.

--help
    Display help information.

--version
    Display version information.

DESCRIPTION

The bootc-switch command allows you to switch the booted system to a different container image. It facilitates transitioning between OS updates, experimental images, or reverting to a previous working state. It operates by updating the bootloader configuration to point to the desired container image, which must already be available in the container storage. This command is crucial for managing A/B style updates and performing rollbacks in a containerized Linux environment. It integrates tightly with the bootc tooling and requires a properly configured bootc system. The typical workflow involves using `bootc pull` to obtain a new container image, followed by `bootc switch` to make that image the active boot target. After switching, a reboot is necessary for the changes to take effect.

The command requires root privileges and careful consideration to avoid disrupting system stability. Proper use of `bootc status` to verify system state before and after using `bootc switch` is recommended.

CAVEATS

A reboot is required for the switch to take effect. Ensure the specified image is valid and bootable before switching. Switching to a broken image can render the system unbootable. Always have a fallback mechanism in place.

EXAMPLE

To switch to a new image and reboot:
bootc switch quay.io/myrepo/myimage:latest --reboot

TROUBLESHOOTING

If the system fails to boot after switching, try booting into a previous kernel via the bootloader menu (GRUB, systemd-boot). Use `bootc status` from the recovery environment to check the configured boot image.

SEE ALSO

bootc(1), bootc-pull(1), bootc-status(1)

Copied to clipboard