From 2521bebbf26a516b966b5ff7b365ceb0c9156514 Mon Sep 17 00:00:00 2001 From: Quantenzitrone Date: Tue, 19 Mar 2024 23:01:04 +0100 Subject: [PATCH] nixosTests.systemd-initrd-luks-fido2: fix test on aarch64-linux This is the error message on fail: > qemu-system-aarch64: -device canokey,file=/tmp/canokey-file: Warning: > speed mismatch trying to attach usb device "CanoKey QEMU" (full > speed) to bus "usb0.0", port "3" (high speed) My Understanding of the Issue is: The test failed because qemu-system-aarch64 apparently has different USB controllers enabled by default, resulting in a "speed mismatch" between the USB controller and CanoKey that only occurred on aarch64. I could reproduce the issue on x86_64 by enabling the EHCI controller and then fix the issue by specifying which USB bus to use for the CanoKey. This didn't fully fix the issue on my first attempt, because the UCHI controller enabled by -usb doesn't have the same bus name on aarch64 and x86_64. While bus=usb-bus.0 worked on x86_64, on aarch64 i get this message: > qemu-system-aarch64: -device canokey,bus=usb-bus.0,file= > /tmp/canokey-file: Bus 'usb-bus.0' not found The final solution now manually enables the OHCI controller (which may be similar to UHCI, but i really have no idea other than it works) and assigns it the id aka bus name "usb-bus", so it works the same under both architectures. --- nixos/tests/systemd-initrd-luks-fido2.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/systemd-initrd-luks-fido2.nix b/nixos/tests/systemd-initrd-luks-fido2.nix index 207f51f4dd9b..4441ad061ee4 100644 --- a/nixos/tests/systemd-initrd-luks-fido2.nix +++ b/nixos/tests/systemd-initrd-luks-fido2.nix @@ -9,7 +9,7 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { # Booting off the encrypted disk requires having a Nix store available for the init script mountHostNixStore = true; useEFIBoot = true; - qemu.options = [ "-device canokey,file=/tmp/canokey-file" ]; + qemu.options = [ "-device pci-ohci,id=usb-bus" "-device canokey,bus=usb-bus.0,file=/tmp/canokey-file" ]; }; boot.loader.systemd-boot.enable = true;