Ubuntu – SD card not working :[ 249.480884] mmc0: error -5 whilst initialising SD card

16.04lspcimmcmodprobesd card

I have an issue with my recent Ubuntu. Actually I have all drivers (USB, WiFi, etc ) working fine however when I insert the SD I can't detect it.

Also I find the following error kernel log:

[  242.936702] mmc0: error -5 whilst initialising SD card
[  244.856671] mmc0: error -5 whilst initialising SD card
[  245.756789] mmc0: error -5 whilst initialising SD card
[  246.657133] mmc0: error -5 whilst initialising SD card
[  248.577135] mmc0: error -5 whilst initialising SD card
[  249.480884] mmc0: error -5 whilst initialising SD card

Below some useful details about my pc:

uname -a

Linux smarto-pc 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

lspci -v 
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
    Subsystem: Lenovo Haswell-ULT DRAM Controller
    Flags: bus master, fast devsel, latency 0
    Capabilities: 
    Kernel driver in use: hsw_uncore

00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b) (prog-if 00 [VGA controller])
    Subsystem: Lenovo Haswell-ULT Integrated Graphics Controller
    Flags: bus master, fast devsel, latency 0, IRQ 45
    Memory at c0000000 (64-bit, non-prefetchable) [size=4M]
    Memory at b0000000 (64-bit, prefetchable) [size=256M]
    I/O ports at 4000 [size=64]
    Expansion ROM at  [disabled]
    Capabilities: 
    Kernel driver in use: i915
    Kernel modules: i915

00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
    Subsystem: Lenovo Haswell-ULT HD Audio Controller
    Flags: bus master, fast devsel, latency 0, IRQ 48
    Memory at c0610000 (64-bit, non-prefetchable) [size=16K]
    Capabilities: 
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel

00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04) (prog-if 30 [XHCI])
    Subsystem: Lenovo 8 Series USB xHCI HC
    Flags: bus master, medium devsel, latency 0, IRQ 42
    Memory at c0600000 (64-bit, non-prefetchable) [size=64K]
    Capabilities: 
    Kernel driver in use: xhci_hcd

00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
    Subsystem: Lenovo 8 Series HECI
    Flags: bus master, fast devsel, latency 0, IRQ 46
    Memory at c0618000 (64-bit, non-prefetchable) [size=32]
    Capabilities: 
    Kernel driver in use: mei_me
    Kernel modules: mei_me

00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
    Subsystem: Lenovo 8 Series HD Audio Controller
    Flags: bus master, fast devsel, latency 0, IRQ 47
    Memory at c0614000 (64-bit, non-prefetchable) [size=16K]
    Capabilities: 
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4) (prog-if 00 [Normal decode])
    Flags: bus master, fast devsel, latency 0, IRQ 40
    Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
    I/O behind bridge: 00003000-00003fff
    Memory behind bridge: c0500000-c05fffff
    Capabilities: 
    Kernel driver in use: pcieport
    Kernel modules: shpchp

00:1c.3 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4) (prog-if 00 [Normal decode])
    Flags: bus master, fast devsel, latency 0, IRQ 41
    Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
    Memory behind bridge: c0400000-c04fffff
    Capabilities: 
    Kernel driver in use: pcieport
    Kernel modules: shpchp

00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04) (prog-if 20 [EHCI])
    Subsystem: Lenovo 8 Series USB EHCI
    Flags: bus master, medium devsel, latency 0, IRQ 23
    Memory at c061c000 (32-bit, non-prefetchable) [size=1K]
    Capabilities: 
    Kernel driver in use: ehci-pci

00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
    Subsystem: Lenovo 8 Series LPC Controller
    Flags: bus master, medium devsel, latency 0
    Capabilities: 
    Kernel driver in use: lpc_ich
    Kernel modules: lpc_ich

00:1f.2 SATA controller: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] (rev 04) (prog-if 01 [AHCI 1.0])
    Subsystem: Lenovo 8 Series SATA Controller 1 [AHCI mode]
    Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 43
    I/O ports at 4088 [size=8]
    I/O ports at 4094 [size=4]
    I/O ports at 4080 [size=8]
    I/O ports at 4090 [size=4]
    I/O ports at 4060 [size=32]
    Memory at c061b000 (32-bit, non-prefetchable) [size=2K]
    Capabilities: 
    Kernel driver in use: ahci
    Kernel modules: ahci

00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
    Subsystem: Lenovo 8 Series SMBus Controller
    Flags: medium devsel, IRQ 11
    Memory at c0619000 (64-bit, non-prefetchable) [size=256]
    I/O ports at 4040 [size=32]
    Kernel modules: i2c_i801

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)
    Subsystem: Lenovo RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
    Flags: bus master, fast devsel, latency 0, IRQ 44
    I/O ports at 3000 [size=256]
    Memory at c0504000 (64-bit, non-prefetchable) [size=4K]
    Memory at c0500000 (64-bit, non-prefetchable) [size=16K]
    Capabilities: 
    Kernel driver in use: r8169
    Kernel modules: r8169

02:00.0 Network controller: Broadcom Corporation BCM43142 802.11b/g/n (rev 01)
    Subsystem: Lenovo BCM43142 802.11b/g/n
    Flags: bus master, fast devsel, latency 0, IRQ 19
    Memory at c0400000 (64-bit, non-prefetchable) [size=32K]
    Capabilities: 
    Kernel driver in use: wl
    Kernel modules: bcma, wl
lsmod
Module                  Size  Used by
bnep                   20480  2
rtsx_usb_ms            20480  0
intel_rapl             20480  0
memstick               20480  1 rtsx_usb_ms
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
coretemp               16384  0
btusb                  45056  0
btrtl                  16384  1 btusb
btbcm                  16384  1 btusb
btintel                16384  1 btusb
kvm                   536576  0
uvcvideo               90112  0
bluetooth             520192  10 bnep,btbcm,btrtl,btusb,btintel
irqbypass              16384  1 kvm
videobuf2_vmalloc      16384  1 uvcvideo
videobuf2_memops       16384  1 videobuf2_vmalloc
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
wl                   6365184  0
videobuf2_v4l2         28672  1 uvcvideo
snd_hda_codec_hdmi     53248  1
videobuf2_core         36864  2 uvcvideo,videobuf2_v4l2
v4l2_common            16384  1 videobuf2_v4l2
videodev              176128  4 uvcvideo,v4l2_common,videobuf2_core,videobuf2_v4l2
media                  24576  2 uvcvideo,videodev
aesni_intel           167936  0
snd_hda_codec_conexant    24576  1
snd_hda_codec_generic    77824  1 snd_hda_codec_conexant
snd_soc_rt5640        114688  0
aes_x86_64             20480  1 aesni_intel
snd_hda_intel          36864  5
snd_soc_rl6231         16384  1 snd_soc_rt5640
lrw                    16384  1 aesni_intel
snd_hda_codec         135168  4 snd_hda_codec_hdmi,snd_hda_codec_conexant,snd_hda_codec_generic,snd_hda_intel
snd_soc_core          212992  1 snd_soc_rt5640
snd_hda_core           73728  5 snd_hda_codec_hdmi,snd_hda_codec_conexant,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
gf128mul               16384  1 lrw
cfg80211              565248  1 wl
snd_compress           20480  1 snd_soc_core
snd_hwdep              16384  1 snd_hda_codec
ac97_bus               16384  1 snd_soc_core
glue_helper            16384  1 aesni_intel
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_seq_midi           16384  0
ablk_helper            16384  1 aesni_intel
snd_seq_midi_event     16384  1 snd_seq_midi
joydev                 20480  0
input_leds             16384  0
cryptd                 20480  2 aesni_intel,ablk_helper
snd_rawmidi            32768  1 snd_seq_midi
snd_seq                69632  2 snd_seq_midi_event,snd_seq_midi
serio_raw              16384  0
snd_pcm               106496  7 snd_soc_rt5640,snd_soc_core,snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_pcm_dmaengine,snd_hda_core
shpchp                 36864  0
snd_seq_device         16384  3 snd_seq,snd_rawmidi,snd_seq_midi
ideapad_laptop         24576  0
mei_me                 36864  0
sparse_keymap          16384  1 ideapad_laptop
snd_timer              32768  2 snd_pcm,snd_seq
mei                    98304  1 mei_me
wmi                    20480  1 ideapad_laptop
dw_dmac                16384  0
dw_dmac_core           24576  1 dw_dmac
snd_soc_sst_acpi       16384  0
8250_fintek            16384  0
8250_dw                16384  0
snd                    81920  23 snd_soc_core,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_hda_codec_conexant,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel,snd_seq_device,snd_compress
lpc_ich                24576  0
soundcore              16384  1 snd
elan_i2c               36864  0
soc_button_array       16384  0
i2c_designware_platform    16384  0
i2c_designware_core    20480  1 i2c_designware_platform
spi_pxa2xx_platform    24576  0
mac_hid                16384  0
mmc_block              36864  0
tifm_sd                20480  0
tifm_core              16384  1 tifm_sd
parport_pc             32768  0
ppdev                  20480  0
lp                     20480  0
parport                49152  3 lp,ppdev,parport_pc
autofs4                40960  2
rtsx_usb_sdmmc         28672  0
rtsx_usb               24576  2 rtsx_usb_sdmmc,rtsx_usb_ms
hid_generic            16384  0
usbhid                 49152  0
i915                 1208320  5
i2c_algo_bit           16384  1 i915
drm_kms_helper        139264  1 i915
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
fb_sys_fops            16384  1 drm_kms_helper
psmouse               126976  0
ahci                   36864  2
drm                   360448  6 i915,drm_kms_helper
r8169                  81920  0
libahci                32768  1 ahci
mii                    16384  1 r8169
sdhci_acpi             16384  0
video                  40960  2 i915,ideapad_laptop
sdhci                  45056  1 sdhci_acpi
i2c_hid                20480  0
hid                   118784  3 i2c_hid,hid_generic,usbhid
fjes                   28672  0

Thanks a lot,

Best Answer

There is a kernel compatibility issue with some sd cards (mainly SDHC or SDXC).

A workaround is below, but the IO speed is about 10x lower :(

Write a file called /etc/modprobe.d/sdcard.conf with this content:

options sdhci debug_quirks2=0x2

Let's remove and probe some modules:

 sudo rmmod sdhci_acpi sdhci_pci sdhci
 sudo modprobe sdhci; sudo modprobe sdhci_acpi; sudo modprobe sdhci_pci

After this, your SD card must be shown at notification bar.

To save all this configurations, run:

 sudo update-initramfs -u
Related Question