Skip to content

build_library: use -nographic for headless amd64 qemu - #4400

Open
Yashika0724 wants to merge 2 commits into
flatcar:mainfrom
Yashika0724:qemu-amd64-headless-nographic
Open

Yashika0724 wants to merge 2 commits into
flatcar:mainfrom
Yashika0724:qemu-amd64-headless-nographic

Conversation

@Yashika0724

Copy link
Copy Markdown

Summary

  • On amd64, build_library/qemu_template.sh (shipped as flatcar_production_qemu.sh) adds -nographic for every host except x86_64. On a headless x86_64 host QEMU tries GTK and exits with gtk initialization failed.
  • Pass -nographic only when DISPLAY and WAYLAND_DISPLAY are both unset. A desktop session still gets a window. Arguments after -- still override this.

Fixes flatcar/Flatcar#1687

flatcar/scripts#2752 adds -nographic unconditionally. Review on that PR asked for a display-server check instead: a window helps diagnose early boot, and on amd64 the default console is tty0 rather than the serial port. Early kernel messages still go to tty0 unless the guest command line includes console=ttyS0. This change only stops the GTK failure so the VM can boot.

An LLM assisted with the patch and this description.

Test plan

  • bash -n build_library/qemu_template.sh
  • On a headless x86_64 host (unset DISPLAY WAYLAND_DISPLAY), run the amd64 flatcar_production_qemu.sh and confirm it no longer fails with gtk initialization failed
  • On a host with DISPLAY or WAYLAND_DISPLAY set, confirm a window still opens
  • Pass -- -nographic and -- -display gtk and confirm those win

Made with Cursor

QEMU defaults to GTK when the helper runs on x86_64, which fails on
hosts with no display server. Pass -nographic only when DISPLAY and
WAYLAND_DISPLAY are unset so a local graphical session still gets a
window.

Fixes flatcar/Flatcar#1687

Signed-off-by: Yashika <ssyashika1311@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Yashika0724
Yashika0724 requested a review from a team as a code owner November 24, 2026 11:15
@chewi

chewi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

It obviously depends on the build, but I don't think the GUI toolkit is ever arch-specific in practise. I would prefer to only use -nographic when there is a display in all cases. I need to revisit the arm64 graphics driver situation.

GTK init fails on a headless amd64 host. Add -nographic when DISPLAY
and WAYLAND_DISPLAY are unset, unless the user already chose a display.
Leave arm64 on -nographic.

Signed-off-by: Yashika <ssyashika1311@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Yashika0724

Copy link
Copy Markdown
Author

Moved the check so it is not tied to the amd64+x86_64 line. amd64 and -s now get -nographic when DISPLAY and WAYLAND_DISPLAY are unset, unless the command already has -display or -nographic. That keeps ./flatcar_production_qemu.sh -display curses working on a headless machine, which is what the image README tells people to run.

arm64 is unchanged and still always passes -nographic. I can change that too once the graphics driver situation is sorted.

I read "when there is a display" as "when there isn't one". The other way would leave the gtk failure in place.

This branch has not been deployed

No deployments
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.

add -nographic in flatcar_production_qemu.sh for amd64-usr+x86_64

2 participants