TIP: Serial port locked while using minicom
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:
# minicom
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.
Solution
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.

Free Email Subscription









December 4th, 2009 at 2:07 am
sir
i am facing problem to installing minicom on ubuntu os .
problem 1 : Device /dev/ttyS0 is locked.
so solve this problem i type this command.
# rm /var/tmp/LOCK..ttyS0
then i got one more problem .
cannot remove `/var/tmp/LOCK..ttyS0′: No such file or directory
SO Please help me
Reply to this comment
siskalandre Reply:
April 17th, 2010 at 1:11 am
please change your command to
#rm /var/lock/LOCK..ttyS0
Reply to this comment
May 12th, 2010 at 4:40 am
you can also try just for
pkill minicom
Reply to this comment
July 12th, 2010 at 1:03 pm
[...] error is the result of a lock file hanging around. If you don’t know the location of the lock file, it might be helpful to check your local [...]