I managed to install ubuntu and dual boot it on a hp pavillion notebook. To do that I had to press esc and f10 immediately after pressing power, in order to access the bios. Enable legacy in the boot options of the bios. Then I installed and configured linux (debian ubuntu and arch linux) fine. As long as I keep the enable legacy option i get grub after boot. What i would like to achieve is that if i disable legacy support at the bios, the notebook prompts me to grub2. Right now if i disable legacy, the notebook boots windows 10 and ignores grub2. I think it has to do with efi but my limited knowledge stops there.
This may not have been the worst thing you could possibly have done, but it was an action that virtually guaranteed you'd run into problems. To learn why, see my Web page on the subject. (Short version: Enabling the CSM, aka "legacy support," turns the boot process into a coin-toss, with "heads" being no different than leaving it disabled and "tails" being a 100% guarantee of problems in dual-booting.)
One fix is to back up and start again -- disable the CSM and re-install all of your Linux distributions. This is overkill, but in many ways it's the easiest solution. Note that if you enabled the CSM because you had problems booting the installation media, chances are they were prepared incorrectly. See the page to which I linked in the previous paragraph for more on that subject.
Another solution is to install an EFI-mode boot loader, which should get your existing installations working. There are many ways to do this, but in all cases you should start by disabling the CSM. Two that are likely to be relatively easy are:
Either method may work partially, but lead you into a new problem. If this happens, post back or start a new question; there are too many potential pitfalls in your quad-boot setup for me to begin to address even a tiny fraction of them pre-emptively.