LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-07-2013, 01:59 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
udev rules: ACTION values and their significance?


Hi

I just solved a udev problem by adding ACTION=="add" to the rule. Before that the udev rule -- for a partition on a USB HDD -- was triggered when the USB HDD's partition was fscked.

What are the possible ACTION values and their significance?

The udev man page is coy:
Quote:
ACTION
Match the name of the event action.
Searching the /lib/udev/rules.d/* files showed ACTION values of "add", "change" and "remove" (and one "add|change").

Which changes are covered by "change"? In general they seem to be changes in a device's attributes; detail can be found by running udevadm monitor --property.

Doing so before an fsck showed two sets of changes but none of them were obviously related to fsck. Perhaps while running fsck, the kernel learns more about the partition so the "change" is "here are some more attributes" ... ?
 
Old 10-07-2013, 02:05 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
I see by the timestamp on your post that you posted about 14 hours ago. You could have had your answer in a few minutes using a web browser.

You could have found this, from and article at Oracle.com:
Quote:
ACTION
Matches the name of the action that led to an event. For example, ACTION="add" or ACTION="remove".
It seems that ACTION is a reporting tool to match an action to a device name.

You could also have found this short article which gives one example of how to use information provided by ACTION.
 
Old 10-07-2013, 06:22 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by bigrigdriver View Post
You could also have found this short article which gives one example of how to use information provided by ACTION.
Looks to me like a pretty bad example. The ACTION=="remove" rule will indeed be triggered when the device is unplugged, but by that time it's too late to run a umount script.
 
Old 10-09-2013, 12:46 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks rknichols

Maybe I should state the questions better rather than reporting my research ...
  • What are the possible actions (is add, change and remove the complete list)?
  • Which events or class of events result in (the kernel communicating) a change action (to udevd)?
 
Old 10-09-2013, 11:22 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
It turned out that adding ACTION=="add" to the rule was an incomplete fix. It fixed the problem of the RUN+= command being run when the partition on the USB HDD was fscked but it also resulted in the symlink created by SYMLINK+= being deleted.

The solution (tested but not yet by extensive usage) was to create a second rule, identical to the first except for ACTION=="change" and having no RUN+=.
 
Old 09-24-2014, 01:58 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
The solution in the last reply has now been extensively tested and found effective.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/udev/rules.d/70-persistent-net.rules and 'ip link' rename rakeafake Linux - Networking 4 02-01-2016 08:34 PM
[SOLVED] Missing /etc/udev/rules.d/70-persistent-net.rules - Chapter 7.2.1. Mordillo98 Linux From Scratch 5 06-11-2012 08:37 PM
[SOLVED] udev rules - how to pass ATTRS{*} values to the RUN command? catkin Programming 8 09-26-2010 05:43 AM
cat: /etc/udev/rules.d/70-persistent-net.rules: No such file or directory rcg1984 Linux From Scratch 2 09-17-2008 07:02 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration