Unavailable Cannot lock port

hello , i have a problem with the serial port , the error is serial port /dev/ttyUSB0 error: Error: Error Resource temporarily unavailable Cannot lock port, please help

29 Oct 10:56:29 - [info] Node-RED version: v1.0.2
29 Oct 10:56:29 - [info] Node.js version: v10.17.0
29 Oct 10:56:29 - [info] Linux 4.19.75-v7+ arm LE
29 Oct 10:56:30 - [info] Loading palette nodes
29 Oct 10:56:33 - [info] Dashboard version 2.17.1 started at /ui
29 Oct 10:56:34 - [info] Starting flows
29 Oct 10:56:34 - [info] Started flows
29 Oct 10:56:34 - [error] serial port /dev/ttyUSB0 error: Error: Error Resource temporarily unavailable Cannot lock port
29 Oct 10:56:34 - [info] Server now running at http://127.0.0.1:1880/

usually this means that some other app has already opened the port, or the user you are running as does not have access to it.

i dont open other app, only node-red and disabled the node "arduino node-red" only eneable node "serial port"

I don't use the arduino node, but I see it has a config node arduino-board. Does that use the serial port? If so then if you have one of these configured then I suspect it maybe using the port. Disabling the in/out nodes will not stop that. I suggest deleting them from the flow, including the config node, and see if that helps.

thanks , the serial port now open

I have the same problem and cannot find a solution. I use serial node not the arduino node. One for incomming data from arduino and one for sending data to arduino over node-red. It took one hour of try to solve the problem but i couldn't solve it.

I am trying to control some sensors and a hydraulic system and vane with a servo via rapsberry pi and arduino. Serial port problem makes this sytem useless. Do i have to use something different than serial communication (maybe modbus or wireless) or can i solve serial problem using a function like C# or Python code which are too simple and stable?

well if it can't be locked it must be already held by something else - so you need to identify which application is already talking to the serial port and stop it - and then restart/redeploy Node-RED.

1 Like

How can i find which program uses the serial port?

Because there is nothing running in dektop of pi 4 maybe a program which is running in background can cause this. But i don't know how to find it.

There is a ton of posts on the web about this. A quick search for "linux find process using serial port" returned many results.

This one should help, but if not, Google it yourself.

I have found the problem and fix it. There is no other program or software was using serial port /dev/ttyACM0 was being used by another flow in a passive node-red window. I have to delete that page and nodes.

1 Like