Bug #394

unable to mount USB storage devices

Added by Human over 15 years ago. Updated almost 13 years ago.

Status:Closed Start date:
Priority:Normal Due date:12/31/1969
Assignee:- % Done:

0%

Category:- Spent time: -
Target version:6.00.04

Description

Maybe I'm doing this wrong, but in a remote ISO build today, I'm unable to mount either of the two USB thumb drives I plugged in. I tried several variants and got "mount: /dev/sg2 is not a block device" each time. I know they detect as sg2 because of kernel log messages.

History

Updated by UniCav over 15 years ago

I have the same thing. Just installed today from R6.00.08 iso and did a full updgrade with pacman. When I insert a usb stick it doesn't do anything.
[edit]
I see hal is installed and working using lshal --monitor ... but there are no policies in /etc/hal.d/fdi/policies
without those hal has no idea what to do with devices. Hopefully they'll assign this to someone shortly and we'll get a fix.

Updated by cecil over 15 years ago

sudo pacman -Sy udev
USB device should get mounted in /media

Updated by UniCav over 15 years ago

That fixes it. I also removed halevt that I had installed yesterday before updating udev and it works perfectly. USB Devices are automatically mounted in /media. It doesn't use the LABEL of the device but that's not really a big deal. Also probably not hard to fix with a tweak to udev's rules.

Additional step is to add /media to the list of directories containing videos under Service > Mythtv > Media > Video Settings, then whenever a usb device is plugged in it gets mounted and you can browse to it in the media library.

Updated by UniCav over 15 years ago

ADDENDUM:
To get the devices mounted under media as their partition label instead of USB# change /etc/udev/rules.d/usb-storage.rules as follows.
Basically you change all the ACTION lines that reference /media/usb%n to /media/$env{ID_FS_LABEL}

KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usb%m", GROUP="users", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usb%n", GROUP="users", NAME="%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /media/$env{ID_FS_LABEL}"
ACTION=="add", KERNEL=="sd[a-z][0-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/%k /media/$env{ID_FS_LABEL}", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /media/$env{ID_FS_LABEL}", OPTIONS="last_rule"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /media/$env{ID_FS_LABEL}"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /media/$env{ID_FS_LABEL}", OPTIONS="last_rule"

Updated by UniCav over 15 years ago

Hold off on that file change. I was unable to boot the system properly (went into maintenance mode) and wound up reinstalling the whole system. Originally I blamed it on plugging in another SATA drive with a bootable partition on it. After getting reinstalled and doing the same file change I tried using a USB adapter with the extra drive and it did the same thing, locked up and then wouldn't boot. I undid the changes and everything has been fine since. Apparently the changes I made cause udev to mount drives in loops and screws up /etc/mtab. So ATM things are working with the original "usb%n" format. Here is the original /etc/udev/rules.d/usb-storage.rules file I went by from http://bbs.archlinux.org/viewtopic.php?id=54607
That has some extra steps which probably prevent this problem. I have yet to test it, however.

KERNEL=="sd[b-z]", NAME="%k", SYMLINK+="usb%m", GROUP="users", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[b-z][0-9]", SYMLINK+="usb%n", GROUP="users", NAME="%k"
ACTION=="add", KERNEL=="sd[b-z][0-9]", RUN+="/bin/mkdir -p /mnt/usb%n"
ACTION=="add", KERNEL=="sd[b-z][0-9]", RUN+="/bin/ln -s /mnt/usb%n /media/$env{ID_FS_LABEL}"
ACTION=="add", KERNEL=="sd[b-z][0-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/bin/mount -t vfat -o rw,noauto,flush,quiet,nodev,nosuid,noexec,noatime,dmask=000,fmask=111 /dev/%k /mnt/usb%n", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[b-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /mnt/usb%n", OPTIONS="last_rule"
ACTION=="remove", KERNEL=="sd[b-z][0-9]", RUN+="/bin/umount -l /mnt/usb%n"
ACTION=="remove", KERNEL=="sd[b-z][0-9]", RUN+="/bin/rm /media/$env{ID_FS_LABEL}"
ACTION=="remove", KERNEL=="sd[b-z][0-9]", RUN+="/bin/rmdir /mnt/usb%n", OPTIONS="last_rule"

Updated by jams almost 13 years ago

  • Target version changed from 8.0 to 6.00.04

Also available in: Atom PDF