Skip to content

Fix/config create early checks - #1214

Open
cmainas wants to merge 2 commits into
mainfrom
fix/config_create_early_checks
Open

cmainas wants to merge 2 commits into
mainfrom
fix/config_create_early_checks

Conversation

@cmainas

@cmainas cmainas commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Description

urunc create used to accept a broken configuration file. When toml.DecodeFile failed, LoadUruncConfig returned the default configuration and create ignored the error. So a single syntax error silently replaced every field of the file, including runtime.libcontainer and the monitor paths. A path field with a relative or invalid filepath, like /opt/urunc/bin/qemu-system-x86_64/, also passed, and failed only when urunc started the monitor.

The first commit makes LoadUruncConfig strict:

  • urunc create fails when the file can not be read or decoded. Only a missing file still means the default configuration.
  • The path and socket_path of every monitor and the path of virtiofsd must be absolute and clean. urunc uses each of them at the same place in the monitor rootfs, where a relative path has no meaning. The check covers every monitor in the file, and a single error names every monitor with an invalid path.
  • urunc-deploy applies the same check to its path overrides before the installation changes the host. A bad override then stops the installation, instead of breaking every create on the node.

The logs and the timestamps still fall back to the defaults, so the error still reaches the log.

A bad configuration must also fail before urunc performs changes that affect the host (e.g. block dev unmount). But InitialSetup collected the resources of the monitor after preSetup, which for a block rootfs copies the file mounts, moves the boot files and unmounts the rootfs. A failure there, e.g. on a host without /dev/kvm, left the device unmounted, and Delete has no state to restore before InitialSetup finishes. So the second commit collects the resources before preSetup. Only the block devices are still collected after preSetup, since preSetup copies file mounts, which might live in a block volume. If finding their device nodes fails, getBlockResources mounts the block volumes back.

The PR adds only cheap checks at create, with no new runtime work. No reason to handle unknown fields in the config file, since it is harmless. A missing file still means the defaults, also when URUNC_CONFIG_FILE names the file. urunc does not need to be exhaustive with the config file. We can think of ways to let a user know that a config is valid.

Also, this is a partial fix for #859 in the case the device nodes are not found. A later failure in InitialSetup, e.g. while saving the state, still leaves the block volumes unmounted. This will be handled later.

At last, data_path is not checked. urunc joins data_path with qemu and seabios on the host and mounts the two directories at fixed places in the monitor rootfs, so data_path itself never appears in the monitor rootfs.

Related issues

How was this tested?

With e2e tests

LLM usage

Opus 5.5

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

urunc create now fails when urunc's configuration file can not be read
or decoded. Only a missing file still means the default configuration.
So the defaults never replace the fields of an existing file.
ParseLogMetricsConfig still falls back to the defaults for the logs and
the timestamps, and its warning now says so.

LoadUruncConfig also checks the path fields: the path and socket_path
of every monitor and the path of virtiofsd. urunc uses each configured
path at the same place in the monitor rootfs, where a relative path has
no meaning. Each path must also be clean. So a value with a trailing
"/", like /opt/urunc/bin/qemu-system-x86_64/, fails when the
configuration loads, not when urunc starts the monitor. LoadUruncConfig
collects the errors of all the fields, so one error lists every invalid
path.

The check covers every monitor, even one no container uses. So a bad
value fails every urunc create, also for the containers urunc hands to
runc. A relative socket_path, which used to work, is now rejected too.

urunc-deploy checks its path and socket_path overrides the same way,
before the installation changes the host. A bad override then stops the
installation, instead of breaking every create on the node. The
configuration page and the k8s tutorial describe the new checks.

Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
InitialSetup collected the resources of the monitor after preSetup,
which changes the host. For a block rootfs, it copies the file mounts of
the container into the rootfs and unmounts it. If collecting the
resources then failed, e.g. on a host without /dev/kvm, create failed
with the host already changed. Nothing restored it, since Delete has no
state to work with before InitialSetup finishes.

Collect them before preSetup. Only the block devices are still collected
after it, since preSetup copies the file mounts of the container, which
might be in a block volume, and getBlockDevs unmounts the block volumes.
If finding their device nodes then fails, mount the volumes back.

Signed-off-by: Charalampos Mainas <charalampos.mainas@gmail.com>
@netlify

netlify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for urunc ready!

Name Link
🔨 Latest commit fe9744b
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6aff14fddacef05bebc07f6d
😎 Deploy Preview https://deploy-preview-1214--urunc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cmainas
cmainas marked this pull request as ready for review November 19, 2026 15:40
@cmainas
cmainas requested a review from ananos November 19, 2026 15:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant