[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: USB flash drive not automounting or mounting



On Mon, 6 Feb 2006 20:45:58 -0800
Rob Blomquist <rob.blomquist@verizon.net> wrote:

> On Monday 06 February 2006 9:58 am, Andrew Sackville-West so eloquently 
> stated:
> 
> > Now, I am not sure which of these would be used for a flash drive, but I
> > can tell that a few won't be....
> 
> look in /etc/udev/rules.d/050_hal* and see what that says. That is the rule
>  that creates sd* devices.
> 
> OK, in /etc/udev/hal.rules:
> # put removable IDE/SCSI devices into the hal group instead of 'disk'
> BUS="scsi",KERNEL="sd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
> %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
> # BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
> %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
> BUS="usb", KERNEL="ub[a-z]*", NAME="%k", MODE="0640", GROUP="hal"
> 
> In /etc/udev/rules.d/:
> I have no 050_hal* files. I have a file called z_hal-plugdev.rules:
> # put removable IDE/SCSI devices into the hal group instead of 'disk'
> BUS="scsi",KERNEL="sd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
> %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
> # BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/device-removable.sh 
> %k", RESULT="1", NAME="%k", MODE="0640", GROUP="hal"
> BUS="usb", KERNEL="ub[a-z]*", NAME="%k", MODE="0640", GROUP="hal"
> 
> Since they point to /etc/udev/scripts/device-removable.sh:
> #!/bin/sh -e
> # print "1" if device $1 is either removable, on the ieee1394 or on the usb 
> bus,
> # and "0" otherwise.
> 
> check_bus() {
>   # check if the DEVICE is on the given bus 
>   # This is done by checking if any of the devices on the bus is a prefix 
>   # of the device
>   BUSDEVP="/sys/bus/$1/devices"
>   for x in $BUSDEVP/*; do
>     [ -L "$x" ] || continue
>     if echo "$DEVICE" | grep -q "^$(readlink -f $x)"; then 
>       return 0
>     fi
>   done
>   return 1
> }
> 
> DEV="${1%[0-9]*}"
> BLOCKPATH="/sys/block/$DEV"
> 
> if [ ! -d "${BLOCKPATH}" ]; then 
>   exit 1
> fi
> 
> REMOVABLE="${BLOCKPATH}/removable"
> DEVICE="$(readlink -f "${BLOCKPATH}/device")"
> IS_REMOVABLE="0"
> 
> if [ -e "$REMOVABLE" ]; then
>   IS_REMOVABLE="$(cat $REMOVABLE)"
> fi
> 
> if [ "$IS_REMOVABLE" = "1" ] || check_bus "usb" || check_bus "ieee1394" ; then 
>   echo 1
> else 
>   echo 0
> fi
> exit 0
> 
> 
> Nothing here leads me to believe this is how the automounting happens. I also 
> looked at my Ubuntu udev scripts and rules and saw nothing there.
> 
> Can someone enlighten me otherwise?

Rod, we have two issues here and the first (can't mount) needs to be solved before the second (automount). The second depends on the first. If you can't mount the flash drive manually, you certainly can't mount it automatically.

So:  

We've got the output from your dmesg and we know that mount -t vfat /dev/sdb1... fails. What we don't know is whether udev is creating /dev/sdb1 for you when you insert the flashcard. Please check that: ls -l /dev | grep sdb  should provide the relevant output.   

I am assuming that udev is not providing this device. Frankly this doesn't make sense to me as mine works just fine without any special rules. But, systems are different. Based on my assumption above, you need to write a special udev rule for this card. incidentally, this will give you the oppportunity to give it a persistent name as well, such as /dev/flash or whatever. Once this problem is solved, and it mounts manually, you can look at the variety of automatic mounting solutions.
check this for udev rules: http://www.reactivated.net/writing_udev_rules.html

A
> 
> Rob
> 
> -- 
> Mountlake Terrace, WA, USA
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 

Attachment: pgp4GZuq3A7K9.pgp
Description: PGP signature


Reply to: