This commit is contained in:
2026-08-06 16:39:31 +00:00
parent 92c63db585
commit eab0b6aa84

View File

@@ -18,6 +18,7 @@ exactly what's missing.
from __future__ import annotations
import argparse
import getpass
import grp
import os
import random
@@ -127,11 +128,29 @@ fix: echo 'KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=
| sudo tee /etc/udev/rules.d/99-uinput.rules
sudo udevadm control --reload-rules && sudo udevadm trigger""")
# Two distinct failures here, with completely different fixes:
# (a) not in the group at all -> usermod
# (b) in the group, but this login -> log out / newgrp
# session predates the change
user = getpass.getuser()
try:
in_input = grp.getgrnam("input").gr_gid in os.getgroups()
group = grp.getgrnam("input")
in_db = user in group.gr_mem
in_session = group.gr_gid in os.getgroups()
except KeyError:
in_input = False
check("you are in the 'input' group", in_input, """
in_db = in_session = False
if in_session:
check("you are in the 'input' group", True)
elif in_db:
check("'input' group active in this session", False, """
You ARE in the group, but this login session started before that
happened, so your processes never got it.
fix: log out and back in (or reboot)
to test right now without logging out: newgrp input""")
else:
check("you are in the 'input' group", False, """
fix: sudo usermod -aG input $USER
then LOG OUT and back in — group changes need a new session""")
@@ -503,4 +522,4 @@ def main() -> None:
if __name__ == "__main__":
main()
main()