SEO

vBulletin Search Engine Optimization


Go Back   UnixAdminTalk.com > Unix Operating Systems > Linux Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 11:42 AM
Mr. Usenet
 
Posts: n/a
Default Problems with udev

Hi

I'm running Slackware 12.0, kernel 2.6.21.5. I have a dvd and a cd
drive. My problem is that the link /dev/cdrom intermittently points
to /dev/hdd, i.e.:

%~$ ls -l /dev/cdrom
lrwxrwxrwx 1 root root 3 2008-01-08 07:13 /dev/cdrom -> hdd

rather than /dev/hdc.

This is after I created the file:

/etc/udev/rules.d/10-local.rules

which contains:

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

Before I created this file, it constantly pointed to /dev/hdd. Now,
it
seems to alternate daily between hdc and hdd. When I do:

udevtest /sys/block/hdd

I get:

.....

update_link: found '/block/hdc' for 'cdrom'
update_link: compare priority of '/block/hdc' 0 > 0
update_link: found '/block/hdd' for 'cdrom'
update_link: compare (our own) priority of '/block/hdd' 0 >= 0
update_link: 'cdrom' with target 'hdd' has the highest priority 0,
create it
.....

which seems to say that there is still some file trying to push /dev/
hdd as
the link from /dev/cdrom. One other confusing thing is that the
timestamp
in:

lrwxrwxrwx 1 root root 3 2008-01-08 07:13 /dev/cdrom -> hdd

for the created link is 07:13, and the computer was not on at this
time.

So can anyone tell me how to make the link with /dev/hdc permanent?
Thanks.
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 11:42 AM
toshiro
 
Posts: n/a
Default Re: Problems with udev

On Jan 9, 1:46 pm, "Mr. Usenet" <[email protected]> wrote:
>

....
> So can anyone tell me how to make the link with /dev/hdc permanent?
> Thanks.


If you *always* want your cdrom to point to /dev/hdc AND you do not
need dynamic assignment of you cdrom device... then there is no need
to use udev for this
so remove *your* changes from /etc/udev/rules.d, and instead do the
following:

Make sure user.group of /dev/hdc is root.cdrom
(ls -l /dev/hdc = brw-rw---- 1 root cdrom 22, 64 2008-01-09 05:58 /dev/
hdc)

Make a symlink /dev/cdrom -> /dev/hdc
(ls -l /dev/cdrom = lrwxrwxrwx 1 root root 3 2008-01-09 05:58 /dev/
cdrom -> hdc)

In fstab uncomment the line (or add the line):
/dev/cdrom /mnt/cdrom iso9660 noauto,user,ro 0 0

This should do what you need.
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 11:42 AM
Mr. Usenet
 
Posts: n/a
Default Re: Problems with udev

toshiro wrote:
> On Jan 9, 1:46 pm, "Mr. Usenet" <[email protected]> wrote:
> >

> ...
> > So can anyone tell me how to make the link with /dev/hdc permanent?
> > Thanks.

>
> If you *always* want your cdrom to point to /dev/hdc AND you do not
> need dynamic assignment of you cdrom device... then there is no need
> to use udev for this
> so remove *your* changes from /etc/udev/rules.d, and instead do the
> following:
>
> Make sure user.group of /dev/hdc is root.cdrom
> (ls -l /dev/hdc = brw-rw---- 1 root cdrom 22, 64 2008-01-09 05:58 /dev/
> hdc)
>
> Make a symlink /dev/cdrom -> /dev/hdc
> (ls -l /dev/cdrom = lrwxrwxrwx 1 root root 3 2008-01-09 05:58 /dev/
> cdrom -> hdc)
>
> In fstab uncomment the line (or add the line):
> /dev/cdrom /mnt/cdrom iso9660 noauto,user,ro 0 0
>
> This should do what you need.


Thanks for the reply. I'm wondering though, if the above will work
since
the system was already set similar to what you have said. fstab has
the
lines you mention, and I get the following when I do:

$ ls -l /dev/hdc
brw-rw-rw- 1 root cdrom 22, 0 2008-01-10 01:08 /dev/hdc
$ ls -l /dev/cdrom
lrwxrwxrwx 1 root root 3 2008-01-10 01:08 /dev/cdrom -> hdc

The only difference is the permissions on my /dev/hdc which is "brw-rw-
rw-"
rather than "brw-rw----". And if I remove rw from o, i.e.

chmod o-rw /dev/hdc

I'm worried I won't be able to use the cdrom writer.
I can remove the rules I added to make things almost exactly like
before, but I think it will just mean that /dev/cdrom will
permanently point to /dev/hdd which was my initial problem.

Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 11:42 AM
jayjwa
 
Posts: n/a
Default Re: Problems with udev

"Mr. Usenet" <[email protected]> writes:


> So can anyone tell me how to make the link with /dev/hdc permanent?
> Thanks.


IMO, dump udev. How many times does one really add devices to their system?
udev takes something trivial, adds a bunch of config files, makes it
more complex, and then fails to work. Progression, backwards.


--
[** America, the police state **]
Whoooose! What's that noise? Why, it's US citizen's
rights, going down the toilet with Bush flushing.
http://www.wired.com/politics/securi...007/08/wiretap
http://www.hermes-press.com/police_state.htm
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 11:42 AM
Robby Workman
 
Posts: n/a
Default Re: Problems with udev

On 2008-01-10, toshiro <[email protected]> wrote:
> On Jan 9, 1:46 pm, "Mr. Usenet" <[email protected]> wrote:
>>

> ...
>> So can anyone tell me how to make the link with /dev/hdc permanent?
>> Thanks.

>
> If you *always* want your cdrom to point to /dev/hdc AND you do not
> need dynamic assignment of you cdrom device... then there is no need
> to use udev for this
> so remove *your* changes from /etc/udev/rules.d, and instead do the
> following:
>
> Make sure user.group of /dev/hdc is root.cdrom
> (ls -l /dev/hdc = brw-rw---- 1 root cdrom 22, 64 2008-01-09 05:58 /dev/
> hdc)
>
> Make a symlink /dev/cdrom -> /dev/hdc
> (ls -l /dev/cdrom = lrwxrwxrwx 1 root root 3 2008-01-09 05:58 /dev/
> cdrom -> hdc)
>
> In fstab uncomment the line (or add the line):
> /dev/cdrom /mnt/cdrom iso9660 noauto,user,ro 0 0
>
> This should do what you need.



That's great until the OP reboots - it's not going to persist.
The proper way is to handle it with udev.
I'll post that in just a moment to the original post.

-RW
Reply With Quote
  #6 (permalink)  
Old 01-19-2008, 11:42 AM
Robby Workman
 
Posts: n/a
Default Re: Problems with udev

["Followup-To:" header set to alt.os.linux.slackware.]
On 2008-01-09, Mr. Usenet <[email protected]> wrote:
> Hi
>
> I'm running Slackware 12.0, kernel 2.6.21.5. I have a dvd and a cd
> drive. My problem is that the link /dev/cdrom intermittently points
> to /dev/hdd, i.e.:
>
> %~$ ls -l /dev/cdrom
> lrwxrwxrwx 1 root root 3 2008-01-08 07:13 /dev/cdrom -> hdd
>
> rather than /dev/hdc.
>
> This is after I created the file:
>
> /etc/udev/rules.d/10-local.rules
>
> which contains:
>
> KERNEL=="hdc", SYMLINK="cdrom"
>
> Before I created this file, it constantly pointed to /dev/hdd. Now,
> it
> seems to alternate daily between hdc and hdd. When I do:
>
> udevtest /sys/block/hdd
>
> I get:
>
> ....
>
> update_link: found '/block/hdc' for 'cdrom'
> update_link: compare priority of '/block/hdc' 0 > 0
> update_link: found '/block/hdd' for 'cdrom'
> update_link: compare (our own) priority of '/block/hdd' 0 >= 0
> update_link: 'cdrom' with target 'hdd' has the highest priority 0,
> create it
> ....
>
> which seems to say that there is still some file trying to push /dev/
> hdd as
> the link from /dev/cdrom. One other confusing thing is that the
> timestamp
> in:
>
> lrwxrwxrwx 1 root root 3 2008-01-08 07:13 /dev/cdrom -> hdd
>
> for the created link is 07:13, and the computer was not on at this
> time.
>
> So can anyone tell me how to make the link with /dev/hdc permanent?
> Thanks.



See /etc/udev/rules.d/75-optical-devices.rules
Edit the generated rules in there to make the links point where you
want them to point. Also remove your custom rule - it's not needed.
The conflict you were seeing is/was the result of your custom rule
in conjunction with the generated rules.

-RW
Reply With Quote
  #7 (permalink)  
Old 01-19-2008, 11:42 AM
Henrik Carlqvist
 
Posts: n/a
Default Re: Problems with udev

jayjwa <[email protected]> wrote:
> IMO, dump udev. How many times does one really add devices to their system?


Every time you insert an USB stick? Every time you connect something else
by USB? IMHO udev is a good replacement for the old hotplug. Also fixed
devices like network cards are handled well. With udev it is easy to make
sure that a card with a special mac address always gets named eth1.

> udev takes something trivial, adds a bunch of config files, makes it
> more complex, and then fails to work. Progression, backwards.


For me it was rather easy to understand how to edit udev files. I have
also been able to edit some hald files, but I think that the hald files
are more messy.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc1(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost

Reply With Quote
  #8 (permalink)  
Old 01-19-2008, 11:42 AM
toshiro
 
Posts: n/a
Default Re: Problems with udev

On Jan 10, 1:47 pm, "Mr. Usenet" <[email protected]> wrote:
> toshiro wrote:
> > On Jan 9, 1:46 pm, "Mr. Usenet" <[email protected]> wrote:

>
> > ...
> > > So can anyone tell me how to make the link with /dev/hdc permanent?
> > > Thanks.

>
> > If you *always* want your cdrom to point to /dev/hdc AND you do not
> > need dynamic assignment of you cdrom device... then there is no need
> > to use udev for this
> > so remove *your* changes from /etc/udev/rules.d, and instead do the
> > following:

>
> > Make sure user.group of /dev/hdc is root.cdrom
> > (ls -l /dev/hdc = brw-rw---- 1 root cdrom 22, 64 2008-01-09 05:58 /dev/
> > hdc)

>
> > Make a symlink /dev/cdrom -> /dev/hdc
> > (ls -l /dev/cdrom = lrwxrwxrwx 1 root root 3 2008-01-09 05:58 /dev/
> > cdrom -> hdc)

>
> > In fstab uncomment the line (or add the line):
> > /dev/cdrom /mnt/cdrom iso9660 noauto,user,ro 0 0

>
> > This should do what you need.

>
> Thanks for the reply. I'm wondering though, if the above will work
> since
> the system was already set similar to what you have said. fstab has
> the
> lines you mention, and I get the following when I do:
>
> $ ls -l /dev/hdc
> brw-rw-rw- 1 root cdrom 22, 0 2008-01-10 01:08 /dev/hdc
> $ ls -l /dev/cdrom
> lrwxrwxrwx 1 root root 3 2008-01-10 01:08 /dev/cdrom -> hdc
>
> The only difference is the permissions on my /dev/hdc which is "brw-rw-
> rw-"
> rather than "brw-rw----". And if I remove rw from o, i.e.
>
> chmod o-rw /dev/hdc
>


Hang on you may have misunderstood - your hdc perms are correct,
they should be brw-rw-rw and the ownership should root:cdrom.
As a normal user you should belong to the cdrom group by default. If
not you can add yourself.

> I'm worried I won't be able to use the cdrom writer.
> I can remove the rules I added to make things almost exactly like
> before, but I think it will just mean that /dev/cdrom will
> permanently point to /dev/hdd which was my initial problem.


You want the cdrom to point to /dev/hdc right?
So make the symlink yourself as I stated earlier and udev will not
change it.

I had a similar problem when I first started using udev+hal+messagebus
with Slack12.
So I simply uncommented the cdrom line in fstab and made the following
link /dev/cdrom -> /dev/hdc (in my case for CD/RW), and it just worked
fine after that.
Programs like kplayer, k3b, xmms, etc work fine, also KDE (which auto
mounts
to /media/cdrom/.... work OK)

The advice of other people about editing udev rules is correct as
well, but my CD devices are
*screwed* into my desktop, laptop, whatever - I do not plug them in
and out at all. So why should I use udev to manage them. Things like
cameras & mem sticks are good candidates for udev but NOT an internal
DVD. For me using fstab and /dev/cdrom->/dev/hdc works fine.

It is your choice which way to go but try the fstab + symlink method,
it is trivial and
you can always rollback your changes in a minute.

And let us know the results. Good luck.
Reply With Quote
  #9 (permalink)  
Old 01-19-2008, 11:42 AM
Mr. Usenet
 
Posts: n/a
Default Re: Problems with udev

Thanks again for everyone's reply.


On Fri, 11 Jan 2008 07:39:56, toshiro wrote:
>You want the cdrom to point to /dev/hdc right?
>So make the symlink yourself as I stated earlier and udev will not
>change it.


I did make this link myself initially before I knew anything about
udev, but it reverted on the next boot. But not after I learned about
udev and made all the rules. So I just did this as root and will
see how it works.

>And let us know the results. Good luck.


Thanks, although if the trick was to make the symlink after
creating rules than before, then this isn't very intuitive.

On Thu, 10 Jan 2008 20:15:33, jayjwa wrote:
>IMO, dump udev. How many times does one really add devices to their system?
>udev takes something trivial, adds a bunch of config files, makes it
>more complex, and then fails to work. Progression, backwards.


I admit this is the way I feel too. As a user of Slackware, many
times
these attempts to automate configuration usually leads to frustration
for me, especially since I don't mind manually handling the mounting
of
hardware. I remember when setting up a printer first meant
configuring
"printcap", then they added "modules.conf", and now CUPS. Sound
started
with ISAPNP, then "sndconfig", then they added "modules.conf", and now
it's "alsaconf". Each time, hours of hard fought knowledge went out
the window as I struggled with the new system that often still had a
lot of kinks. I'm an 10+ year user of Linux, and if I get exasperated
by the changes, what will this mean to non-Unix newbies.

But I guess the point of the changes were so that new users wouldn't
have to struggle with configuration, and since every new version of a
distribution will end up using the new utilities, I've decided just to
go along.

On Fri, 11 Jan 2008 05:22:37, Robby Workman wrote:
>See /etc/udev/rules.d/75-optical-devices.rules
>Edit the generated rules in there to make the links point where you
>want them to point. Also remove your custom rule - it's not needed.
>The conflict you were seeing is/was the result of your custom rule
>in conjunction with the generated rules.


I've taken a look but I couldn't figure out what to do except maybe
comment out the line:

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-1:1",
SYMLINK+="cdrom"

I tried tracing this to /lib/udev/cdrom-symlinks.sh, but I can't see
anything about "hdd" or "hdc". My online reading of:

http://reactivated.net/writing_udev_rules.html

didn't help much either, since it seems they thought that
my custom rules would have been enough.

On Fri, 11 Jan 2008 08:27:35, Henrik Carlqvist wrote:
>Every time you insert an USB stick? Every time you connect something else
>by USB? IMHO udev is a good replacement for the old hotplug. Also fixed
>devices like network cards are handled well. With udev it is easy to make
>sure that a card with a special mac address always gets named eth1.


I admit, my USB flash drive gets detected pretty easily.

Reply With Quote
  #10 (permalink)  
Old 01-19-2008, 11:42 AM
Robby Workman
 
Posts: n/a
Default Re: Problems with udev

["Followup-To:" header set to alt.os.linux.slackware.]
On 2008-01-11, Mr. Usenet <[email protected]> wrote:
>
> I admit this is the way I feel too. As a user of Slackware, many
> times
> these attempts to automate configuration usually leads to frustration
> for me, especially since I don't mind manually handling the mounting
> of
> hardware. I remember when setting up a printer first meant
> configuring
> "printcap", then they added "modules.conf", and now CUPS. Sound
> started
> with ISAPNP, then "sndconfig", then they added "modules.conf", and now
> it's "alsaconf". Each time, hours of hard fought knowledge went out
> the window as I struggled with the new system that often still had a
> lot of kinks. I'm an 10+ year user of Linux, and if I get exasperated
> by the changes, what will this mean to non-Unix newbies.
>
> But I guess the point of the changes were so that new users wouldn't
> have to struggle with configuration, and since every new version of a
> distribution will end up using the new utilities, I've decided just to
> go along.



While I admit that sometimes there are kinks in the "new" ways,
the idea behind them is indeed to make the stuff "just work" for
all users (not just new users).


> On Fri, 11 Jan 2008 05:22:37, Robby Workman wrote:
>>See /etc/udev/rules.d/75-optical-devices.rules
>>Edit the generated rules in there to make the links point where you
>>want them to point. Also remove your custom rule - it's not needed.
>>The conflict you were seeing is/was the result of your custom rule
>>in conjunction with the generated rules.

>
> I've taken a look but I couldn't figure out what to do except maybe
> comment out the line:
>
> ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-1:1",
> SYMLINK+="cdrom"



Okay, here's what the autogenerated rules put in my 75-optical-devices.rules
file:

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdrom0"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdrom"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="dvd0"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="dvd"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdr0"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdr"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdrw0"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdrw"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdwriter0"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdwriter"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="writer"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="cdrom1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvd1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvdrw1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvdrw"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvdwriter1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvdwriter"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="cdr1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="cdrw1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="cdwriter1"

Since I don't care about all of the "extra" links, here's what I do to that
file:

ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:0", SYMLINK+="cdrom"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvd"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="cdwriter"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="dvdwriter"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.1-ide-0:1", SYMLINK+="writer"

This is because my first drive (at /dev/hda) is a cd writer but only can
read dvds, and my second drive can write both cds and dvds, and I use the
second one for most (if not all) writing tasks...

You can use "trial and error" to find which path points to which actual
device node, or udevinfo(8) should be helpful.

-RW
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



All times are GMT. The time now is 06:01 PM.


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