Error whilst initializing SD card on Linux

21,023

Solution 1

Your SD card has died. This happens over time, anything like a drop or a lot of use can cause a SD card to die. I have had the same thing happen to me on a 16GB micro SD card used with my Raspberry Pi 2. It just stopped working one day.

The only way you could possibly get the data off the SD card at this point is to take it to a professional in the Data Recovery Field.

Solution 2

Do you use an SD adapter with a mechanical write lock switch?

Indeed, an old SD card of mine (no adapter needed) has the same problem on my Lenovo ThinkPad E540. The solution in my case is toggling the write lock switch a couple times. Since this is purely mechanical, I suspect a buggy/mangled card port -- mine looks and... "sounds" pretty flimsy!

Solution 3

I see exactly the same error in my Lenovo Laptop while trying to mount a SD card, and I must say that SD cards support on the Linux desktop is unfortunately suboptimal. The same card works perfectly fine in my Android phone and in my camera!

As a workaround, to make it work in the desktop, the only solution I have found is leaving it connected, and waiting for a few minutes until the error stops and the device appears.

Solution 4

Try connecting the SD card using a USB memory card reader.

This worked in my case, a Lenovo laptop running Ubuntu 16.04, and the SD card is definitely recognized in other operating systems.

Instead of getting the error messages when running dmesg

[  882.603991] mmc0: card never left busy state
[  882.604001] mmc0: error -110 whilst initialising SD card

I get the success messages

[ 1724.883050] sd 6:0:0:2: [sdd] 250607616 512-byte logical blocks: (128 GB/119 GiB)
[ 1724.888318]  sdd: sdd1

I'm not sure if reading speed is as fast as connecting the SD directly to the laptop but I'm glad the SD is at least recognized.

Solution 5

I've run into this with almost-new SD cards on modern Linux machines, where the same cards work fine in Raspberry Pis (running Linux!) with no hitches. My suggestion is first to:

  • remove, wait a few seconds, and re-insert the card
  • running sudo partprobe occasionally works (you might need to install a package first depending on your system)
  • as Teresa says, wait a few minutes and the kernel will be able to detect the card

Oh, and backup your card because it could well be about to die, regardless of age.

Share:
21,023

Related videos on Youtube

denisq
Author by

denisq

Updated on September 18, 2022

Comments

  • denisq
    denisq over 1 year

    I have noticed troubles with my microSD card in my Android phone and when I tried to insert it into my Linux laptop, I get the following error in dmesg:

    [  247.588279] mmc0: error -123 whilst initialising SD card
    [  247.591314] sdhci-pci 0000:0d:00.1: Will use DMA mode even though HW doesn't fully claim to support it.
    [  247.648629] sdhci-pci 0000:0d:00.1: Will use DMA mode even though HW doesn't fully claim to support it.
    [  248.903044] mmc0: card never left busy state
    [  248.903051] mmc0: error -110 whilst initialising SD card
    [  248.907007] sdhci-pci 0000:0d:00.1: Will use DMA mode even though HW doesn't fully claim to support it.
    

    Does this mean my microSD card is broken? How could it suddenly happen in my phone? Is there no way to recover eve partially the data on it?

    • Mark
      Mark about 9 years
      @DrMoishePippik, the errors are occurring at a level far below the filesystem level. Lack of exFAT support wouldn't show up until the user attempted to mount the filesystem, and would involve a message along the lines of "unsupported filesystem or corrupted superblock".
  • Alex Ljamin
    Alex Ljamin over 7 years
    This is more of a comment than an answer.
  • admirabilis
    admirabilis over 7 years
    @alljamin I don't agree. The accepted answer suggests the user should throw the SD card away. Also it actually answers that it is an existing bug, and that workarounds do exist.
  • Jean-Bernard Jansen
    Jean-Bernard Jansen over 6 years
    This is not true. Dead card is a possible reason, but there is others. I have the same problem with a brand new SD Card, and it works perfectly well into my camera. Yet my Linux laptop shows this exact problem. Card still works after putting in back in the camera. It did not die (yet), this is a linux lack of support of some odd combination of formatting/manufacturer.
  • Lock
    Lock about 6 years
    Just rebooting was enough...
  • jcomeau_ictx
    jcomeau_ictx over 4 years
    that helped. it at least changed the error message from -123 to -110.