Sometimes if the connection to a device via Minicom is lost, the next time you start Minicom you could see an error:
Device /dev/ttyS0 is locked.
The name /dev/ttyS0 may be different, depending on your COM port. To avoid this issue you should always shut down Minicom using CTRL+A keys and then the Q key.
To resolve the issue you can kill the process as a root user. Use the following command in your terminal:
killall -9 minicom
In Ubuntu is similar. Run the command in your terminal using sudo:
sudo killall -9 minicom
You can also try to delete the file:
LCK..ttyS0 in the /var/lock directory.