2009/02/08

Fixing a Readonly SD Card Reader in Ubuntu

On one of my laptops running Ubuntu I noticed that my SD card was always mounted in readonly mode. My other Linux-powered laptop mounted the same SD card just fine in read/write mode. As a workaround, I could remove photo's directly from the camera or from the other laptop, but I was intriged and decided to delve deeper into this issue.

A few relevant commands stumbled upon thanks to Google:
$ dmesg | grep -i sdhci
[ 15.122623] sdhci: Secure Digital Host Controller Interface driver
[ 15.122627] sdhci: Copyright(c) Pierre Ossman
[ 15.194747] sdhci-pci 0000:0a:09.1: SDHCI controller found [1180:0822] (rev 19)
[ 15.194768] sdhci-pci 0000:0a:09.1: PCI INT B -> GSI 18 (level, low) -> IRQ 18
[ 15.197935] mmc0: SDHCI controller on PCI [0000:0a:09.1] using PIO

$ lsmod | grep -i sdhci
sdhci_pci 15360 0
sdhci 23940 1 sdhci_pci
mmc_core 58268 2 mmc_block,sdhci

$ lspci | grep -i ricoh
...
0a:09.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller
0a:09.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 19)
0a:09.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 0a)
0a:09.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 05)
0a:09.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev ff)

$ tail -f /var/log/syslog
...
Feb 8 13:48:51 michael-laptop2 kernel: [ 3910.801967] mmc0: card lacks mandatory switch function, performance might suffer.
Feb 8 13:48:51 michael-laptop2 kernel: [ 3910.802543] mmc0: new SD card at address b368
Feb 8 13:48:51 michael-laptop2 kernel: [ 3910.805647] mmcblk0: mmc0:b368 E0421 501248KiB (ro)
Feb 8 13:48:51 michael-laptop2 kernel: [ 3910.806012] mmcblk0: p1
Feb 8 13:48:51 michael-laptop2 hald: mounted /dev/mmcblk0p1 on behalf of uid 1000

$ cat /etc/mtab
/dev/mmcblk0p1 /media/disk vfat ro,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush 0 0
After a long search on google and in my logs, I couldn't find any clue. The SD read-only-switch was correctly turned off ; my tests on the other laptop confirmed this. Finally I rebooted my laptop under Vista and ... the SD was also mounted read-only. Conclusion: it was not an OS / driver problem and the problem was related to that PC. I then simply blew some air with a "dust remover" into the SD slot and the magic happened: the SD card mounted in read write mode... A trivial solution to a seemingly complex problem.

23 comments:

laudicignolo said...

I was getting crazy with the same problem oh an almost new trancend sdhc 4GB!
Many many thanks, you saved me from madness
:)

xcrow said...

I had te same problem, but I have a laptop with SD-card slot. The sntence which saved my life: "The SD read-only-switch was correctly turned off". In my case the switch was turned on. Thank you very much :-)

Anonymous said...

Thanks Thanks, mine problem was also
that dammed switch...Thanks again
The Dane:-)

RapteR said...

Hi. I have the same card reader on my HP Pavilion dv6236ea - the same problem. Thanks for the information.

Anonymous said...

thank you... thank you... thank you...

Urza9814 said...

Holy crap. Thank you! I was having the same problem on my Dell Vostro 1000. I just blew into the slot and it fixed the problem. So weird. Reminds me of the old Nintendo cartridges....

Anonymous said...

Thank you, thank you , thank you *42

had the same problem! Didn't know dust could cause strange problem like this one.

ulyses said...

Thanks for saving me a lot of time searching and searching ... I couldn't have imagined it. That's the magic of computers.

Anonymous said...

Excellent!! ++ on the thanks for this! I spent HOURS following other advice using mount/umount before following this simple tip. Will now be the first thing I try when having card/stick problems.

Anonymous said...

Amazing: Reinserting the micro-sd in the adapter did the trick, while reinserting the adapter into the sd-slot - off course - didn't help. Thank's a lot for finding out and publishing.

Unknown said...

Excellent, thanks a lot - this put me on the right track. My SD Card adapter's lock slider kept moving to the locked position every time I inserted the card. I'll have to super-glue it in the unlocked position!

Ronny said...

Thank you so much. Blowing with my mouth into the slot has cured the read-only nightmare. I had also been searching the whole afternoon, thinking that it must have been some settings in the Windows CE registry that put the card reader of my GPS navigator in read-only mode. No sir, it seems to have been a simple speck of dust :-S

Anonymous said...

Tried 3 cards so far and was expecting heavy effort - blew in the slot, worked fine. Thanks a lot!

Shibby said...

I just had the same problem!

Getting all crazy with dmesg etc.

Thank you!

Anonymous said...

same here:

first try:
[ 692.934651] mmcblk0: mmc0:b368 SD 486 MiB (ro)
[ 692.936135] mmcblk0: p1
[ 700.615993] mmc0: card b368 removed

few more blows:

[ 645.092688] mmcblk0: error -123 sending status command
[ 645.092697] mmcblk0: error -123 sending read/write command, response 0x0, card status 0x0
[ 645.092776] mmcblk0: error -123 requesting status
[ 645.092815] end_request: I/O error, dev mmcblk0, sector 731
[ 645.092821] quiet_error: 33 callbacks suppressed
[ 645.092826] Buffer I/O error on device mmcblk0p1, logical block 496
[ 645.092831] lost page write due to I/O error on mmcblk0p1

head exploding:

[ 723.172585] mmc0: new SD card at address b368
[ 723.173017] mmcblk0: mmc0:b368 SD 486 MiB
[ 723.174635] mmcblk0: p1

WORKED!!!!! \o/ WHAT THE HELL!!!!

DIE HP DIE!!!!

doorknob60 said...

Haha! I have a card reader in my Desktop that was doing this, so I googled and read this. I just stuck my face up to it, blew a couple times, and now it works :P I was pretty skeptical, but I guess it worked :)

Anonymous said...

Strange but simply blowing into the reader fixed it in my case too.
Now, that was an easy work-around.
Thank you.

Migz Beats said...

Wowww. I was going crazy looking for a fix on the web to no avail . . .until i stumbled upon this page . .

After blowing thru a shirt into the slot like an old school supernintendo cartridge that hasn't been used for years - i can finally use my SD card with readyboost again! =)

thanks!

want fresh beats? folow me on twitter @MigzBeats

House + Hip-Hop Radio 24/7/365
for the free
@ Musiqsource.com


Thanks Again!!

Migz Beats said...

sorry about all the reposts
the captcha kept on telling me i did it wrong .. oops

David Bartlett @CardiffInternet said...

Another happy customer of yours. First blow did nothing, fifth time lucky. Thanks a lot.

ennui said...

same issue on a ricoh r5c822 (sd card reader on the lenovo x220). i literally blew once into the sd card slot and it worked right after.

Sergii Getman said...

Thank you very much!!

Anonymous said...

Wooooooooah! It worked, thanks!