I managed to install ubuntu by allocating separate partition on my laptop. In order to do that I had to disable "secure boot" and select "CMOS" as boot type. Then it's successfully boot my USB and installed.
Now my issue is whenever I start my PC it's directly going to Ubuntu. If I change the boot type to "UEFI" or "UEFI and CMOS" it's directly going inside Windows. SO it's came down to BIOS change every time I want to boot into different OS.
I searched something and find these links useful.
As the thread owner suggested I followed official method.
https://help.ubuntu.com/community/UEFI (Part 5 in the Installing Ubuntu Quickly and Easily via Trial and Error section).
But when I try to use Boot repair I'm having issues. After running this first it ask me to enter the following commands in terminal.
At the end of these commands it said like going to remove GRUB. Once I did I can't boot Ubuntu etc. I select "YES" for that.
sudo chroot "/mnt/boot-sav/sda9" dpkg --configure -a
sudo chroot "/mnt/boot-sav/sda9" apt-get install -fy
sudo chroot "/mnt/boot-sav/sda9" apt-get purge -y --force-yes grub*-common shim-signed linux-signed*
Again Boot repair asked me to enter the following command. I think this is to install GRUB again.
When I enter this in the Boot repair windows there is a progression bar saying "GRUB is installing. This might take several minutes". But my machine stuck at this step for hours.
sudo chroot "/mnt/boot-sav/sda9" apt-get install -y --force-yes grub-efi linux
After like 1 hour I cancelled and ran Boot repair again. This time it's directly goes to the stuck step (Installing GRUB) and takes forever and install nothing.
I cancelled and rebooted machine and now machine is asking for grub recovery.
By changing boot type I can still login to Windows 8. Please help me what should I do to fix this. I really need both Windows and Ubuntu!