Hi,
what's the proposed way to permanently change udev rules in Fedora?
The file I need to edit has a comment in it: "do not edit this file, it will be overwritten on update".
On 07/17/13 08:07, lee wrote:
Hi,
what's the proposed way to permanently change udev rules in Fedora?
The file I need to edit has a comment in it: "do not edit this file, it will be overwritten on update".
From "man 7 udev"
The udev rules are read from the files located in the system rules directory /usr/lib/udev/rules.d, the volatile runtime directory /run/udev/rules.d and the local administration directory /etc/udev/rules.d. All rules files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical file names replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same name in /lib. This can be used to override a system-supplied rules file with a local file if needed; a symlink in /etc with the same name as a rules file in /lib, pointing to /dev/null, disables the rules file entirely.
Ed Greshko Ed.Greshko@greshko.com writes:
On 07/17/13 08:07, lee wrote:
Hi,
what's the proposed way to permanently change udev rules in Fedora?
The file I need to edit has a comment in it: "do not edit this file, it will be overwritten on update".
From "man 7 udev" with the same name in /lib. This can be used to override a system-supplied rules file with a local file if needed; a symlink in /etc with the same name as a rules file in /lib, pointing to /dev/null, disables the rules file entirely.
Thank you! So I'll just copy the file I want to modify into /etc/udev/rules.d/ and delete everything I don't want to modify, that should work ...
On 07/16/2013 08:39 PM, lee wrote:
Thank you! So I'll just copy the file I want to modify into /etc/udev/rules.d/ and delete everything I don't want to modify, that should work ...
Please let us know how this works. I'm sure that there are others on this list who could take advantage of the information.
Joe Zeff joe@zeff.us writes:
On 07/16/2013 08:39 PM, lee wrote:
Thank you! So I'll just copy the file I want to modify into /etc/udev/rules.d/ and delete everything I don't want to modify, that should work ...
Please let us know how this works. I'm sure that there are others on this list who could take advantage of the information.
This won't work because when I delete everything else from the copy of the file and leave only what I want, it would mean that everything I might want will not be in effect because my copy of the file would wholly replace the file provided as default.
So I can't do this.
What I'm trying to do is three things:
+ make it so that smart information is not being polled from /dev/sda
+ make it so that DVD drives are not being polled for media changes
+ make sure that /dev/sda can go into sleep mode without being woken up unless I mount the file system it has on it
I have made a service file for systemd so that 'hdparm -S 240 /dev/sda' is being run automatically --- it could use some improvement so that it goes by UUID rather than by the device name, but that's a different problem.
Any ideas on how to achieve this?
Trying to do anything related to udev is like trying to read 500 pages of a pgp encrypted binary file without being able to decrypt it and without even knowing what kind of file it is :(
In case it might be useful for someone:
[Unit] Description=enable power saving for hard disk(s) After=syslog.target network.target remote-fs.target nss-lookup.target
[Service] Type=simple User=root Group=root ExecStart=/sbin/hdparm -S 240 ExecReload=/sbin/hdparm -S 240 RemainAfterExit=yes
[Install] WantedBy=multi-user.target
On 07/16/2013 09:32 PM, lee wrote:
Joe Zeffjoe@zeff.us writes:
On 07/16/2013 08:39 PM, lee wrote:
Thank you! So I'll just copy the file I want to modify into /etc/udev/rules.d/ and delete everything I don't want to modify, that should work ...
Please let us know how this works. I'm sure that there are others on this list who could take advantage of the information.
This won't work because when I delete everything else from the copy of the file and leave only what I want, it would mean that everything I might want will not be in effect because my copy of the file would wholly replace the file provided as default.
Thank you. Even knowing that your idea won't work as originally suggested is better than nothing. Let's all hope that your new idea works out.
On 07/17/13 12:32, lee wrote:
Joe Zeff joe@zeff.us writes:
On 07/16/2013 08:39 PM, lee wrote:
Thank you! So I'll just copy the file I want to modify into /etc/udev/rules.d/ and delete everything I don't want to modify, that should work ...
Please let us know how this works. I'm sure that there are others on this list who could take advantage of the information.
This won't work because when I delete everything else from the copy of the file and leave only what I want, it would mean that everything I might want will not be in effect because my copy of the file would wholly replace the file provided as default.
So I can't do this.
Then try this.....
Make a new file with a new name in /etc/udev/rules.d with only your specific rules? The one thing that isn't clear to me is if you should have a higher number or a lower number than a rule which may also match the condition you're trying to catch. I can't tell, from the documentation, if rules processing stops when a match is made or if rules are processed in order such that the last match is what is used.
So, to me, the question would be what is more appropriate. 10-mystuff.rules or 99-mystuff.rules.
Ed Greshko Ed.Greshko@greshko.com writes:
On 07/17/13 12:32, lee wrote:
Joe Zeff joe@zeff.us writes:
On 07/16/2013 08:39 PM, lee wrote:
Thank you! So I'll just copy the file I want to modify into /etc/udev/rules.d/ and delete everything I don't want to modify, that should work ...
Please let us know how this works. I'm sure that there are others on this list who could take advantage of the information.
This won't work because when I delete everything else from the copy of the file and leave only what I want, it would mean that everything I might want will not be in effect because my copy of the file would wholly replace the file provided as default.
So I can't do this.
Then try this.....
Make a new file with a new name in /etc/udev/rules.d with only your specific rules?
Which rules do I need to make for what I'm trying to achieve?
So, to me, the question would be what is more appropriate. 10-mystuff.rules or 99-mystuff.rules.
The man page of udev says:
,---- | All rules files are collectively sorted and processed in lexical | order, regardless of the directories in which they live. `----
Something like 'zzzz-blah.rule' might be executed last. Since file names can contain all kinds of characters and there isn't any way to close this security hole, like by limiting the characters allowed in file names, the rule would have to have an unlimited number of whatever character no. 65535 is as its file name.
So now I have made /etc/udev/rules.d/zzzz-yun-disable-media-polling.rules:
# disable in-kernel media-presence polling ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}!="0", ATTR{parameters/events_dfl_poll_msecs}="0"
I don't know if this is a good idea. If some software wants to poll some block device now, it could do so nonetheless and might employ a worse way of doing it. OTOH, I don't see any reason why devices should be polled every 2 seconds like the default rule specifies. Why would anyone want that??
How do I apply this rule? Can udev be somehow restarted?
There is another problem with this: My new rule doesn't disable a default one, it merely overrides the default one. That probably works in this case, but there's also /usr/lib/udev/rules.d/80-udisks.rules which has:
# Check if a disk is ATA SMART capable #
# USB ATA enclosures with a SAT layer KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
# ATA disks driven by libata KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="ata", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
# ATA disks connected via SAS (not driven by libata) KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="scsi", ENV{DEVTYPE}=="disk", ENV{ID_VENDOR}=="ATA", IMPORT{program}="udisks-probe-ata-smart $tempnode"
If this is what I want to disable, how would I do that?
lee lee@yun.yagibdah.de writes:
What I'm trying to do is three things:
make it so that smart information is not being polled from /dev/sda
make it so that DVD drives are not being polled for media changes
make sure that /dev/sda can go into sleep mode without being woken up unless I mount the file system it has on it
I ended up removing the udisks2 and udisks packages, and after killing udisks2, /dev/sda is finally asleep.
Why is the smart data requested all the time? Is something processing this data to send a warning if there is an indication that a disk might fail?
Besides removing this udisks stuff, what is the proposed way of disabling these daemons?
There isn't even any decent documentation about these things.