Keep a file descriptor open for reserved VTs - #476
Open
Mrmaxmeier wants to merge 1 commit into
Open
Conversation
logind decides whether to spawn an autovt getty on a VT by asking the kernel whether anything currently has it open (vt_is_busy(), consulted from manager_spawn_autovt() on every VT switch). The VT we pick becomes active before the display server running on it has opened it, so logind can win that race and start a getty on the VT we are about to use. The getty then shares the VT with the session and keeps resetting the keyboard out of the K_OFF mode the session controller asks for, so that Alt+Left and Alt+Right switch VT from inside the session. Hold a file descriptor on each VT for as long as we have it reserved, so the kernel reports it as busy for as long as it is ours. This only has an effect on VTs logind would spawn a getty on: those up to NAutoVTs (6 by default) and other than ReserveVT. With the default minimum-vt of 7 lightdm is outside that range and nothing changes; it matters for configurations that lower minimum-vt. Assisted-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator
/shrug I'll come back to this.. eventually! :D Thanks for disclosing your LLM usage |
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.
Hi,
I recently looked into odd behaviour with LightDM on NixOS:
NixOS/nixpkgs#422331 (comment)
NixOS sets
minimum-vt = 1and suffers from a race where a VT is used both by the desktop session and getty. In this situation, getty then receives desktop session keystrokes and resets the keyboard out of K_OFF. As a symptom, Alt+Left/Right then switch VTs from inside of the desktop session.It seems like this can be mitigated by holding onto VT fds inside of LightDM: logind skips VTs that are "in use" / where fds are held by any process.
Note: This change in LightDM is LLM-suggested but looks fine to me. I'm running the patched version and while the underlying mechanism to avoid collisions doesn't seem fully sound to me, it seems to mitigate the racy behaviour.
Does this change make sense or is NixOS holding display managers wrong in this case?
Thanks! 🙂