How to override the default keyboard layout in Linux
Problem
When you plug in a USB keyboard into a Linux machine it has the wrong layout.
For example, you want it to be Dvorak but it's Qwerty. This starts to be very
annoying when you use a KVM to switch between computers. Sadly, gnome
keyboard properties and the layout switcher get very confused by all this and
make things worse rather than better.
Edit /etc/default/console-setup and set XKBLAYOUT to what you want it to be,
e.g., "dvorak". If, like me, you want to swap the Escape and the CapsLock
key, set XKBOPTIONS to 'caps:swapescape'.