Continuous repeating Warnings /sys/class/tty/ttyUSB0

Thanks for your help. I will try setting new loglevel.

Should i open an issue on github?

EDIT: Setting loglevel does not work. Warnings are not gone… :confused:

1 Like

yes, do that. The developers may have an other idea on what to check.

Can you post a link to your GitHub issue please?

1 Like

@Wolfgang_S @BigCol

I changed the user from openhab to root in the openhab.service file.

The warning is gone.
So it must be a permission issue but i dont know which one.

could you do the ls commands you did in post 16 without the leading sudo again please ?

[14:23:32] openhabian@smarthome:~$ ls -l /dev/ttyUSB3 /dev/ttyUSB1 /dev/ttyUSB5 /dev/ttyUSB6
crw-rw---- 1 root dialout 188, 1 Dec 25 00:30 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 3 Dec 30 14:20 /dev/ttyUSB3
crw-rw---- 1 root dialout 188, 5 Dec 25 00:30 /dev/ttyUSB5
crw-rw---- 1 root dialout 188, 6 Dec 25 00:30 /dev/ttyUSB6

thank you. Please also for the second command:

ls -ld /sys/class/tty/ttyUSB3 /sys/class/tty/ttyUSB4 /sys/class/tty/ttyUSB5 /sys/class/tty/ttyUSB6

Sorry. Didnt read that.

[20:54:26] openhabian@smarthome:~$ ls -ld /sys/class/tty/ttyUSB3 /sys/class/tty/ttyUSB4 /sys/class/tty/ttyUSB5 /sys/class/tty/ttyUSB6
lrwxrwxrwx 1 root root 0 Dec 30 15:11 /sys/class/tty/ttyUSB3 -> ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/ttyUSB3/tty/ttyUSB3
lrwxrwxrwx 1 root root 0 Dec 30 15:11 /sys/class/tty/ttyUSB4 -> ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1.4/1-1.1.1.4:1.0/ttyUSB4/tty/ttyUSB4
lrwxrwxrwx 1 root root 0 Dec 30 15:11 /sys/class/tty/ttyUSB5 -> ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/ttyUSB5/tty/ttyUSB5
lrwxrwxrwx 1 root root 0 Dec 30 15:11 /sys/class/tty/ttyUSB6 -> ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.4/1-1.1.4:1.0/ttyUSB6/tty/ttyUSB6



[20:54:29] openhabian@smarthome:~$ cd /sys/class/tty
[20:55:28] openhabian@smarthome:/sys/class/tty$ cd ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/ttyUSB3/tty/ttyUSB3
-bash: cd: ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/ttyUSB3/tty/ttyUSB3: Permission denied
[20:55:37] openhabian@smarthome:/sys/class/tty$ ls ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/ttyUSB3/tty/ttyUSB3
ls: cannot access '../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/ttyUSB3/tty/ttyUSB3': Permission denied
[20:56:00] openhabian@smarthome:/sys/class/tty$ sudo ls -l ../../devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/ttyUSB3/tty/ttyUSB3
total 0
-r--r--r-- 1 root root 4096 Dec 30 20:56 dev
lrwxrwxrwx 1 root root    0 Dec 30 15:11 device -> ../../../ttyUSB3
drwxr-xr-x 2 root root    0 Dec 30 20:56 power
lrwxrwxrwx 1 root root    0 Dec 30 20:56 subsystem -> ../../../../../../../../../../../../../../../class/tty
-rw-r--r-- 1 root root 4096 Dec 30 15:11 uevent
[20:56:13] openhabian@smarthome:/sys/class/tty$

I found out, that the permission of “usb1” directory is not correct:

drw-rw---- 6 root root    0 Dec 30 15:11 usb1/
drwxr-xr-x 6 root root    0 Dec 30 15:11 usb2/


[08:56:24] openhabian@smarthome:/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0$ cd usb1
-bash: cd: usb1: Permission denied
[08:56:33] openhabian@smarthome:/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0$ sudo chmod 755 usb1

After this change the warning is gone.

So the question is: When will this created an how can i change the default permissions?

have a look to udev rules.
You can find a set of rules in directory /etc/udev/rules.d.
Check if for your device ( vendor, product ) a specific rule is created.

These articles usb - Understanding udev rules and permissions in libusb - Unix & Linux Stack Exchange
udev - Debian Wiki may help a bit.
If they don’t please let us know.

@Wolfgang_S

Ive extended my udev rules to set rights and groups but that did not help.
So ive added the RUN parameter with chmod of the problem directory. This worked in my
udevadm trigger test but not always at reboot.

There is a race condition between udev daemon and mounting filesystems. When udev ran before filesystem is mounted then my udev rule did not work.

The last piece of the puzzle was creating a systemd service which only runs
udevadm trigger

Now the warning is gone and reboots are fine.

Thanks for your help!

2 Likes

Nice to see that you were able to find a solution.

Hi! Could somoeone explain clearly how to fix this issue?

can you short explain what udevadm trigger do - I tried it because I have the same problem but it doesn’t change anything. Is there something what must be resvert ?

I was wondering a little bit because the problem I got today after a reboot - before it runs without problems. I restart oh3 every day and there are also no problems. Thats what I don’t understand. I never changed anything in the last time outside OH
thanks and regards
Christian

The problem seems to be permission in the path /sys/class/tty/ttyXXX or item the link points to.
E.g.

ls -lH /sys/class/tty/ttyUSB0   /sys/class/tty/ttyUSB1  /sys/class/tty/ttyACM0

The code that generates the log entry converts the symbolic link to a real path. If the symbolic link cannot be converted to the real path, null is returned and a warning is logged.

I would say this is a problem of a prober permission setting done either by udev rules or by the driver itself.
As a workaround @s4ndst0rm added RUN parameter to the udev rule for the related device.
With udevadm trigger the rule can be triggered to correct the permission.
As that was not always working during boot he created a systemd startup script that executes the udevadm trigger command to be sure that the permissions are always set by the udev rule by forcing it again ( to overwrite the missing permission ).

Ill post my udev Rules and systemd Service when im at home later.

That would be great. I’m dealing with the same and it looks like something with the OH3 upgrade goes wrong. Before I have not this warning.

My udev rule file:

[00:29:33] openhabian@smarthome:~$ cat /etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{serial}=="00F3029C", SYMLINK+="StromHeizung", GROUP="openhab", MODE="0666", RUN+="/usr/bin/chmod 755 /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1"
SUBSYSTEM=="tty", ATTRS{serial}=="00F2E5DA", SYMLINK+="StromHaushalt", GROUP="openhab", MODE="0666", RUN+="/usr/bin/chmod 755 /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1"
SUBSYSTEM=="tty", ATTRS{serial}=="AI03092S", SYMLINK+="Vitocal", GROUP="dialout", MODE="0666", RUN+="/usr/bin/chmod 755 /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1.4/1-1.1.1.4:1.0"
SUBSYSTEM=="tty", ATTRS{serial}=="AC00ISM6", SYMLINK+="Wasseruhr", GROUP="openhab", MODE="0666", RUN+="/usr/bin/chmod 755 /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1"
SUBSYSTEM=="tty", ATTRS{bNumEndpoints}=="03", ATTRS{bInterfaceNumber}=="00", SYMLINK+="GSMStick", GROUP="dialout", MODE="0666", RUN+="/usr/bin/chmod 755 /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1"
[00:30:00] openhabian@smarthome:~$

Because of a race condition between mounting filesystems and udev it is possible that udev rule is triggered before filesystems are mounted.
So my udev RUN command does not work.

For this case i am using systemd to start a oneshot service which only runs “udevadm trigger”.
This runs the rules again. So its safe that the proper permissions are set.

Here my systemd service file:

[00:32:57] openhabian@smarthome:~$ cat /etc/systemd/system/systemd-udev-trigger.service
[Unit]
Description=udev Coldplug all Devices
Wants=systemd-udevd.service
After=systemd-udevd-kernel.socket systemd-udevd-control.socket
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/udevadm trigger

[Install]
WantedBy=multi-user.target

[00:33:31] openhabian@smarthome:~$
2 Likes

Hi Dominik,

many thanks for sharing ! This helps me very much.

best
Christian