Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

SD card not detected unless inserted at boot time

Need help with peripherals or devices?
Message
Author
User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: SD card not detected unless inserted at boot time

#16 Post by bw123 »

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
resigned by AI ChatGPT

Jerome
Posts: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#17 Post by Jerome »

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: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#18 Post by Jerome »

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.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: SD card not detected unless inserted at boot time

#19 Post by bw123 »

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
resigned by AI ChatGPT

Jerome
Posts: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#20 Post by Jerome »

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

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: SD card not detected unless inserted at boot time

#21 Post by bw123 »

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.
resigned by AI ChatGPT

Jerome
Posts: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#22 Post by Jerome »

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 ?

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: SD card not detected unless inserted at boot time

#23 Post by bw123 »

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?
resigned by AI ChatGPT

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

Re: SD card not detected unless inserted at boot time

#24 Post by olivierb2 »

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.

Jerome
Posts: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#25 Post by Jerome »

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)

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

Re: SD card not detected unless inserted at boot time

#26 Post by olivierb2 »

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

#27 Post by olivierb2 »

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

#28 Post by olivierb2 »

Also discovered that running update-initramfs -u "rescans" and mount my SD card if present.

Jerome
Posts: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#29 Post by Jerome »

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.

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

Re: SD card not detected unless inserted at boot time

#30 Post by olivierb2 »

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.

Jerome
Posts: 54
Joined: 2011-07-18 20:57
Location: France

Re: SD card not detected unless inserted at boot time

#31 Post by Jerome »

Just tried here with 3.2.0-4-amd64 from Wheezy on my Jessie installation and it didn't work. I had to blkid /dev/sde.

Looks trickier. What kind of machine is it you have ?

Maybe should I investigate the hal related advice here: http://forums.debian.net/viewtopic.php? ... 62#p512396

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: SD card not detected unless inserted at boot time

#32 Post by llivv »

Jerome wrote:Just tried here with 3.2.0-4-amd64 from Wheezy on my Jessie installation and it didn't work. I had to blkid /dev/sde.

Looks trickier. What kind of machine is it you have ?

Maybe should I investigate the hal related advice here: http://forums.debian.net/viewtopic.php? ... 62#p512396
Or you could try an older Debian Live CD like an early squeeze version.
I have the issue too.
What I noticed was that my older 1GB and smaller SD cards stopped working about a year ago in my USB 2 reader.
But I had been using some 512 MB to 4GB micro SD cards for about a year too before wheezy went stable.
So that leaves about a 2 year window in which the issue could have started for me when I was paying attention to other issues.

I got a new usb 3 card reader and it works fine plugged into my usb 2 ( ten year old i386 machines ) and mounts and reads my newer 8 GB SD cards without issue in wheezy.
My older USB 2 card reader is giving me issues all the time both auto mounting and manually mounting, if I can mount from it at all.

edit:
dmesg and manual mount of SD card

Code: Select all

 [53.252127] device eth0 ----
[ 5992.653382] perf samples too long (2546 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
[ 8068.188026] usb 1-3: new high-speed USB device number 4 using ehci-pci
[ 8068.648020] usb 3-1: new full-speed USB device number 3 using uhci_hcd
[ 8068.787230] usb 3-1: Parent hub missing LPM exit latency info.  Power management will be impacted.
[ 8068.791229] usb 3-1: not running at top speed; connect to a high speed hub
[ 8068.818226] usb 3-1: New USB device found, idVendor=05e3, idProduct=0732
[ 8068.818231] usb 3-1: New USB device strings: Mfr=3, Product=4, SerialNumber=5
[ 8068.818235] usb 3-1: Product:  USB3 Reader
[ 8068.818239] usb 3-1: Manufacturer: Genesys 
[ 8068.818242] usb 3-1: SerialNumber: 000000000390
[ 8068.821335] usb-storage 3-1:1.0: USB Mass Storage
[ 8068.821485] scsi5 : usb-storage 3-1:1.0
[ 8069.824098] scsi 5:0:0:0: Direct-Access     Generic  STORAGE DEVICE   0567 PQ: 0 ANSI: 6
[ 8069.827091] scsi 5:0:0:1: Direct-Access     Generic  STORAGE DEVICE   0567 PQ: 0 ANSI: 6
[ 8069.830096] scsi 5:0:0:2: Direct-Access     Generic  STORAGE DEVICE   0567 PQ: 0 ANSI: 6
[ 8069.833095] scsi 5:0:0:3: Direct-Access     Generic  STORAGE DEVICE   0567 PQ: 0 ANSI: 6
[ 8069.833688] sd 5:0:0:0: Attached scsi generic sg5 type 0
[ 8069.834168] sd 5:0:0:1: Attached scsi generic sg6 type 0
[ 8069.834576] sd 5:0:0:2: Attached scsi generic sg7 type 0
[ 8069.835060] sd 5:0:0:3: Attached scsi generic sg8 type 0
[ 8069.986123] sd 5:0:0:1: [sde] Attached SCSI removable disk
[ 8069.994010] sd 5:0:0:0: [sdd] Attached SCSI removable disk
[ 8070.008176] sd 5:0:0:2: [sdf] Attached SCSI removable disk
[ 8070.016136] sd 5:0:0:3: [sdg] Attached SCSI removable disk

Code: Select all

me@me:~$ su -c 'mount /dev/sde1 /m'
me@me:~$  ls -la /m
total 132
drwxr-xr-x  5 root root 32768 Dec 31  1969 .
drwxr-xr-x 27 root root  4096 Oct 22 16:40 ..
drwxr-xr-x 11 root root 32768 Sep 30 15:39 DCIM
drwxr-xr-x  2 root root 32768 Aug 31 20:15 MISC
drwxr-xr-x  4 root root 32768 Aug 31 20:15 PRIVATE
edit 2:
looks like 3.11 kernel is getting even more picky them 3.10
and the usb reader is connecting at usb 1 speed now
from the above code

Code: Select all

[ 5992.653382] perf samples too long (2546 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
[ 8068.188026] usb 1-3: new high-speed USB device number 4 using ehci-pci
[ 8068.648020] usb 3-1: new full-speed USB device number 3 using uhci_hcd
[ 8068.787230] usb 3-1: Parent hub missing LPM exit latency info.  Power management will be impacted.
[ 8068.791229] usb 3-1: not running at top speed; connect to a high speed hub
arrrrr
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

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

Re: SD card not detected unless inserted at boot time

#33 Post by olivierb2 »

For my self, I tried to install hal, but I got this error several time during the startup :

Code: Select all

udevd[2463]: failed to execute '/lib/udev/socket:@/org/freedesktop/hal/udev_event' 'socket:@/org/freedesktop/hal/udev_event': No such file or directory

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

Re: SD card not detected unless inserted at boot time

#34 Post by olivierb2 »

I finally found my solution here :

http://ignorantguru.github.io/udevil/#polling

I added the following command to my /etc/rc.local and now my card reader work like a charm :D

Code: Select all

echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: SD card not detected unless inserted at boot time

#35 Post by llivv »

I think that the issue is a combination of kernel version, card reader and SD card.

I saved a bunch of dmesg while testing my usb2 and usb3 card readers
with a 512 mb, 2 partition, SD card and the 8 gb SD card from my camera
using wheezy default gnome and 3.2.0-4-686-pae kernel

nautilus behaved differently almost every time I changed either the SD card or the card reader.
and would not detect my 8gb SD card from the usb2 card reader.

I haven't gotten a chance to test
bw123's mounting script yet, thanks bw123
or olivierb2 workaround either
echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

but that is why I posted in the thread in the first place.
I wanted to test some stuff, as I missed how it broke on my box too.
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Post Reply