LinuxCommandLibrary

ostree

Manage bootable, immutable operating system images

TLDR

Initialize a repository of the files in $PWD with metadata in $PWD/path/to/repo

$ ostree init --repo [path/to/repo]
copy

Create a commit (snapshot) of the files
$ ostree commit --repo [path/to/repo] --branch [branch_name]
copy

Show files in commit
$ ostree ls --repo [path/to/repo] [commit_id]
copy

Show metadata of commit
$ ostree show --repo [path/to/repo] [commit_id]
copy

Show list of commits
$ ostree log --repo [path/to/repo] [branch_name]
copy

Show repo summary
$ ostree summary --repo [path/to/repo] --view
copy

Show available refs (branches)
$ ostree refs --repo [path/to/repo]
copy

SYNOPSIS

ostree [OPTIONS...] COMMAND [ARGS...]

Common COMMANDS include:
status
pull
deploy
rollback
commit
ref
admin

PARAMETERS

--repo=PATH
    Specifies the path to the ostree repository. If not specified, it defaults to the system repository (e.g., /ostree/repo) or the current working directory for administrative commands.

--sysroot=PATH
    Specifies the path to the system root directory for operations, typically /sysroot in immutable OS setups.

--version
    Displays the ostree version information.

--help
    Shows help message for the main command or a specific subcommand (e.g., ostree deploy --help).

--variant=NAME
    Selects a specific repository variant when multiple are configured. Useful in complex multi-repository setups.

COMMAND
    A specific operation to perform (e.g., deploy, pull, status). Each command has its own set of arguments and options.

DESCRIPTION

ostree is a system for atomic filesystem upgrades and deployments. It operates on a Git-like model, managing bootable operating system trees as a series of commits in a content-addressed object store. This allows for transactional updates, meaning an upgrade either fully succeeds or the system remains in its previous state, preventing partial or broken updates.

It's foundational for immutable operating systems, ensuring consistency, reliability, and easy rollbacks. Instead of individual package updates, ostree deploys entire, tested filesystem trees, making it ideal for large-scale deployments, IoT devices, and container hosts where stability and predictable behavior are paramount.

Key features include atomic upgrades and rollbacks, deduplication of filesystem content, and support for parallel installations of different OS versions or configurations. It integrates with system bootloaders (like GRUB) to manage boot entries for different deployments.

CAVEATS

ostree is not a general package manager; it operates at the level of whole filesystem trees. While it enables layering (e.g., via rpm-ostree), it's not designed for granular package management in the way dnf or apt are. It typically requires specific system architecture and bootloader integration for its full benefits, making it less suitable for traditional mutable Linux distributions.

IMMUTABLE OPERATING SYSTEMS

ostree is a core technology behind modern immutable operating systems (e.g., Fedora CoreOS, Endless OS, RHEL for Edge). These systems separate the base OS from user data and applications, ensuring the core OS remains consistent and untampered, which greatly enhances security, reliability, and simplifies management.

ATOMIC UPDATES AND ROLLBACKS

One of ostree's most significant features is its ability to perform atomic updates. This means an update is either fully applied or entirely discarded, preventing systems from entering a half-updated or inconsistent state. If an update causes issues, a user can easily roll back to a previously known good state, enhancing system resilience.

CONTENT-ADDRESSABLE STORAGE

Similar to Git, ostree uses content-addressable storage. This means filesystem objects (files, directories) are stored based on their cryptographic hash. This allows for efficient deduplication of common files across different OS versions and deployments, saving disk space and speeding up transfers.

HISTORY

ostree originated as part of Project Atomic (later Fedora Atomic Host and RHEL Atomic Host), aiming to bring cloud-native development practices to operating systems. It was designed to provide robust, transactional updates and a foundation for container-centric immutable operating systems. Its development has been driven by the need for more reliable and maintainable system deployments, particularly in environments like edge computing, IoT, and large-scale server infrastructures.

SEE ALSO

git(1), rpm-ostree(1), systemctl(1), bootctl(1)

Copied to clipboard