Bug#968122: #968122 - keyboard-configuration: Empty /sys/bus/usb/devices causes runtime error in the debconf script
Control: found 968122 1.240
Control: tags 968122 patch
Ryutaroh, Thomas, et al,
On Sun, 09 Aug 2020 21:01:01 +0900, Ryutaroh Matsumoto wrote:
> By
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968109
> I have empty /sys/bus/usb/devices directory.
>
> Then dpkg-reconfigure keyboard-configuration fails as
>
> root@rpi4-20200805:~# dpkg-reconfigure keyboard-configuration
> cat: '/sys/bus/usb/devices/*:*/bInterfaceClass': No such file or directory
> cat: '/sys/bus/usb/devices/*:*/bInterfaceSubClass': No such file or directory
> cat: '/sys/bus/usb/devices/*:*/bInterfaceProtocol': No such file or directory
>
> and I have no method to configure my keyboard layout.
On Sun, 11 Feb 2024 15:34:45 +0100, Thomas Lange wrote:
> I can confirm this bug.
>
> Using qemu/kvm with autopkgtests I have
> keyboard-configuration 1.221 inside the testbed and the postinst
> script of keyboard-configuration fails with
>
> cat: '/sys/bus/usb/devices/*:*/bInterfaceClass': No such file or directory
> cat: '/sys/bus/usb/devices/*:*/bInterfaceSubClass': No such file or directory
> cat: '/sys/bus/usb/devices/*:*/bInterfaceProtocol': No such file or directory
The original bug was fixed:
#968109 - linux-image-5.7.0-2-arm64: USB unusable on Raspberry Pi 4B 8GB
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968109
The attached keyboard_present.sh patch does the following:
* eliminates these runtime errors
* removes Linux Kernel v2.x legacy code
Thank you!
Daniel Lewart
Urbana, Illinois
diff -ru a/debian/keyboard_present.sh b/debian/keyboard_present.sh
--- a/debian/keyboard_present.sh 2025-06-27 10:13:21.000000000 -0500
+++ b/debian/keyboard_present.sh 2025-07-29 00:00:00.000000000 -0500
@@ -1,18 +1,11 @@
keyboard_present () {
- local kern kbdpattern class subclass protocol
-
- kern=`uname -r`
- case "$kern" in
- 2.0*|2.1*|2.2*|2.3*|2.4*|2.5*)
- # can't check keyboard presence
- return 0;
- ;;
- esac
+ local kbdpattern class subclass protocol
[ -d /sys/bus/usb/devices ] || return 0
for d in /sys/bus/usb/devices/*:*; do
+ [ -d "$d" ] || continue
class=$(cat "$d/bInterfaceClass") # 03 = Human Interface Device
subclass=$(cat "$d/bInterfaceSubClass") # 01 = Boot Interface Subclass
protocol=$(cat "$d/bInterfaceProtocol") # 01 = Keyboard
Reply to: