Skip to content

Make the boot test container a container, so the first boot finishes - #9

Merged
marcos-mendez merged 1 commit into
mainfrom
fix/container-redirect-output
Sep 27, 2026
Merged

marcos-mendez merged 1 commit into
mainfrom
fix/container-redirect-output

Conversation

@marcos-mendez

Copy link
Copy Markdown
Contributor

With the republished chain the gate pulls, verifies, assembles and boots, and
then stops: [40nodebb] running is the last line of the container's
inithooks log and the hook never returns. The node process running
./nodebb setup is asleep in a write to the terminal:

[<0>] wait_woken+0x52/0x60
[<0>] n_tty_write+0x406/0x500
[<0>] file_tty_write.isra.0+0x175/0x2c0
[<0>] vfs_write+0x28c/0x440

/proc/<pid>/fd/1 -> /dev/lxc/tty1.

Why

The layer ships the plain appliance inithooks.service:

StandardOutput=tty
TTYPath=/dev/tty1

A real container image does not run that unit. buildtasks' headless patch
carries ConditionPathExists=!/var/lib/turnkey-info/inithooks.service/lxc,
and patches/container/conf sets REDIRECT_OUTPUT=true. Nothing reads tty1
in a container nobody has attached to, so once the terminal buffer fills the
write blocks forever, and ./nodebb setup prints well past it.

The boot test wrote only the marker file, so its container was a container to
keel inspect and an appliance on a console to systemd. That went unnoticed
while the published layer could not finish its first boot at all.

What changes

bt_mark_container replaces the bare install of the marker and does the
three things a container build does:

  • the marker under /var/lib/turnkey-info,
  • REDIRECT_OUTPUT=true in etc/default/inithooks, the same edit
    patches/container/conf makes,
  • a drop-in giving inithooks.service StandardOutput=journal, which is
    what keeps the hooks off tty1.

Nothing in the layer changes, so there is no changelog entry.

Measured

On the build host, against the chain now on the mirror, in a container
assembled and booted the way the gate does it:

INFO: [15regen-sslcert] successfully completed
INFO: [40nodebb] successfully completed
INFO: [95secupdates] successfully completed
INFO: [98finalize] successfully completed

https 443: 200
http 80: 307 -> https://[fc42:...]/
<title>Home | NodeBB</title>

15regen-sslcert and 95secupdates had also been reporting failures while
the console was blocked; both complete now.

Test plan:

  • bats tests/boot-test.bats, 41 tests, six added for bt_mark_container
  • tests/coverage.sh: boot-test-lib.sh 137/137, every measured file at or
    above the threshold of 95
  • shellcheck -S warning clean
  • appliance / build-and-boot on main

…ishes

With the republished layer the gate boots the appliance and the first boot
stops in firstboot.d/40nodebb, which never returns. The node process running
"./nodebb setup" is asleep in n_tty_write:

    [<0>] wait_woken+0x52/0x60
    [<0>] n_tty_write+0x406/0x500
    [<0>] file_tty_write.isra.0+0x175/0x2c0

The layer ships the plain appliance inithooks.service, which runs the hooks
with StandardOutput=tty on /dev/tty1. A real container image does not: the
headless unit is skipped on the lxc marker and the container patch sets
REDIRECT_OUTPUT=true. Nothing reads tty1 in a container nobody has attached
to, so the terminal buffer fills and the write blocks. The setup prints well
past the buffer.

The test wrote only the marker, so its container was a container to keel
inspect and an appliance on a console to systemd. bt_mark_container now does
all three things a container build does: the marker, REDIRECT_OUTPUT=true in
etc/default/inithooks, and a drop-in giving inithooks.service
StandardOutput=journal.

Measured on the build host against the published chain: the first boot runs
to 98finalize, [40nodebb] successfully completed, port 80 answers 307 to
https and port 443 answers 200 with <title>Home | NodeBB</title> over IPv6.
15regen-sslcert and 95secupdates, which also reported failures while the
console was blocked, now complete too.

Six tests for bt_mark_container; boot-test-lib.sh stays at 100 percent
(137/137). Nothing in the layer changes, so no changelog entry.
@marcos-mendez
marcos-mendez merged commit 2ebf7db into main Sep 27, 2026
2 checks passed
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