Multimedia Optical Drive Naming (ie /dev/dvd & /dev/cdrom) How To in openSUSE

Well, I have come to a new understanding of optical drive naming and just what openSUSE seems to be doing for us automatically each time we boot up SuSE. There is a file that registers each cdrom or dvd drive that is connected to our computers. It provides symbolic device links for each optical drive and places them in /dev folder.

And the name and the location of this file is:

/etc/udev/rules.d/70-persistent-cd.rules

Now my main openSUSE computer has but one optical drive and so here is a look at my 70-persistent-cd.rules optical configuration text file.

# This file was automatically generated by the /lib/udev/write_cd_rules
# program, 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.

# DVDRAM_GH24NS50 (pci-0000:00:12.0-scsi-2:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrw1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvd1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",  ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvdrw1",  ENV{GENERATED}="1"

There will be a five line entry per optical drive you have installed in your system and a five line entry for any drive that used to exist, but has now been removed. My single optical DVD drive is an LG 24X model. But I had to get the box out to discover its model number was GH24NS50 as appears in the above file. After playing around with my optical drive I discovered that a new entry is made for each new or added drive found in your system. Further, for each additional optical drive installed, you will notice that the device names keep going up by one number. By that I mean the first optical drive uses cdrom1, cdrw1, dvd1, dvdrw1 while the next will be cdrom2, cdrw2, dvd2, dvdrw2 and on and on. If you replace a drive, you may find two entries with the same ending number. To see how this works, I went to kaffeine/KDE3 and modified the XINE media entries for cdrom and dvd to be /dev/cdrom1 & /dev/dvd1 respectivly. I had changed them both to /dev/sr0 which is the actual drive name for my optical drive. Using the new names found in the 70-persistent-cd.rules text file causes a DVD to play in Kaffeine.

Now one thing may become obvious here. There is no entry that specifies** /dev/dvd or /dev/cdrom**, the two names that seem to show up all over Linux for optical drives. The answer is simple, there is no automatic method that can assign these names that makes sense since only one optical drive can be /dev/dvd or /dev/cdrom, though these two names could point to two different optical drives.

In my case, the answer is simple, just add the /dev/dvd and /dev/cdrom names for my single optical drive. Thus here is a copy of my modified 70-persistent-cd.rules text file.

# This file was automatically generated by the /lib/udev/write_cd_rules
# program, 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.

# DVDRAM_GH24NS50 (pci-0000:00:12.0-scsi-2:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrw1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvd1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvdrw1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",  ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvd",  ENV{GENERATED}="1"

Now after making this change, even the CD player KsCD works with my audio CD’s. There are some programs like Banshee that did not have any problems reading my audio CD,s without making any changes to the 70-persistent-cd.rules text file, but this seemed to make more programs work properly for me.

What this text file is doing is providing symbolic device links in your /dev folder pointing to your real hardware. Further, you could create a symbolic link in /dev manually if you wanted to that pointed /dev/cdrom & /dev/dvd to your correct optical drive, but why bother if this file will do it for you automatically? If you should replace an optical drive, the old and new entries will be present and I determined you can delete the old entry if you wish. When a drive is replaced you will need to edit this file again to add the /dev/dvd & /dev/cdrom to point to your new optical drive. If you have more than one optical drive, there will be one entry set of five lines per optical drive made automatically for you. Make your entry for /dev/cdrom and/or /dev/dvd under the existing lines for the selected optical drive and you can only have one /dev/cdrom entry and one /dev/dvd entry in this entire file. Only ONE /dev/dvd entry per file and only ONE /dev/cdrom per file. Got it?

To edit this file you need root privilege. To use kwrite to do the editing use the following command:

kdesu kwrite /etc/udev/rules.d/70-persistent-cd.rules

After making any change to the 70-persistent-cd.rules text file you must reboot your computer to see how it works. Please let me know if you have any questions about using this prcedure to add /dev/dvd and /dev/cdrom to your configuration file. Programs that look for these will now work properly. Also, now you know that you could modify your device entries to use the automatically added drives like /dev/dvd1 or /dev/cdrom1 if you wanted to. Knowing how the 70-persistent-cd.rules optical drive configuration text file works will make you a smarter openSUSE Linux user.

Thank You,

*** Revised Version 5-6-2010 ***

Well, I have come to a new understanding of optical drive naming and just what openSUSE seems to be doing for us automatically each time we boot up SuSE. There is a file that registers each cdrom or dvd drive that is connected to our computers. It provides symbolic device links for each optical drive and places them in the /dev folder. As I talk about optical drive names, I will add the folder name /dev/ in front of the name, but this is assumed in the configuration text file and not shown.

And the name and the location of this optical drive configuration text file is:

/etc/udev/rules.d/70-persistent-cd.rules

Now my main openSUSE computer has but one optical drive (the hardware name for it is /dev/sr0) and so here is a look at my 70-persistent-cd.rules optical configuration text file.

# This file was automatically generated by the /lib/udev/write_cd_rules
# program, 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.

# DVDRAM_GH24NS50 (pci-0000:00:12.0-scsi-2:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrw1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvd1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvdrw1", ENV{GENERATED}="1"

There will be a five line entry per optical drive that you have installed in your system and a five line entry for any drive that used to exist, but has now been removed. My single optical DVD drive is an LG 24X model. But I had to get the box out to discover its model number was GH24NS50 as it appears in the above text file. After playing around with my optical drive I discovered that a new entry is made for each new or added drive found in your system. Further, for each additional optical drive installed, you will notice that the device names keep going up by one number. By that I mean the first optical drive uses cdrom1, cdrw1, dvd1, dvdrw1 while the next will be cdrom2, cdrw2, dvd2, dvdrw2 and so on. If you replace a drive, you may find two entries with the same ending number. To see how this works, I went to kaffeine/KDE3 and modified the XINE media entries for cdrom and dvd to be /dev/cdrom1 & /dev/dvd1 respectively. I had changed them both to /dev/sr0 which is the actual drive name for my optical drive. Using the new names found in the 70-persistent-cd.rules text file causes a DVD to play in Kaffeine.

First off, the 70-persistent-cd.rules optical drive configuration text file only lists the ending device names like cdrom?, cdrw?, dvd? or dvdrw?. No /dev/ is in front of the name. That is because symbolic device links are being created in the /dev folder and so the name /dev/ is assumed in all cases to be in front of the device names. Also, another thing that may become obvious here is there are no entries that specifies the default /dev/dvd or /dev/cdrom names, the two names that seem to show up all over Linux for optical drives. The answer is simple, there is no automatic method that can assign these names that makes sense since only one optical drive can use the /dev/dvd or /dev/cdrom device names, though these two names could point to two different optical drives.

In my case, the answer is simple, just add the /dev/dvd and /dev/cdrom names for my single optical drive. Thus here is a copy of my modified 70-persistent-cd.rules text file. I just copied the last line twice and changed dvdrw1 to cdrom first and in the other line to dvd.

# This file was automatically generated by the /lib/udev/write_cd_rules
# program, 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.

# DVDRAM_GH24NS50 (pci-0000:00:12.0-scsi-2:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrw1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvd1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvdrw1", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:12.0-scsi-2:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1"

Now after making this change, even the CD player KsCD works with my audio CD’s. There are some programs like Banshee that did not have any problems reading my audio CD’s without making any changes to the 70-persistent-cd.rules text file, but this seemed to make more programs work properly for me. I found that mplayer could now find and play my DVD’s. It is possible to start mplayer from the command line with the correct dvd drive listed, but it is better to not have to do that at all using 70-persistent-cd.rules text file.

What this text file is doing is providing symbolic device links for your optical drives in your /dev folder pointing to your real hardware. Further, you could create a symbolic link in /dev manually if you wanted to and knew how to do it that pointed /dev/cdrom & /dev/dvd to your correct optical drives, but why bother if this file will do it for you automatically? If you should replace an optical drive, the old and new entries will be present and I determined that you can delete the old entry if you wish. When a drive is replaced you will need to edit this file again to add the /dev/dvd & /dev/cdrom to point to your new optical drive. If you have more than one optical drive, there will be one entry set of five lines per optical drive made automatically for you. Make your entry for /dev/cdrom and/or /dev/dvd under the existing lines for the selected optical drive and you can only have one /dev/cdrom entry and one /dev/dvd entry in this entire file. Only ONE /dev/dvd entry per file and only ONE /dev/cdrom per file. Got it?

To edit this file you need root privilege. To use kwrite to do the editing use the following command:

kdesu kwrite /etc/udev/rules.d/70-persistent-cd.rules

After making any changes to the 70-persistent-cd.rules text file you must reboot your computer to see how it works. You should think about this file as creating Alias names for your optical drives. Your hardware name may be /dev/sr0, but now in my case /dev/cdrom, /dev/dvd, /dev/cdrom1, /dev/cdrw1, /dev/dvd1, /dev/dvdrw1 all point to the same hardware drive /dev/sr0 through the use of the70-persistent-cd.rules optical drive configuration text file. To get a real list of the hardware names for all drives installed in your system, open up a terminal session and enter the command “df -T”, without the quotes.

Please let me know if you have any questions about using this procedure to add /dev/dvd and /dev/cdrom to your configuration file. Programs that look for these names will now work properly. Also, now you know that you could modify your device entries to use the automatically added drives like /dev/dvd1 or /dev/cdrom1 if you wanted to. Knowing how the 70-persistent-cd.rules optical drive configuration text file works will make you a smarter openSUSE Linux user.

Thank You,

Using the command you posted to edit the config file that “houses” the names of the optical drives, I was a bit perplexed at first due to the fact my file was set up differently than yours. This is what the file originally looked like:

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

program, 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.

DVD±RW_GWA4164B (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+=“cdrom”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?
", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:1:0”, SYMLINK+=“cdrw”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:1:0”, SYMLINK+=“dvd”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?
", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:1:0”, SYMLINK+=“dvdrw”, ENV{GENERATED}=“1”

DVD-ROM_DDU1615 (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+=“cdrom1”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?
", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:0:0”, SYMLINK+=“dvd1”, ENV{GENERATED}=“1”

After staring at it for a few minutes, I noticed the top four device names had no number (“1”) after them but the bottom two devices did. I knew that the CD/DVD reader was listed as “sr0” in /dev/ and the burner was listed as “sr1” so I reversed the number in the configuration file so that it ended up looking like this:

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

program, 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.

DVD±RW_GWA4164B (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+=“cdrom1”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?
", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:1:0”, SYMLINK+=“cdrw1”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:1:0”, SYMLINK+=“dvd1”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?
", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:1:0”, SYMLINK+=“dvdrw1”, ENV{GENERATED}=“1”

DVD-ROM_DDU1615 (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+=“cdrom”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, ENV{ID_CDROM}=="?
", ENV{ID_PATH}==“pci-0000:00:1f.1-scsi-0:0:0:0”, SYMLINK+=“dvd”, ENV{GENERATED}=“1”

Saved the changes, rebooted and the respective drives operated like they were suppose to. I can now play audio CDs in the reader and no longer have to use the burner to listen to music. How you were able to discover this off-beat file and know what it was for is beyond my level of knowledge but rest assured it’s been added to my little bag of tricks if/when this problem rears its ugly head again. Can’t thank you enough for your help!

Thanks for your reply ZCSuse and it is interesting to find a computer were the base names of cdrom & dvd were assigned. I looked at two different computers and they did not exist. So this is very useful information. I am happy you found this tutorial useful in solving your optical drive naming setup that you desired. As for this file, I looked through forum posts all over the internet for days, but I never saw anything useful except for the manual creation of symbolic links in the folder /dev. Then, I ran across a passing mention of this text file 70-persistent-cd.rules and when I looked at it on my PC, the clouds parted and the sun came out. I added and remove drives on my main PC and then looked at another dual boot machine that had more than one CD ROM, and determined I needed to write just how this was working in openSUSE.

Thank You,

As for this file, I looked through forum posts all over the internet for days, but I never saw anything useful except for the manual creation of symbolic links in the folder /dev.

You must have been reading historic information then. Dynamic device management with udev (and the associated rules) has been with Linux since the 2.6 kernel series - several years now.

deano_ferrari I do not think that how alias drive names are assigned to optical drives is all that common knowledge. If you search on /dev/dvd or /dvd/cdrom, your not going to find many suggestions to use the 70-persistent-cd.rules as a method to control this optical drive naming action. You could ask some new openSUSE users if they understand how optical drive naming works. I do think the subject (of optical drive naming) should be included in our multimedia howto sections. Maybe I am just dumb, but this subject has been a mystery for a long time. Perhaps others are in the same boat. In any event, I am just trying to help other openSUSE users that need this advice.

Thank You,

deano_ferrari I do not think that how alias drive names are assigned to optical drives is all that common knowledge.

I don’t disagree, although the use of udev is resonably well known (but not necessarily well understood).

I do think the subject (of optical drive naming) should be included in our multimedia howto sections.

Yes, thats a good idea (especially for those with multiple optical drive devices).

A further important point to make is that it is preferable to add custom rules with a higher numeric number in the name (eg 90-custom-cd.rules), rather than editing the existing rules. This is due to the fact that if udev is upgraded, your custom edit may be replaced. When any matching rules are present, it is the last one that is applied, unless (OPTIONS+=“last_rule”) is included in the desired rule.

A couple of good references here:

Writing udev rules

http://wiki.archlinux.org/index.php/Udev

OK deano_ferrari I have bookmark both of the sources that you have provided. They provide a great amount of detail on the subject, but it does not appear as something that will get you directly to solution to the problem of optical device naming in your system. Further, no 90-custom-cd.rules file exists on my system, so I guess you normally have to create it from scratch.

Providing an example to an end is the best way to shortcut reading of text to get more quickly to an end solution for new users. I would request that, if you have time, provide an example of how you would write a new 90-custom-cd.rules text file so that it could control the optical drive naming in your system. I would attempt to include it in a more comprehensive howto that might be more worthy of acceptance. I am serious that I will do this with your help. I feel strongly that this is a subject that bears more explanation for our openSUSE users.

Thank You,

Further, no 90-custom-cd.rules file exists on my system, so I guess you normally have to create it from scratch.

Thats correct. Its similar to what you have already outlined already. (Editing system files with root permissions is often risky and difficult for new users). Open the 70-persistent-cd.rules first, and copy the relevant rules, then

kdesu kwrite /etc/udev/rules.d/90-custom-cd.rules

For Gnome users

gnomesu gedit /etc/udev/rules.d/90-custom-cd.rules

and paste the entries into this file (it will create it for you), and edit as required. The actual name is not important, so long as it appears numerically after the first similar rule(s). It can come first, but you need the ‘last rule’ option present in that case.

Some of us prefer the CLI editors, like nano or vi. The advantage is being able to edit files quickly from a console-only environment.

OK deano_ferrari, so in the new file 90-custom-cd.rules I could just copy the contents of my 70-persistent-cd.rules and they would become permanent? Now we know that if I change out an optical drive, I must edit the 70-persistent-cd.rules file for the new drive. However, having the old drive in 90-custom-cd.rules would still require an edit to make the new drive work, so you don’t get out of editing to something when you replace an optical drive. How would using the 90-custom-cd.rules help me in some other way? Now hang in there with me. I am trying to understand when the 90-custom-cd.rules file is better than the 70-persistent-cd.rules file. What might I do to my system where the 70-persistent-cd.rules would undo my changes? I already know that in a steady state system where I am not adding in or removing optical drives, the changes I made to the 70-persistent-cd.rules file are not changing on me when I reboot my computer.

Thank You,

Now hang in there with me. I am trying to understand when the 90-custom-cd.rules file is better than the 70-persistent-cd.rules file. What might I do to my system where the 70-persistent-cd.rules would undo my changes?

It might happen if udev was upgraded AFIU. Custom rules (not part of udev package) would be left alone. Its just an extra precaution. :slight_smile:

OK, you got me again. What does AFIU stand for? Armed Forces Institute Of Urology, was one suggestion which does not seem to go with udev. lol!

Is there a command for udev that can list all of your symlinks in /dev folder? I can’t seem to find anything that might list what you have created there.

Thank You,

What does AFIU stand for?

As far as I understand :wink:
Another commonly used as well: AFAIK == As far as I know

To see device links

ls -l /dev

Hi Jdmcdaniel,

I have seen your quoted very valuable post. Now knowing your depth of knowledge, I want ask you a related question.

I have two CD/DVD+RW drive, one is internally mounted and the other one is externally attached through USB. If I put a CDA or a CDDA compact disk in the external drive neither kaffeine nor mplayer nor xine nor the Dolphin recognize or read these two types of disks. There is no problem with disks written in mp3 or avi or just text data. Strangely, there is absolutely no problem when the same CDDA/CDA disk when they are put in the internally mounted optical dive.

I have spent days on the SUSE or other forums but no solution as yet. Do you have any advice for me?

Regards. Sheo

First off, what program are you trying to play the audio CD with? There are programs like Banshee that can play an audio CD from any drive. While there are other programs that will only play an audio CD from the default CD Audio drive /dev/cdrom. My example shows how you might assign or reassign the default optical drive to use for Audio CD player programs that only look for the /dev/cdrom. Naming either optical drive you have as the default Audio CD drive can be done, but only one drive can be the default. If you prefer to play your Audio CD’s on the external drive, my example here shows you how that can be done. If you want to play Audio CD’s on either drive, you have to find a program that is smart enough to look at other optical drives besides the default. Does that make sense to you?

Thank You,

My first reaction was “Wall of Text” :smiley:

In my case I just want to switch from a SATA to a PATA drive and have all my stuff still work.
I will only have one drive. What creates the /etc/udev/rules.d/70-persistent-cd.rules file?
Is it safe to just delete it will it be auto generated when I reboot?

What creates the /etc/udev/rules.d/70-persistent-cd.rules file?

DeviceKit (now known as udisks) is responsible for this AFAIU.

Is it safe to just delete it will it be auto generated when I reboot?

Yes, that is correct.

I painlessly switched from my SATA DVD-ROM to a PATA DVD-ROM drive as the new one showed up this afternoon.

I powered down the computer and removed the SATA drive and rebooted openSUSE 11.3 and deleted the /etc/udev/rules.d/70-persistent-cd.rules file. I then powered down the computer and installed the PATA drive rebooted and went into BIOS to make sure the drive was detected saved the configuration. After seeing it was and I rebooted openSUSE 11.3. I checked the /etc/udev/rules.d/70-persistent-cd.rules to see if a new one was there and it was. I put a DVD in the new drive and mounted it with the “device notifier” and started Kaffine. I selected play DVD and I got the FBI warning :). My drive is working and it was pretty simple.

Thanks for the help.

Good stuff! :slight_smile:

Just my 2 cents on this topic… (susefan57 on Nov.4, 2010)
If you get the message “Cannot find input plugin for MRL [dvd:/]” you have a problem with the udev system. The udev demon should normally create a symlink /dev/dvd to the DVD media. The desktop system looks for the media resource locator (MRL) dvd:/ which leads to /dev/dvd. But if the symlink /dev/dvd is not present you get an error message. Even if you try to create the symlinks manually it doesn’t work (That’s because udev overwrites the symlinks temporarily!)
“But it has been working before” you might say… Yes, that’s true. No Linux Distribution is perfect. It might be that you had a kernel update that changed something. It might be you put in new hardware… Anyway, how can it be fixed?
So we must use udev and it is am mighty system but it needs the right rules to work properly. Sometimes the auto-generated rules are not correct. And sometimes the user repairs the rules but with the next hardware or kernel change the repaired rules are overwritten. So we have to do 2 things:
(1) Write correct udev rules.
(2) Protect these rules so they can’t be autochanged again.
Here we go… at first we solve issue (2):
Open as root the file /etc/udev/rules.d/70-persistent-cd.rules
Save it as the new file /etc/udev/rules.d/69-persistent-cd.rules
Explanation: Rule 69 is done before rule 70. And if we tell udev to ignore the rules in 70-persistent-cd.rules we are on the save side if if the system autogenerates an new file named 70-persistent-cd.rules. We can even delete 70-persistent-cd.rules if we want to. And if our rules in 69-persistent-cd.rules causes trouble, we can delete our file; the system generates a new file 70-persistent-cd.rules on its own (but these autogenerated rules may not be correct).

Now we solve isssue (1)
Open a root terminal, start the command “udevadm monitor” and put in a dvd into your drive. My system responsed like that:
KERNEL[1288804669.809901] change /devices/pci0000:00/0000:00:1f.1/host1/target1:0:0/1:0:0:0 (scsi)
UDEV [1288804669.809988] change /devices/pci0000:00/0000:00:1f.1/host1/target1:0:0/1:0:0:0 (scsi)
KERNEL[1288804669.810045] change /devices/pci0000:00/0000:00:1f.1/host1/target1:0:0/1:0:0:0/block/sr0 (block)
UDEV [1288804669.966368] change /devices/pci0000:00/0000:00:1f.1/host1/target1:0:0/1:0:0:0/block/sr0 (block)
That means the system got a message from the scsi emulation and assigned a block device to /sr0

OK - we take this information into our new file: Edit the file 69-persistent-cd.rules …

Tis file is generated by susefan57

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

line, and set the $GENERATED variable.

DVD-ROM_GDR8164B (/dev/sr0)

SUBSYSTEM==“block”, KERNEL==“sr0”, SYMLINK+=“dvd”, GROUP=“users”, ENV{GENERATED}=“1”
SUBSYSTEM==“block”, KERNEL==“sr0”, SYMLINK+=“cdrom”, GROUP=“users”, OPTIONS+=“last_rule”, ENV{GENERATED}=“1”

So - what does that mean?
Lines with # are just comments. The interesting lines is the last line.
== means “Go on if we have a match here”
+= means “Add this feature”
= means “Set this feature”
ENV sets an environment variable which is important for the desktop system
For example:
SUBSYSTEM==“block”, KERNEL==“sr0”, tests if there’s a block device on /dev/sr0
SYMLINK+=“dvd”, GROUP=“users” creates the symlink /dev/dvd and assigns the group “users” to the disk (which is fine for OpenSuSE but for other Distros the group “cdrom” might be better). SYMLINK+=“cdrom” sets the symlink /dev/cdrom (which is needed by some programs if you insert a CD-ROM…)
ENV{GENERATED}=“1” sets the environment variable “GENERATED” to 1 (which is important for the desktop system)
OPTIONS+=“last_rule” tells udev that udev has to ignore any other rule on THIS device. That means (a) if you have another device with other rules, they will be done and (b) if you have other rules for the dvd device (in the same file or in a “later” file) they won’t be done.

Save the new file. Now you can reboot or just reload the udev rules with the command
udevadm control --reload-rules

Now I test it:
Eject the disc. If there are symlinks /dev/dvd and /dev/cdrom I remove them. I put in the disk again. Now the symlinks /dev/dvd and /dev/cdrom appear again.

After that my OpenSuse11.2 - system worked fine :wink: