Udev Randomly Doesn't Run Run Script on Remove

Bug #1906263 reported by Marjan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Hello, I'm running ubuntu (Description: Ubuntu 18.04.4 LTS, Release: 18.04) with 5.0.21-sunxi kernel.
I've updated udev to latest version (237-3ubuntu10.43 500).
I've written the following rule to create (and removing) symlink to modem ports:

https://pastebin.com/cUwHrf1f

Since many usb modems hase more than one serial i enumerate them with their port number (as just some specific serial can be used to connect)

Here link to mu RUN script /opt/trx/gprs-modem-symlink-handler.bash

https://pastebin.com/2XTCiV27

What I expect to happen is having many /dev/ttyTRXGPRSMODEM* (enumerated) when I plug-in a modem in the list, and having symlink cleared on removing.

every modem listed in rule is using "option" usb serial driver.

When i plug in a device I have no issues, everything works fine.
But sometimes, on removing, I found that some links are still there (it's not happening everytime).

I've enabled debug log with udev and found that sometimes is not calling RUN script:

Here the working situation (3 tty remove events and 3 RUN events):

https://pastebin.com/EKX5zMh7

And here is the buggy situation (3 tty remove events, but only 2 RUN events) with the same device as the example above:

https://pastebin.com/dB7ujQ79

Since it's happening randomly I can't figure out whats causing the problem.

I guess it's not the rule because on an old debian 7 release it's working fine, and on the release described above I get others symlinks removed even in the buggy situation (as in the example: two are removed, one not).

It seems like sometimes udev ignores totally the run event.

Last thing to report: I'm not opening these links! So are not locked or protected.

Revision history for this message
lotuspsychje (lotuspsychje) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please execute the following command only once, as it will automatically gather debugging information, in a terminal:
apport-collect 1906263

When reporting bugs in the future please use apport by using 'ubuntu-bug' and the name of the package affected. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

Revision history for this message
Marjan (frikoanpulento) wrote :

Thank you for your response.

I wasn't able to run properly "apport-collect" due to browser/screen problem (I'm on an embedded device).

Here result of ubuntu-bug udev

Revision history for this message
Marjan (frikoanpulento) wrote :

Whooops, I read to avoid pastebin links, I'll attach files from original post.
here modem rule in /etc/udev/rules.d/

Revision history for this message
Marjan (frikoanpulento) wrote :

here my RUN script /opt/trx/gprs-modem-symlink-handler.bash

Revision history for this message
Marjan (frikoanpulento) wrote :

Correct Remove (3 remove tty events and 3 RUN events)

Revision history for this message
Marjan (frikoanpulento) wrote :

Wrong Remove

Revision history for this message
Marjan (frikoanpulento) wrote :

(3 remove tty events and 2 RUN events)

Revision history for this message
Marjan (frikoanpulento) wrote :

Hello, just to be sure, I've tried with different kernel versions (5.3.18 and 5.4.81) and the problem's still here.
Same udev version (last) 237-3ubuntu10.43.

Revision history for this message
Marjan (frikoanpulento) wrote :

Other useful info:
I've run
udevadm test --action=remove /devices/platform/soc/1c14000.usb/usb1/1-1/1-1.2/1-1.2:1.2/ttyUSB2/tty/ttyUSB2
Several times, but everytime I got

ACTION=remove
DEVNAME=/dev/ttyUSB2
DEVPATH=/devices/platform/soc/1c14000.usb/usb1/1-1/1-1.2/1-1.2:1.2/ttyUSB2/tty/ttyUSB2
MAJOR=188
MINOR=2
SUBSYSTEM=tty
run: '/opt/trx/gprs-modem-symlink-handler.bash remove /devices/platform/soc/1c14000.usb/usb1/1-1/1-1.2/1-1.2:1.2/ttyUSB2/tty/ttyUSB2 ttyUSB2'
Unload module index
Unloaded link configuration context.

Which is the correct behaviour.

But, again, when in unplugged the modem it doesn't run RUNscript for ttyUSB2.
I'm sure it doesn't raises error because in /var/log/syslog the log line
starting '/bin/bash /opt/trx/gprs-modem-symlink-handler.bash remove /devices/platform/soc/1c14000.usb/usb1/1-1/1-1.2/1-1.2:1.2/ttyUSB2/tty/ttyUSB2 ttyUSB2'
Is missing (only when I have this bad behaviour, so not every disconnection, but randomly).

Revision history for this message
Marjan (frikoanpulento) wrote :

I've upgraded to ubuntu 20.4.1. Udev verision now is 245.4-4ununtu3.3. Problem persists

Revision history for this message
Dan Streetman (ddstreet) wrote :

I suggest you test with the latest upstream systemd code, and report it there if it still exists upstream.

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.