# 70-persistent-cd.rules not working??

## tld

Wow...this one's had me ripping my hair out for hours...I just don't get it.

My 70-persistent-cd.rules have apparently stopped working entirely on all my gentoo boxes.  I'm not getting any of my /dev/cdrom, /dev/dvd etc symlinks...just /dev/scd0, /dev/scd1 etc.

I'm also confused about stuff I keep reading about 70-persistent-cd.rules getting auto generated.  I thought maybe I need to regenerate that and edit it, but if I move it somewhere and reboot, it doesn't get generated.

Looking at the wiki:

http://wiki.gentoo.org/wiki/Udev

I noticed that I in fact didn't have a few of those kernel options set...the block layer sg one and the devtmpfs.  However enabling them didn't help, and I'm sure I never had them set in the past and had no issues.

I have three machines with the same problem, and I'm getting nowhere.  I'm not clear when this changed, as I actually don't do a lot of things that require those links.

Any help would be appreciated.

Tom

----------

## tld

Unreal.  My 70-persistent-cd.rules file had several auto generated entries for each of my drives, much like what's shown in this (apparently unresolved) post:

https://forums.gentoo.org/viewtopic-t-891630.html

Mine looked like this:

```
# This file was automatically generated by the /lib/udev/write_cd_rules

# program, probably run by the cd-aliases-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single line

# and set the $GENERATED variable.

# PIONEER_DVD-RW_DVR-111D (pci-0000:00:1f.1-ide-1:0)

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-1:0", SYMLINK+="cdrom", ENV{GENERATED}="1"

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-1:0", SYMLINK+="dvd", ENV{GENERATED}="1"

# SAMSUNG_CD-RRW_SW-248F (pci-0000:00:1f.1-ide-1:1)

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-1:1", SYMLINK+="cdrom2", ENV{GENERATED}="1"

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-1:1", SYMLINK+="cdrw", ENV{GENERATED}="1"

#  (pci-0000:00:1f.1-scsi-1:0:0:0)

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-1:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-1:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1"

#  (pci-0000:00:1f.1-scsi-1:0:1:0)

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-1:0:1:0", SYMLINK+="cdrom2", ENV{GENERATED}="1"

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-1:0:1:0", SYMLINK+="cdrw", ENV{GENERATED}="1"

# LaCie_DVD_Drive_USB2 (pci-0000:02:02.2-usb-0:2:1.0-scsi-0:0:0:0)

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="cdrom3", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="cdrw3", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="dvd3", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="dvdrw3", ENV{GENERATED}="1"

# SAMSUNG_CD-R_RW_SW-248F (pci-0000:00:1f.1-scsi-0:0:1:0)

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-0:0:1:0", SYMLINK+="cdrom4", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-0:0:1:0", SYMLINK+="cdrw4", ENV{GENERATED}="1"

# PIONEER_DVD-RW_DVR-111D (pci-0000:00:1f.1-scsi-0:0:0:0)

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-0:0:0:0", SYMLINK+="cdrom5", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-0:0:0:0", SYMLINK+="cdrw5", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-0:0:0:0", SYMLINK+="dvd5", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-scsi-0:0:0:0", SYMLINK+="dvdrw5", ENV{GENERATED}="1"

```

No matter what I did, NONE of the above pci related entries would work.  The only way I seem to be able to get my symlinks is with very simply entries like this, creating links based on the existing sr0 and sr1 names:

```
SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="dvd", GROUP="cdrom", ENV{GENERATED}=1

SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="cdrom", GROUP="cdrom", ENV{GENERATED}=1

SUBSYSTEM=="block", KERNEL=="sr1", SYMLINK+="cdrom2", GROUP="cdrom", ENV{GENERATED}=1

```

What's really unusual is that, when I tried plugging in a USB dvd burner I have, it automatically added three lines to my 70-persistent-cd.rules:

```

# LaCie_DVD_Drive_USB2 (pci-0000:02:02.2-usb-0:4:1.0-scsi-0:0:0:0)

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="cdrom3", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="cdrw3", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="dvd3", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="LaCie_LaCie_DVD_Drive_USB2_10000E0008441C1E", SYMLINK+="dvdrw3", ENV{GENERATED}="1"

```

...yet for the life of me I could NOT get it to generate that stuff for my ide drives.  Honest to God...has udev just gotten this buggy??

Tom

----------

## toofastforyahuh

1.  Yes, I also see that udev-171 does not regenerate persistent CD rules upon reboot.

I was about to try udev-189, but upon emerging it a notice appeared saying all persistent network and CD rule generation scripts were removed upstream. (!!)  So apparently we need to write our own rules from now on anyway.  I promptly gave up on udev-189 without even trying it.

2.  I'm no udev rule expert, but I guess "ID_PATH" may be the culprit, even though its values for PCI bus and SCSI ID are correct.  My fresh gentoo install had the following rules from somewhere.

```

# ATAPI_iHAS124_C (pci-0000:00:11.0-scsi-5:0:0:0)

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-5:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-5:0:0:0", SYMLINK+="cdrw", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-5:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-5:0:0:0", SYMLINK+="dvdrw", ENV{GENERATED}="1"

```

and this simply did NOT work.

I saw no such ID_PATH variables in the output of this command.

```

udevadm  info --query=all --name=/dev/sr0

```

But there were plenty of other hooks to try.  I chose to key off of "ID_MODEL" instead, since I only have one of these optical drives, and it will therefore be unique.

```

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_MODEL}=="ATAPI_iHAS124_C", SYMLINK+="cdrom", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_MODEL}=="ATAPI_iHAS124_C", SYMLINK+="cdrw", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_MODEL}=="ATAPI_iHAS124_C", SYMLINK+="dvd", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_MODEL}=="ATAPI_iHAS124_C", SYMLINK+="dvdrw", ENV{GENERATED}="1"

```

and this finally worked.

 *Quote:*   

> 
> 
> has udev just gotten this buggy??
> 
> 

 

As a gentoo user since 2004, udev's been buggy since day 1.  I still disagree with the whole concept.

----------

## jchau

Thanks, toofastforyahuh.  I've had the same problem.

----------

## gsom

My version, seems to be more unique:

Getting info from udevadm info --query=all --name=/dev/sr0

```
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", DEVPATH=="/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/ata7/host6/target6:0:0/6:0:0:0/block/sr0", SYMLINK+="cdrom", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", DEVPATH=="/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/ata7/host6/target6:0:0/6:0:0:0/block/sr0", SYMLINK+="cdrw", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", DEVPATH=="/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/ata7/host6/target6:0:0/6:0:0:0/block/sr0", SYMLINK+="dvd", ENV{GENERATED}="1"

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", DEVPATH=="/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/ata7/host6/target6:0:0/6:0:0:0/block/sr0", SYMLINK+="dvdrw", ENV{GENERATED}="1"
```

----------

## jchau

I think the main idea though is that you don't want "sr0" to be in your match rules because that's not static/persistent.  If the kernel decides to name your CD/DVD drive "sr1" instead (because it decided to call another CD/DVD drive "sr0"), the rules you have would break since "sr0" would no longer be on that devpath.  As a result, you would have no cdrom, cdrw, dvd, or dvdrw symlinks (not even to the second drive that's now called "sr0" since the new "sr0" may not be on the same devpath).

----------

