dd sd card issue

Discussion in 'Mac Programming' started by skippymac, Mar 4, 2013.

  1. macrumors 6502a

    skippymac

    Joined:
    Jun 9, 2010
    Location:
    Hampshire, UK
    #1
    I didn't know where to post this so I thought I'd put it here, please move it if it's in the wrong place!

    I'm trying to install a raspbmc image on an 8GB sd card for my raspberry pi. I put it in my MBP sd card slot and do the following:

    Code:
    diskutil unmount /dev/disk4s1
    dd bs=1m if=~/Downloads/installer.img of=/dev/rdisk4
    and every single time I get this error:

    Code:
    dd: /dev/rdisk4: Permission denied
    I tried this with a USB drive and it worked just fine. I have tried it with the sd switch in both locked and unlocked positions and have even tried blowing in the sd slot as per this page.

    Is my sd card slot well and truly screwed or is this another problem? Do I just need to blow harder?! :rolleyes:
     
  2. macrumors 6502

    ElectricSheep

    Joined:
    Feb 18, 2004
    Location:
    Wilmington, DE
    #2
    Uh, even though it seems like a totally obvious thing...

    ...are you executing these commands with superuser privileges?
     
  3. thread starter macrumors 6502a

    skippymac

    Joined:
    Jun 9, 2010
    Location:
    Hampshire, UK
    #3
    tried both with and without sudo and same thing happened both times :(
     
  4. Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    Whakatane, New Zealand
    #4
    You definitely need sudo. Where did you get "rdisk4" from? Did you look it up through System Profiler (good) or just copy it from a tutorial (bad)?
     
  5. thread starter macrumors 6502a

    skippymac

    Joined:
    Jun 9, 2010
    Location:
    Hampshire, UK
    #5
    used df -h to find the sd card
     
  6. macrumors 603

    Joined:
    Aug 9, 2009
    #6
    Post the complete command, and the exact error message.

    It seems unlikely that a correct use with 'sudo' could result in a Permission denied error.


    The raspbmc website also shows a Python-based install process. What happens if you use that?
     
  7. Nermal, Mar 5, 2013
    Last edited: Mar 5, 2013

    Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    Whakatane, New Zealand
    #7
    Edit: This is not good advice; see below.

    While df probably does something similar, when I've looked it up using System Profiler then I get disk1, not rdisk1 (and this works in dd). Try disk4 instead of rdisk4 and see what happens.
     
  8. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #8
    Is there a write-protect switch on the SD card?

    [​IMG]

    The command you should use is actually:

    sudo diskutil list

    However, you want to use /dev/rdisk4 and not just /dev/disk4 - Writing to a 'raw' device with dd (in the case of an SD card) is much, much faster. link
     
  9. Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    Whakatane, New Zealand
    #9
    Thanks for that, it's good to know. I wondered why it took so long to write!
     
  10. thread starter macrumors 6502a

    skippymac

    Joined:
    Jun 9, 2010
    Location:
    Hampshire, UK
    #10
    Same thing with the install.py it gives the same error. Here's an example of what commands I've been using (It's disk 3 now)
    Code:
    diskutil unmount /dev/disk3s1
    Volume UNTITLED on disk3s1 unmounted
    
    dd bs=1m if=~/Downloads/installer.img of=/dev/rdisk3
    dd: /dev/rdisk3: Permission denied
    
    sudo dd bs=1m if=~/Downloads/installer.img of=/dev/rdisk3
    dd: /dev/rdisk3: Permission denied
    Yes, and I've tried it multiple times in both positions. Im beginning to think the write protection switch in my sd card reader is knackered :(
     
  11. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #11
    Imagine what I thought when I went out and bought faster, more expensive SD cards and it still took forever to write an image.
     
  12. macrumors 603

    Joined:
    Aug 9, 2009
    #12
    Code:
    ls -l /dev/*disk*
    
    Is the device writable or not?
     
  13. macrumors 6502

    ElectricSheep

    Joined:
    Feb 18, 2004
    Location:
    Wilmington, DE
    #13
    Can you use the SD card normally (Format it with Disk Utility, copy files to it with the Finder, etc)? If not, then yeah, its probably the card.
     
  14. thread starter macrumors 6502a

    skippymac

    Joined:
    Jun 9, 2010
    Location:
    Hampshire, UK
    #14
    I can't write any files to any sd cards so it looks like my reader has given up the ghost :(
     
  15. macrumors newbie

    Joined:
    Jun 10, 2013
    #15
    Found a fix

    I had the exact same problem, I managed to get it to work by unmounting just the fat partition of the SD card, but not the whole SD from Disk Utility (I selected 'NO NAME' rather than 'Apple SDXC reader media').

    I also made rdisk3 writable, but I'm not sure if this helped at all.

    Hope it helps others.
     
  16. macrumors newbie

    Joined:
    Feb 28, 2014
    #16
    Another solution

    I was having the exact same problem (getting a permission denied error to the device even when using sudo). I figured maybe it was an issue with sudo not giving me full root access so I first ran:

    sudo su

    Then entered my password and retried the dd command (without "sudo" since I'm not using the root user).
    It worked!!!
    Hope this helps someone...
     

Share This Page