Long story short , i inserted a windows 10 bootable USB deleted all partitions previously were installed , did this in command prompt :
diskpart
select disk 0
clean
then installed a windows 10 on the machine .
after that made a new bootable USB with ubuntu 16.04 , after booting the USB ,
before installing i had a warning saying somthing like :
another operatin system (windows 10) is installed , using legacy BIOS and you are trying to install ubuntu through uefi , if you continue you might not be able to load the other operating system
i ignored it and went to install ubuntu, created a new partition alongside windows created a swap partition , and i the bootloader partition i think was the hard disk itself .
after finishing the installation i couldnt see windows entry in grub menu .
after searching i booted again into windows 10 usb and in command prompt i did :
bootsect /nt60 c: /mbr
this command deleted ubuntu grub and now im only able to load into windows 10 .
how can set up grub with both ubuntu and windows 10 entries ?
what i did is , using Rufus for creating a windows 10 and ubuntu 16.04 bootable images ,
important : when creating the usb under partition scheme select only UEFI with GPT disk (for both ubuntu 16.04 and windows 10) .
Turn on PC and :
click the usb and boot into windows 10 installation , on the screen install now click shift+alt+f10 this will open command prompt , do the following :
diskpart select disk 0 - (in my case i wanted to install on disk 0) you can whatever you have clean - this will clean any disk type (MBR or GPT)
after you can partion and install windows 10 as you like .
after installing windows 10 , remove windows 10 usb and insert ubuntu (created as above ).
install ubuntu as you would do normally .