Linux and serial port

I don't know what "messed up" means.

If the com port gets stuck open by avrdude or some other process then:

"lsof | grep <serial_port_name>" will tell you the process holding the serial port open.