Can you Option Boot the Mini by holding down the Option key immediately after the startup chime? Make sure to use a wired USB keyboard since a wireless keyboard may not go ready quickly enough. If you can get the Apple boot picker menu, then try using Command + Option + R while still sitting on the Apple boot picker menu assuming that macOS 10.12.4+ was installed on this Mac at some point in the past. I know this works on the later Intel Macs, not sure about a 2012, otherwise just use those keys immediately after the startup chime using a USB connected keyboard.
Also, make sure you have the Mini connected directly to the router using an Ethernet cable to bypass any difficult to troubleshoot WiFi issues.
Can you still boot into Ubuntu? And is Ubuntu working Ok? If you are having issues with Ubuntu, then maybe the same issue is why you are having trouble booting into any other modes.
Try booting into the Apple Diagnostics. If you see an error message something like "Cannot Load EFI/Drivers/TestSupport.efi", then it just means your Mac is one of the ones where Apple messed up the system firmware causing a compatibility issue with the bootloader for the Apple Diagnostics and does not tell us anything useful.
Try an SMC Reset and a PRAM Reset (hold the PRAM Reset for at least three chimes).