Not sure if it is worth an answer, but the formatting will go all wrong in a comment. Allow me to share with you a little batch file I use to program ATtiny's. Tiny's are pretty much the same to program as a Mega. Also notice I use a different programmer (
-c), but that shouldn't be the difficulty here.
freq AVR clock frequency
baud is the baud rate that my programmer likes to communicate on
src is the source code that is to be compiled
avr the device type to be programmed
dev the device as it shows up in
dmesg when I connect my programmer. This is actually the setting that I consider odd in your command.
avr-gcc -g -DF_CPU=$freq -Wall -Os -mmcu=$avr -c -o tmp.o $src &&
avr-gcc -g -DF_CPU=$freq -Wall -Os -mmcu=$avr -o tmp.elf tmp.o &&
avr-objcopy -j .text -j .data -O ihex tmp.elf tmp.hex &&
avrdude -p $avr -cstk500v1 -P$dev -b$baud -v -U flash:w:tmp.hex
You can check the exact device by typing
dmesg | tail from a terminal. When I connect my programmer it says:
[816888.277342] usb 2-2.3: FTDI USB Serial Device converter now attached to ttyUSB1
Notice the ttyUSB1 device node name.
Coming to think of it ..., your error message might imply the problem isn't between your PC and the programmer, but between programmer and AVR. The latter case disqualifying my answer entirely.