dd on Catalina gives "Permission denied" error even after grant it Full Disk Access in Security and Privacy

date; sudo dd bs=1M if=2020-02-13-raspbian-buster-full.img of=/dev/rdisk3; date
    Thu Apr 23 20:22:45 PDT 2020
    Password:
    dd: failed to open '/dev/rdisk3': Permission denied
    Thu Apr 23 20:22:54 PDT 2020

I've tried giving Full Disk Access to all of these, but to no avail:

/usr/local/bin/gdd
/usr/local/bin/dd
/usr/local/opt/coreutils/libexec/gnubin/gdd
/usr/local/opt/coreutils/libexec/gnubin/dd

enter image description here

The device exists:

diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         1.0 TB     disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.0 TB     disk1
                                 Physical Store disk0s2
   1:                APFS Volume d - Data                638.3 GB   disk1s1
   2:                APFS Volume Preboot                 81.1 MB    disk1s2
   3:                APFS Volume Recovery                526.9 MB   disk1s3
   4:                APFS Volume VM                      3.2 GB     disk1s4
   5:                APFS Volume d                       11.1 GB    disk1s5

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *8.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS time-machine2           2.0 TB     disk2s2
   3:                  Apple_HFS data2                   6.0 TB     disk2s3

/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk3
   1:             Windows_FAT_32 NO NAME                 31.9 GB    disk3s1

I'm not sure what the problem is?


Solution 1:

My bad. If this happens to you, you might want to check the switch on your SD card to see if it is set to read-only. :)

Solution 2:

Catalina mounts system directory's in apfs containers (think linux lvm volume) explicitly as read-only, yet another security feature.

To access raw block devices you need to remount with explicitly adding rw options: bsd mount: mount -uw / or mount -X /, try to add -o remount I think, look at man mount and diskutil help I don't recall bsd mount opts now exactly but starting macOS in single mode will give you a warning about read-only and how to remount in rw, so try booting holding cmd - s and take a look what it says, type exit to start launched default session ergo normal start.

using gnu mount: mount /dev/diskXsX -o remount,rw,force

What does df -H and mount shows in terminal? Check if mount points are flagged as ro only.

Update: disable this "feature" (SIP) in recovery mode: csrutil enable --without fs , then you can remount with rw access without disabling SIP completely - although I always disable all SIP stuff including gatekeeper sudo spctl --master-disable but it's not recommended by apple 😀