After switching to 21.05, keyboard stops working after sleep

I’m running NixOS on an semi-old Xiaomi Air laptop (specs here), but after upgrading to 21.05 my keyboard stops working after sleep.

If I boot on my last 20.09 configuration it’s fine - the keyboard works after sleep again. So I don’t think it’s a hardware issue.

I have to hard reset the computer and start it up again, each time I’ve put it to sleep.

I’ve googled this quite a bit and tried different variations of kernel parameters with 21.05, but the issue remains.

From my current configuration.nix:

# boot.kernelParams = [ "i8042.dumbkbd=1" "atkbd.reset=1" "i8042.nomux=1" "i8042.reset=1" "i8042.nopnp=1" ];
boot.kernelParams = [ "i8042.dumbkbd=1" "i8042.reset=1" "i8042.direct=1" ];

Any ideas?

Maybe this hack from Vaio laptops will work:

As it happens, those exact lines were already in my configuration.nix. Interesting.

I’ll try to remove them instead, and disable powerTop as well.

if that doesn’t work, find out what kernel you 20.09 was running, and perhaps rebuild with an older kernel. Nixos uses cutting edge/bleeding edge kernels… nixos with it’s roll back features can give you the ablity to try out new/custom/old kernels without fear of disaster.

as @grahamc coined ‘fearless tinkering’.

I was suspecting that something in userland was the issue - but going back to kernel 5.4 seems to have fixed the issue! I’ve included the resumeCommands line in my config as well before rebuilding with 5.4

I’ll try a version somewhere in between 5.4 and the latest.