Skip to content

fix(installer): keep dtoverlay and max_framebuffers on separate lines in config.txt#2911

Merged
vpetersson merged 1 commit into
masterfrom
worktree-rosy-weaving-dewdrop
May 19, 2026
Merged

fix(installer): keep dtoverlay and max_framebuffers on separate lines in config.txt#2911
vpetersson merged 1 commit into
masterfrom
worktree-rosy-weaving-dewdrop

Conversation

@vpetersson
Copy link
Copy Markdown
Contributor

@vpetersson vpetersson commented May 19, 2026

Issues Fixed

Fixes #2910

Description

ansible/roles/system/templates/config.txt.j2 produced a glued line in the generated /boot/firmware/config.txt:

dtoverlay=vc4-kms-v3dmax_framebuffers=2

{%- endif %} stripped the trailing newline from dtoverlay=vc4-kms-v3d, and Ansible's trim_blocks=True then stripped the newline after endif %}, concatenating the two directives. Dropping the - whitespace-trim markers from the {% if %} / {% else %} / {% endif %} lets each branch keep its trailing newline.

Failure modes (before fix)

The bug manifests differently per board:

Reproduction & verification on the test fleet

Rendered the broken (pre-fix) and fixed templates for each device_type, deployed both to real hardware, rebooted between, and inspected the system state.

Check Pi 4 (broken) Pi 4 (fixed) Pi 5 (broken) Pi 5 (fixed)
config.txt line 19 glued (bug) dtoverlay=vc4-kms-v3d glued (bug) dtoverlay=vc4-kms-v3d,cma-512
lsmod | grep ^vc4 empty loaded loaded loaded
/sys/class/drm/ only version card0, card1, … card0, card1, … card0, card1, …
Framebuffer (fbset -i) 1920x1280 (pillarbox) 3840x2160 (16:9) 3840x2160 3840x2160
CmaTotal (/proc/meminfo) n/a (Pi 4 default) n/a 65536 kB (64 MiB) 524288 kB (512 MiB)
max_framebuffers n/a 2 1 (firmware default) 2
rpi_hevc_dec n/a n/a loaded (but starved) loaded
/dev/video* HEVC nodes n/a n/a present present (19–35)

Local Jinja2 rendering also verified for the remaining device types (pi2, pi3, x86, arm64) — all render dtoverlay=… and max_framebuffers=2 on separate lines after the fix.

Also audited cmdline.txt.j2 — clean (no control-flow tags between literal lines; token list is joined with explicit ' ').

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices. (Pi 4 + Pi 5 testbeds — see table above.)
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

… in config.txt

`{%- endif %}` stripped the trailing newline from `dtoverlay=vc4-kms-v3d`
and Ansible's `trim_blocks=True` stripped the newline after `endif %}`,
gluing the two lines together as `dtoverlay=vc4-kms-v3dmax_framebuffers=2`.
The vc4-kms-v3d overlay then failed to load, no DRM device registered,
and the display fell back to a non-16:9 framebuffer (pillarboxing on 16:9
TVs). Same bug on Pi 5 — `dtoverlay=vc4-kms-v3d,cma-512max_framebuffers=2`.

Dropping the `-` from the if/else/endif whitespace controls lets each
branch keep its trailing newline.

Fixes #2910

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vpetersson vpetersson requested a review from a team as a code owner May 19, 2026 05:54
@vpetersson vpetersson self-assigned this May 19, 2026
@sonarqubecloud
Copy link
Copy Markdown

@vpetersson vpetersson merged commit 2dffa0a into master May 19, 2026
8 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.

[BUG] Broken dtoverlay line in /boot/firmware/config.txt - vc4-kms-v3d and max_framebuffers smushed together

1 participant