`nix build .#checks.x86_64-linux.vm-basic` failed because Hyprland 0.56.2
aborted with `CBackend::create() failed!` on every start. Reading aquamarine
0.15.1 rather than guessing at it, that abort had three independent causes on a
NixOS test machine, and none of them is visible in the journal until
`debug:disable_logs = false` is set -- Hyprland mutes aquamarine, so the abort
is all that survives. checks/lib/gpu-session.nix now supplies all three and
records the evidence for each:
* `-vga virtio`, for a DRM render node. `virtualisation.graphics = false`
still leaves QEMU's default bochs-drm adapter, which gives card0 and no
renderD*. Measured in the guest: `-vga virtio` -> card0 + renderD128;
`-device virtio-gpu-pci` only *adds* a card next to bochs-drm, so it would
need `-vga none` beside it.
* `hardware.graphics.enable`, so Mesa's GBM backends exist at all. Without it
gbm_create_device() fails with "MESA-LOADER: failed to open dri:
/run/opengl-driver/lib/gbm/dri_gbm.so" and aquamarine reports "Cannot open
backend: no allocator available".
* `SEATD_VTBOUND=0`, so libseat's embedded seatd hands out a seat with no VT.
`CHeadlessBackend::drmFD()` returns -1 unconditionally, so the *only*
source of an allocator is the DRM backend, which opens /dev/dri/card0
through libseat -- and the default VT-bound seat needs /dev/tty0, which the
unprivileged service user cannot open.
The diagnostics dump grows a "graphics devices" section (`ls -l /dev/dri`,
`cat /proc/fb`) and a "wayland socket vs WAYLAND_DISPLAY" section, so the next
machine that is missing a render node, or that binds a socket the frame server
is not waiting on, says so in three lines instead of timing out mutely.
vm-basic's `dump()` is now vm-hyprland's, which reports the exit status too.
vm-basic also gained `python3` in the guest: its last subtest shells out to a
python one-liner and had been dying on exit code 127 -- invisible until the
compositor got far enough to reach that subtest.
Neither check passes yet, and the two remaining blockers both live in
nix/module.nix, which this slice may not edit, so they are reported rather
than patched:
* vm-basic stops at "the module's two units come up". The compositor is up
and healthy; the frame server sits in ExecStartPre forever. The module
hardcodes `waylandDisplay = "wayland-0"`, but Hyprland's socket loop is
`// get socket, avoid using 0` over candidates 1..32 (src/Compositor.cpp),
so the session binds wayland-1. Forcing WAYLAND_DISPLAY=wayland-1 in the
guest was verified to carry vm-basic through every other subtest.
* vm-hyprland stops at "the compositor reports the configured headless
output" with "hyprctl never reported a HEADLESS-1 monitor". hyprctl reports
`Monitor Virtual-1` at 1280x800 -- the virtio-gpu output. A HEADLESS-N
output only exists after `hyprctl output create headless`, which the module
never issues; Hyprland's own fallback output is named FALLBACK. The
`monitor = HEADLESS-1, ...` line in hyprland.conf is a rule for a monitor
that is never created.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fJZYyS4pqxt2FC37JsFYd
85 lines
4.3 KiB
Nix
85 lines
4.3 KiB
Nix
# What a NixOS test machine has to be given before Hyprland 0.56.2 will start.
|
|
#
|
|
# Imported by both VM checks. It is a machine definition, not a test: nothing
|
|
# here relaxes anything either check asserts, it only supplies hardware and
|
|
# session facts that a default `nodes.machine` does not have.
|
|
#
|
|
# The failure it fixes is the same one every time -- the compositor aborts with
|
|
#
|
|
# terminate called after throwing an instance of 'std::runtime_error'
|
|
# what(): CBackend::create() failed!
|
|
#
|
|
# and systemd restarts it until the test's timeout expires. `CBackend::create()`
|
|
# is aquamarine's, and reading aquamarine 0.15.1 rather than guessing at it, it
|
|
# needs three separate things that a bare test machine does not provide. Each is
|
|
# one of the blocks below, and each was confirmed in the guest by removing it
|
|
# again and watching the compositor die on the next line down.
|
|
#
|
|
# A note for whoever hits this next: none of it is visible in the journal until
|
|
# you also set `debug:disable_logs = false`, because Hyprland mutes aquamarine
|
|
# by default and the abort is all that survives. That is how the three causes
|
|
# below were separated.
|
|
{ ... }:
|
|
{
|
|
# 1. A DRM render node.
|
|
#
|
|
# `virtualisation.graphics = false` still leaves QEMU's default bochs-drm
|
|
# adapter in the guest, which offers /dev/dri/card0 and *no* renderD*. Measured
|
|
# in the guest, not assumed:
|
|
#
|
|
# (default) card0 (bochs-drm)
|
|
# -vga virtio card0, renderD128 (virtio_gpu)
|
|
# -device virtio-gpu-pci card0, card1, renderD128 (bochs + virtio)
|
|
# -vga none -device virtio-gpu-pci card0, renderD128 (virtio_gpu)
|
|
#
|
|
# `-vga virtio` *replaces* the default adapter, so it is the one-option form of
|
|
# the last line. `-device virtio-gpu-pci` on its own only *adds* a second card
|
|
# next to bochs-drm, so it would need `-vga none` beside it to leave the guest
|
|
# with a single DRM device.
|
|
virtualisation.qemu.options = [ "-vga virtio" ];
|
|
|
|
# 2. Mesa, where the GBM loader looks for it.
|
|
#
|
|
# aquamarine's allocator is gbm_create_device() on that node. On NixOS the GBM
|
|
# backends live under /run/opengl-driver, which only exists when
|
|
# hardware.graphics is enabled -- a test machine has it off. Without it:
|
|
#
|
|
# MESA-LOADER: failed to open dri: /run/opengl-driver/lib/gbm/dri_gbm.so:
|
|
# cannot open shared object file: No such file or directory
|
|
# ERR from aquamarine ]: Couldn't open a GBM device at fd 21
|
|
# CRIT from aquamarine ]: Cannot open backend: no allocator available
|
|
hardware.graphics.enable = true;
|
|
|
|
# 3. A seat that is not bound to a VT.
|
|
#
|
|
# This one is not really the test machine's business, and it is flagged rather
|
|
# than fixed: it belongs in nix/module.nix, which this slice may not edit.
|
|
#
|
|
# Only the DRM backend ever yields a buffer allocator --
|
|
# `CHeadlessBackend::drmFD()` returns -1 unconditionally (aquamarine
|
|
# src/backend/Headless.cpp), and CBackend::start() takes the allocator from the
|
|
# first implementation with a drm fd. So "headless" here does not mean "no
|
|
# GPU": the headless backend still rides on the DRM backend's allocator, and if
|
|
# the DRM backend fails there is none, whatever /dev/dri holds.
|
|
#
|
|
# The DRM backend opens /dev/dri/card0 through libseat. For this unit libseat
|
|
# finds no /run/seatd.sock and no logind session (it is a system service, not a
|
|
# login), so it falls back to its embedded seatd -- whose seat is VT-bound by
|
|
# default. It then tries to open /dev/tty0, which the unprivileged `hhstream`
|
|
# user cannot, so the client never becomes active and every device open is
|
|
# refused:
|
|
#
|
|
# ERR ]: [libseat] [common/terminal.c:162] Could not open target tty: Permission denied
|
|
# ERR ]: [libseat] [seatd/seat.c:557] Could not open VT for client
|
|
# ERR ]: libseat: Couldn't open device at /dev/dri/card0
|
|
# ERR ]: drm: Skipping device /sys/devices/.../drm/card0, not a KMS device
|
|
# ERR ]: drm: Found no gpus to use, cannot continue
|
|
# ERR ]: DRM Backend failed
|
|
#
|
|
# SEATD_VTBOUND=0 (seatd/server.c) asks that embedded seatd for a seat with no
|
|
# VT at all, which is the truth about this session: there is no terminal to
|
|
# switch away from. A headless session run as a system user will need this on
|
|
# any machine, not just in the test.
|
|
systemd.services.hyprland-headless.environment.SEATD_VTBOUND = "0";
|
|
}
|