Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
usb smart media card on amd 64 (won't mount)
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Sun Mar 05, 2006 8:37 am    Post subject: usb smart media card on amd 64 (won't mount) Reply with quote

I cannot mount this device (usb smart media card).
lsusb says the card is on bus 4, device 2. How can I find the right dev/ entry and choose the right filesystem type (I think it is vfat.) BTW sda is the hard drive. Is it possible to set it up so that it mounts automatically to /mnt/smartcard when it is plugged in, regardless of the slot used, if so how?


Last edited by degras on Sun Mar 12, 2006 9:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Mon Mar 06, 2006 3:33 am    Post subject: Reply with quote

Read this, do as it says.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Thu Mar 09, 2006 10:55 am    Post subject: Reply with quote

I found /sys/block/sdb and lo and behold udevinfo shows
Code:

...link to the physcial device...
BUS="scsi"
...
SYSFS{vendor}="LEXAR SM"


This is the vendor but why it says scsi and not usb I don't know.
Anyway I made a rule based on this info, but the mount command gives error
saying the dev/(SYMLINK name I used) is not a block device.

Another thing: if I boot up with the card reader attached the system suspends
with a blinking cursor.
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Thu Mar 09, 2006 5:18 pm    Post subject: Reply with quote

Regarding the drive being listed as scsi instead of usb, that is normal, basically the kernel treats usb drives as scsi internally (to a point).

As for the problem, seeing the rule would likely be diagnostically useful.

Not that I will likely be much help in diagnosing the boot issue, but could you give more details? Things like when it suspends, if it really just suspends, what kernel you have running, hardware and whatnot could be of import in diagnosing exactly what is happening. In the mean time, plug it in after you boot.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Fri Mar 10, 2006 2:22 pm    Post subject: Reply with quote

Eh, ahh sorry, I'm not interested in booting from the card, it was just something that the machine was doing that I'd rather not have happen. I am interested in using the card as a mounted drive to transfer small files. The idea is for it to always appear on the same directory, reglardless of which USB slot I plug it into.

The rule transcribed is:
Code:

BUS=="usb", SYSFS{product}=="SMART MEDIA   ?", NAME="%k", SYSLINK="lexarsm"
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Mar 10, 2006 8:52 pm    Post subject: Reply with quote

Given this:
degras wrote:
I found /sys/block/sdb and lo and behold udevinfo shows
Code:

...link to the physcial device...
BUS="scsi"
...
SYSFS{vendor}="LEXAR SM"

And this:
degras wrote:
The rule transcribed is:
Code:
BUS=="usb", SYSFS{product}=="SMART MEDIA   ?", NAME="%k", SYSLINK="lexarsm"

I think I might see the problem.

Given the proffered data, I would try something like:
Code:
BUS=="scsi", SYSFS{vendor}=="LEXAR SM", NAME="%k", SYMLINK="lexarsm"


As always, I could very readily be wrong.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Fri Mar 10, 2006 11:40 pm    Post subject: Reply with quote

Well that was the logical first choice. Maybe it is working.
But I plug it in and
Code:

# ls /mnt/lexarsm
#


nothing :roll:

Code:

# mount /dev/lexarsm /mnt/lexarsm
mount: /dev/lexarsm is not a block device
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Sat Mar 11, 2006 5:46 am    Post subject: Reply with quote

A pair of questions:
  1. Why no mount point?
  2. Is the default device node being created?
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Sat Mar 11, 2006 1:37 pm    Post subject: Reply with quote

1. I don't understand, isn't /mnt/lexarsm a mount point?

2. I think yes, it is creating /dev/lexarsm which links to /dev/sg1.

After it is plugged in, I do a dmesg and it looks like it is /dev/sdb, but sg1 is mentioned.
FAT, SQUASHFS and VFS all spout errors in dmesg output.
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Sat Mar 11, 2006 9:07 pm    Post subject: Reply with quote

  1. My point exactly, getting nothing back when you ls /mnt/lexarsm indicates the absence of the mount point.
  2. Good, that much is working.


I am unsure what you mean about the dmesg output, could you post the relevant lines?
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Sat Mar 11, 2006 10:05 pm    Post subject: Reply with quote

There is lots before this about scsi and usb but i cannot transfer to here..
Code:

sd 2:0:0:0: Attached scsi removeable disk sdb
sd 2:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete
SQUASHFS error: Can't find a SQUASHFS superblock on sdb
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sdb.


The result of mount command:
Code:

# mount -t vfat /dev/sdb /mnt/lexarsm
mount: wrong fs type, bad option, bad superblock on /dev/sdb
missing code page or other error


The result of fdisk command:
Code:

# fdisk -l /dev/sdb

Disk /dev/sdb: 4 heads, 16 sectors, 500 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb              1       500      15979+  1  FAT12


Well, i did have this card working on another machine. So I don't know, could it be USB 1 incompatibility?

(Argh :() ^10
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Mon Mar 13, 2006 12:34 am    Post subject: Reply with quote

degras wrote:
Code:
sd 2:0:0:0: Attached scsi removeable disk sdb
sd 2:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete
SQUASHFS error: Can't find a SQUASHFS superblock on sdb
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev sdb.

That indicates that /dev/sdb and /dev/sg1 are two seperate logical devices, sg1 is not the storage facet of the device, sdb is, modify your udev rules to link /dev/lexarsm to the sd* (scsi disk) device instead of the sg* (scsi generic) device.

At this point I would check the card in the system it worked in to ensure that nothing was amiss, even with nothing looking terribly wrong on this system.

Having never had to mess with FAT in any great detail, I do not really know what to check regarding the apparent misrecognition of the media as being not FAT, having a bad superblock or a missing codepage. Barring, of course, checking that the media is indeed FAT, has a valid superblock and that the proper codepage is available.

About what I posted in regards to the mount point, that was a thinko on my part, sorry.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Mon Mar 13, 2006 9:21 am    Post subject: Reply with quote

sg1 turns up on dmesg and ls -l /dev/sdb, but I don't use it.

Ah this is crazy I just tried
Code:

# mount -t vfat /dev/sdb1 /mnt/lexarsm

it worked, why sdb1?
How was I supposed to know that?
Now how do I get that udev rule working?
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Mon Mar 13, 2006 11:02 pm    Post subject: Reply with quote

Interesting that, I was going to suggest you try sdb1 until I looked at the fdisk -l output you posted which (as I parsed it) stated that there was no sdb1 and that the whole of sdb was formatted FAT, oops.

As for getting that udev rule working, I could take a crack at it if you would post the output of:
Code:
udevinfo -q all -n /dev/sdb

Note that, rather obviously, I am requesting the data on the device in question, so if something else gets sdb before you plug this device in, post the info for this device not whatever happened to get sdb.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Tue Mar 14, 2006 10:16 am    Post subject: Reply with quote

Here is the output from udevinfo (copied using the card :) )
Code:

P: /block/sdb
N: sdb
S: disk/by-id/usb-LEXAR_SM_READER
S: disk/by-path/usb-LexarMedia-SMREADER:0:0:0
E: ID_VENDOR=LEXAR_SM
E: ID_MODEL=READER
E: ID_REVISION=1.00
E: ID_SERIAL=LEXAR_SM_READER
E: ID_TYPE=disk
E: ID_BUS=usb
E: ID_PATH=usb-LexarMedia-SMREADER:0:0:0


I still got the boot problem, if the card is plugged in, gentoo tries to boot from it.

One other question, when removing the card am I supposed to eject or is umount sufficient,
if so what is the command?
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Tue Mar 14, 2006 5:51 pm    Post subject: Reply with quote

Try :
Code:
BUS=="usb", SYSFS{type}=="disk", SYSFS{vendor}=="LEXAR_SM", SYSFS{model}=="READER", SYSFS{serial}=="LEXAR_SM_READER", NAME="%k", SYMLINK="lexarsm%n"

If I am correct, that should give you /dev/lexarsm0 as the first card reader, /dev/lexarsm1 as the second and so on, I did that because I saw no unique looking identifiers for the device itself.

Are you sure that Gentoo is trying to use the card during bootup, could it be your BIOS?

I think (nonauthoritatively) that umount will suffice.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Tue Mar 14, 2006 6:16 pm    Post subject: Reply with quote

Oh dear, the udev still did not work. I had the card plugged in already, edited the rule, used umount, even created lexarsm0 and lexarsm1 directories but still nothing after udevstart. Well I'm not too bothered now, the thing works and I can use it.
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Thu Mar 16, 2006 11:21 pm    Post subject: Reply with quote

I am slightly confused here, you created lexarsm0 and lexarsm1 directories? Why not just edit your /etc/fstab (or the configuration of your automounter) to mount /dev/lexarsm1 instead of lexarsm at the same mount point?

If I understand things here properly, under the current setup you are getting the default name but not the customized link. It appears as though your custom rule is evaluated after the default rule has taken effect, negating your rule.

Edit: fixed a typo and removed a thinko.


Last edited by desultory on Sat Mar 18, 2006 5:24 am; edited 1 time in total
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Thu Mar 16, 2006 11:54 pm    Post subject: Reply with quote

It is like I said, the udev stuff did not work for me, so I just use mount /dev/sdb1 /mnt/lexarsm. I created /mnt/lexarsm0 and /mnt/lexarsm1 to see if that would help udev / rules.
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Mar 17, 2006 7:27 pm    Post subject: Reply with quote

Having just done some configuration of udev I can now tell you with some degree of certainty why these rules have been failing to work for you, they have all used the wrong set of attributes.

To find the correct set of attributes, follow this simple twelve step programme:
  1. Unplug the reader.
  2. Code:
    ls /sys/bus/usb/devices/

  3. Plug in the reader.
  4. Code:
    ls /sys/bus/usb/devices/

  5. Note the new link(s).
  6. Code:
    udevinfo -a -p $notedlink

  7. Use the output from the previous step to formulate a new udev rule set.
  8. Place the rule set formulated in the previous step in a file with a name ending in '.rules' lexicographically earlier than the file containing your default udev rules and any other udev rules files which might affect the device at hand in /etc/udev/rules.d/.
  9. Save the file.
  10. Unplug the reader.
  11. Code:
    udevstart

  12. Plug in the reader.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Fri Mar 17, 2006 8:52 pm    Post subject: Reply with quote

Noted "4-1 4-1:1-0"

Code:

# udevinfo -a -p $4-1
could'nt get the class device
# udevinfo -a -p $4-1:1-0
could'nt get the class device
# udevinfo -a -p $4-1 4-1:1-0
could'nt get the class device
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Mar 17, 2006 10:48 pm    Post subject: Reply with quote

Try:
Code:
udevinfo -a -p /sys/bus/usb/devices/4-1

And:
Code:
udevinfo -a -p /sys/bus/usb/devices/4-1:1-0

I suspect the second will by the interesting one.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Fri Mar 17, 2006 11:41 pm    Post subject: Reply with quote

Code:

udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

  looking at class device '/sys/devices/pci0000:00/0000:00:10.2/usb4/4-1':
    KERNEL=="4-1"
    SUBSYSTEM=="unknown"
    SYSFS{bConfigurationValue}=="1"
    SYSFS{bDeviceClass}=="00"
    SYSFS{bDeviceProtocol}=="00"
    SYSFS{bDeviceSubClass}=="00"
    SYSFS{bMaxPacketSize0}=="8"
    SYSFS{bMaxPower}=="100mA"
    SYSFS{bNumConfigurations}=="1"
    SYSFS{bNumInterfaces}==" 1"
    SYSFS{bcdDevice}=="0001"
    SYSFS{bmAttributes}=="80"
    SYSFS{configuration}==""
    SYSFS{devnum}=="6"
    SYSFS{idProduct}=="0002"
    SYSFS{idVendor}=="05dc"
    SYSFS{manufacturer}=="Lexar Media    "
    SYSFS{maxchild}=="0"
    SYSFS{product}=="SM READER   ?"
    SYSFS{serial}=="               "
    SYSFS{speed}=="12"
    SYSFS{version}==" 1.00"

"Lexar Media "? Isn't that is a bit sloppy, I noticed even this editor deletes some of the spaces (4).

Anyway I picked product, manufacturer and bDeviceClass.
My rules file..
Code:

# rule for lexar card
SYSFS{bDeviceClass}=="00", SYSFS{product}=="SM READER   ?", SYSFS{manufacturer}=="Lexar Media    ", NAME="%k", SYMLINK="lexarsm%n"


I notice there is /dev/lexarsm1 and 8, what should I expect to happen, should there be a /mnt/lexar directory?
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Sat Mar 18, 2006 6:13 am    Post subject: Reply with quote

degras wrote:
"Lexar Media "? Isn't that is a bit sloppy, I noticed even this editor deletes some of the spaces (4).

Sloppy, maybe, but harmless trailing whitespace should be ignored by udevd.

degras wrote:
Anyway I picked product, manufacturer and bDeviceClass.
My rules file..
Code:

# rule for lexar card
SYSFS{bDeviceClass}=="00", SYSFS{product}=="SM READER   ?", SYSFS{manufacturer}=="Lexar Media    ", NAME="%k", SYMLINK="lexarsm%n"


I notice there is /dev/lexarsm1 and 8, what should I expect to happen, should there be a /mnt/lexar directory?


In that case it worked, expect the filesystem (the one of interest anyway) to be at lexarsm1, may as well be (see below).

I am getting the impression that you are assigning significant , and spurious, meaning to /mnt/*, I think some minor meme surgery may be in order. You can put the mount point where ever you want and call it whatever you like just remember to tell /etc/fstab or your automounter. You could, if you like, have a device symlinked to /dev/lexarsm1 and mounted at ~/camera or at /usr/tmp/tofu or at /mnt/film, remember this stuff is all mneumonic and between udev allowing you to set a consistent device name and /etc/fstab allowing you to set a consistent mount point you can put nearly whatever you want nearly where ever you want it.

If you want, some refinement of the rule could allow only block devices to show up as /dev/lexarsm*, I think a simple KERNEL=="sd*" added to the rule set would suffice though I have not tried it myself.
Back to top
View user's profile Send private message
degras
Guru
Guru


Joined: 05 Jan 2006
Posts: 460

PostPosted: Sat Mar 18, 2006 4:05 pm    Post subject: Reply with quote

OK, great the "/mnt/lexarsm" is my choice, but it does have to be created manually with mkdir right? Well what exactly do I put into /etc/fstab?

I found this on a newsgroup
Code:

/dev/sda1       /mnt/lexar      auto    noauto,user 0 0


Assuming it is right would my version would be
Code:

/dev/sdb1       /mnt/lexarsm1      auto    noauto,user 0 0


But now should I ignore "sdb1" and link from the node udev is creating
Code:

/dev/lexarsm1       /mnt/lexarsm1      auto    noauto,user 0 0

?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum