You seem to have UEFI boot. The required boot files should be in the /EFI/BOOT directory on the EFI System Partition (usually a FAT32 partition at the beginning of the GPT-partition style system hard disk). In short, you need to boot from another source (example: a DVD image of Ubuntu or a USB stick made after it), then reinstall GRUB on the system hard disk.
If F2 fails
You say however that you cannot get into the BIOS/UEFI setup with F2 upon boot - if that's really the case, then it might mean that either your BIOS/UEFI chip is damaged (very unlikely, but not impossible), or one peripheral device is broken (usually a disk). Don't hesitate to remove (or just disconnect) your hard disk(s) or any other peripheral devices and see if the behaviour changes.
The bottom line is that you should have no problem getting into BIOS/UEFI setup with F2 or choosing your boot source with F12. If you cannot see the BIOS/UEFI setup screen when you press F2 upon boot, then there's really a problem with your firmware chip and there's no point to continue, you must repair/reflash your firmware or replace your chip before trying anything else. This might be your only problem.
If BIOS/UEFI setup is accessible with the hard disks or other devices disconnected, then one of these devices is defective and you should replace it or give it up. Try reconnecting them one at a time
shutdown → connect device → turn on
to see which one has a problem.
If the problem device happens to be the system disk, then bad luck, you need to fresh-install on a new hard disk but after that you're done, no need to read further.
If F2 passes
If you can get into BIOS/UEFI setup upon pressing F2 at boot, then you should also be able to choose your boot medium by pressing F12. You need therefore the aforementioned "other boot source" - an UEFI boot medium.
Alternative boot medium is not ready
If you don't have this other boot medium (DVD or USB), then you need another computer to set it up :
1) Download the iso image from ubuntu website and
2) either burn it on a DVD or use a tool like "unetbootin" or "Startup Disk Creator" or "Rufus" to setup a bootable USB stick (or simply write the iso image byte-by-byte on the USB stick with
sudo dd if=/path/to/image.iso of=/dev/sdX bs=4M
on a Linux terminal, where /path/to/image.iso
is your full path to your downloaded iso image and /dev/sdX
is the destination USB disk).
If you have a Debian-based Linux computer, you also can use the
Main Menu → Accesories → Disks application
select the USB stick on the left column and then use the "Restore Disk Image..." command in order to write the iso image on the USB stick).
If you have a Windows computer, then I advise you to use the Rufus application to setup your boot medium. There is a dd.exe
utility for Windows, but the names of the source and destination disks are much more complicated, you risk messing up your system.
Anyway, regardless of which application you use to set up your boot medium, BE CAREFUL TO SELECT THE RIGHT SOURCE AND DESTINATION.
Alternative boot medium is ready
Once you have the needed boot medium, insert it into the "sick" computer and boot from it. You have to press F12 to select the right boot source.
Once the system has booted, you need to reinstall GRUB on the system disk. You should open a terminal and type sudo lsblk
in order to show the disks installed on the system, with their partitions and respective mountpoints.
Then you identify the system disk (for example: /dev/sda
, but if you have multiple disks it might be other than "a").
Then you install GRUB on this disk by typing sudo grub-install /dev/sd**X
, where sdX
is your system disk that you just identified in the previous step. Again, be careful to select the good destination disk.
GRUB will then be installed.
At last, you must type sudo update-grub
in order to identify all the operating systems installed and create the GRUB configuration which allows you to choose the operating system you want to boot.
That's it
That's it. Shut down the computer, remove the boot medium and start again. You should see the GRUB menu where you can choose which operating system you want to start.
It's a little tricky I guess, I hope I have been sufficiently clear.
The worst-case scenario is when your bios chip is damaged.
Your computer is then a brick until you repair/replace this chip.
I hope this is not the case.
A broken hard disk is easier to cope with, though it means nevertheless that you probably lost the data on it (totally or partially).
Anyway, if that's the case, don't hesitate to attempt to connect it to another computer with a USB-to-SATA cable and try to see if you can recover anything, it might work.
Good luck!