fix: unify TTY selection logic across ARM64 and AMD64 - #1284
Open
Hero2633 wants to merge 1 commit into
Open
Conversation
Signed-off-by: zuoyi.wan <zuoyi.wan@winicssec.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
On ARM64 servers such as Kunpeng 920, after booting the Harvester ISO, the screen directly shows the

rancher login:prompt instead of entering the Harvester interactive installer UI.Observed behavior:
rancher login:harvester-installeroutput is actually redirected to the serial console (for examplettyS0)Further investigation showed that this problem is related to the installer's TTY selection logic: when both a local virtual terminal and a serial console are present (for example

ttyS0andtty1), the installer may be bound to the serial console first instead of the localtty1.Solution:
This PR unifies the TTY selection logic used by the installer so that startup, internal console detection in Go, and getty restart handling all follow the same priority:
tty1 > other virtual ttys > serial consoleThis PR includes:
setup-installer.shto prefertty1, then other virtual terminals, and fall back to serial console only when no virtual tty is availablepkg/console/tty.goso the Go-side console selection logic matches the shell-side behaviorharv-restart-servicesto use the same priority when restarting the console gettyThis makes console selection behavior consistent across ARM64 and AMD64, and fixes the case where installer output is redirected to serial console even though a local virtual terminal is available.
Related Issue(s):
none
Test plan:
Verified with:
bash -n package/harvester-os/files/usr/bin/setup-installer.shbash -n package/harvester-os/files/usr/sbin/harv-restart-servicesgo test ./pkg/consoleAdditional documentation or context
In the affected environment, the installer could be manually brought back to the local terminal using: