I general use the program minicom to use my serial ports in Debian Linux. Many program including the likes of X server, create a “temporary lock” file in some of the temporary directory in Linux like /tmp or /var/tmp/, so that there is no access violation in case if another user is trying to use the same program. Many times these program have to be quit or exited in an un-graceful fashion as a result of which the “temporary lock” file is never deleted. While using minicom, you may have seen messages like the following:
Device /dev/ttyS0 is locked.
No matter what you try, you still get the same message. This usually happens when your terminal window quits unexpectedly or it hangs for some reasons. In such a case the minicom program does not exits graciously and hence the temporary locked file is not delete.
The easiest way to resolve this problem is to give the following command:
# rm /var/tmp/LCK..ttyS0
Basically what we are doing above is manually removing the temporary lock file. Now you can start using your minicom program as you would do normally. The name of the temporary lock file might differ on your system but it should generally start with “LCK” and should will “ttyS<n>” somewhere in it’s name.
Please report if your experience have been different and I will update this post.