3

I'd like to disable my CD/DVD drive so that it doesn't spin up every time I select Save in my Kate editor, or select a file-accessing action in other applications. The spinning up just delays what I'm doing, and I'm not even using the DVD drive.

I want to leave the CD in the drive, and not have it spin up.

I found a website that said a udev rule will definitely disable the drive.

So far, I've tried the following 2 rules (separately), but neither of them disable the DVD drive (it still spins up - even when not mounted):

ENV{ID_SERIAL}=="PIONEER_DVD-RW_DVRTD11RS_SAC1009942", ENV{UDISKS_IGNORE}="1"
KERNEL=="sr0",ENV{UDISKS_IGNORE}="1", RUN+="/bin/touch /home/peter/udev-rule-ran"

The RUN+ in the second instance, creates my test file "udev-rule-ran", so this tells me that my rule file is being executed, and that the rule line is being run.

My Question:

Could you tell me what I should be doing to definitely disable the darned DVD drive? I also want to be able to enable the drive again on the occasions that I need it.

Supplementary Details:

I'm trying very hard to write a udev rule to disable my CD/DVD drive. I've tried various non-udev methods to disable it but none of them work.

There is no loaded module¹⁾ for the drive that I can unload, so I can't use that method to disable the drive.

¹⁾ So I think the driver must be compiled into the kernel.

polemon
  • 11,133
  • 11
  • 69
  • 111
dave
  • 31
  • 2
  • Is there a specific reason why you keep a CD in the drive? If you're certain that you don't want to use it, why have it there? – Hans-Martin Mosner Feb 05 '17 at 21:23
  • 3
    @Hans-MartinMosner Not sure of OP's reason, but I keep mine loaded because it's old (dinosaur) and locks shut if closed empty, even briefly. Not sure of the process, udev or otherwise, but wouldn't `umount`ing it solve the problem? If so, just add `noauto` to the fstab options. – Chindraba Feb 06 '17 at 07:23

2 Answers2

0

To the fine Administrator from OP:

I'm sorry that I can't leave a comment because I'm a guest. So could I humbly ask if you would add my comment below to the page please. Thanks so much.

Thanks Hans-Martin Mosner and Gypsy Spellweaver. Sorry but yes I do have a reason why I want to keep the CD in the drive. Re Gypsy: After umounting the CD, the drive still spins up when I select a file-accessing action in an application. For example, in Kate, when I select File/Save, the Save window appears, then the DVD drive spins up, presumably offering itself for possible use. I checked, and the CD remains unmounted.

dave
  • 1
0

I have also fought with udisks/udisks2 in the past (because may CD is behind a cheap SATA-IDE bridge, which goes into a reset loop if an audio CD is present when udisk tries to poll), and it's really difficult to disable it reliably. It's not properly documented, some stuff changed from udisks to udisks2, etc.

I ended up making a file /etc/udev/rules.d/80-udisks2.rules to circumvent the original /lib/udev/rules.d/80-udisks2.rules with contents:

ACTION!="add|change", GOTO="udisks_end"
SUBSYSTEM!="block", GOTO="udisks_end"
KERNEL=="ram*", GOTO="udisks_end"
ENV{UDISKS_PRESENTATION_NOPOLICY}="1"
ENV{UDISKS_DISABLE_POLLING}="1"

########

LABEL="udisks_end"

This is still not 100% effective, under some conditions udisks2 still gets invoked. For whatever reason.

If you find a more reliable and selective way to disable it, I'd be interested to know.

dirkt
  • 31,679
  • 3
  • 40
  • 73