Why do I get Error No Permission to Create Lock File when I try to receive Data via USBtoSerial in MATLAB on RHEL 7?
8 views (last 30 days)
Show older comments
MathWorks Support Team
on 26 Feb 2018
Edited: MathWorks Support Team
on 23 Oct 2023
I have a problem with reading data over an usb-to-uart ftdi interface (C232HD). The interface is connected to a microcontroller which is transmitting the data.
I can see on minicom how data is received, but no chance to see it in matlab.
I also have created as symbolic link from /dev/ttyUSB0 to /dev/ttyS100. I tried also the java.opts file to place in userpath.
On another Windows Machine it works fine. It seems to be a Linux problem.
MATLAB can recognize the port.
>> instrhwinfo('serial')
ans =
HardwareInfo with properties:
AvailableSerialPorts: {2×1 cell}
JarFileVersion: 'Version 3.11'
ObjectConstructorName: {2×1 cell}
SerialPorts: {2×1 cell}
Access to your hardware may be provided by a support package. Go to the Support Package Installer to learn more.
>> ans.AvailableSerialPorts
ans =
2×1 cell array
'/dev/ttyS1'
'/dev/ttyS0'
>> instrhwinfo('serial')
ans =
HardwareInfo with properties:
AvailableSerialPorts: {3×1 cell}
JarFileVersion: 'Version 3.11'
ObjectConstructorName: {3×1 cell}
SerialPorts: {3×1 cell}
Access to your hardware may be provided by a support package. Go to the Support Package Installer to learn more.
>> ans.AvailableSerialPorts
ans =
3×1 cell array
'/dev/ttyUSB0'
'/dev/ttyS1'
'/dev/ttyS0'
MATLAB properly recognizes /dev/ttyUSB0.
The port permissions of /dev/ttyUSB0 is 666
>> system('ls -als /dev/ttyUSB0')
0K crw-rw-rw- 1 root root 188, 0 Jan 16 14:27 /dev/ttyUSB0
Accepted Answer
MathWorks Support Team
on 23 Oct 2023
Edited: MathWorks Support Team
on 23 Oct 2023
This error could appear if you do not have read/write access to /lock directory.
ERROR: $ ls -ald /var/lock
lrwxrwxrwx. 1 root root 1K Jun 22 2017 /var/lock -> ../run/lock
$ ls -ald /run/lock
drwxr-xr-x 8 root root 1K Feb 23 13:10 /run/lock
$ touch /var/lock/testtouch: cannot touch ‘/var/lock/test’: Permission denied
To fix this, change the permission on /lock directory
$ sudo chmod o+w /run/lock
$ ls -ald /run/lock
drwxr-xrwx 8 root root 1K Feb 23 13:10 /run/lock
$ touch /var/lock/test
$ ls -al /var/lock/test
-rw-r----- 1 maximilian.sgodda ime 0K Feb 23 13:17 /var/lock/test
You may need to reboot as well
$ reboot
$ ls -ald /run/lock
drwxr-xr-x 8 root root 1K Feb 23 13:20 /run/lock
0 Comments
More Answers (0)
See Also
Categories
Find more on Instrument Control Toolbox Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!