LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I am having a problem with my symlinks in the /dev directory (https://www.linuxquestions.org/questions/linux-newbie-8/i-am-having-a-problem-with-my-symlinks-in-the-dev-directory-662451/)

JasonC10203 08-13-2008 08:19 AM

I am having a problem with my symlinks in the /dev directory
 
When I want to mount a cdrom or a dvd, the device that I must mount is /dev/hda. By default, the OS creates symlinks that point to /dev/hda (e.g. /dev/cdrom, /dev/dvd).

The problem is that for some reason, it is adding numbers behind these symlinks. For example, /dev/cdrom6 and /dev/dvd6. The number increases by one ever time I reboot the computer, which makes it nearly impossible for me to keep fstab working unless I want to let rebuildfstab do its thing (which I don't for various reasons).

So my question is, why are there numbers being appended to the end of my sym links and how do I stop this from happening?

Thanks,
Jason

P.S.
My Linux version is 2.6.23-grml

JasonC10203 08-13-2008 09:44 AM

After doing a bit of searching, I think I may have solved the problem (although this won't fix it if you are using more than one optical drive).

I edited the /lib/udev/write_cd_rules script file, making the following changes:

link_num=$(find_next_available 'cdrom[0-9]*') <---original
link_num="" <---my version

If you look further down in the script, you will see the following:
Code:

      write_rule "$match" "cdrom$link_num" "$comment"
["$ID_CDROM_CD_R" -o "$ID_CDROM_RW" ] && \

Since all I wanted was to have my cdrom, cdrw, dvd, and dvdrw symlinks stay the same (i.e. not have any numbers appended) this works since $link_num is set to nothing. It's a bit hacky, but it's the only solution I've found so far.

timmeke 08-13-2008 09:49 AM

Could you post the code of find_next_available?


All times are GMT -5. The time now is 02:49 AM.