### Wrapped dnf install Command Output Source: https://github.com/coreos/rpm-ostree/blob/main/docs/cliwrap.md Example output when attempting to use dnf install on an image-based system. ```text [root@cosa-devsh ~]# dnf install foo Note: This system is image (rpm-ostree) based. Before installing packages to the host root filesystem, consider other options: - `toolbox`: For command-line development and debugging tools in a privileged container - `podman`: General purpose containers - `docker`: General purpose containers - `rpm-ostree install`: Install RPM packages layered on the host root filesystem. Consider these "operating system extensions". Add `--apply-live` to immediately start using the layered packages. error: not implemented ``` -------------------------------- ### Start Fedora CoreOS VM with Ignition Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Use virt-install to launch a Fedora CoreOS VM with a specified Ignition configuration for automatic setup. Ensure the Ignition config file and disk image are accessible. ```bash $ virt-install --name=fcos --vcpus=2 --ram=2048 --os-variant=fedora-coreos-stable \ --import --network=bridge=virbr0 --graphics=none \ --qemu-commandline="-fw_cfg name=opt.com.coreos/config,file=${PWD}/autologin.ign" \ --disk=size=20,backing_store=${PWD}/fedora-coreos.qcow2 ``` -------------------------------- ### Install packages with rpm Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md You can also use the `rpm` command directly to install packages, for example, by providing a URL to an RPM file. ```bash rpm -Uvh https://mirror.example.com/iptables-1.2.3.rpm ``` -------------------------------- ### Install and run composecheck tests Source: https://github.com/coreos/rpm-ostree/blob/main/tests/README.md Builds and installs the project before invoking the compose test script. ```bash make && sudo make install ``` ```bash ./tests/compose ``` -------------------------------- ### Sync with custom installation tree Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md Use the SKIP_INSTALL flag to sync binaries from a previously prepared installation tree. ```sh $ make vmsync SKIP_INSTALL=1 $ make vmoverlay SKIP_INSTALL=1 ``` -------------------------------- ### Verify installed packages and configuration Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Check package installation details and verify configuration file integrity. ```bash [core@tutorial ~]$ rpm -qi cachefilesd ``` ```bash [core@tutorial ~]$ cat /etc/cachefilesd.conf ``` -------------------------------- ### Clone and Navigate to Example Repository Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Clone the `fcos-derivation-example` repository and change into its directory to prepare for building a custom image. ```bash $ git clone git@github.com:coreos/fcos-derivation-example.git && cd fcos-derivation-example ``` -------------------------------- ### Install RPMs and run post-processing scripts Source: https://github.com/coreos/rpm-ostree/blob/main/docs/compose-server.md Use `rpm-ostree compose install` for a granular approach to image composition. This command installs RPMs, executes specified post-processing scripts from the treefile, and places the result in a target directory. A cache directory and repository should also be specified. ```bash # rpm-ostree compose install --unified-core --cachedir=cache --repo=./build-repo /path/to/manifest.yaml ./sysroot ``` -------------------------------- ### Install custom ostree version Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md Build and install a custom version of ostree into a local installation tree for testing. ```sh $ # from the rpm-ostree build dir $ INSTTREE=$PWD/insttree $ rm -rf $INSTTREE $ # from the ostree build dir $ make $ make install DESTDIR=$INSTTREE $ # from the rpm-ostree build dir $ make $ make install DESTDIR=$INSTTREE ``` -------------------------------- ### Wrapped grubby Command Output Source: https://github.com/coreos/rpm-ostree/blob/main/docs/cliwrap.md Example output when executing the wrapped grubby command. ```text [root@cosa-devsh ~]# grubby This system is rpm-ostree based; grubby is not used. Use `rpm-ostree kargs` instead. ``` -------------------------------- ### Example Treefile with Packages Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Demonstrates the structure of a treefile including package specifications, with support for version constraints and whitespace splitting. ```yaml packages: - ca-certificates - efitools pesign sbsigntools - "'podman >= 4.1'" - kernel-6.9.11-100.fc39 ``` -------------------------------- ### Build a container image Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Example Dockerfile and build command to create a container image for later import into an ostree repository. ```bash $ cat Dockerfile FROM quay.io/fedora/fedora-bootc:41 RUN < ``` -------------------------------- ### Declarative package management with treefiles Source: https://github.com/coreos/rpm-ostree/blob/main/docs/ex-rebuild.md Create a YAML configuration file in the origin.d directory to define packages to install and remove, then trigger a system rebuild. ```bash $ mkdir -p /etc/rpm-ostree/origin.d $ cat > /etc/rpm-ostree/origin.d/mycustom.yaml <. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Optional features enabled: stack-trace=libdw stack-demangle m32-mpers mx32-mpers secontext ``` -------------------------------- ### Download Fedora CoreOS next stream image Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Fetches the latest 'next' stream QEMU image for Fedora CoreOS. Ensure `jq` is installed for JSON parsing. ```bash # This is the 'next' image we will be using. # Anything newer than this should work too. $ RELEASE_URL=$(curl https://builds.coreos.fedoraproject.org/streams/next.json | jq -r '.architectures.x86_64.artifacts.qemu.formats."qcow2.xz".disk.location') # Download the image. $ curl -o fedora-coreos.qcow2.xz "$RELEASE_URL" # Uncompress the qemu image. $ unxz fedora-coreos.qcow2.xz ``` -------------------------------- ### Verify cachefilesd Package Installation Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Use `rpm -qi` to confirm that the `cachefilesd` package is not installed on the system. ```bash [core@tutorial ~]$ rpm -qi cachefilesd package cachefilesd is not installed ``` -------------------------------- ### Configure Custom RPM Repository Source: https://github.com/coreos/rpm-ostree/blob/main/docs/ex-replace.md Download and install a repository configuration file into the system's yum directory. ```bash $ curl -s https://copr.fedorainfracloud.org/coprs/g/kernel-vanilla/mainline-wo-mergew/repo/fedora-rawhide/group_kernel-vanilla-mainline-wo-mergew-fedora-rawhide.repo | sudo tee /etc/yum.repos.d/kernel-vanilla-mainline-wo-mergew.repo ``` -------------------------------- ### Install package with forced file replacement Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Installs a package, allowing it to overwrite files from other packages. Useful for specific scenarios like kernel module updates without rebuilding. ```bash # rpm-ostree install --force-replacefiles ``` -------------------------------- ### Wrapped rpm Command Output Source: https://github.com/coreos/rpm-ostree/blob/main/docs/cliwrap.md Example output when executing the wrapped rpm command on an image-based system. ```text [root@cosa-devsh ~]# rpm -e toolbox rpm-ostree: Note: This system is image (rpm-ostree) based. rpm-ostree: Dropping privileges as `rpm` was executed with not "known safe" arguments. rpm-ostree: You may invoke the real `rpm` binary in `/usr/libexec/rpm-ostree/wrapped/rpm`. rpm-ostree: Continuing execution in 5 seconds. error: can't create transaction lock on /usr/share/rpm/.rpm.lock (Read-only file system) [root@cosa-devsh ~]# ``` -------------------------------- ### Wrapped dracut Command Output Source: https://github.com/coreos/rpm-ostree/blob/main/docs/cliwrap.md Example output when executing the wrapped dracut command. ```text [root@cosa-devsh ~]# dracut This system is rpm-ostree based; initramfs handling is integrated with the underlying ostree transaction mechanism. Use `rpm-ostree initramfs` to control client-side initramfs generation. ``` -------------------------------- ### Arch-Include Example Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Includes base architectures with specific treefiles. Each member maps a base architecture to a single string or array of strings for inclusion. Processed after general 'include'. ```yaml arch-include: x86_64: bootloader-x86_64.yaml s390x: - bootloader-s390x.yaml - tweaks-s390x.yaml ``` -------------------------------- ### Containerfile for rpm-ostree Build Environment Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Sets up a CentOS Stream 9 environment with necessary tools and repositories for building rpm-ostree. Includes updating packages, enabling CRB, adding custom repositories, installing rpm-build, and setting up the rustup toolchain. ```bash FROM centos:stream9 RUN dnf update -y RUN dnf install -y 'dnf-command(config-manager)' epel-release RUN dnf config-manager --set-enabled crb RUN dnf config-manager --add-repo https://buildlogs.centos.org/9-stream/automotive/aarch64/packages-main/ RUN dnf config-manager --add-repo https://buildlogs.centos.org/9-stream/autosd/aarch64/packages-main/ # Install rpm-build and create empty dir structure. RUN dnf install -y rpm-build RUN mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} # Install deps required for recent rpm-ostree RUN cd $HOME/rpmbuild/SPECS/ && curl -OL https://gitlab.com/redhat/centos-stream/rpms/rpm-ostree/-/raw/c9s/rpm-ostree.spec RUN cd $HOME/rpmbuild/SPECS && dnf builddep -y rpm-ostree.spec RUN cargo install cargo-vendor-filterer --version ^0.5 # Lets use the latest from community (see next curl rustup step). # Also avoids "cargo metadata: error: failed to run rustc to learn about target-specific information" RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ``` -------------------------------- ### Build and Test rpm-ostree with Kola Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md This sequence demonstrates the workflow for iterating on kola external tests. It includes building the project, generating a local FCOS VM, installing test suite components, and running a specific kola test. ```bash make # To build cosa build-fast # Generate a local FCOS VM sudo make -C tests/kolainst install # Run this only when you change the test suite kola run ext.rpm-ostree.destructive.container-image # Or any other test you want ``` -------------------------------- ### Replace RPM with local file Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Downloads a package locally and replaces the installed version with the local file. ```bash $ curl https://rpmfind.net/linux/fedora/linux/updates/testing/38/Everything/x86_64/Packages/p/podman-4.5.1-1.fc38.x86_64.rpm --output podman.rpm $ sudo rpm-ostree override replace ./podman.rpm ``` -------------------------------- ### Postprocess Script Example Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Specifies a script to be executed within the target tree context. The script is copied, run in a restricted chroot, and then deleted. Avoid unless necessary, as it bypasses RPM versioning. ```shell #!/bin/bash # Example postprocess script echo "Running postprocess script..." # Add your commands here ``` -------------------------------- ### Include Example Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Specifies paths to other treefiles for inheritance. Non-array values override parent values, while array values are concatenated. Supports single string or array of strings. ```yaml include: - manifests/kernel.yaml - manifests/bootupd.yaml ``` -------------------------------- ### Postprocess Inline Script Example Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md An inline variant of postprocess-script, defined as an array of strings. Useful for inheritance and ordering. Scripts in included manifests are executed before those in the main manifest. ```yaml postprocess: - echo foo ``` -------------------------------- ### Check cachefilesd Version Inside Container Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Execute `cachefilesd --version` within the running container to verify that `cachefilesd` has been correctly installed. ```bash $ cachefilesd --version ``` ```text cachefilesd version 0.10.10 ``` -------------------------------- ### Conditional Include Example Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Includes treefiles based on conditions involving variables. Supports multiple conditions that must all be met for inclusion. Operators include ==, !=, <, <=, >, >=. ```yaml conditional-include: - if: - "os.version == 22" - "arch == x86_64" include: "base-x86_64.yaml" ``` -------------------------------- ### Add Commit Metadata Example Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Inject custom metadata into composed commits. Keys can be overridden via the command line. Supports variable substitution for string values. ```yaml add-commit-metadata: cool-os.is-production: false cool-os.git-snapshot: "${git_snapshot}" ``` -------------------------------- ### Set automatic version prefix with date and variable substitution Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Use `automatic-version-prefix` with a date format and variable substitution to dynamically set commit versions. This example uses the `${releasever}` variable and a daily date format. ```yaml automatic-version-prefix: "${releasever}..dev" ``` -------------------------------- ### Spawn VM and sync build Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md Use the helper script to spawn a QEMU image and sync the current build into the VM. ```sh export COSA_DIR=/path/to/cosa/workdir tests/vm.sh spawn make vmsync ``` -------------------------------- ### Replace kernel packages Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Overrides the kernel by replacing the entire set of installed kernel-related RPMs. ```bash $ ls -al kernel*.rpm -rw-r--r--. 1 root root 8085596 Jan 27 22:02 kernel-4.18.0-123.el8.x86_64.rpm -rw-r--r--. 1 root root 40709632 Jan 27 22:02 kernel-core-4.18.0-123.el8.x86_64.rpm -rw-r--r--. 1 root root 32533504 Jan 27 22:02 kernel-modules-4.18.0-123.el8.x86_64.rpm -rw-r--r--. 1 root root 8790996 Jan 27 22:02 kernel-modules-extra-4.18.0-123.el8.x86_64.rpm $ rpm-ostree override replace ./kernel*.rpm ``` -------------------------------- ### Verify Automatic Login and Hostname Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md After the VM boots, observe the console output to confirm automatic login and check the hostname, which should reflect the applied configuration. ```text [ OK ] Started rpm-ostree System Management Daemon. Fedora CoreOS 32.20200715.3.0 Kernel 5.7.8-200.fc32.x86_64 on an x86_64 (ttyS0) SSH host key: SHA256:XlbayjbgDKNoAAHQxsEL5Q7BdwLxxWSw4NXN9SALLmo (ED25519) SSH host key: SHA256:3sx5jseteO4BvdOMWIi0J4koQL015mLonnD0UPTtnZk (ECDSA) SSH host key: SHA256:K0fn5/TMJOoMs7Fu7RRkE7IBEf2t8OYCfVaVc+GJWGs (RSA) ens2: 192.168.122.127 fe80::5054:ff:feb9:3d97 Ignition: user provided config was applied No ssh authorized keys provided by Ignition or Afterburn tutorial login: core (automatic login) [core@tutorial ~]$ ``` -------------------------------- ### Clone the autosd repository Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Initializes the project environment by cloning the sample-images repository. ```bash git clone https://gitlab.com/CentOS/automotive/sample-images && cd sample-images ``` -------------------------------- ### Add cachefilesd to Dockerfile Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Modify the `Dockerfile` to include `cachefilesd` in the `rpm-ostree install` command, alongside `strace`. ```dockerfile RUN rpm-ostree install strace cachefilesd && rpm-ostree cleanup -m ``` -------------------------------- ### Rebase to a container image Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Use this command to switch your system to boot from a container image. This operation rebases the system to the specified container image from a registry. ```bash $ rpm-ostree rebase ostree-unverified-registry:quay.io/fedora/fedora-coreos:stable ``` -------------------------------- ### Replace RPM with remote URL Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Replaces an installed RPM package with a specific version from a remote HTTP URL. ```bash $ sudo rpm-ostree override replace https://kojipkgs.fedoraproject.org//packages/podman/3.3.1/1.fc34/x86_64/podman-3.3.1-1.fc34.x86_64.rpm ``` -------------------------------- ### Initialize Git Submodules and Build rpm-ostree Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md This sequence of commands initializes git submodules, configures the build using autotools, and then compiles the rpm-ostree project. Ensure the repository is cloned before running. ```bash $ git submodule update --init $ ./autogen.sh --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc $ make ``` -------------------------------- ### Run rpm-ostree Unit Tests Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md Execute the project's unit tests using the 'make check' command. This is a standard way to verify the correctness of the code. ```bash $ make check ``` -------------------------------- ### Generate the autosd image Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Executes the build process for the qcow2 image using the initoverlayfs target. ```bash pushd osbuild-manifests sudo make cs9-qemu-initoverlayfs-ostree.x86_64.qcow2 popd ``` -------------------------------- ### Set automatic version prefix Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Use `automatic-version-prefix` to set a static prefix for commit versions. This example sets the prefix to "22.0". ```yaml automatic-version-prefix: "22.0" ``` -------------------------------- ### Create a local RPM repository Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Generates repository metadata for the local RPM build directory. ```bash pushd ~/rpmbuild/RPMS createrepo . popd ``` -------------------------------- ### Live-apply package additions with rpm-ostree Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Applies package additions to the running system immediately, provided there are no other pending changes. Use with caution. ```bash # rpm-ostree install -yA ``` -------------------------------- ### Apply image configuration Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Use the --image-config flag to apply a JSON configuration file during image composition. ```bash rpm-ostree compose image --initialize --format=ociarchive --image-config=config.json manifest.yaml image.ociarchive ``` -------------------------------- ### Build OCI image from root filesystem tree Source: https://github.com/coreos/rpm-ostree/blob/main/docs/build-chunked-oci.md This command builds a chunked OCI image from a source root filesystem tree. First, create the rootfs using `rpm-ostree compose rootfs`, then use `build-chunked-oci` with the `--rootfs` option. The output can be directed to `containers-storage` or `oci`. ```bash # assumes package system configuration in /repos rpm-ostree compose rootfs --source-root=/repos /path/to/input_manifest.yml /path/to/target_rootfs rpm-ostree compose build-chunked-oci --bootc --format-version=1 --rootfs=/path/to/target_rootfs \ --output containers-storage:quay.io/exampleos/exampleos:latest podman push quay.io/exampleos/exampleos:latest ``` -------------------------------- ### Perform an offline rpm-ostree system upgrade Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Prepares a system upgrade by creating a new deployment, which is finalized at shutdown. A reboot is required to apply the update. ```bash # rpm-ostree upgrade ``` -------------------------------- ### Run additional post-processing on sysroot Source: https://github.com/coreos/rpm-ostree/blob/main/docs/compose-server.md After `rpm-ostree compose install`, you can manually modify files under the sysroot's rootfs. Then, run `rpm-ostree compose postprocess` to apply any remaining post-processing steps defined in the manifest. ```bash # rpm-ostree compose postprocess ./sysroot/rootfs /path/to/manifest.yaml ``` -------------------------------- ### Enable Testing Repository with sed Source: https://github.com/coreos/rpm-ostree/blob/main/docs/ex-replace.md Use this command to enable a testing repository by modifying the repository configuration file. It targets the first occurrence of 'enabled=0' and replaces it with 'enabled=1'. ```bash sudo sed -i '0,/enabled=0/s//enabled=1/' /etc/yum.repos.d/fedora-updates-testing.repo ``` -------------------------------- ### Build Custom FCOS Image with Podman Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Use Podman to build an OCI image from the modified `Dockerfile`. The image will be tagged as `localhost/my-custom-fcos`. ```bash $ podman build -t localhost/my-custom-fcos . ``` -------------------------------- ### Build OCI image from container image Source: https://github.com/coreos/rpm-ostree/blob/main/docs/build-chunked-oci.md Use this command to build a chunked OCI image from an existing container image. Ensure the input image is already fetched into a `containers-storage` instance. The output can be directed to `containers-storage` or `oci`. ```bash podman build -t quay.io/exampleos/exampleos:build ... ... rpm-ostree compose build-chunked-oci --bootc --format-version=1 \ --from=quay.io/exampleos/exampleos:build --output containers-storage:quay.io/exampleos/exampleos:latest podman push quay.io/exampleos/exampleos:latest ``` -------------------------------- ### Push OCI image to registry Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Authenticate with the container registry and push the local image. ```bash $ podman login quay.io ``` ```bash $ podman push localhost/my-custom-fcos quay.io//my-custom-fcos ``` -------------------------------- ### Rebase Fedora CoreOS to custom image Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Stop the Zincati service to prevent auto-updates and perform the system rebase. ```bash [core@tutorial ~]$ sudo systemctl stop zincati.service ``` ```bash [core@tutorial ~]$ sudo rpm-ostree rebase \ ostree-unverified-registry:quay.io//my-custom-fcos ``` -------------------------------- ### Run fcos-buildroot Container Interactively Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md Use this command to work interactively inside the fcos-buildroot container. Ensure you run it from the project's root directory. This mounts your current directory into the container. ```bash # IMPORTANT: Run this command from the projects root directory! $ podman run --rm -it -v "$PWD:$PWD:z" -w "$PWD" \ quay.io/coreos-assembler/fcos-buildroot:testing-devel ``` -------------------------------- ### Check rpm-ostree system status Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Displays current deployments and the default boot entry. The '●' indicates the currently booted deployment. ```bash # rpm-ostree status ``` -------------------------------- ### Apply overrides live Source: https://github.com/coreos/rpm-ostree/blob/main/docs/administrator-handbook.md Applies staged override changes to the live system or reverts to the booted tree. ```bash $ rpm-ostree apply-live --allow-replacement ``` -------------------------------- ### Set SELinux label for Ignition config Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Applies the correct SELinux label (`svirt_home_t`) to the Ignition configuration file to ensure it can be accessed by the virtual machine. This is necessary when using `virt-install` with libvirt. ```bash # Setup the correct SELinux label to allow access to the config $ chcon --verbose --type svirt_home_t autologin.ign ``` -------------------------------- ### Check cachefilesd Configuration Source: https://github.com/coreos/rpm-ostree/blob/main/docs/layering.md Inspect the contents of the `/etc/cachefilesd.conf` file to verify the cache configuration settings have been applied. ```bash [core@tutorial ~]$ cat /etc/cachefilesd.conf dir /var/cache/fscache tag mycache brun 8% bcull 6% bstop 2% frun 9% fcull 5% fstop 4% secctx system_u:system_r:cachefiles_kernel_t:s0 ``` -------------------------------- ### View manifest configuration changes Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Displays the required diff for adding the extra repository to the manifest. ```diff diff --git a/osbuild-manifests/distro/cs9.ipp.yml b/osbuild-manifests/distro/cs9.ipp.yml index c2e3abc..1564c9d 100644 --- a/osbuild-manifests/distro/cs9.ipp.yml +++ b/osbuild-manifests/distro/cs9.ipp.yml @@ -15,6 +15,8 @@ mpp-vars: baseurl: https://mirror.stream.centos.org/SIGs/9-stream/autosd/$arch/packages-main/ - id: next baseurl: https://download.copr.fedorainfracloud.org/results/@centos-automotive-sig/next/epel-9-$arch/ + - id: extra + baseurl: file:///root/rpmbuild/RPMS/ distro_devel_repos: - id: crb baseurl: $distro_baseurl/CRB/$arch/os/ ``` -------------------------------- ### rpm-ostree Configuration Schema Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Configuration parameters for defining the build manifest in rpm-ostree. ```APIDOC ## Configuration Schema ### Description Defines the structure and options for the rpm-ostree build manifest. ### Parameters - **repo-packages** (Array of objects) - Optional - Set of packages to install from specific repos. - **packages** (Array of strings) - Required - List of packages to install. - **repo** (String) - Required - Name of the repo. - **ostree-layers** (Array of strings) - Optional - OSTree refs to check out after package installation. - **ostree-override-layers** (Array of strings) - Optional - OSTree refs that override files in packages and prior layers. - **container-cmd** (Array of strings) - Optional - Maps to the CMD Dockerfile instruction. - **recommends** (Boolean) - Optional - Install Recommends, defaults to true. - **units** (Array of strings) - Optional - Systemd units to enable. - **default-target** (String) - Optional - Set the default systemd target. - **rpmdb** (String) - Optional - RPM database backend (target or host). - **rpmdb-normalize** (Boolean) - Optional - Deterministic RPM database result. - **selinux-label-version** (Integer) - Optional - Set to 1 to label /usr/etc as /etc. - **readonly-executables** (Boolean) - Optional - Remove write bit from all executables. - **remove-files** (Array of strings) - Optional - Files to delete from the generated tree. - **remove-from-packages** (Array) - Optional - Delete files matching regex from specified packages. ### Request Example { "repo-packages": [{"packages": ["vim"], "repo": "fedora"}], "recommends": false, "units": ["sshd.service"], "remove-from-packages": [["cpio", "/usr/share/.*"]] } ``` -------------------------------- ### Move /opt files during build Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Use this pattern in a Dockerfile to relocate files from /opt to /var/opt and create a symlink for compatibility. ```dockerfile FROM quay.io/fedora/fedora-coreos:testing-devel RUN mkdir /var/opt && \ rpm -Uvh https://downloads.linux.hpe.com/repo/stk/rhel/7/x86_64/current/hp-scripting-tools-11.60-20.rhel7.x86_64.rpm && \ mv /var/opt/hp/ /usr/lib/hp && \ echo 'L /opt/hp - - - - ../../usr/lib/hp' > /usr/lib/tmpfiles.d/hp.conf && \ ostree container commit ``` -------------------------------- ### Enable cliwrap at Build Time Source: https://github.com/coreos/rpm-ostree/blob/main/docs/cliwrap.md Set this configuration in the treefile to enable cliwrap during the build process. ```yaml cliwrap: true ``` -------------------------------- ### Run rpm-ostree Development Container Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Executes the built container, mounting the host's rpmbuild directory to persist generated RPMs. This allows interactive access to the build environment. ```bash sudo podman run --rm --security-opt label=disable -v /home/$USER/rpmbuild/:/home/$USER/rpmbuild/ -ti rpmostreedevel /bin/bash ``` -------------------------------- ### Create buildroot Alias for Container Usage Source: https://github.com/coreos/rpm-ostree/blob/main/HACKING.md Create a 'buildroot' alias to use the fcos-buildroot container for commands like 'make'. This simplifies running build commands within the container environment. Remember to run this from the project's root directory. ```bash # IMPORTANT: Run this command from the projects root directory! $ alias buildroot="podman run --rm -it -v \"$PWD:$PWD:z\" -w \"$PWD\" \ quay.io/coreos-assembler/fcos-buildroot:testing-devel" # These commands run in the container now $ buildroot make ... ``` -------------------------------- ### Import container image to ostree repository Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Commands to pull a container image into a bare-user ostree repository and identify the resulting commit. ```bash $ ostree container image pull /path/to/repo ostree-unverified-registry:quay.io/exampleos/exampleos:latest # Find the branch/ref for the container $ imgref=$(ostree --repo=/path/to/repo refs ostree/container/image) # Find its commit $ commit=$(ostree --repo=/path/to/repo rev-parse ostree/container/image/$imgref) ``` -------------------------------- ### Define extensions in extensions.yaml Source: https://github.com/coreos/rpm-ostree/blob/main/docs/extensions.md Configuration file format for specifying OS extensions and development packages to be downloaded during the compose process. ```yaml # Any additional repos to enable on top of treefile repos repos: - myrepo # The top-level object is a dict. The only supported key # right now is `extensions`, which is a dict of extension # names to extension objects. extensions: # This can be whatever name you'd like. The name itself # isn't used by rpm-ostree. sooper-dooper-tracers: # Optional; defaults to `os-extension`. An OS extension # is an extension intended to be `rpm-ostree install`ed. kind: os-extension # List of packages for this extension packages: - strace - ltrace # Optional additional repos (still added globally). # The reason use per-extension `repos` and `modules` # is that it more closely groups them (where relevant) # and further these are only added after architecture conditionals # apply, so one can use repositories that only exist # on a particular architecture. repos: - sooper-repo # Optional list of architectures on which this extension # is valid. These are RPM basearches. If omitted, # defaults to all architectures. architectures: - x86_64 - aarch64 kernel-dev: # A development extension lists packages useful for # developing for the target OSTree, but won't be layered # on top. A common example is kernel modules. No # depsolving happens, packages listed are downloaded. kind: development packages: - kernel-devel - kernel-headers # Optional name of a base package used to constrain the # EVR of all the packages in this extension. match-base-evr: kernel ``` -------------------------------- ### Compose base images Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Generate base images from treefiles using different formats. ```bash $ rpm-ostree compose image --initialize-mode=if-not-exists --format=ociarchive \ workstation-ostree-config/fedora-silverblue.yaml fedora-silverblue.ociarchive ``` ```bash $ rpm-ostree compose image --initialize-mode=if-not-exists --format=registry \ workstation-ostree-config/fedora-silverblue.yaml quay.io/example/exampleos:latest ``` -------------------------------- ### Clone and Prepare rpm-ostree Fork Source: https://github.com/coreos/rpm-ostree/blob/main/docs/building-rpm-ostree-and-autosd.md Clones a forked rpm-ostree repository and checks out a specific branch for development. Initializes necessary submodules required for the build process. ```bash cd /tmp git clone https://github.com/dougsland/rpm-ostree.git && cd rpm-ostree git checkout remotes/origin/initoverlayfs -b initoverlayfs ``` ```bash git submodule update --init ``` -------------------------------- ### Variable Substitution in Mutate OS Release Source: https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md Illustrates variable substitution for the 'mutate-os-release' field to customize OS release information. ```yaml mutate-os-release: "${releasever}" ``` -------------------------------- ### Enable or Disable cliwrap on a Client System Source: https://github.com/coreos/rpm-ostree/blob/main/docs/cliwrap.md Use these commands to toggle the cliwrap feature on an existing system. ```bash $ rpm-ostree deploy --ex-cliwrap=true ``` ```bash $ rpm-ostree deploy --ex-cliwrap=false ``` -------------------------------- ### Configure OCI image metadata Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Define environment variables, commands, and labels for OCI images using a JSON configuration file. ```json { "Env": [ "FOO=BAR" ], "Cmd": [ "/bin/bash" ], "Labels": { "license": "MIT" } } ``` -------------------------------- ### Polkit Policy for rpm-ostree Source: https://github.com/coreos/rpm-ostree/blob/main/docs/architecture-daemon.md This is a base Polkit policy file for rpm-ostree. It defines the actions that can be authorized, allowing unprivileged users to perform system mutations when properly configured. ```polkit polkit.addRule(function(action, subject) { if (action.id.indexOf("org.projectatomic.rpmostree1.") == 0 && subject.isInGroup("wheel")) { return polkit.Result.YES; } }); ``` -------------------------------- ### Generate chunked images Source: https://github.com/coreos/rpm-ostree/blob/main/docs/container.md Create efficient, multi-layer container images to optimize download sizes. ```bash $ rpm-ostree compose container-encapsulate --repo=/path/to/repo fedora/35/x86_64/silverblue \ docker://quay.io/myuser/fedora-silverblue:35 ```