Skip to content

install: Skip mirroring /run/udev when the host has none - #112

Draft
cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-42361697751
Draft

cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-42361697751

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

Executive summary

bootc install to-filesystem fails on hosts without /run/udev, such as mdev-based hosts, because install always mirrors that path from the host. This makes only that mirror optional. If the host has no /run/udev, install logs at debug level and skips it without creating a local path. If the host has it, install creates a missing local mount point and compares filesystems and bind mounts as before. The other mirrors are still required. Errors other than not-found still propagate, and a path on a different filesystem still gets a bind mount. The blockdev code already falls back to blkid when there is no udev database.

This replaces #101 and so also supersedes #97 and #72. It is #101's patch refreshed onto current main. The required and optional mirrors now share one implementation (plan_mirror/ensure_mirror with an optional flag), which answers #101's review comment about duplicated helpers. The data-driven tests now cover both modes for every combination of the path existing locally and on the host. They also check that nothing is created when the host path is missing, that ELOOP propagates, and how host paths are mapped. None of them need privileged mounts.

While here, this replaces the remaining str::len calls that clippy.toml disallows with as_bytes().len(), which counts the same bytes. They are in crates/ostree-ext/src/fixture.rs (from #101), crates/ostree-ext/tests/it/main.rs and crates/lib/src/deploy.rs. These were meant to be a separate prep commit, but this handback produces a single patch, so they can be split out when promoting.

Verification

I ran this on Ubuntu 26.04 with Rust, rustfmt and clippy 1.94.1 from rustup, plus the ostree 2025.7 CLI. Podman cannot start containers in this sandbox, so the earlier Fedora 44 environment was not available. cargo fmt --check exited 0 and cargo clippy --all-targets exited 0 (on base 0ca885f it exits 101 at fixture.rs:274). Acceptance is incomplete: cargo test --no-fail-fast exited 101, with 542 passed, 1 failed and 4 ignored. The failure is bootc-internal-utils command::tests::command_run_capture_stderr, which fails the same way on base 0ca885f in this environment. Here /bin/sh is dash, and its echo -e handling differs from the bash that test expects, and I could not swap the shell without root or user namespaces. Full installation on an mdev host was not run.

Review: one pass found no blockers. I applied its suggestions for a host_path test and clearer test panics. Still open: there is no integration test running install in a PID namespace without /run/udev. Also, install to-disk still runs udevadm settle unconditionally, so this fixes only to-filesystem and to-existing-root.

Part of #57
Part of cgwalters-forge/tracker#313; references bootc-dev#2239.

Generated by dispatch · ◷

## Executive summary

`bootc install to-filesystem` fails on hosts without `/run/udev`, such as mdev-based hosts, because install always mirrors that path from the host. This makes only that mirror optional. If the host has no `/run/udev`, install logs at debug level and skips it without creating a local path. If the host has it, install creates a missing local mount point and compares filesystems and bind mounts as before. The other mirrors are still required. Errors other than not-found still propagate, and a path on a different filesystem still gets a bind mount. The blockdev code already falls back to `blkid` when there is no udev database.

This replaces bootc-dev#101 and so also supersedes bootc-dev#97 and bootc-dev#72. It is bootc-dev#101's patch refreshed onto current main. The required and optional mirrors now share one implementation (`plan_mirror`/`ensure_mirror` with an `optional` flag), which answers bootc-dev#101's review comment about duplicated helpers. The data-driven tests now cover both modes for every combination of the path existing locally and on the host. They also check that nothing is created when the host path is missing, that ELOOP propagates, and how host paths are mapped. None of them need privileged mounts.

While here, this replaces the remaining `str::len` calls that clippy.toml disallows with `as_bytes().len()`, which counts the same bytes. They are in `crates/ostree-ext/src/fixture.rs` (from bootc-dev#101), `crates/ostree-ext/tests/it/main.rs` and `crates/lib/src/deploy.rs`. These were meant to be a separate prep commit, but this handback produces a single patch, so they can be split out when promoting.

## Verification

I ran this on Ubuntu 26.04 with Rust, rustfmt and clippy 1.94.1 from rustup, plus the ostree 2025.7 CLI. Podman cannot start containers in this sandbox, so the earlier Fedora 44 environment was not available. `cargo fmt --check` exited 0 and `cargo clippy --all-targets` exited 0 (on base 0ca885f it exits 101 at fixture.rs:274). **Acceptance is incomplete:** `cargo test --no-fail-fast` exited 101, with 542 passed, 1 failed and 4 ignored. The failure is `bootc-internal-utils` `command::tests::command_run_capture_stderr`, which fails the same way on base 0ca885f in this environment. Here `/bin/sh` is dash, and its `echo -e` handling differs from the bash that test expects, and I could not swap the shell without root or user namespaces. Full installation on an mdev host was not run.

Review: one pass found no blockers. I applied its suggestions for a `host_path` test and clearer test panics. Still open: there is no integration test running install in a PID namespace without `/run/udev`. Also, `install to-disk` still runs `udevadm settle` unconditionally, so this fixes only to-filesystem and to-existing-root.

Part of bootc-dev#57
Part of cgwalters-forge/tracker#313; references bootc-dev#2239.

Generated-by: https://github.com/cgwalters/#llms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant