Loadkeys: permission denied

If memory serves me correctly, it used to be possible to switch the keymap in the console using loadkeys dvorak or loadkeys us. In both NixOS 23.11 and 24.05 both of these give the error:

Keymap 0: Permission denied
Keymap 1: Permission denied
Keymap 2: Permission denied
KDSKBENT: Operation not permitted: could not deallocate keymap 3

Can you offer any wisdom on this?

I think root permissions have always been required. Not sure why, though…

Could it be that the ability for normal users to do this, was removed at some stage?

It works with sudo.

Hmm, I have a fairly strong recollection of being able to do this as a normal user. Perhaps many moons ago and not on NixOS, though.

Changing the keymap changes it for all consoles, so an unprivileged user could change the keymap for other users … and maybe that’s considered too hazardous?

Anyway, I guess that sudo is the way to get it to work today.

I will take a wild guess and say you have installed Arch Linux at least once, the official installer image boots straight into a root shell so you didn’t need to use sudo.