I'm not running Ubuntu anymore, but I can confirm that this is a problem in Debian Stretch (and was an issue in Debian Jessie). I see similar behavior for keyboard rates set via `xset r rate`. Plugging in the USB keyboard resets the keyboard settings. Suspending while a USB keyboard is plugged in also resets the keyboard settings, though suspending without a USB keyboard attached doesn't. I suspect that whatever logic executes on plugging in the keyboard is also run on resume.
For anyone looking for a workaround for mapping caps lock to escape, setting `XKBOPTIONS="caps:escape"` in `/etc/default/keyboard` (and rebooting) will do that reliably. That should work for anything that can be configured via `XKBOPTIONS`. As for the rate issue, I don't yet have a good workaround. I suspect a udev rule might do what I need, but that's also clearly a hack, so it would be nice to have a fix for this.
I'm not running Ubuntu anymore, but I can confirm that this is a problem in Debian Stretch (and was an issue in Debian Jessie). I see similar behavior for keyboard rates set via `xset r rate`. Plugging in the USB keyboard resets the keyboard settings. Suspending while a USB keyboard is plugged in also resets the keyboard settings, though suspending without a USB keyboard attached doesn't. I suspect that whatever logic executes on plugging in the keyboard is also run on resume.
For anyone looking for a workaround for mapping caps lock to escape, setting `XKBOPTIONS= "caps:escape" ` in `/etc/default/ keyboard` (and rebooting) will do that reliably. That should work for anything that can be configured via `XKBOPTIONS`. As for the rate issue, I don't yet have a good workaround. I suspect a udev rule might do what I need, but that's also clearly a hack, so it would be nice to have a fix for this.