First of all, test if the problem occurs with other browsers.
If the problem occurs with other browsers:
Is possibly a network issue, like DNS resolution. In this case disable ipv6 in grub.
gksudo gedit /etc/default/grub
Then replace the following line:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
With the following line:
GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”
Then update grub and reboot:
sudo update-grub
If that doesn't help, try a different DNS server like OpenDNS or Google Public DNS.
If the problem occurs only with Firefox:
Clear your browser cookies and browser cache, then try again. If that doesn't help, disable ipv6 in Firefox preferences.
- Type about:config in the address bar, press Enter.
- Find network.dns.disableIPv6 in the list.
- Right-click -> Toggle.
- Restart Firefox and try again.
If that doesn't help, start Firefox in safe mode. Close Firefox, then:
firefox -safe-mode
If that works, then is an extension affecting your login. You can disable all extensions from the safe mode starting dialog and then enable one-by-one until you find the culprit.
If that doesn't help, create a new Firefox profile and test it. You can create a new profile by starting the profile manager. Close Firefox, then:
firefox -P
If that solves the problem, then see the tutorial "Fixing a problematic or corrupted profile". If the problem persist even when using a new profile, then create a new Ubuntu user and test it. You can do that from "System >> Administration >> Users and Groups". If the problem does not persist when using a new user account, then you need to figure out which of your Gnome settings is affecting the Gmail login. Report back with the results.