8000 os-release (new): ship /etc/os-release in every box via base by jtnkminimal · Pull Request #1661 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

os-release (new): ship /etc/os-release in every box via base - #1661

Merged
bryan-minimal merged 4 commits into
mainfrom
base-os-release
Nov 26, 2026
Merged

bryan-minimal merged 4 commits into
mainfrom
base-os-release

Conversation

@jtnkminimal
@jtnkminimal jtnkminimal commented Nov 23, 2026 •
Copy link
Copy Markdown
Contributor

Summary

Boxes have no /etc/os-release, so tools that identify the distro refuse to run. The one that prompted this is Rex's installer: rex server install ssh://box exits with "cannot tell which Linux distribution this is". /etc is read-only and built from package outputs, so the file has to come from a package.

This adds an os-release package and puts it in base's runtime_deps, the same way #804 added tzdata.

Changes

  • New package packages/os-release: it ships the vendor file at usr/lib/os-release and etc/os-release as a relative symlink to it, the layout os-release(5) specifies:
    NAME="Minimal"
    ID=minimal
    PRETTY_NAME="Minimal"
    HOME_URL="https://minimal.dev"
    
    Build deps are bash-bootstrap and coreutils only. It must not depend on base, because base carries it at runtime and that would be a cycle.
  • A standalone test sources both paths and checks ID and NAME.
  • packages/base/build.ncl: import os-release and add it to runtime_deps.

Risks

  • Mass rebuild. Most packages import base, so this changes their inputs. fix(base): ship the IANA timezone database in every box #804 paid the same cost.
  • Builds that sniff the distro. fix(base): ship the IANA timezone database in every box #804 broke Tcl, whose configure noticed the new zoneinfo directory. /etc/os-release can trigger the same thing in configure scripts, Python platform/distro, and installers that branch on ID. Watch the rebuild for changed outputs.
  • Field choice. ID=minimal with no ID_LIKE, on purpose: claiming a parent distro would make tools reach for its package manager. VERSION_ID is optional and can be added later. No BUILD_ID either: the spec defines it as a unique image identifier, which rolling isn't.

Testing

  • min package patched-build os-release and min package patched-build base both succeeded locally, before this branch was rebased onto the current main. They have not been rerun since the rebase or since the move to /usr/lib/os-release + symlink; the new build.sh was only run by hand outside the sandbox.
  • Installed the built os-release into a session and confirmed /etc/os-release has the content above.
  • min check was not run locally: with base changed it evaluates and rebuilds most of the tree. Leaving it to the pipeline.
  • Not tested: a box with packages = ["base"] at this commit, and the Rex install end to end.

Checklist

  • I've read CONTRIBUTING.md.
  • I've accepted the ICLA (and CCLA if contributing on my employer's time). CLA Assistant will prompt me on this PR if I haven't already.
  • min check passes for the affected packages/harnesses.
  • min patched-build <name> succeeds for any package I added or modified.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added system identification information to the base environment, including the system name, ID, display name, and home page.
    • Made the identification information available through the standard system release files.

Generated by Claude Code

Boxes have no /etc/os-release, so tools that identify the distro refuse
to run (the Rex installer exits with "cannot tell which Linux
distribution this is"). /etc is read-only and built from package
outputs, so the file has to come from a package.

ID=minimal with no ID_LIKE, on purpose: claiming a parent distro would
make tools reach for its package manager.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jtnkminimal
jtnkminimal requested a review from a team as a code owner November 23, 2026 20:32
@coderabbitai
coderabbitai Bot commented Nov 23, 2026 •
Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: gominimal/pkgs
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 248d5e6
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: bfe182ce-bb7c-425d-b659-b6d3675653fb
Commits

Reviewing files that changed from the base of the PR and between 7879b4e and 0f52a9c.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The change adds an os-release package that writes and tests the Minimal distribution identity. The base package now includes os-release as a runtime dependency.

Changes: os-release package and base integration

Layer / File(s) Summary
Build and test os-release
packages/os-release/build.ncl, packages/os-release/build.sh
The build specification runs the script, declares two output paths, and checks the ID and NAME values. The script writes the Minimal distribution identity fields and links /etc/os-release to /usr/lib/os-release.
Add os-release to base
packages/base/build.ncl
The base build specification imports os-release and adds it to runtime dependencies.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: bryan-minimal, agent-137

Merge Risk: Minimal · previous review 4947d

This change adds distribution identity data to every box via base. No concrete defect was found, so the merge risk is minimal. Rebuild effects from distro detection by downstream tools were not exercised.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a new os-release package that ships /etc/os-release in every box through the base package. The raw summary confirms that base now depends on os-release and that the ne…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a new os-release package that ships /etc/os-release in every box through the base package. The raw summary confirms that base now depends on os-release and that the new package provides /usr/lib/os-release with a relative /etc/os-release symlink. The title is specific and matches the objectives, and it does not describe anything absent from the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: gominimal/pkgs
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 8ea3ce5
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: bf5c32b3-e766-46e2-90a8-42504ac2b344
Commits

Reviewing files that changed from the base of the PR and between 33979ad and 4947d96.

Files selected for processing: 2

  • packages/os-release/build.ncl
  • packages/os-release/build.sh

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

@bryan-minimal bryan 8000 -minimal left a comment •
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Three things to settle before we pay for the world rebuild:

  1. Rex end to end. Rex's installer is the reason for this PR, but it hasn't been tested against it yet. If Rex only accepts distro IDs it knows, ID=minimal could still fail with "unsupported distribution". Can you hand-place this exact file at /etc/os-release in a box (or a box with the built package installed) and run rex server install ssh://box? That would confirm the fields are enough before every package rebuilds.

  2. A simpler shape (your call). base already writes /etc/hosts from its own build.sh (packages/base/build.sh, outputs.hosts). os-release could be a few more lines there plus an os_release = { glob = "etc/os-release" } | OutputData output, with no new package and no runtime-dep/cycle note. The separate package has one advantage: a box that doesn't use base can opt in. Either is fine.

  3. BUILD_ID=rolling. Minimal has no version number, and os-release(5) suggests BUILD_ID for exactly that; Arch, also rolling, ships BUILD_ID=rolling with no VERSION_ID. Some installers look for VERSION_ID or BUILD_ID, so this one line costs nothing and saves a later rebuild. It's optional.

Checked and fine: #!/bin/sh with only bash-bootstrap (it ships usr/bin/sh), no attrs (same as base/toolchain), OutputData for an etc/ file, no other package ships an os-release, ID=minimal with no ID_LIKE, and the test.

@jtnkminimal
Copy link
Copy Markdown
Contributor Author

@msample - we should arch out 2 + 3 on this list before merging

@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
8000
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope matches the title. The diff adds one package with one output and one edge in base. It follows the tzdata change in #804 line for line.

Clobber none. git log on packages/base/build.ncl shows only the tzdata change before this one, and the diff keeps it.

Correctness The build deps give build.sh its sh, mkdir and cat. No dependency cycle exists, because the package uses bash-bootstrap and coreutils, as tzdata does. No other package declares etc/os-release, and no build.sh in the repo reads it. The file content is valid for os-release(5). One finding: the package declares no license_spdx.

Not checked The mass rebuild needs a build. An upstream configure script or installer can read /etc/os-release and change its output, as Tcl did with zoneinfo in #804. The PR body names this risk. I did not check the four packages with a broad etc/* glob for a new match, and I did not run the test.


outputs = {
os_release = { glob = "etc/os-release" } | OutputData,
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low · The package declares no license_spdx. The license lint (.github/scripts/license_lint.py) will report it as missing license_spdx, and the catalog will carry no license for a package that is in every box. The lint excuses only aggregate packages such as base and toolchain. packages/resolver-quad8/build.ncl, the same kind of config-only package, declares attrs = { license_spdx = "Apache-2.0" } | Attrs and cites LICENSING.md section 1. Add the same attribute here, and add Attrs to the import line. This is one instance: 583 of 591 packages declare the field.

@msample
msample commented Nov 25, 2026
Copy link
Copy Markdown
Member

Checked against os-release(5). One change I'd make before the rebuild: the spec puts the vendor file at /usr/lib/os-release and makes /etc/os-release a relative symlink to it. We ship a regular file in /etc only, so a tool that reads just /usr/lib/os-release finds nothing.

mkdir -p "$OUTPUT_DIR/usr/lib" "$OUTPUT_DIR/etc"
cat > "$OUTPUT_DIR/usr/lib/os-release" << "EOF"
NAME="Minimal"
ID=minimal
PRETTY_NAME="Minimal"
HOME_URL="https://minimal.dev"
EOF
ln -s ../usr/lib/os-release "$OUTPUT_DIR/etc/os-release"

with a second output, { glob = "usr/lib/os-release" } | OutputData.

On item 3, I'd skip BUILD_ID=rolling. The spec defines BUILD_ID as a unique identifier for the image originally installed (its example is 2013-03-20.3), which rolling isn't, and it says rolling releases may leave the version fields unset. Add it only if the Rex run shows something needs it.

Since any later edit to this file is another world rebuild: if we want DOCUMENTATION_URL, BUG_REPORT_URL, SUPPORT_URL, or VENDOR_NAME + VENDOR_URL, they should go in now.

@CLAassistant
CLAassistant commented Nov 25, 2026 •
Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…release

os-release(5) puts the vendor file at /usr/lib/os-release and makes
/etc/os-release a relative symlink to it. Shipping only a regular file in
/etc meant a tool reading just /usr/lib/os-release found nothing.

Adds a second output for the vendor file and extends the test to read both
paths. BUILD_ID stays out: the spec defines it as a unique image identifier,
which "rolling" isn't.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A31JRi4PcZ65P9Z1cn49Vr
@jtnkminimal
jtnkminimal added this pull request to the merge queue Nov 25, 2026
@bryan-minimal
bryan-minimal removed this pull request from the merge queue due to a manual request Nov 26, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 581dffe Nov 26, 2026
16 checks passed
@bryan-minimal
bryan-minimal deleted the base-os-release branch November 26, 2026 03:39
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.

5 participants

0