Sometimes if the connection to Linux from which the connection was made via Minicom is lost, then 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 what COM port you have.
To avoid such an error, it is necessary to correctly shut down Minicom using the CTRL-A keys and then the Q key.
You can solve the problem by killing the process as a root user with the command:
killall -9 minicom
In Ubuntu, use the command:
sudo killall -9 minicom
Or you can simply delete the file «LCK..ttyS0» in the /var/lock/ directory.
After that, the error will not be displayed.