Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm having a bit of a problem getting my computer to permanently recognize my new cd drive. I make a link from the device (/dev/hdc) to /dev/cdrom and from /dev/cdrom to /mnt/cdrom, making all the appropriate changes to the FSTAB file (I also change all the settings for the old cd drive from /whatever/cdrom to /whatever/cdrom1). It works fine until I turn the computer off or reboot, then my links go back to what they were. I've looked over my fstab file, and it doesn't change, so I assume the problem is with my links. If someone could please tell me what to do to make the changes I make permanent, I would greatly appreciate it. Thanks in advance.
I'm fairly certain this has something with udev in the 2.6.11 kernel. The device files are created dynamically during boot-up, and the links get confused. I tried to produce a similar behaviour with links in another directory, by deleting and recreating the file a link pointed to, but nothing like this happened. Maybe there's a config file somewhere that tells hotplug what link to make when creating device files? Thoughts?
Found the problem, but I'm not sure how to fix it. In /etc/udev/scripts, the make_extra_nodes.sh script contains:
Code:
# If we can, add a default /dev/cdrom and /dev/dvd link:
if /bin/ls -l /dev | grep -w cdrom 1> /dev/null 2> /dev/null ; then
( cd $udev_root
/bin/ls -l * | grep -w cdrom | cut -f 2 -d : | cut -f 2 -d ' ' | while read
optical_device ; do
# It has to be a cdrom. Last one wins.
ln -sf $optical_device cdrom
# If it's a DVD, set that link as well:
if grep -i dvd /proc/ide/$optical_device/model 1> /dev/null 2> /dev/null ;
then
ln -sf $optical_device dvd
fi
done
unset optical_device
)
fi
I understand the behaviour of the script, but I'm not sure how to fix it. The problem is that this script will basically only create links for the last optical device it finds. I can comment it out and just create the links manually for now, but I'd prefer to keep the functionality of udev completely intact. That way if for some reason I swap the drive on the ide ribbon, the links will still point to the correct devices.
Is there a script wizard out there who wants to tackle this?
In this thread shilo posts one solution. I don't really like this solution because the whole purpose of udev is to be dynamic, and these sorts of rules are not. It does, however, have the benefit that if you have a third optical drive, you just have to add another rule to the file.
I opted to make a partial fix to the make_extra_nodes.sh script (in /etc/udev/scripts/). The relevant section now looks like this:
Code:
# If we can, add a default /dev/cdrom and /dev/dvd link:
if /bin/ls -l /dev | grep -w cdrom 1> /dev/null 2> /dev/null ; then
( cd $udev_root
/bin/ls -l * | grep -w cdrom | cut -f 2 -d : | cut -f 2 -d ' ' | while read optical_device ; do
# If it's a DVD, set that:
if grep -i dvd /proc/ide/$optical_device/model 1> /dev/null 2> /dev/null ; then
ln -sf $optical_device dvd
else
# It has to be a cdrom. Last one wins.
ln -sf $optical_device cdrom
fi
done
unset optical_device
)
fi
This is only a partial fix because it can only handle the case of one DVD-ROM drive and one CD-ROM drive. If you add a third optical drive or you have two of the same type of drive you end up with basically the same problem as before. I might take some time later to produce a better version of this script.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.