If Ubuntu does not work, you can still access your installation via chroot.
Be aware that the live system must have the same architecture (32 or
64bit) as your system on the hard disk.
Boot from a Live media of Ubuntu (USB/CD/DVD) and open a terminal (CTR+ALT+T). The general idea here is to mount the (root) partition of Ubuntu and then chroot in it.
First give this command to list the partitions
sudo fdisk -l
here is an example result
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 206848 81922047 40857600 7 HPFS/NTFS/exFAT
/dev/sda3 81922048 625142447 271610200 5 Extended
/dev/sda5 81924096 140517375 29296640 83 Linux
/dev/sda6 140519424 433487871 146484224 83 Linux
If this does not work, you can also use gparted (open the dash and type gparted) to find what your root partition is.
I know that my Ubuntu (root) partition is /dev/sda5 (because I have a separate /home in /dev/sda6).
Now I will mount the /dev/sda5 in /mnt
sudo mount /dev/sda5 /mnt
Now I will connect to /mmt and mount some other folders that might be needed.
cd /mnt
sudo mount -t proc proc proc/
sudo mount -t sysfs sys sys/
sudo mount -o bind /dev dev/
sudo mount -t devpts pts dev/pts/
Now I will chroot to my Ubuntu installation
sudo chroot /mnt
Edit the file you want.
nano etc/default/grub
Be careful the forward-slash here. etc not need forward-slash in the beginning because you will edit the wrong file then.
Now remove the entry nomodeset (or anything else)
save the file with CTRL + X , then Y(es) and then ENTER.
now update grub
update-grub
Exit the chroot enviroment and unmount the folders - partitions
exit
sudo umount {proc/,sys/,dev/pts,dev/}
cd .. ; sudo umount /mnt
The changes have been applied.. reboot your system.
source 1
source 2