Some installs give a choice on where to install grub2's boot loader. You can then not install, if an option or install to a partition (Ubuntu's only other option). The install to a partition will never be used and is just to keep your main install's grub2 in the MBR.
If your second install overwrites the MBR but gives the option to boot into Ubuntu your can easily reinstall Ubuntu with this:
#reinstall from working (not liveCD) system - first find Ubuntu drive (example is drive sdb but use your drive not partitions):
sudo fdisk -l
#if it's "/dev/sdb" then just run:
sudo grub-install /dev/sdb
#If that returns any errors run:
sudo grub-install --recheck /dev/sdb
If it gets to the point you need a liveCD to reboot.
Reinstall grub2 - Short version & full chroot version
Or you can have Boot-Repair, Supergrub or other boot alternatives.
I also install grub2 directly to a flash drive and manually configure a grub.cfg to boot several other drives either MBR, or to a partition.
Install grub2 to USB -general info