public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] help with UDEV and USB flash drive
@ 2006-06-09  8:12 Daevid Vincent
  2006-06-09  8:33 ` Dirk Heinrichs
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Daevid Vincent @ 2006-06-09  8:12 UTC (permalink / raw
  To: gentoo-user

I've been googling and hacking at this for about three hours now. 

Can someone tell me what I am doing wrong?

locutus mnt # cat /etc/udev/rules.d/local.rules
# This is for my Intelligent Stick USB Memory flash drive
BUS=="usb", SYSFS{serial}=="20031112223132-01", NAME="istick", MODE="0666"

locutus linux # cat /etc/fstab
# Intelligent Stick flash drive (UDEV)
/dev/istick  /mnt/istick  vfat defaults,noauto,user,umask=000  0 0

locutus linux # ll /dev/istick
crw-rw-rw- 1 root root 21, 1 Jun  9 00:32 /dev/istick

locutus linux # mount /dev/istick
mount: /dev/istick is not a block device

But after a long night, I tried this and was shocked to see it works:

locutus linux # ll /dev/sda1
brw-rw---- 1 root disk 8, 1 Jun  9 00:32 /dev/sda1

locutus linux # mount -t vfat /dev/sda1 /mnt/istick/
locutus linux # ls /mnt/istick/
MIDI Files  pwsafe.key

So, why doesn't my /dev/istick work? 
I assume it has to do with that 'b' on /dev/sda1 and the 'c' on /dev/istick
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09  8:12 Daevid Vincent
@ 2006-06-09  8:33 ` Dirk Heinrichs
  2006-06-09  8:35 ` Neil Bothwick
  2006-06-09 11:45 ` Dirk Heinrichs
  2 siblings, 0 replies; 13+ messages in thread
From: Dirk Heinrichs @ 2006-06-09  8:33 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]

Am Freitag, 9. Juni 2006 10:12 schrieb ext Daevid Vincent:

> Can someone tell me what I am doing wrong?
>
> locutus mnt # cat /etc/udev/rules.d/local.rules
> # This is for my Intelligent Stick USB Memory flash drive
> BUS=="usb", SYSFS{serial}=="20031112223132-01", NAME="istick",
> MODE="0666"

BUS=="scsi" and I would also use SYMLINK="istick%n" instead of NAME. I'd 
also guess that the SYSFS{serial} is not the one of the stick, but four 
your USB hub.

> locutus linux # cat /etc/fstab
> # Intelligent Stick flash drive (UDEV)
> /dev/istick  /mnt/istick  vfat defaults,noauto,user,umask=000  0 0
>
> locutus linux # ll /dev/istick
> crw-rw-rw- 1 root root 21, 1 Jun  9 00:32 /dev/istick

This is a character device.

> So, why doesn't my /dev/istick work?
> I assume it has to do with that 'b' on /dev/sda1 and the 'c' on
> /dev/istick

Yes.

You should also read http://www.reactivated.net/writing_udev_rules.html.

HTH...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Hambornerstraße 55      | Web:  http://www.capgemini.com
D-40472 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09  8:12 Daevid Vincent
  2006-06-09  8:33 ` Dirk Heinrichs
@ 2006-06-09  8:35 ` Neil Bothwick
  2006-06-09  8:59   ` Dirk Heinrichs
  2006-06-09 19:21   ` Daevid Vincent
  2006-06-09 11:45 ` Dirk Heinrichs
  2 siblings, 2 replies; 13+ messages in thread
From: Neil Bothwick @ 2006-06-09  8:35 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1866 bytes --]

On Fri, 9 Jun 2006 01:12:50 -0700, Daevid Vincent wrote:

> I've been googling and hacking at this for about three hours now. 
> 
> Can someone tell me what I am doing wrong?
> 
> locutus mnt # cat /etc/udev/rules.d/local.rules
> # This is for my Intelligent Stick USB Memory flash drive
> BUS=="usb", SYSFS{serial}=="20031112223132-01", NAME="istick",
> MODE="0666"

This should be in /etc/udev/rules.d/10-local.rules, so it is processed
before the default rules, but that's not the problem here.

> locutus linux # cat /etc/fstab
> # Intelligent Stick flash drive (UDEV)
> /dev/istick  /mnt/istick  vfat defaults,noauto,user,umask=000  0 0
> 
> locutus linux # ll /dev/istick
> crw-rw-rw- 1 root root 21, 1 Jun  9 00:32 /dev/istick
> 
> locutus linux # mount /dev/istick
> mount: /dev/istick is not a block device

That's because you are trying to mount the whole device, not the
partition.

> locutus linux # ll /dev/sda1
> brw-rw---- 1 root disk 8, 1 Jun  9 00:32 /dev/sda1
> 
> locutus linux # mount -t vfat /dev/sda1 /mnt/istick/
> locutus linux # ls /mnt/istick/
> MIDI Files  pwsafe.key

Now you are mounting the partition.

> 
> So, why doesn't my /dev/istick work? 
> I assume it has to do with that 'b' on /dev/sda1 and the 'c'
> on /dev/istick

Yes, it's not a block device. Change the NAME part of the rule to
NAME="istick%n" and mount /dev/istick1. Or just set up a rule to match
the partition. This is the sort of thing I use for a USB stick

BUS=="usb",  KERNEL=="sd?1", SYSFS{idProduct}=="0845", SYSFS{idVendor}=="08ec", NAME="gigabyte", SYMLINK="%k usb/gigabyte"

I don't use fstab, but let KDE/HAL/pmount mount it on /media/gigabyte.
But I could put /dev/gigabyte in fstab if I didn't want automounting.


-- 
Neil Bothwick

Any sufficiently advanced bug is indistinguishable from a feature.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09  8:35 ` Neil Bothwick
@ 2006-06-09  8:59   ` Dirk Heinrichs
  2006-06-09 10:16     ` Neil Bothwick
  2006-06-09 19:21   ` Daevid Vincent
  1 sibling, 1 reply; 13+ messages in thread
From: Dirk Heinrichs @ 2006-06-09  8:59 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

Am Freitag, 9. Juni 2006 10:35 schrieb ext Neil Bothwick:

> That's because you are trying to mount the whole device, not the
> partition.

Even the whole device should be a block device, shouldn't it? And if it had 
a filesystem, you could even mount it, having one partition is as good as 
having no partition, at least for Linux.

> BUS=="usb",  KERNEL=="sd?1", SYSFS{idProduct}=="0845",
> SYSFS{idVendor}=="08ec", NAME="gigabyte", SYMLINK="%k usb/gigabyte"

OK, here is what I do :-)

BUS=="scsi", KERNEL=="sd*", SYSFS{model}=="HardDrive       ", 
SYSFS{rev}=="1.11", SYSFS{vendor}=="32MB    ", SYMLINK="usb/stick%n"

This will give me nodes for the device itself and its partitions.

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Hambornerstraße 55      | Web:  http://www.capgemini.com
D-40472 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09  8:59   ` Dirk Heinrichs
@ 2006-06-09 10:16     ` Neil Bothwick
  2006-06-09 11:15       ` Dirk Heinrichs
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Bothwick @ 2006-06-09 10:16 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]

On Fri, 9 Jun 2006 10:59:13 +0200, Dirk Heinrichs wrote:

> > That's because you are trying to mount the whole device, not the
> > partition.
> 
> Even the whole device should be a block device, shouldn't it?

Yes it should, it's podd that is appears as a character device.

> And if it
> had a filesystem, you could even mount it, having one partition is as
> good as having no partition, at least for Linux.

It's not the same. A filesystem on a single partition filling the device
is not the same as a filesystem on the device itself. Both are possible,
and mountable, but not at the same time. I've just checked with with a
single partition device to be sure, it didn't work.

> > BUS=="usb",  KERNEL=="sd?1", SYSFS{idProduct}=="0845",
> > SYSFS{idVendor}=="08ec", NAME="gigabyte", SYMLINK="%k usb/gigabyte"
> 
> OK, here is what I do :-)
> 
> BUS=="scsi", KERNEL=="sd*", SYSFS{model}=="HardDrive       ", 
> SYSFS{rev}=="1.11", SYSFS{vendor}=="32MB    ", SYMLINK="usb/stick%n"
> 
> This will give me nodes for the device itself and its partitions.

I do that for some drives, but my USB sticks are always a single
partition, so I give the name to the partition not the device. I also set
NAME and put %k in SYMLINK, because pmount uses the name to create the
directory in /media, and I want the device mounted
at /media/somethingmeaningful, not /media/sdxn.


-- 
Neil Bothwick

This fortune soaks up 47 times its own weight in excess memory.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09 10:16     ` Neil Bothwick
@ 2006-06-09 11:15       ` Dirk Heinrichs
  0 siblings, 0 replies; 13+ messages in thread
From: Dirk Heinrichs @ 2006-06-09 11:15 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

Am Freitag, 9. Juni 2006 12:16 schrieb ext Neil Bothwick:
> On Fri, 9 Jun 2006 10:59:13 +0200, Dirk Heinrichs wrote:
> > > That's because you are trying to mount the whole device, not the
> > > partition.
> >
> > Even the whole device should be a block device, shouldn't it?
>
> Yes it should, it's podd that is appears as a character device.

It isn't. Read my very first answer.

> > And if it
> > had a filesystem, you could even mount it, having one partition is as
> > good as having no partition, at least for Linux.
>
> It's not the same. A filesystem on a single partition filling the device
> is not the same as a filesystem on the device itself. Both are possible,
> and mountable, but not at the same time. I've just checked with with a
> single partition device to be sure, it didn't work.

Of course not at the same time, thought that would be clear :-)

> I do that for some drives, but my USB sticks are always a single
> partition, so I give the name to the partition not the device. I also set
> NAME and put %k in SYMLINK, because pmount uses the name to create the
> directory in /media, and I want the device mounted
> at /media/somethingmeaningful, not /media/sdxn.

Good point, I switched to hal/dbus not long ago. Seems I need to rework my 
rules :-)

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Hambornerstraße 55      | Web:  http://www.capgemini.com
D-40472 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09  8:12 Daevid Vincent
  2006-06-09  8:33 ` Dirk Heinrichs
  2006-06-09  8:35 ` Neil Bothwick
@ 2006-06-09 11:45 ` Dirk Heinrichs
  2 siblings, 0 replies; 13+ messages in thread
From: Dirk Heinrichs @ 2006-06-09 11:45 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

Am Freitag, 9. Juni 2006 10:12 schrieb ext Daevid Vincent:

Another hint:

> locutus mnt # cat /etc/udev/rules.d/local.rules
> # This is for my Intelligent Stick USB Memory flash drive
> BUS=="usb", SYSFS{serial}=="20031112223132-01", NAME="istick",
> MODE="0666"
>
> locutus linux # cat /etc/fstab
> # Intelligent Stick flash drive (UDEV)
> /dev/istick  /mnt/istick  vfat defaults,noauto,user,umask=000  0 0
>
> locutus linux # ll /dev/istick
> crw-rw-rw- 1 root root 21, 1 Jun  9 00:32 /dev/istick

The device has major number 21, and char device 21 is SCSI generic, not SCSI 
disk (which is block device 8, see below). This may come from not having 
KERNEL=="sd*" in your rule.

> locutus linux # ll /dev/sda1
> brw-rw---- 1 root disk 8, 1 Jun  9 00:32 /dev/sda1

Bye...

	Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Hambornerstraße 55      | Web:  http://www.capgemini.com
D-40472 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09  8:35 ` Neil Bothwick
  2006-06-09  8:59   ` Dirk Heinrichs
@ 2006-06-09 19:21   ` Daevid Vincent
  2006-06-09 19:30     ` znx
  2006-06-09 19:50     ` Richard Fish
  1 sibling, 2 replies; 13+ messages in thread
From: Daevid Vincent @ 2006-06-09 19:21 UTC (permalink / raw
  To: gentoo-user

Thanks everybody that was the trick. I settled upon this:

BUS=="usb", KERNEL=="sd?1", SYSFS{idVendor}=="0ef5",
SYSFS{idProduct}=="2202", SYMLINK="istick%n", MODE="0666"

And for my /etc/fstab entry:
/dev/istick1  /mnt/istick  vfat  defaults,noauto,user,umask=000  0 0

Now the second part of this. SOMETIMES, when I plug the stick in (I assume
that's when it happens), KDE gives me a nice little window to view the files
or take no action. But it's not consistent?! What triggers that 'event', and
how can I make it happen all the time?

Also related, is there an easy way to make this stick auto un/mount upon
removal/insertion respectively?

I tried taking out the 'noauto' in fstab, but that didn't do it.

I saw some web search results, but most of them feel outdated, or for other
distros.

DÆVID  


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09 19:21   ` Daevid Vincent
@ 2006-06-09 19:30     ` znx
  2006-06-09 19:50     ` Richard Fish
  1 sibling, 0 replies; 13+ messages in thread
From: znx @ 2006-06-09 19:30 UTC (permalink / raw
  To: gentoo-user

On 09/06/06, Daevid Vincent <daevid@daevid.com> wrote:
> Also related, is there an easy way to make this stick auto un/mount upon
> removal/insertion respectively?

Try looking into autofs .. simple to setup and works really well for
me with my USB/CD-ROM devices.

Mark
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09 19:21   ` Daevid Vincent
  2006-06-09 19:30     ` znx
@ 2006-06-09 19:50     ` Richard Fish
  2006-06-09 20:54       ` Daniel Drake
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Fish @ 2006-06-09 19:50 UTC (permalink / raw
  To: gentoo-user

On 6/9/06, Daevid Vincent <daevid@daevid.com> wrote:
> Thanks everybody that was the trick. I settled upon this:
>
> BUS=="usb", KERNEL=="sd?1", SYSFS{idVendor}=="0ef5",
> SYSFS{idProduct}=="2202", SYMLINK="istick%n", MODE="0666"

One problem with this.  Udev will apply all matching rules until it
finds one with a NAME entry.  So you probably want MODE:="0666" to
prevent any later rules from overwriting your mode.

-Richard
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [gentoo-user] help with UDEV and USB flash drive
@ 2006-06-09 20:39 neil
  0 siblings, 0 replies; 13+ messages in thread
From: neil @ 2006-06-09 20:39 UTC (permalink / raw
  To: gentoo-user


-----Original Message-----

From:  "Daevid Vincent" <daevid@daevid.com>
Subj:  RE: [gentoo-user] help with UDEV and USB flash drive
Date:  Fri 9 Jun 2006 20:32
Size:  848 bytes
To:  <gentoo-user@lists.gentoo.org>


Now the second part of this. SOMETIMES, when I plug the stick in (I assume
that's when it happens), KDE gives me a nice little window to view the files
or take no action. But it's not consistent?! What triggers that 'event', and
how can I make it happen all the time?

KDE uses HAL for this, but it can take a few seconds to see the device. You don't need an fstab entry for this, it may even confuse things.

Also related, is there an easy way to make this stick auto un/mount upon
removal/insertion respectively?

KDE will do that, and open a window too if you want it. It is set in the Control Centre.




-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09 19:50     ` Richard Fish
@ 2006-06-09 20:54       ` Daniel Drake
  2006-06-09 23:49         ` Richard Fish
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Drake @ 2006-06-09 20:54 UTC (permalink / raw
  To: gentoo-user

Richard Fish wrote:
> One problem with this.  Udev will apply all matching rules until it
> finds one with a NAME entry.  So you probably want MODE:="0666" to
> prevent any later rules from overwriting your mode.

This isn't entirely true, udev doesn't stop at NAME any more. It stops 
at the end of the rules files, or when it sees OPTIONS="last_rule".

Daniel

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [gentoo-user] help with UDEV and USB flash drive
  2006-06-09 20:54       ` Daniel Drake
@ 2006-06-09 23:49         ` Richard Fish
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Fish @ 2006-06-09 23:49 UTC (permalink / raw
  To: gentoo-user

On 6/9/06, Daniel Drake <dsd@gentoo.org> wrote:
> Richard Fish wrote:
> > One problem with this.  Udev will apply all matching rules until it
> > finds one with a NAME entry.  So you probably want MODE:="0666" to
> > prevent any later rules from overwriting your mode.
>
> This isn't entirely true, udev doesn't stop at NAME any more. It stops
> at the end of the rules files, or when it sees OPTIONS="last_rule".

Ah, thanks.

Sadly, this change is not noted in
/usr/share/doc/udev-*/RELEASE-NOTES.gz file.  The 057 notes specify
the stop-on-NAME behavior, and nothing newer (at least through 090)
retracts  that statement.

-Richard
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-06-09 23:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-09 20:39 [gentoo-user] help with UDEV and USB flash drive neil
  -- strict thread matches above, loose matches on Subject: below --
2006-06-09  8:12 Daevid Vincent
2006-06-09  8:33 ` Dirk Heinrichs
2006-06-09  8:35 ` Neil Bothwick
2006-06-09  8:59   ` Dirk Heinrichs
2006-06-09 10:16     ` Neil Bothwick
2006-06-09 11:15       ` Dirk Heinrichs
2006-06-09 19:21   ` Daevid Vincent
2006-06-09 19:30     ` znx
2006-06-09 19:50     ` Richard Fish
2006-06-09 20:54       ` Daniel Drake
2006-06-09 23:49         ` Richard Fish
2006-06-09 11:45 ` Dirk Heinrichs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox