LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-21-2004, 04:00 PM   #1
Atticus87
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware 10, kernel 2.6.8.1
Posts: 9

Rep: Reputation: 0
CD Drive Woes


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.

- Joe
 
Old 11-21-2004, 04:07 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
What distro, what kernel?



Cheers,
Tink
 
Old 11-23-2004, 02:16 PM   #3
Atticus87
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware 10, kernel 2.6.8.1
Posts: 9

Original Poster
Rep: Reputation: 0
Slackware 10, kernel 2.6.8.1. Sorry about the slow response time, I've been really busy lately.
 
Old 03-13-2005, 06:34 PM   #4
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
I'm having exactly the same problem. I have two optical drives. I make links in /dev:

user@blueberry:~$ ls -al /dev | grep hd[cd]
lrwxrwxrwx 1 root root 3 2005-03-13 16:57 cdrom -> hdc
lrwxrwxrwx 1 root root 3 2005-03-13 06:18 dvd -> hdd
brw-rw---- 1 root cdrom 22, 0 2005-03-13 06:18 hdc
brw-rw---- 1 root cdrom 22, 64 2005-03-13 06:18 hdd

When I reboot, I get:

user@blueberry:~$ ls -al /dev | grep hd[cd]
lrwxrwxrwx 1 root root 3 2005-03-13 16:57 cdrom -> hdd
lrwxrwxrwx 1 root root 3 2005-03-13 06:18 dvd -> hdd
brw-rw---- 1 root cdrom 22, 0 2005-03-13 06:18 hdc
brw-rw---- 1 root cdrom 22, 64 2005-03-13 06:18 hdd

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?
 
Old 03-13-2005, 07:03 PM   #5
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
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?
 
Old 03-13-2005, 11:07 PM   #6
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hard drive woes FliesLikeABrick Linux - Hardware 3 10-10-2005 02:12 AM
USB flash drive woes Darin Linux - Hardware 2 11-11-2004 03:33 PM
More zip drive woes 9.2 Rotwang Mandriva 0 04-02-2004 04:45 PM
Tape Drive Woes Evilphantom Linux - Hardware 0 11-10-2003 03:03 PM
Hard Drive Woes jwchanman Linux - Hardware 11 02-12-2003 12:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration