I\'ve uploaded a sketch to an Arduino Uno whose loop is something like this:
void loop(){
Serial.println(\"Hello, World!\");
}
So, now,
For Arduino Yún users, try uploading via Ethernet/Wi-Fi (menu Tools → Port).
I had exactly the same problem, and I tried pretty much everything (apart from burning a new bootloader). I am surprised it worked, but I've uploaded an empty sketch without any problem.
Based on my experience with the communication already in use or blocked, I would say that the program you are interfacing with still has the communication open.
I also found that if you disconnect the USB cable it will rest the communication. It is not the greatest solution, but it solves the problem.
If you still have the serial console open, it will reserve the serial port. Close it, and try again.
It will free your port for sure.
Make sure you plug the Arduino directly into the computer and not through a hub. Using a hub will give you this error.