Unix Technical Forum

CDROM mounting under 2.6 kernel

This is a discussion on CDROM mounting under 2.6 kernel within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> I have upgraded to the 2.6.18 pre-compiled kernel and having problems with CDROM mounting. I've previously had a symlink: ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 08:50 PM
trryhend@gmail.com
 
Posts: n/a
Default CDROM mounting under 2.6 kernel

I have upgraded to the 2.6.18 pre-compiled kernel and having problems
with CDROM mounting. I've previously had a symlink: /dev/hdc --> /dev/
cdrom, which still works, but each time I reboot, the /dev/cdrom
symlink gets deleted. (I also installed udev, and am pretty sure that
has a lot to do with it.)
So, what is the proper way to set up the CDROM for use with 2.6 kernel
running udev?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 08:50 PM
Chris Sorenson
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

On Jan 30, 4:15 pm, "trryh...@gmail.com" <trryh...@gmail.com> wrote:
> I have upgraded to the 2.6.18 pre-compiled kernel and having problems
> with CDROM mounting. I've previously had a symlink: /dev/hdc --> /dev/
> cdrom, which still works, but each time I reboot, the /dev/cdrom
> symlink gets deleted. (I also installed udev, and am pretty sure that
> has a lot to do with it.)
> So, what is the proper way to set up the CDROM for use with 2.6 kernel
> running udev?


It's udev, not the kernel. udev sucks granite but that's beside the
point...

Sounds like the easiest thing would be to use 'mount /dev/hdc' instead
of 'mount /dev/cdrom'

For example, in /etc/fstab, add the line:

/dev/hdc /mnt/cdrom auto noauto,owner,ro 0 0

Then, if /dev/hdc is owned by group 'cdrom', add your username to that
group in /etc/group...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 08:50 PM
steelneck
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

trryhend@gmail.com wrote:
> So, what is the proper way to set up the CDROM for use with 2.6 kernel
> running udev?
>


An udev rule like this ought to do it:

KERNEL=="hdc", SYMLINK+="cdrom"

It matches what the kernel names hdc, and makes a
symlink to it under /dev




--
Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 08:51 PM
Alan
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

trryhend@gmail.com wrote:

> < runs 2.6.18 pre-compiled and runs udev. The cdrom symlink in /dev is

missing upon reboot >

(I don't fully savvy grep, etc.) but Don't the next lines from rc.udev pull
from fstab to begin what later on is to be the symlinks in /dev

Next lines copied from /etc/rc.d/rc.udev

# Copy the needed disk nodes to the static devices directory:
RDEV=`grep -v '^#' /etc/fstab | sed -ne '/\W\/\W/s#/dev/\(\w*\
[0-9].*#\1#p'`
if ! [ -e /lib/udev/devices/$RDEV ]; then
cp -a /dev/`echo $RDEV | cut -f3 -d/` /lib/udev/devices/ 2>/dev/null
fi
for i in `grep "$RDEV" /etc/fstab | cut -f1 -d\ | cut -f3 -d/`; do
if ! [ -e /lib/udev/devices/$i ]; then
cp -a /dev/$i /lib/udev/devices/ 2>/dev/null
fi
done
------------------------------------------

Mine (/extra Kern 2617) (rc.udev is executable) works. But I've /dev/hdd

On mine there's no /dev/hdc

al@p3srv:/dev$ ls -la cdrom
lrwxrwxrwx 1 root root 6 2007-01-30 18:08 cdrom -> cdrom0
al@p3srv:/dev$ ls -la cdrom0
lrwxrwxrwx 1 root root 3 2007-01-30 18:08 cdrom0 -> hdd
al@p3srv:/dev$ ls -la dvd
lrwxrwxrwx 1 root root 4 2007-01-30 18:08 dvd -> dvd0
al@p3srv:/dev$ ls -la dvd0
lrwxrwxrwx 1 root root 3 2007-01-30 18:08 dvd0 -> hdd
al@p3srv:/dev$ ls -la dvdrw
lrwxrwxrwx 1 root root 6 2007-01-30 18:08 dvdrw -> dvdrw0
al@p3srv:/dev$ ls -la dvdrw0
lrwxrwxrwx 1 root root 3 2007-01-30 18:08 dvdrw0 -> hdd
al@p3srv:/dev$

--
abc Alan_Cu

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 08:51 PM
Ivar Rosquist
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

On Tue, 30 Jan 2007 15:48:31 -0800, Chris Sorenson wrote:

> On Jan 30, 4:15 pm, "trryh...@gmail.com" <trryh...@gmail.com> wrote:
>> I have upgraded to the 2.6.18 pre-compiled kernel and having problems
>> with CDROM mounting. I've previously had a symlink: /dev/hdc --> /dev/
>> cdrom, which still works, but each time I reboot, the /dev/cdrom
>> symlink gets deleted. (I also installed udev, and am pretty sure that
>> has a lot to do with it.)
>> So, what is the proper way to set up the CDROM for use with 2.6 kernel
>> running udev?

>
> It's udev, not the kernel. udev sucks granite but that's beside the
> point...


I have seen lots of statements similar to this, but never an explanation
about the shortcomings of udev. Could you please elaborate? I am not
challenging you; I am just curious.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 08:51 PM
Chris Sorenson
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

On Jan 31, 10:12 am, Ivar Rosquist <IRosqu...@irq.org> wrote:
> On Tue, 30 Jan 2007 15:48:31 -0800, Chris Sorenson wrote:
> > On Jan 30, 4:15 pm, "trryh...@gmail.com" <trryh...@gmail.com> wrote:
> >> I have upgraded to the 2.6.18 pre-compiled kernel and having problems
> >> with CDROM mounting. I've previously had a symlink: /dev/hdc --> /dev/
> >> cdrom, which still works, but each time I reboot, the /dev/cdrom
> >> symlink gets deleted. (I also installed udev, and am pretty sure that
> >> has a lot to do with it.)
> >> So, what is the proper way to set up the CDROM for use with 2.6 kernel
> >> running udev?

>
> > It's udev, not the kernel. udev sucks granite but that's beside the
> > point...

>
> I have seen lots of statements similar to this, but never an explanation
> about the shortcomings of udev. Could you please elaborate? I am not
> challenging you; I am just curious.



To be honest, I have recently been won over the udev/devfs side of the
argument. In order for Linux to succeed on the desktop, something like
either of those is necessary. Not for experienced users, but for the
rest of the world, it probably is.

If you're used to managing your own devices from Slackware's old dev
package, udev is painful.

Oh, and having to to write your own udev rules seems like a design
flaw. But what do I know? It's probably good for you. Just like
learning Mandarin Chinese would be.

Plus the udev guys, at least at first, seemed to go out of their way
to piss people off:

http://kerneltrap.org/node/1893

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-20-2008, 08:51 PM
trryhend@gmail.com
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

On Jan 30, 10:42 pm, Alan
<mtbr0228NOSPAMA...@sbcglobalNOSPAMDOTdot.net> wrote:
> trryh...@gmail.com wrote:
> > < runs 2.6.18 pre-compiled and runs udev. The cdrom symlink in /dev is

>
> missing upon reboot >
>
> (I don't fully savvy grep, etc.) but Don't the next lines from rc.udev pull
> from fstab to begin what later on is to be the symlinks in /dev
>
> Next lines copied from /etc/rc.d/rc.udev
>
> # Copy the needed disk nodes to the static devices directory:
> RDEV=`grep -v '^#' /etc/fstab | sed -ne '/\W\/\W/s#/dev/\(\w*\
> [0-9].*#\1#p'`
> if ! [ -e /lib/udev/devices/$RDEV ]; then
> cp -a /dev/`echo $RDEV | cut -f3 -d/` /lib/udev/devices/ 2>/dev/null
> fi
> for i in `grep "$RDEV" /etc/fstab | cut -f1 -d\ | cut -f3 -d/`; do
> if ! [ -e /lib/udev/devices/$i ]; then
> cp -a /dev/$i /lib/udev/devices/ 2>/dev/null
> fi
> done
> ------------------------------------------
>
> Mine (/extra Kern 2617) (rc.udev is executable) works. But I've /dev/hdd
>
> On mine there's no /dev/hdc
>
> al@p3srv:/dev$ ls -la cdrom
> lrwxrwxrwx 1 root root 6 2007-01-30 18:08 cdrom -> cdrom0
> al@p3srv:/dev$ ls -la cdrom0
> lrwxrwxrwx 1 root root 3 2007-01-30 18:08 cdrom0 -> hdd
> al@p3srv:/dev$ ls -la dvd
> lrwxrwxrwx 1 root root 4 2007-01-30 18:08 dvd -> dvd0
> al@p3srv:/dev$ ls -la dvd0
> lrwxrwxrwx 1 root root 3 2007-01-30 18:08 dvd0 -> hdd
> al@p3srv:/dev$ ls -la dvdrw
> lrwxrwxrwx 1 root root 6 2007-01-30 18:08 dvdrw -> dvdrw0
> al@p3srv:/dev$ ls -la dvdrw0
> lrwxrwxrwx 1 root root 3 2007-01-30 18:08 dvdrw0 -> hdd
> al@p3srv:/dev$
>
> --
> abc Alan_Cu


So, what does your fstab file look like?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-20-2008, 08:51 PM
yoyo
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

On Wed, 31 Jan 2007 16:12:54 +0000, Ivar Rosquist wrote:

> I have seen lots of statements similar to this, but never an
> explanation
> about the shortcomings of udev. Could you please elaborate? I am not
> challenging you; I am just curious.


It's not so much what is wrong as it is why udev. Per man, "udev -
dynamic device management". Great, another config file to learn. I
already have a script to mount and umount my USD-HDD and Flash. Why
should I bother?

Ok, so I can pre-assign mount point(s) for the filesystems on the device.
Well, the only problem I encounter now is sometimes I get /dev/sdb and my
script is hardcoded to /dev/sdaN partitions. If I replug the device, I
get /dev/sda reassigned; two seconds and I am done. Is there a poor
benefit:bother ratio?


Here is my mount script:
echo " $0: mounting external usb drive"

df -Th
.. /usr/local/bin/umntwd.sh

df -Th
mkdir -p /media/wd/vfat
mkdir -p /media/wd/lfs

df -Th
mount -t reiserfs /dev/sda1 /media/wd/lfs -o defaults,users
mount -t vfat /dev/sda6 /media/wd/vfat
-o defaults,users,umask=0

df -Th

How would I go about this with udev?



John
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-20-2008, 08:52 PM
Alan
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

trryhendAT@gmail.DOTcom wrote:
> On Jan 30, 10:42 pm, Alan
> <mtbr0228NOSPAMA...@sbcglobalNOSPAMDOTdot.net> wrote:
>> trryh...@gmail.com wrote:
>> > < runs 2.6.18 pre-compiled and runs udev. The cdrom symlink in /dev is

>> missing upon reboot >
>>
>> (I don't fully savvy grep, etc.) but Don't the next lines from rc.udev
>> pull from fstab to begin what later on is to be the symlinks in /dev
>>
>> Next lines copied from /etc/rc.d/rc.udev
>>
>> # Copy the needed disk nodes to the static devices directory:
>> RDEV=`grep -v '^#' /etc/fstab | sed -ne '/\W\/\W/s#/dev/\(\w*\

<snipped>
>> Mine (/extra Kern 2617) (rc.udev is executable) works. But I've /dev/hdd
>> On mine there's no /dev/hdc
>>
>> al@p3srv:/dev$ ls -la cdrom
>> lrwxrwxrwx 1 root root 6 2007-01-30 18:08 cdrom -> cdrom0
>> al@p3srv:/dev$ ls -la cdrom0
>> lrwxrwxrwx 1 root root 3 2007-01-30 18:08 cdrom0 -> hdd
>> al@p3srv:/dev$ ls -la dvd
>> lrwxrwxrwx 1 root root 4 2007-01-30 18:08 dvd -> dvd0
>> al@p3srv:/dev$ ls -la dvd0
>> lrwxrwxrwx 1 root root 3 2007-01-30 18:08 dvd0 -> hdd
>> al@p3srv:/dev$ ls -la dvdrw
>> lrwxrwxrwx 1 root root 6 2007-01-30 18:08 dvdrw -> dvdrw0
>> al@p3srv:/dev$ ls -la dvdrw0
>> lrwxrwxrwx 1 root root 3 2007-01-30 18:08 dvdrw0 -> hdd
>> al@p3srv:/dev$

>
> So, what does your fstab file look like?


al@p3srv:~$ cat /etc/fstab
/dev/sda5 swap swap defaults 0 0
/dev/sda2 / reiserfs defaults 1 1
/dev/sda1 /boot ext2 defaults 1 2
/dev/cdrom /mnt/cdrom auto noauto,users,ro 0 0
/dev/hdd /mnt/dvd auto noauto,users,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,users,rw 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
/dev/sdb6 /mnt/sata ext3 noauto,users,rw 0 0
al@p3srv:~$

That's it. Due to cd and dvd symlink to /dev/hdd -- I'm sure that I could
remove either the cd or the dvd line. I probably was half asleep when I
configured it and thought I needed an entry for cd and an entry for dvd.

It's working that way. But I'd guess it would be better to just have 1
instead of 2 in fstab that points to /dev/hdd

/dev/hdd is a dvd read-write (the drive does dvd burner, cd burner and dvd
and cd reader). I turn on DMA to it in /etc/rc.d/rc.local

burnt 3 or 4 cd's so far just fine. burnt 1 dvd just fine. (recently got it
up this box, not used it a lot yet).

--
Alan_Cu abc

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-20-2008, 08:52 PM
Robby Workman
 
Posts: n/a
Default Re: CDROM mounting under 2.6 kernel

On 2007-01-31, yoyo <news@eleven.pm> wrote:
>
> It's not so much what is wrong as it is why udev. Per man, "udev -
> dynamic device management". Great, another config file to learn. I
> already have a script to mount and umount my USD-HDD and Flash. Why
> should I bother?
>
> Ok, so I can pre-assign mount point(s) for the filesystems on the device.
> Well, the only problem I encounter now is sometimes I get /dev/sdb and my
> script is hardcoded to /dev/sdaN partitions. If I replug the device, I
> get /dev/sda reassigned; two seconds and I am done. Is there a poor
> benefit:bother ratio?
>
>
> Here is my mount script:
> echo " $0: mounting external usb drive"
>
> df -Th
> . /usr/local/bin/umntwd.sh
>
> df -Th
> mkdir -p /media/wd/vfat
> mkdir -p /media/wd/lfs
>
> df -Th
> mount -t reiserfs /dev/sda1 /media/wd/lfs -o defaults,users
> mount -t vfat /dev/sda6 /media/wd/vfat
> -o defaults,users,umask=0
>
> df -Th
>
> How would I go about this with udev?


In a custom udev rules file (I use 10-rw.rules), define something like this:
ATTRS{manufacturer}=="SanDisk Corporation", ATTRS{serial}=="200443174207a491e849", KERNEL=="sd?1", NAME="%k", SYMLINK+="usb256"
[1] [2]

That will allow the kernel to create the same device node that it would
normally create anyway, and generally speaking, you don't want to bother
with trying to alter that anyway. It then creates a symlink to that
device node at /dev/usb256. The fstab line for this device is:

/dev/usb256 /usb1 vfat noauto,user,rw,dmask=0022,fmask=0133 0 0

Now, I simply insert the device, call "mount /usb1" from a terminal, and the
device is mounted and ready to use. When finished, "umount /usb1" and unplug
it. [3]

[1] The syntax for rules is dependent on udev version. This rule syntax is
specific to udev-098 and later, so if you're using the stock udev-097
with Slackware 11, it will be different.

[2] See /usr/doc/udev-097/docs/writing_udev_rules/ on a Slackware 11.0 system,
or http://reactivated.net/writing_udev_rules.html for the most up-to-date
version specific to current udev.

[3] The device symlink and mountpoints are obviously customizable, and if you
are so inclined, you could certainly make a mount/umount script to be
called on the desktop. That script could test whether the device is
currently mounted, and if not, mount it; if so, unmount it, and if
unsuccessful on either, return an error. Viewing that error message in an
X environment without running it in a terminal, though, is an exercise
left to the reader - I'm sure it's possible, but I've never given it any
thought, as the whole idea of a script to do it seems more complicated
than opening a terminal and doing it manually. YMMV.

RW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:50 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com