I accidentally formatted boot partition, so now when I boot the computer it just said “no bootable device found". How can I repair the boot partition?
you could download supergrub2 put this on a cd or usb then boot into your system then reinstall grub from your system Im only guessing your using linux
use the Ubuntu installation CD to repair the installation to a working condition.
Also try attaching the disk as secondary disk in another machine and try recreating the /boot with files copied from similar OS. For more details check the link below
Depends on what you mean by "boot" partition. If it's the linux partition that is mounted as
/boot then earlier answers involving 'repair', or using your original installation media and looking for a repair option, are probably all you need. I'd recommend trying the original install media first, since it's going to be closest to what you had already, but any grub tool will probably suffice.
OTH if it's the main boot partition for the system and was mounted as
/ in linux, without a separate
/boot partition, it can be a whole lot more work. (If even possible.)
From beginning, if not already done and if you have the hardware available, make an image of the partition using something like
dd before doing anything else that can possibly write to that partition.
Depending on the original file system, different tools are available to "unformat" the disk. The one I've seen most promising results from for others is TestDisk.
I can't give testimonial to that, or any other tools, since the list time I formated the wrong disk I was using DOS and had to use DOS debug and lots of hex math to recreate the FAT table by hand. :'( I haven't made that mistake again!
Hopefully you had ext3/4 and the backup superblocks will save the day. And now you have personal experience in the need for backups, and the wisdom of compartmentalized partitions. I'd rather sacrifice some diskspace to extra partitions than my data to errors - human or mechanical.
Best wishes and lots of luck.