Repository navigation
shutdown: preserve console graphics mode across the exitrd handoff - #43671
Conversation
Reviewed the Completed lenses: resource lifetimes and concurrency; security and robustness; architecture, API design and compatibility; coding style and maintainability; tests and regression coverage; plus two domain lenses (Linux VT/console semantics and splash interoperability, test-environment isolation and host side effects). Incomplete: the correctness and memory safety lens exceeded its time budget and was stopped, so its findings are missing; its area is partly covered by the other lenses. All confirmed candidates were re-checked by independent validators. Verified separately: all three production callers of Must fix
Suggestions
Nits
Not raised as inline comments: the repository agent guidance in the base revision asks that a review-confirmation banner be present as the first two lines of README.md when source files are modified, and this PR modifies source files without it. That is a process/documentation step for the human author rather than a code defect, so it is noted here only. |
2633d9e to
9ff9082
Compare
make_console_stdio() forces KD_TEXT while reopening /dev/console. When systemd-shutdown enters the exitrd, this can expose the text console over a retained graphical shutdown splash. Let callers choose whether to switch to text mode, and preserve the mode for the exitrd handoff. Keep the existing text-mode behavior for manager reexecution and the crash shell. Restore text mode if executing /shutdown fails and before reporting a fatal error and freezing. Add an unsafe, nonparallel virtual-console regression test requiring explicit opt-in and an already-owned inactive VT in a disposable VM. Check graphics preservation and text restoration through a private /dev/console bind mount, retain stderr diagnostics, and restore the saved mode in the parent even if the child fails.
9ff9082 to
00712c3
Compare
Summary
Preserve the current console graphics mode when systemd-shutdown reopens
/dev/consolebefore executing/shutdownin the exitrd.make_console_stdio()currently callsreset_dev_console_fd()withswitch_to_text=true. During the exitrd handoff, that can replace a graphical shutdown splash retained by Plymouth with the text console. Allow the internal helper's caller to choose whether to switch modes, and pass false at this one shutdown call site. The core manager reexecution and crash-shell callers continue to pass true.If executing
/shutdownfails, restore text before reporting the saved execution error and continuing with fallback shutdown. Also restore text before the fatal shutdown message andfreeze(). This does not disable logging, alter watchdog behavior or add a hardware-specific condition. A console already in text mode remains in text mode.Validation
9457f81485bfe8e09d45c0376fe02ebce7c15872, fetched again on 7 September.systemd-shutdown.standalone,systemdandtest-console-stdio.meson test -C build -v test-terminal-util test-umount: passed.openvt --wait, without--switchor--force. The active VT stayed unchanged and the test VT was in text mode afterward.The full test suite, a complete boot of current-main systemd and an injected PID-1 exitrd execution failure have not been tested. The physical reboot observation is for the v261.2 backport, not the main-based binary.