If you are facing issues with keyboard mapping in ubuntu which is the most common error currently you can use the below solution,
Find your start up script
find / -name xstartup
in file xstartup
You have to add the line export XKL_XMODMAP_DISABLE=1 before /etc/X11/Xsession or gnome-session (in case you use GNOME)
export XKL_XMODMAP_DISABLE=1
restart your vnc and all is fixed
