virtualbox – the capslock functionaliy is reversed in Ubuntu

This can sometimes happen on certain OSes in Virtualbox when you save the machine state when capslock set to ON.

You should be able to fix it by setting capslock to ON on your keyboard, saving the machine state, switching capslock OFF on your keyboard and then restarting the VM.