Hi @protovtol. Select Tools > Processor > ATmega2560 (Mega 2560) from the Arduino IDE menus and then try uploading to your Mega boards again.
There have been two variants of the Mega board, each with a different microcontroller. The Tools > Processor menu allows you to select between the two, so it is essential to have the right setting there in order for the upload to succeed. I can see that you had "ATmega1280" selected from the menu, but you must have the other variant of the board with the ATmega2560 microcontroller.