sd card is read only

Discussion in 'UDOO X86' started by puschkin, Mar 31, 2017.

  1. puschkin

    puschkin New Member

    Joined:
    Jan 24, 2014
    Messages:
    11
    Likes Received:
    1
    Hi,

    I am now able to boot the board from a ubuntu USB stick, my plan is to install ubuntu to a empty sd-card.
    However all sd cards (Transcend, SanDisk, Intenso; 16GB, 32GB) are detected as readonly.


    When inserting a sd -card dmesg shows the following:
    [ 732.954886] mmc1: new ultra high speed SDR104 SDHC card at address 59b4
    [ 732.956289] mmcblk1: mmc1:59b4 USDU1 15.0 GiB (ro)
    udevadm monitor shows:
    KERNEL[894.513403] add /devices/pci0000:00/80860F14:01/mmc_host/mmc1/mmc1:59b4 (mmc)
    KERNEL[894.514899] add /devices/virtual/bdi/179:32 (bdi)
    KERNEL[894.519474] add /devices/pci0000:00/80860F14:01/mmc_host/mmc1/mmc1:59b4/block/mmcblk1 (block)
    UDEV [894.522250] add /devices/virtual/bdi/179:32 (bdi)
    UDEV [894.523492] add /devices/pci0000:00/80860F14:01/mmc_host/mmc1/mmc1:59b4 (mmc)
    UDEV [894.573978] add /devices/pci0000:00/80860F14:01/mmc_host/mmc1/mmc1:59b4/block/mmcblk1 (block)
    hdparm /dev/mmcblk1 shows:
    /dev/mmcblk1:
    HDIO_DRIVE_CMD(identify) failed: Invalid argument
    readonly = 1 (on)
    readahead = 256 (on)
    geometry = 490976/4/16, sectors = 31422464, start = 0

    When I set the device than to readwrite with hdparm r=0 /dev/mmcblk1, I receive:
    /dev/mmcblk1:
    HDIO_DRIVE_CMD(identify) failed: Invalid argument
    readonly = 0 (off)
    readahead = 256 (on)
    geometry = 490976/4/16, sectors = 31422464, start = 0

    however, the device is still read-only:

    dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=10
    dd: failed to open '/dev/mmcblk1': Read-only file system

    However all my tested cards are read-write, when I plug them in an USB-card reader, connected to the Udoo-x86

    Thanks for any hints!
     
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  3. puschkin

    puschkin New Member

    Joined:
    Jan 24, 2014
    Messages:
    11
    Likes Received:
    1
    There is unfortunately no useful hint in the internet. Problems discussed there are either
    • write-protection sliders,
    • wrong permissions on the mount directory
    • broken/damaged partition data
    • broken/damaged file system.
    However here the problem is before all that. The kernel itself identifies the raw device as RO, when plugged in.

    I tried several recent *ubuntu derivates (Ubuntu, Mate, Ubuntu Studio and Lubuntu), all with 64bit kernel 4.8.0-22 and 4.8.0-45.
    in addition I tried the most recent Ubuntu 17.04 beta with kernel 4.10.0-13 (64-bit)
    I know, that the micro-sd card is not using the USB interface. I mentioned, that my cards are making no problem at all, when used via an USB card reader. That should proof, that the cards itself have no problem.
    Everytime when I plug in a card the two lines in dmesg look like:
    mmc1: new ultra high speed SDR104 SDHC card at address 59b4
    mmcblk1: mmc1:59b4 USDU1 15.0 GiB (ro)
    That is the same for cards without any partition data and for cards with valid partition information an filesystem.
    Each card with a valid filesystem is recognised and can be used read only.
     
  4. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    We've just tried to install Ubuntu from a bootable SD-card, flashed with Ubuntu 16.10 Kernel 4.8, and we are able to write on the Micro SD, it doesn't appear as read-only. Anyway we are going on with tests and we'll let you know as soon as possible.
     
  5. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Could you guys give us the links to the model of SDs you got, so we can order them and test them here?
     
  6. Jetguy

    Jetguy Member

    Joined:
    Mar 28, 2017
    Messages:
    65
    Likes Received:
    60
    Here's what I know from testing, so far Windows 10 as zero issues with writing to the SD card and tried with both class 4 and class 10 cards. It's slow as dirt and this did make an SD card image process fail trying to create an SD card for an IOT device (Rapsberry Pi3) using the supplied microsoft tool where a plug in USB to microSD card adapter worked fine, but as far as normal within the OS writes to SD card it functions.
     
  7. Chirag A

    Chirag A New Member

    Joined:
    Apr 4, 2017
    Messages:
    4
    Likes Received:
    0
    SAME problem,

    DMESG LOG
    ----------------------------------------------------------------------------------------------
    mmc1: new ultra high speed SDR104 SDHC card at address aaaa
    mmcblk1: mmc1:aaaa SL16G 14.8 GiB (ro)
    mmcblk1: p1
    ----------------------------------------------------------------------------------------------

    Micros SD Card - Sandisk Ultra Class 10, 16 Gb
    OS - Ubuntu 16.04 (4.4.0-71-generic)

    I also tried multiple other cards ( 4Gb, 8Gb ) but no luck !

    Kindly guide
    Best,
    @nccchirag
     
  8. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Hi @Chirag A,
    many thanks for providing this info.
    Did you changed something in the BIOS? If you restore the default configuration in the BIOS through the F9 key, do you get the same behaviour from your SD?
     
  9. Mfigs

    Mfigs New Member

    Joined:
    Feb 10, 2017
    Messages:
    5
    Likes Received:
    1
    I've had this kind of problem with most Linux distributions. The SD card gets set to read-only because the linux distro doesn't think you have the proper permissions or ownership of the card. This always happens because another computer formatted the sd card. There is some painful method I remember chmod +x or chown that you can do. Another trick that you might be able to do is to use another computer and delete the partition tables fdisk/gparted (linux) or diskman (windows) and leave it unformatted. Insert it into the Udoo and then have the Udoo format it via fdisk or right clicking on it -> format [I do this in live mode in linux]. That should make the Linux Distro think that it's the owner of the card. Otherwise happy hunting with chmod or chown.
     
    Last edited: Apr 4, 2017
  10. Chirag A

    Chirag A New Member

    Joined:
    Apr 4, 2017
    Messages:
    4
    Likes Received:
    0
    Yes I did update the BIOS .. but hadn't changed any settings .. nevertheless I tried F9, No luck with that too
     
  11. Chirag A

    Chirag A New Member

    Joined:
    Apr 4, 2017
    Messages:
    4
    Likes Received:
    0
    chmod / chown isn't a solution for this case .. even if you plug in a raw unpartitioned micro SD card ... it does not work !
    you cannot partition using gparted
     
  12. Mfigs

    Mfigs New Member

    Joined:
    Feb 10, 2017
    Messages:
    5
    Likes Received:
    1
    If you have a windows installation on hand you can try installing it to a formated SDcard just to test if it is the Udoo board or a bad SDcard. Windows is more liberal and doesn't care about ownership like linux does. If it does start to install then that means it's definitely Linux being Linux.
    It would have to be a permissioning issue at that point.
    Try unmounting then mounting it another way.

    Be sure to use the sdcard device name /dev/SDCARDDEVICENAME I think yours is mmcblk1 and I updated command to reflect that.
    Method One:
    sudo mount -t vfat -o rw,uid=1000 /dev/mmcblk1 /mnt/sdcard
    This makes you the owner when mounting.

    Method Two:
    sudo mount -t vfat -o rw,umask=000 /dev/mmcblk1 /mnt/sdcard
    This leaves root the owner, but lets everyone write.
     
  13. Chirag A

    Chirag A New Member

    Joined:
    Apr 4, 2017
    Messages:
    4
    Likes Received:
    0
    thank you for the help, but no luck with either methods... in both cases it is mounting the SD as "read-only" .. the OS detects it as write-protected .. ( dmesg logs show that ) .. I think it's something relating to hardware as, the same SD card works on other SBC's ( raspberry pi, odroid etc )
     
  14. puschkin

    puschkin New Member

    Joined:
    Jan 24, 2014
    Messages:
    11
    Likes Received:
    1
    Those are my cards:
    sd-cards.jpg
     
  15. puschkin

    puschkin New Member

    Joined:
    Jan 24, 2014
    Messages:
    11
    Likes Received:
    1
    This does not help, because /dev/mmcblk1 is already ReadOnly! That is the cause, that you are neither able to create partititions, create filesystems etc..

    Without beeing mounted the command "echo "TEST" > /dev/mmcblk1" (as root!) gives the write permission failure.
     
  16. Mfigs

    Mfigs New Member

    Joined:
    Feb 10, 2017
    Messages:
    5
    Likes Received:
    1
    I wish I could be of more help. I can usually figure out this kind of issue. I have over 10 micro SDcards 5 different types and can put write protection with different file system types fat32, ext2, ext4... on them and then test them on the Udoo x86 then try removing the protection when I receive my Udoo. It could be anything from a linux driver issue [likely, might need some special NUC driver], bad SDcards [unlikely], Permissioning issues [likely, I'd need to exhaustively test them], Udoo bios firmware [unlikely since it's still reading]. When I get my Udoo I'll figure it out.
     
  17. puschkin

    puschkin New Member

    Joined:
    Jan 24, 2014
    Messages:
    11
    Likes Received:
    1
  18. Markus Laire

    Markus Laire Active Member

    Joined:
    Mar 9, 2017
    Messages:
    225
    Likes Received:
    92
    Here is actual SoC datasheet (for N3710) - page 25 says that it's "Designed to work with I/O cards, Read-only cards and Read/Write cards" but pages 93-94 which list actual signals doesn't seem to mention any write-protect signal.

    Also Wikipedia page Secure Digital says that there is also a programmable write-protect[1] and that physical write-protect is optional feature which is not supported by all host devices.

    [1] "The host device can command the SD card to become read-only (to reject subsequent commands to write information to it). There are both reversible and irreversible host commands that achieve this."
     
  19. puschkin

    puschkin New Member

    Joined:
    Jan 24, 2014
    Messages:
    11
    Likes Received:
    1
    As far, as I understand the SD-card mechanisms, there are a bunch of possibilities to protect the card.
    The programmable write protect, you mentioned from the Wikipedia-article. Here for example is a standalone device, which can program a card: http://hackaday.com/2013/11/12/keep-your-sd-cards-data-safe-with-the-sd-locker/
    This information is stored in a register inside the card, and is either temporary or final. The latter is used sometimes for archive issues, when you need to make sure, that data is not tampered.

    The problem I am facing i think is related to this optional write protection input on the SD-card host. Here a hint would be helpful, if there is the possibility, to check if this specific pin from the SoC is reachable on the board, to check its state with an oscilloscope or a voltmeter.

    All my tests are showing, that the cards are writable, as soon, as I plug them into a usb based reader on the same udoo board. As well on all my other computers, raspberrys, pine64, ....
     
  20. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Hi everyone,
    this isn't an hardware problem, but a firmware bug that will be fixed shortly.
    In the meanwhile, the only viable workaround is to plug a Wi-Fi-BT M.2 expansion card, like the one in the shop. I know it sounds weird, but this will remove the bug.
     

Share This Page