RS232 udev rule not working on startup

Hello everyone,

I am trying to make a symlink for my rs232 device (for which I am using a usb convertor). I have a udev rule in my service which does that as the following:

ACTION=="add", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0666", SYMLINK+="RS232-1"

This works fine in normal conditions. However, when I try to reboot the system, udev rule no longer works. More precisely, the device gets mounted but it is not symlinked. In such a case I should either trigger the udev rules manually or simply replug the device. What is strange is that I have other udev rules e.g., for mounting external storage disks and those work fine on reboots as well, but for the rs232 it fails. I have even tried a different device and it’s the same. I have also tested this on two different BalenaOS versions: balenaOS 3.0.17 and balenaOS 2.115.8+rev1 and both were the same.

Does anyone know what could be causing it and how I can solve it (without manual intervention)?

Thanks in advance for your help.

Hello @alireza-moayyedi first of all welcome to the balena community.

Could you please confirm how are you trying this udev-rules? Could you please share more details?

When you restart the device do you see any error on the USB that you use for the RS232 using dmesg?

Hello @mpous ,

Thanks for the warm welcome. I have my rs232.rules inside /etc/udev/rules.d/ with the following content:

ACTION=="add", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0666", SYMLINK+="RS232-1"

I have also other rules in the same place for automatically mounting/unmounting external storage disks and they work always fine.

Regarding the dmesg, I tried rebooting (hence the unsuccessful udev rule) and then replugging my convertor (successful udev rule) and as you can see the same output is being shown:

I would be happy to give you any extra information upon request.

@alireza-moayyedi could you please confirm what device type are you using?

@mpous I’m using a Lenovo ThinkStation P360 Tower computer with Intel® Core™ i9-12900K-processor for which I have installed the Generic x86_64 (GPT) BalenaOS on it.

Hello @alireza-moayyedi i’m reading this Apply custom udev rule at boot - Fedora Discussion and actually they mention that it could be related with a timing issue.

Could you please try their solution?

@mpous Thanks a lot for the hint. adding the change to my udev rule solved the problem! It seems like the device’s properties change on startup. The updated rule:

ACTION=="add|change", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0666", SYMLINK+="RS232-1"

Thanks a lot for your support, much appreciated!

1 Like

Glad to see that this worked @alireza-moayyedi

Let us know if we can help you more!

1 Like