17

I've got an IcyBox USB hub/card reader combo in my computer, running Ubuntu 12.10.

It's got an issue with SD cards. It always mounts them read-only, regardless of the write-lock switch. This is observed across many SD cards that otherwise work, and crucially occurs for a microSD in an adapter, where the microSD was fine in the microSD slot in the reader.

Anyone got any ideas as to what's going on and how I can fix it?

6 Answers 6

14

It sounds to me to be a permissions issue. I've come across this myself with my Linux Mint 14 (Cinnamon) install, which I believe is based on Ubuntu 12.10.

First thing to do is to check the permissions on the hardware device mounting your card. You'll need to find the device name. To do this run the following command:

sudo fdisk -l

Your device will probably be something along the lines of /dev/sdb1, in my case the SD Reader was /dev/mmcblk0p1.

Next you need to get the permissions on this device:

sudo ls -l /dev/mmcblk0p1

Replace "/dev/mmcblk0p1" with your device location. The output will look something like this:

brw-rw---- 1 root disk 179, 1 Feb 3 21:58 /dev/mmcblk0p1

This tells us the device is owned by User 'root' and group 'disk' You need to be a member of group 'disk' to be able to write to the SD card. You can check which groups your a member of with

groups username

In my case I was not a member of the 'disk' group, I rectified this with

sudo usermod -G disk --append username

This adds the group 'disk' to your user's groups, which should allow you to now read & write to the SD card

5
  • 1
    "sudo usermod -G disk username" removed my other groups from my account. Adding "--append" will add the group without removing the existing groups.
    – matt
    Commented May 3, 2014 at 0:26
  • 1
    --append must be after the group name, like sudo usermod -G disk --append username (else there is an error about group "--append") Commented Jul 14, 2014 at 16:00
  • FWIW, usermod -a -G <group> <username> is also valid. Commented Nov 14, 2015 at 2:26
  • 4
    "You need to be a member of group 'disk' to be able to write to the SD card." This is wrong and dangerous.
    – ijk
    Commented Dec 11, 2015 at 23:44
  • Downvoting!!! Having write access to the block device means you can bypass the filesystem mount and write anything you like to the device, treating it sort of like a tape drive. It shouldn't have anything to do with a RO mount. If you check your main disk (sda1?) you'll see it has same permissions, yet you can save files to that without being a member of 'disk'. This answer is wrong and dangerous!
    – SusanW
    Commented May 17 at 14:05
2

It's likely that the SD card was removed without ejecting it properly, and the file system is marked as dirty. The media mounting system checks the dirty flag when it sees the device, and by default mounts read-only when there's an error (mount option errors=remount-ro).

You can check this by looking in the syslog (use sudo less /var/log/syslog) for something like this:

May 17 14:56:47 myhost udisksd[800]: Mounted /dev/sdc1 at /media/susan/5EC4-D59E on behalf of uid 1000
May 17 14:56:47 myhost kernel: [1017820.273269] FAT-fs (sdc1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

In this case, it was a DOS FAT filesystem, and can be fixed with

dosfsck -l -t /dev/sdb

Remove dirty bit (y)
Answer Yes for ALL

Once complete, then eject the card and put it back in.

1
  • This is a very good answer if you have a single SD card that's failing. But it doesn't explain why the OP had a problem with many cards that were fine elsewhere.
    – SusanW
    Commented May 17 at 14:28
1

Open terminal by hitting Alt+Ctrl+T and run:

sudo mount --options remount,rw /dev/sdd

Replace /dev/sdd with your SDHC drive, you can find it using fdisk -l.

1
  • 8
    with this command the result is: cannot remount /dev/sdc1 read-write, is write-protected Commented Jan 8, 2015 at 13:49
1

Get hold of a PC running windows, download a program called SD Formatting, install and reformat the SD card, making sure the option is set to "ON", it will then be recognised on a Linux machine! without the read only option.

1
  • This doesn't explain why the OP had a problem with many cards that were fine elsewhere. Also, should it be highlighted that reformatting the card will destroy all your data!! ?
    – SusanW
    Commented May 17 at 14:30
1

In my case Ubuntu auto-mounted the SD Card into a directory it created that didn't have write permissions.

  • Once mounted (accessible but read-only), find the mount point: /media/{username}/{sd-card name}

    (in my case this was: /media/andrew/SDCard - you can find this by right-clicking on the drive, selecting 'Properties' and looking for 'Mounted on', or by typing mount -l in a terminal)

  • Open a terminal and type the following: sudo chmod 777 /media/{username}/{sd-card name}

    e.g. sudo chmod 777 /media/andrew/SDCard

The SD card is now writable

0

I've had this problem. I noticed other devices were able to write to the SD card.
It turned out to be a bad SD card adapter (the kind with the ro/rw switch).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .