I have been looking into this for like one hour, because it has been nuisance for me as well.
The simplest solution I found, but I am not too sure if this is working all the time but it's worth the try as the first solution is when you login in, at the right top corner, you will be able to choose your keyboard, Choose the one you want from the list, after that, next time it will be the remembered (I'm not quiet sure how this works out with multiple users who choose different keyboard layouts).
Just use it if the Easy Solution did not work.
The other solution that i found is to override gnome-setting with the default system settings,
run this until you get the desired keyboard layout
$ gsettings set org.gnome.settings-daemon.plugins.keyboard active
and setxkbmap will tell you those settings
$ setxkbmap -query
and you will get something like:
So just add the new two following commands to be executed when ubuntu starts up, by adding the them
# prevent gnome from resetting keyboard setting in X
gsettings set org.gnome.settings-daemon.plugins.keyboard active false
Command #2: (based on the information obtained above by
setxkbmap -rules evdev -model pc105 -layout us -variant intl -option lv3 -option lv3:ralt_switch