This started happening to me recently, not sure what change could be to blame but I found a lengthy thread on the ubuntu bug tracker that seems to confirm things. Copying the relevant post: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1508146/comments/66
--- In my case, I traced the issue to the keyboard-configuration package postinst script, which ends up calling 'setupcon --force --save' which in turn calls 'kbd_mode -u' To reproduce: sudo apt install --reinstall keyboard-configuration setupcon documentation states: "--force Do not check whether we are on the console. Notice that you can be forced to hard-reboot your computer if you run setupcon with this option and the screen is controlled by a X server." It looks like the checks to avoid this behavior while a graphic environment is active don't work in the context of the installer. --- In any case they've found 'sudo kbd_mode -s' to be a workaround.