Error: Error while opening serialport 'Error: Error Resource temporarily unavailable Cannot lock port'

HI all,

I’ve followed all steps in the tutorial, but keep running into the same error when starting npm

pi@raspberrypi:/opt/zigbee2mqtt $ DEBUG=zigbee-herdsman* npm start

zigbee2mqtt@1.14.1 start /opt/zigbee2mqtt
node index.js

zigbee2mqtt:info 2020-07-26 15:05:33: Logging to console and > directory: ‘/opt/zigbee2mqtt/data/log/2020-07-26.15-05-33’ filename: log.txt
zigbee2mqtt:debug 2020-07-26 15:05:33: Removing old log directory ‘/opt/zigbee2mqtt/data/log/2020-07-26.14-35-54’
zigbee2mqtt:debug 2020-07-26 15:05:33: Loaded state from file /opt/zigbee2mqtt/data/state.json
zigbee2mqtt:info 2020-07-26 15:05:33: Starting zigbee2mqtt version 1.14.1 (commit #f26791a)
zigbee2mqtt:info 2020-07-26 15:05:33: Starting zigbee-herdsman…
zigbee2mqtt:debug 2020-07-26 15:05:33: Using zigbee-herdsman with settings: ‘{“network”:{“panID”:6754,“extendedPanID”:[221,221,221,221,221,221,221,221],“channelList”:[11],“networkKey”:“HIDDEN”},“databasePath”:"/opt/zigbee2mqtt/data/database.db",“databaseBackupPath”:"/opt/zigbee2mqtt/data/database.db.backup",“backupPath”:"/opt/zigbee2mqtt/data/coordinator_backup.json",“serialPort”:{“baudRate”:115200,“rtscts”:true,“path”:"/dev/ttyUSB.CC2531-01"},“adapter”:{“concurrent”:null}}’
zigbee-herdsman:adapter Path ‘/dev/ttyUSB.CC2531-01’ is valid for ‘ZStackAdapter’ +0ms
zigbee-herdsman:controller:log Starting with options ‘{“network”:{“networkKeyDistribute”:false,“networkKey”:[1,3,5,7,9,11,13,15,0,2,4,6,8,10,12,13],“panID”:6754,“extendedPanID”:[221,221,221,221,221,221,221,221],“channelList”:[11]},“serialPort”:{“baudRate”:115200,“rtscts”:true,“path”:"/dev/ttyUSB.CC2531-01"},“databasePath”:"/opt/zigbee2mqtt/data/database.db",“databaseBackupPath”:"/opt/zigbee2mqtt/data/database.db.backup",“backupPath”:"/opt/zigbee2mqtt/data/coordinator_backup.json",“adapter”:{“concurrent”:null}}’ +0ms
zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with /dev/ttyUSB.CC2531-01 and {“baudRate”:115200,“rtscts”:true,“autoOpen”:false} +0ms
zigbee2mqtt:error 2020-07-26 15:05:34: Error while starting zigbee-herdsman
zigbee2mqtt:error 2020-07-26 15:05:34: Failed to start zigbee
zigbee2mqtt:error 2020-07-26 15:05:34: Exiting…
zigbee2mqtt:error 2020-07-26 15:05:34: Error: Error while opening serialport ‘Error: Error Resource temporarily unavailable Cannot lock port’
at Znp. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:123:32)
at Generator.next ()
at /opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:8:71
at new Promise ()
at __awaiter (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:4:12)
at SerialPort. (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:121:49)
at SerialPort._error (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:198:14)
at /opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules/@serialport/stream/lib/index.js:242:12
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.14.1 start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zigbee2mqtt@1.14.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-07-26T13_05_34_280Z-debug.log

this is my configuration.yaml https://pastebin.com/BgefgQhL

`pi@raspberrypi:/opt/zigbee2mqtt $ test -w [PORT] && echo success || echo failure
failure ´

pi@raspberrypi:/opt/zigbee2mqtt $ sudo chown pi /dev/ttyACM0

pi@raspberrypi:/opt/zigbee2mqtt $ udevadm info -a -n /dev/ttyACM0 | grep ‘serial’

ATTRS{serial}=="__0X00124B0014D9AF63"
ATTRS{serial}=="3f980000.usb"

`

then i change /etc/udev/rules.d/99-usb-serial.rules

SUBSYSTEM==“tty”, ATTRS{idVendor}==“0451”, ATTRS{idProduct}==“16a8”, ATTRS{serial}=="__0X00124B0014D9AF63", SYMLINK=“ttyUSB.CC2531-01”, OWNER=“pi”

i dont no what to do i follow this step ls -l /proc/[0-9]/fd/ |grep /dev/ttyUSB.CC2531-01 but only with sudo it works

`pi@raspberrypi:/opt/zigbee2mqtt ls -l /proc/[0-9]/fd/ |grep /dev/ttyUSB.CC2531-01 ls: cannot open directory '/proc/1/fd/': Permission denied ls: cannot open directory '/proc/2/fd/': Permission denied ls: cannot open directory '/proc/3/fd/': Permission denied ls: cannot open directory '/proc/4/fd/': Permission denied ls: cannot open directory '/proc/8/fd/': Permission denied ls: cannot open directory '/proc/9/fd/': Permission denied pi@raspberrypi:/opt/zigbee2mqtt sudo ls -l /proc/[0-9]/fd/ |grep /dev/ttyUSB.CC2531-01
pi@raspberrypi:/opt/zigbee2mqtt $

`
but the same error?? maybe someone can help me

This is where you go wrong. Do not change permissions or ownership of devices. Instead, add the “pi” user to the “dialout” group.

Besides, is there a reason why you want to pin the port down with the udev rule? I understand that you want to make sure it gets the same port every time, but that is usually not a problem. Mine is the 2nd device to use a port, and it always gets ttyACM1.