SD card not detected unless inserted at boot time

Getting your soundcard to work, using Debian on non-i386 hardware, etc

Re: SD card not detected unless inserted at boot time

Postby bw123 » 2013-09-21 00:44

might be relevant, not sure whether it's udev or kernel?

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648810
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696509

Just for the heck of it, here's the device I'm using. I thought the problem might be related to the mtp_probe errors from udev on bootup, but when I filed my bug report I was told it wasn't a udev bug so I just gave up trying to help.

Code: Select all
# udevadm info --query=all --name=/dev/sde
P: /devices/pci0000:00/0000:00:13.1/usb3/3-4/3-4:1.0/host3/target3:0:0/3:0:0:0/block/sde
N: sde
S: disk/by-id/usb-Generic_USB_SD_Reader_2004888-0:0
S: disk/by-path/pci-0000:00:13.1-usb-0:4:1.0-scsi-0:0:0:0
E: DEVLINKS=/dev/disk/by-id/usb-Generic_USB_SD_Reader_2004888-0:0 /dev/disk/by-path/pci-0000:00:13.1-usb-0:4:1.0-scsi-0:0:0:0
E: DEVNAME=/dev/sde
E: DEVPATH=/devices/pci0000:00/0000:00:13.1/usb3/3-4/3-4:1.0/host3/target3:0:0/3:0:0:0/block/sde
E: DEVTYPE=disk
E: ID_BUS=usb
E: ID_INSTANCE=0:0
E: ID_MODEL=USB_SD_Reader
E: ID_MODEL_ENC=USB\x20SD\x20Reader\x20\x20\x20
E: ID_MODEL_ID=9360
E: ID_PATH=pci-0000:00:13.1-usb-0:4:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_00_13_1-usb-0_4_1_0-scsi-0_0_0_0
E: ID_REVISION=1.00
E: ID_SERIAL=Generic_USB_SD_Reader_2004888-0:0
E: ID_SERIAL_SHORT=2004888
E: ID_TYPE=disk
E: ID_USB_DRIVER=usb-storage
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Generic
E: ID_VENDOR_ENC=Generic\x20
E: ID_VENDOR_ID=058f
E: MAJOR=8
E: MINOR=64
E: SUBSYSTEM=block
E: UDEV_LOG=3
E: USEC_INITIALIZED=8706554


I can't believe you said my workaround script was ugly? I spent 17 min adding new features

Code: Select all
#!/bin/sh
# sdcard1 script workaround

DEV=sde
PART=1
MNTP=/media/sdcard1

case "$1" in
   mount)
      if (mount | grep $MNTP >> /dev/null)
         then echo "already mounted on $MNTP"
         else if test -e /dev/$DEV$PART
                 then mount $MNTP
                 else
                    {  /sbin/blkid /dev/$DEV
                    if test -e /dev/$DEV$PART
                       then mount $MNTP
                       else echo "Couldn't mount $MNTP"
                    fi
                    }
               fi
      fi
   ;;
   umount)
 if (mount | grep $MNTP >> /dev/null)
         then umount $MNTP
         else echo "$MNTP not mounted"
      fi
   ;;
   *)
      echo "Specify mount or umount for $MNTP"
      if (mount | grep $MNTP >> /dev/null)
         then echo "mounted on $MNTP"
         else echo "$MNTP not mounted"
      fi
   ;;
esac


Code: Select all
$ cat /etc/fstab | grep sdcard1
UUID=GET-YOUR-OWN-BLKID  /media/sdcard1  vfat  rw,users,noatime,noauto  0  0
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: SD card not detected unless inserted at boot time

Postby Jerome » 2013-09-22 12:33

I can't remember if I had the partition on the card mounted, but it was in and detected.

I'll do it again with and without, and I'll do a diff.

Edit: @bw, I had not seen your post. Your script is great.
Jerome
 
Posts: 53
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

Postby Jerome » 2013-09-23 17:40

I did a lsusb -v in all those cases, and got the same output each time:

- Card detected at boot
- Card detected at boot then mounted
- Card detected at boot then mounted then directory opened
- Card detected at boot then mounted then directory opened then card ejected
- Card not inserted at boot
- Card inserted after boot and not detected
- Card inserted after boot and not detected then detected after blkid

Not sure about the bug reports. My USB sticks are detected.
Jerome
 
Posts: 53
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

Postby bw123 » 2013-09-23 17:45

so, if you put the card in and do this in a term your automount stuff takes over and finds it right?

Code: Select all
$ /sbin/blkid /dev/sde
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: SD card not detected unless inserted at boot time

Postby Jerome » 2013-09-23 18:00

Yes, exactly.

And this is what happens in dmesg when I do that:

Code: Select all
[ 1770.076544] sd 6:0:0:3: [sde] 3932160 512-byte logical blocks: (2.01 GB/1.87 GiB)
[ 1770.087268] sd 6:0:0:3: [sde] No Caching mode page present
[ 1770.087272] sd 6:0:0:3: [sde] Assuming drive cache: write through
[ 1770.102276] sd 6:0:0:3: [sde] No Caching mode page present
[ 1770.102280] sd 6:0:0:3: [sde] Assuming drive cache: write through
[ 1770.104295]  sde: sde1 sde2
Jerome
 
Posts: 53
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

Postby bw123 » 2013-09-23 18:17

the way i follow the conversation in the bug reports, udev maintainer rules out udev as the culprit like this

Code: Select all
# udevadm monitor --kernel --udev


insert card, no response from kernel = not a udev problem.

i've read somewhere there used to be a way to make a device node manually but didn't really look into it.

anyway, you ruled out hardware problem for me, and i'm not worried about automount, so thanks. hope you get it working the way you want.
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: SD card not detected unless inserted at boot time

Postby Jerome » 2013-09-23 20:07

Here's what I get:

Code: Select all
#udevadm monitor --kernel --udev
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent


If I plug the card, nothing happens.

If I

Code: Select all
/sbin/blkid /dev/sde


I get following lines:

Code: Select all
KERNEL[9188.599001] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
KERNEL[9188.630762] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
KERNEL[9188.630867] add      /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde1 (block)
KERNEL[9188.631157] add      /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde2 (block)
UDEV  [9188.847623] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
UDEV  [9189.052552] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
UDEV  [9189.163935] add      /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde1 (block)
UDEV  [9189.294987] add      /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde2 (block)


If I unplug, nothing happens. If I blkid, I get

Code: Select all
KERNEL[9223.320549] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
KERNEL[9223.324177] remove   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde1 (block)
KERNEL[9223.325025] remove   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde2 (block)
KERNEL[9223.325052] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
UDEV  [9223.335318] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)
UDEV  [9223.336438] remove   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde1 (block)
UDEV  [9223.337207] remove   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde/sde2 (block)
UDEV  [9223.351193] change   /devices/pci0000:00/0000:00:0b.1/usb1/1-1/1-1.2/1-1.2:1.0/host6/target6:0:0/6:0:0:3/block/sde (block)


Same if I use the eject function of the GUI.

I could open a bug, but against which packet ?

I don't think it is only the kernel. I think it is another packet. I tried old kernels, same issue, even with kernels I'm sure used to work. And when I used a recent knoppix I think it worked.

I could try with live-CDs from other distros, see if it works. If so, what should I note ?
- Kernel options ?
- Packages versions ? Which packages ?
Jerome
 
Posts: 53
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

Postby bw123 » 2013-09-23 20:18

I don't know where the problem is, but like i said it's down deep somewhere, maybe it's whatever is assigning device to the floppy group? floppies don't have partitions from what i remember?
User avatar
bw123
 
Posts: 3188
Joined: 2011-05-09 06:02
Location: TN_USA

Re: SD card not detected unless inserted at boot time

Postby olivierb2 » 2013-10-22 11:41

Hi Everybody,

Same issue there, using blkit /dev/sde force the detection of the SD card reader. Anyone as found from were is issue is coming?

Thanks.
olivierb2
 
Posts: 13
Joined: 2012-05-18 11:46

Re: SD card not detected unless inserted at boot time

Postby Jerome » 2013-10-22 12:25

As far as I remember, it works correctly with Knoppix.

What I wanted to do, but haven't done yet, is boot on knoppix and keep a log of what happens there (dmesg, syslog, whatever). Maybe you'll get the time to do that before me...

We may also want to compare kernel compilation options. (No idea what to expect there, just shooting in the dark.) Those may be found in

Code: Select all
/boot/config-$(uname -r)


(https://wiki.debian.org/KernelFAQ)
Jerome
 
Posts: 53
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

Postby olivierb2 » 2013-10-22 12:32

Fine, I will try with knoppix this evening.

Thanks.

Olivier.
olivierb2
 
Posts: 13
Joined: 2012-05-18 11:46

Re: SD card not detected unless inserted at boot time

Postby olivierb2 » 2013-10-23 19:44

I've tried Knoppix, and all is working fine. But also, it's seems that Knoppix is based on Debian stable (Wheezy). I have an other instance with Wheezy on my computer, and all is working fine.

Just discover that this is the same issue with DVD drive. May be a package is missing on my system?

I'm currently compare the kernel option, I let you know if I find something.

Thanks.

Olivier.
olivierb2
 
Posts: 13
Joined: 2012-05-18 11:46

Re: SD card not detected unless inserted at boot time

Postby olivierb2 » 2013-10-23 20:11

Also discovered that running update-initramfs -u "rescans" and mount my SD card if present.
olivierb2
 
Posts: 13
Joined: 2012-05-18 11:46

Re: SD card not detected unless inserted at boot time

Postby Jerome » 2013-10-23 20:34

I can't tell whether this begun on my computer after or before the release of Wheezy.

I also checked with Knoppix and didn't really find interesting stuff in dmesg:

Insert SD card

Code: Select all
[  752.096877] sd 6:0:0:3: [sde] 3932160 512-byte logical blocks: (2.01 GB/1.87 GiB)
[  752.107116] sd 6:0:0:3: [sde] No Caching mode page present
[  752.107120] sd 6:0:0:3: [sde] Assuming drive cache: write through
[  752.126120] sd 6:0:0:3: [sde] No Caching mode page present
[  752.126123] sd 6:0:0:3: [sde] Assuming drive cache: write through
[  752.128012]  sde: sde1


Mount

Code: Select all
[  784.954178] FAT-fs (sde1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!


Eject

Code: Select all
[  813.866424] sde: detected capacity change from 2013265920 to 0


I also have the kernel compile options to compare. I haven't done the comparison yet. (Can't embed them in this message. Too long, I guess.)

It's great that you have a working Wheezy. Perhaps could you try it with a recent kernel from testing/unstable to see if it comes from the kernel.

I'd say no, as I tried with older kernels and it didn't work either. But then I'm clueless.
Jerome
 
Posts: 53
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

Postby olivierb2 » 2013-10-23 21:47

I tested kernel 3.2-0-2 from wheezy on my sid, and even if the graphical interface doesn't start (issue with nvidia module build), the kernel shows the detection of the SD card. The issue is definitely coming from the kernel.
olivierb2
 
Posts: 13
Joined: 2012-05-18 11:46

PreviousNext

Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable