Skip to content

kernel-cachyos-core %posttrans triggers grub2-mkconfig in non-grub / container / ostree environments #96

Description

@daniel-g-carrasco

Summary

kernel-cachyos-core's %posttrans scriptlet unconditionally invokes grub2-probe and grub2-editenv. On systems where grub2 is not the bootloader (or the install runs inside a container / bootc-image-builder / rpm-ostree build environment), these calls fail visibly in the build log:

>>> Finished %posttrans scriptlet: kernel-cachyos-core-0:7.0.11-cachyos1.fc44.x86_64
>>> Scriptlet output:
>>> grub2-probe: error: failed to get canonical path of `overlay'.
>>> No path or device is specified.
>>> Usage: grub2-probe [OPTION...] [OPTION]... [PATH|DEVICE]
>>> grub2-editenv: error: failed to get canonical path of `/boot/grub2'.
>>> System has not been booted with systemd as init system (PID 1). Can't operate.
>>> Failed to connect to system scope bus via local transport: Host is down

Reproducible on every Fedora-atomic bootc image build that installs kernel-cachyos from the bieszczaders/kernel-cachyos COPR — we hit it on every Margine OS build (ghcr.io/daniel-g-carrasco/margine).

Environment

  • Image base: ghcr.io/ublue-os/bluefin-dx:stable (Fedora 44 atomic, bootc)
  • Kernel: kernel-cachyos-core-0:7.0.11-cachyos1.fc44.x86_64
  • Build: GitHub Actions ubuntu-24.04 + buildah build --layers

Why it does not (yet) break us

The scriptlet exits non-zero but dnf does not propagate the failure — the build continues. The kernel install completes, dracut runs, etc. So this is log noise + a real exit-code problem in %posttrans rather than an installer break.

Suggested fix

Guard the grub2 calls so they only run on a booted host system with a real /boot/grub2/ directory:

%posttrans
if [ -d /boot/grub2 ] && [ -e /run/systemd/system ]; then
    grub2-probe ... 
    grub2-editenv ...
fi

This matches what mainstream Fedora kernel-core does in its own scriptlets — the upstream Fedora kernel.spec guards %post/%posttrans with similar checks for atomic/container/ostree environments.

Reference

Metadata

Metadata

Assignees

Labels

atomic desktopsIssue related to Fedora Atomic Desktops: Silverblue, Kinote, Bluefin, Bazzite.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions