My Ubuntu on my laptop was not functioning correctly for a week. After login, the resolution is wrong using Unity and I couldn't change the resolution because all the interaction (mouse clicking) was not working. When I switch to GNOME, the resolution is better (usable) but still not correct. So I changed the resolution using the Nvidia setting tool and saved the configuration file (this is a mistake).
After restarting, it froze during boot. I tried a lot of thing, rebooting, going to recovery mode etc. All didn't work. If I end 'e' at the GRUB menu and the enter Ctl+x, it froze at the line "Checking battery state..." After some searching online, I found a solution.
First enter TTY1 by holding down Ctl+Alt+1 when you see it freezes at "Checking battery state...". Then in the command line, redo the nvidia configuration:
$sudo nvidia-xconfig
The output said there were errors in the xconfig settings and a new file is generated. So the problem is really with the Nvidia settings.