Its always recommended to install windows first(keeping enough of raw disk-space) and later install linux, as linux grub will detect installed OS and the currently being installed and prepare boot menu for both OS. This is not done by windows. I've been victim of this. I had Ubuntu 14 desktop happily running. One day I thought of trying windows 10 just for time pass, and started installation on 40GB raw leftover space on my hard-disk. Awesomely windows 10 was installed... but I noticed while restart, I've lost ubuntu. System just boots into windows. After few google search (sources: ) found a solution that indicated, need to re-install grub on my HDD. Following were steps to drag linux and windows both, back on stage:
mkdir /mnt
mount /dev/sda1 /mnt
grub-install --recheck --root-directory=/mnt /dev/sda
GRUB>
#Hard at luck, but a small progress. from here we still can boot into either of OS using following commands: use tab for auto completion of commands.set pager=1
#it just controls the amount of output to scroll at page size.Its helpful when there is longer output of any command as scrolling back is not easy. set root=(hd0, 1)
#1 is /boot partitionlinux16 /vmlinuz-4.4.0-148-generic root=/dev/sda5
#sda5 in my case was / partition of my working ubuntu initrd16 /vmlinuz-4.4.0-148-generic
boot
set root=(hd0,3)
#3is windows-10 system partition sized around 524 mb.chainloader +1
update-grub
grub-install /dev/sda