You are not logged in.

#1 2012-03-09 17:20:10

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

[SOLVED] kindle fire does not automount

I've followed instructions on the udev wiki page to automount USB devices.  Mostly, it works, but not for my kindle fire.

Here's what dmesg has to say after I connect the fire...

[  988.103247] usb 1-7: new high-speed USB device number 9 using ehci_hcd
[  988.240616] scsi11 : usb-storage 1-7:1.0
[  989.243894] scsi 11:0:0:0: Direct-Access     Amazon   Kindle           0001 PQ: 0 ANSI: 2
[  989.246391] sd 11:0:0:0: [sde] Attached SCSI removable disk
[  993.763487] sd 11:0:0:0: [sde] 10508288 512-byte logical blocks: (5.38 GB/5.01 GiB)
[  993.764223] sd 11:0:0:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[  993.768872]  sde:

The fire is recognized as /dev/sde:

[dave@starbuck ~]$ ls -l /dev/disk/by-id/usb-Amazon_Kindle_5C2C002600000001-0\:0 
lrwxrwxrwx 1 root root 9 Mar  9 09:10 /dev/disk/by-id/usb-Amazon_Kindle_5C2C002600000001-0:0 -> ../../sde

At this point I can manually mount it.  But why doesn't it automount?  Any tips on how to troubleshoot are appreciated.


For comparison, when I connect an android phone to the same usb cable, it automounts correctly.  Here's the end of dmesg after the phone is automounted as /media/usbhd-sde1:

[  851.448740] sd 9:0:0:0: [sde] Synchronizing SCSI cache
[  851.448798] sd 9:0:0:0: [sde]  Result: hostbyte=0x01 driverbyte=0x00
[  855.369929] usb 1-7: new high-speed USB device number 8 using ehci_hcd
[  855.500847] scsi10 : usb-storage 1-7:1.0
[  856.503965] scsi 10:0:0:0: Direct-Access     Motorola A855             0001 PQ: 0 ANSI: 2
[  856.506460] sd 10:0:0:0: [sde] Attached SCSI removable disk
[  914.403519] sd 10:0:0:0: [sde] 31326208 512-byte logical blocks: (16.0 GB/14.9 GiB)
[  914.404505] sd 10:0:0:0: [sde] No Caching mode page present
[  914.404510] sd 10:0:0:0: [sde] Assuming drive cache: write through
[  914.406504] sd 10:0:0:0: [sde] No Caching mode page present
[  914.406507] sd 10:0:0:0: [sde] Assuming drive cache: write through
[  914.410914]  sde: sde1

Last edited by Dave Cohen (2012-03-09 22:29:00)

Offline

#2 2012-03-09 17:27:59

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] kindle fire does not automount

The kindle doesn't seem to have any partitions.  Maybe that's why it won't automount.

Last edited by alphaniner (2012-03-09 17:29:11)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2012-03-09 21:53:22

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

Re: [SOLVED] kindle fire does not automount

True, it appears to have no partitions.  But that does not explain why it does not automount.  Does my udev rule only run for partitions?

How can I troubleshoot these rules?  Is there something I can put in there to log when it is being called and with what values?

Here's the rules I'm using, copied from the wiki page:

# /etc/udev/rules.d/10-my-media-automount.rules

# start at sdb to ignore the system hard drive
KERNEL!="sd[d-z]*", GOTO="my_media_automount_end"
ACTION=="add", PROGRAM!="/sbin/blkid -p %N", GOTO="my_media_automount_end"

# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"

# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# create the dir in /media and symlink it to /mnt
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"

# global mount options
ACTION=="add", ENV{mount_options}="relatime"
# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"

# automount ntfs filesystems using ntfs-3g driver
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
# automount all other filesystems
ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"

# clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"

# exit
LABEL="my_media_automount_end"

Offline

#4 2012-03-09 22:06:59

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] kindle fire does not automount

Try udiskie or similar. My android also presents itself as /dev/sdX, and udiskie handles it fine.

Offline

#5 2012-03-09 22:28:43

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

Re: [SOLVED] kindle fire does not automount

I found udevadm which let me see all the events being processed.  I discovered that the kindle gets an add event when plugged in, but not yet ready to be mounted.  Later it gets a change event. (and more change events when I disconnect/reconnect via the button on the kindle).

So I changed my udev script to respond to both add and change events.  It seems to work although I haven't tested other devices yet.

Here's what I'm currently testing

# /etc/udev/rules.d/10-my-media-automount.rules

# start at sdb to ignore the system hard drive
KERNEL!="sd[d-z]*", GOTO="my_media_automount_end"
ACTION=="add|change", PROGRAM!="/sbin/blkid -p %N", GOTO="my_media_automount_end"

# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"

# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# create the dir in /media and symlink it to /mnt
ACTION=="add|change", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"

# global mount options
ACTION=="add|change", ENV{mount_options}="relatime"
# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
ACTION=="add|change", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"

# automount ntfs filesystems using ntfs-3g driver
ACTION=="add|change", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
# automount all other filesystems
ACTION=="add|change", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"

# clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"

# exit
LABEL="my_media_automount_end"

Thanks for the tip about udiskie.  I'll try something like that if my fix turns out to be broken.

Offline

Board footer

Powered by FluxBB