Link to home
Start Free TrialLog in
Avatar of Q010797
Q010797

asked on

unlocking a serial device

Heya all!

Sometimes after i reboot my linux box a serial port or two
are locked for some reason.. and a file LCK..ttySx is created in /var/lock

Is there anyway to unlock this device so it's useable again ?

unlock /var/lock/LCK..ttySx doesn't work..  makes the computer THINK it's unlocked, but still doesn't work.

Is there another way I should be doing this?

Thanks
Andrew

q@qonline.com.au
Avatar of bjacobs
bjacobs

Delete the LCK file
Avatar of Q010797

ASKER

that's the same as unlock /var/lock/{lock file}

no go.  I need some correct way of doing it
Which daemons are running??
Do a 'ps -ax' and post it.
Avatar of Q010797

ASKER

I have to wait till the problem occurs again (only ever after a reboot) and I will paste the ps -ax here . .

Have just rebooted.. if I don't have locked tty's in an hour.. I won't have them at all . . makes sense right ? :)
Avatar of Q010797

ASKER

at the moment . .ttyR7 is locked but it shouldn't be

120  ?  S    0:00 /usr/local/sbin/mgetty ttyR6 -n 1 -D -x2 -m "" ATZ OK
  121  ?  D    0:00 /usr/local/sbin/mgetty ttyR7 -n 1 -D -x2 -m "" ATZ OK
  122  ?  S    0:00 /usr/local/sbin/mgetty ttyS0 -n 1 -D -x2 -m "" ATZ OK
  123  ?  S    0:00 /usr/local/sbin/mgetty ttyS1 -n 1 -D -x2 -m "" ATZ OK
  124  ?  S    0:00 /usr/local/sbin/mgetty ttyS2 -n 1 -D -x2 -m "" ATZ OK
  125  ?  S    0:00 /usr/local/sbin/mgetty ttyS3 -n 1 -D -x2 -m "" ATZ OK

it has a D instead of an S next to it... this help anyone fix my problem?
The only way to get a lock-file is to start a deamon which uses that port. The problem can, with other words, be a hanging process or a process with crashed.

If it only occurs during/after a reboot check your boot scripts for such kind of daemons.
Avatar of Q010797

ASKER

Thing is... straight after the boot there will be no lock file for upto 30minutes..  and I assume it's mgetty that is hanging.  Why does it only do it sometimes? and why only after a reboot?  I don't usually have to reboot more than twice for it to go away.
ASKER CERTIFIED SOLUTION
Avatar of luteijn
luteijn
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial