You are not logged in.

#1 2020-01-09 01:57:49

nathanb
Member
Registered: 2011-11-28
Posts: 101
Website

Can't mount or read SD card

I have a Lexar SD XC II 64GB SD card. I use it in my camera. This card used to read fine (although slowly) using the exfat driver, but lately I can't read it anymore.

I'm using an Intel NUC with a built-in card reader. With lspci, I get:

02:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01)

When I insert the card, I get:

Jan 08 20:47:45 nathanb-nuc kernel: blk_update_request: I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
Jan 08 20:47:45 nathanb-nuc kernel: mmc0: Tuning timeout, falling back to fixed sampling clock
Jan 08 20:47:45 nathanb-nuc kernel: mmc0: Tuning timeout, falling back to fixed sampling clock
Jan 08 20:47:45 nathanb-nuc kernel: mmc0: Tuning timeout, falling back to fixed sampling clock
Jan 08 20:47:45 nathanb-nuc kernel: blk_update_request: I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Jan 08 20:47:45 nathanb-nuc kernel: Buffer I/O error on dev mmcblk0, logical block 0, async page read

Other SD cards read fine. This card reads and writes fine on my camera and on my Chromebook, so I don't think the card is bad or the filesystem is corrupted. It's just on my Arch Linux system that it won't mount.

If I try to mount it, I get the following:

[root@nathanb-nuc mnt]# mount  /dev/mmcblk0 usb
mount: /mnt/usb: can't read superblock on /dev/mmcblk0.
[root@nathanb-nuc mnt]# mount -t exfat  /dev/mmcblk0 usb
FUSE exfat 1.3.0
ERROR: failed to read boot sector.

Any suggestions?

Offline

#2 2020-01-09 09:05:30

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,568

Re: Can't mount or read SD card

 blk_update_request: I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0

Run an fsck on the drive.

Offline

#3 2020-01-09 09:25:33

seth
Member
Registered: 2012-09-03
Posts: 51,270

Re: Can't mount or read SD card

Can you

dd if=/dev/mmcblk0 of=/tmp/bad_sd.img count=16

w/o errors (also monitor "dmesg -w" while trying)?
If not: do you have another card reader available?

Offline

#4 2020-01-09 10:21:22

sabroad
Member
Registered: 2015-05-24
Posts: 242

Re: Can't mount or read SD card

Try loading the sdhci module with debug_quirks2

modprobe sdhci debug_quirks2="0x8000"

--
saint_abroad

Offline

#5 2020-01-09 13:37:26

nathanb
Member
Registered: 2011-11-28
Posts: 101
Website

Re: Can't mount or read SD card

d_fajardo wrote:

Run an fsck on the drive.

The system sees no partitions and no filesystems on the drive, so I don't think fsck would work. I tried it anyway (yolo) and got:

[root@nathanb-nuc mnt]# fsck /dev/mmcblk0
fsck from util-linux 2.34
e2fsck 1.45.4 (23-Sep-2019)
fsck.ext2: Input/output error while trying to open /dev/mmcblk0

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

[root@nathanb-nuc mnt]# fsck.
fsck.btrfs     fsck.cramfs    fsck.exfat     fsck.ext2      fsck.ext3      fsck.ext4      fsck.fat       fsck.jfs       fsck.minix     fsck.msdos     fsck.reiserfs  fsck.vfat      fsck.xfs       
[root@nathanb-nuc mnt]# fsck.exfat /dev/mmcblk0
exfatfsck 1.3.0
Checking file system on /dev/mmcblk0.
ERROR: failed to read boot sector.
File system checking stopped. ERRORS FOUND: 1, FIXED: 0.
[root@nathanb-nuc mnt]# 
seth wrote:

Can you

dd if=/dev/mmcblk0 of=/tmp/bad_sd.img count=16

w/o errors (also monitor "dmesg -w" while trying)?
If not: do you have another card reader available?

[root@nathanb-nuc mnt]# dd if=/dev/mmcblk0 of=/tmp/bad_sd.img count=16
dd: error reading '/dev/mmcblk0': Input/output error
0+0 records in
0+0 records out
0 bytes copied, 0.333775 s, 0.0 kB/s

Sadly I don't have a usb SD card reader.

sabroad wrote:

Try loading the sdhci module with debug_quirks2

I tried this, and sadly same problem. I also tried some of the other values suggested in the linked bug report, with no success.

Offline

#6 2020-01-09 13:51:21

seth
Member
Registered: 2012-09-03
Posts: 51,270

Re: Can't mount or read SD card

Did you unload the module before? Because otherwise this won't do anything.

Offline

#7 2020-01-09 15:03:04

sabroad
Member
Registered: 2015-05-24
Posts: 242

Re: Can't mount or read SD card

sabroad wrote:

Try loading the sdhci module with debug_quirks2

Sorry, this should be 0x80000000:

rmmod sdhci_pci
rmmod sdhci
modprobe sdhci debug_quirks2="0x80000000"
modprobe sdhci_pci

--
saint_abroad

Offline

#8 2020-01-10 00:01:23

nathanb
Member
Registered: 2011-11-28
Posts: 101
Website

Re: Can't mount or read SD card

I get some interesting new debug information!

[1029915.348840] sdhci-pci 0000:02:00.0: SDHCI controller found [1217:8621] (rev 1)
[1029915.353590] mmc0: SDHCI controller on PCI [0000:02:00.0] using ADMA
[1029915.420596] mmc0: Card Detect debounce never finished.
[1029915.420599] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[1029915.420602] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00000603
[1029915.420605] mmc0: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
[1029915.420608] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000000
[1029915.420611] mmc0: sdhci: Present:   0x01fb0000 | Host ctl: 0x00000000
[1029915.420614] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[1029915.420617] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x0000fa03
[1029915.420620] mmc0: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
[1029915.420623] mmc0: sdhci: Int enab:  0x00ff0083 | Sig enab: 0x00ff0083
[1029915.420626] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[1029915.420629] mmc0: sdhci: Caps:      0x25f8c8bf | Caps_1:   0x00002077
[1029915.420632] mmc0: sdhci: Cmd:       0x00000000 | Max curr: 0x005800c8
[1029915.420635] mmc0: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
[1029915.420637] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[1029915.420639] mmc0: sdhci: Host ctl2: 0x00000000
[1029915.420642] mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[1029915.420643] mmc0: sdhci: ============================================
[1029915.470664] mmc0: Card Detect debounce never finished.
[1029915.470665] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[1029915.470668] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00000603
[1029915.470671] mmc0: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
[1029915.470674] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000000
[1029915.470677] mmc0: sdhci: Present:   0x01fb0000 | Host ctl: 0x00000000
[1029915.470680] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[1029915.470683] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x0000fa03
[1029915.470686] mmc0: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
[1029915.470689] mmc0: sdhci: Int enab:  0x00ff0083 | Sig enab: 0x00ff0083
[1029915.470691] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[1029915.470694] mmc0: sdhci: Caps:      0x25f8c8bf | Caps_1:   0x00002077
[1029915.470697] mmc0: sdhci: Cmd:       0x00000000 | Max curr: 0x005800c8
[1029915.470700] mmc0: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
[1029915.470703] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[1029915.470705] mmc0: sdhci: Host ctl2: 0x00000000
[1029915.470708] mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[1029915.470708] mmc0: sdhci: ============================================
[1029915.520742] mmc0: Card Detect debounce never finished.
[1029915.520743] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[1029915.520746] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00000603
[1029915.520749] mmc0: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
[1029915.520752] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000000
[1029915.520755] mmc0: sdhci: Present:   0x01fb0000 | Host ctl: 0x00000000
[1029915.520758] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[1029915.520760] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x0000fa03
[1029915.520763] mmc0: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
[1029915.520766] mmc0: sdhci: Int enab:  0x00ff0083 | Sig enab: 0x00ff0083
[1029915.520769] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[1029915.520772] mmc0: sdhci: Caps:      0x25f8c8bf | Caps_1:   0x00002077
[1029915.520775] mmc0: sdhci: Cmd:       0x00000000 | Max curr: 0x005800c8
[1029915.520778] mmc0: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
[1029915.520781] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[1029915.520782] mmc0: sdhci: Host ctl2: 0x00000000
[1029915.520785] mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[1029915.520786] mmc0: sdhci: ============================================
[1029915.570813] mmc0: Card Detect debounce never finished.
[1029915.570815] mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
[1029915.570818] mmc0: sdhci: Sys addr:  0x00000000 | Version:  0x00000603
[1029915.570821] mmc0: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
[1029915.570824] mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000000
[1029915.570826] mmc0: sdhci: Present:   0x01fb0000 | Host ctl: 0x00000000
[1029915.570829] mmc0: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[1029915.570832] mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x0000fa03
[1029915.570835] mmc0: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
[1029915.570838] mmc0: sdhci: Int enab:  0x00ff0083 | Sig enab: 0x00ff0083
[1029915.570841] mmc0: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[1029915.570844] mmc0: sdhci: Caps:      0x25f8c8bf | Caps_1:   0x00002077
[1029915.570847] mmc0: sdhci: Cmd:       0x00000000 | Max curr: 0x005800c8
[1029915.570850] mmc0: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
[1029915.570853] mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[1029915.570854] mmc0: sdhci: Host ctl2: 0x00000000
[1029915.570857] mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[1029915.570858] mmc0: sdhci: ============================================
[1029920.002644] mmc0: Card removed during transfer!
[1029920.002657] mmc0: Resetting controller.

Seeing that information made me wonder if the slot was being janky, so I inserted it and then held my thumb on the card to maximise the chance of proper contact being made. And it worked!

I wondered if the slot was the problem the whole time, so I reloaded the module without the debug_quirks2, but even doing the same thing (holding the card with my thumb) yielded the same results as before. So it looks like I need the debug_quirks2 parameter in order for it to work probably?

Offline

#9 2020-01-10 16:09:26

seth
Member
Registered: 2012-09-03
Posts: 51,270

Re: Can't mount or read SD card

You'll probably have to give this a couple of runs w/ and w/o te quirks, because "held my thumb" is not a deterministic process ;-)

Offline

#10 2020-01-19 03:37:15

nathanb
Member
Registered: 2011-11-28
Posts: 101
Website

Re: Can't mount or read SD card

The final results of my research:
* It works fairly reliably with quirks mode set as above
* It does not work without it set, no matter how much I jigger it
* I just bought a third-party USB SD card dongle for like seven bucks and it works great all the time without me having to hold the card a certain way. So that's what I use now.

Hurray for Intel hardware

Offline

Board footer

Powered by FluxBB