LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   [Request] udev ACTION=="remove" NOT WORKING CORRECTLY , tried everything (https://www.linuxquestions.org/questions/linux-software-2/%5Brequest%5D-udev-action%3D%3D-remove-not-working-correctly-tried-everything-4175662283/)

finalturismo 10-09-2019 10:28 AM

[Request] udev ACTION=="remove" NOT WORKING CORRECTLY , tried everything
 
Ok guys so i have been working on my drive wiper for a while now, i keep making progress and getting help. This on the other hand seems to be a nightmare. I cant for the life of me get udev remove action to work. I have no problem with the following


Code:

ACTION=="remove", KERNEL=="sdb", RUN+="/bin/udev_sdb_shred"




The remove rule seems simply just not be working correctly.
Code:

ACTION=="remove", KERNEL=="sdb", RUN+="/bin/udev_sdb_shred"
Code:

ACTION=="remove", ENV{DEVTYPE}=="disk", RUN+="/bin/udev_sdb_remove"


The idea is to put drives in the wiper and have them start wiping automatically with shred (Works great). if i come across a bad drive in the process , just pull it out.

I noticed on dmesg when i pull the drive it automatically kills /bin/udev_sdb_shred by default and times out. (This is great, but it does not kill the actual shred

process........) Just the script holding the shred process.

So i need either the remove feature of udev to be working correctly or the automatic kill feature of udev when a drive is pulled and stops responding to work.

code of /bin/udev_sdb_shred (auto killed by udev when drives no longer responses via I/O)
Code:

shred -v -f -z /dev/sdb  (not autokilled - actual code of udev_sdb_shred)

Any ideas guys, i got everything working even the auto upload log to my website.



This is literally my LAST hurdle before this project is completely finished.

berndbausch 10-10-2019 06:48 AM

Quote:

Originally Posted by finalturismo (Post 6045400)
The remove rule seems simply just not be working correctly.
Code:

ACTION=="remove", KERNEL=="sdb", RUN+="/bin/udev_sdb_shred"
Code:

ACTION=="remove", ENV{DEVTYPE}=="disk", RUN+="/bin/udev_sdb_remove"

The first rule seems to run udev_sdb_shred when sdb is pulled out. This confuses me, because I would think that you want to stop shredding at this moment.
The second rule runs a different script udev_sdb_remove when any disk is pulled out.
Is my interpretation correct? Admittedly, I am not certain about the meaning of the KERNEL and ENV{DEVTYPE} attributes.

You say that it's not working correctly. Do you mean the scripts are not invoked?

Did you run udevadm monitor to see what udev events are actually generated, and what their attributes are?


All times are GMT -5. The time now is 05:13 PM.