0

I know there is tons of information on this and similar questions on this site, but I have been at this for a couple hours and could use some confirmation of a few specific details.

I just want to write a CentOS Minimal ISO image for ARM64 I downloaded, to my M1 MacBook Air, 2021.

My current understanding is that you should not partition the actual disk for a Mac disk, but rather create a new APFS volume in the main APFS container:

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:             Apple_APFS_ISC ⁨⁩                        524.3 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk3⁩         245.1 GB   disk0s2
   3:        Apple_APFS_Recovery ⁨⁩                        5.4 GB     disk0s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +245.1 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD⁩            23.4 GB    disk3s1
   2:              APFS Snapshot ⁨com.apple.os.update-...⁩ 23.4 GB    disk3s1s1
   3:                APFS Volume ⁨Preboot⁩                 847.5 MB   disk3s2
   4:                APFS Volume ⁨Recovery⁩                1.7 GB     disk3s3
   5:                APFS Volume ⁨Data⁩                    136.6 GB   disk3s5
   6:                APFS Volume ⁨VM⁩                      20.5 KB    disk3s6
   7:                APFS Volume ⁨Nix Store⁩               2.7 GB     disk3s7
   8:                APFS Volume ⁨centos⁩                  20.0 GB    disk3s9

So disk3 is sort of a "virtual" or "synthetic" partition or disk, it is not actually a partition but it basically acts like one within the context of APFS.

I was operating on the assumption that I just needed to make a new volume and write to it using dd:

addVolume seems to work (now I have centOS twice obviously, this is just to test this command):

~ % diskutil apfs addVolume disk3 APFS centos
Will export new APFS Volume "centos" from APFS Container Reference disk3
Started APFS operation on disk3
Preparing to add APFS Volume to APFS Container disk3
Creating APFS Volume
Created new APFS Volume disk3s8
Mounting APFS Volume
Setting volume permissions
Disk from APFS operation: disk3s8
Finished APFS operation on disk3
~ % diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:             Apple_APFS_ISC ⁨⁩                        524.3 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk3⁩         245.1 GB   disk0s2
   3:        Apple_APFS_Recovery ⁨⁩                        5.4 GB     disk0s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +245.1 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD⁩            23.4 GB    disk3s1
   2:              APFS Snapshot ⁨com.apple.os.update-...⁩ 23.4 GB    disk3s1s1
   3:                APFS Volume ⁨Preboot⁩                 847.5 MB   disk3s2
   4:                APFS Volume ⁨Recovery⁩                1.7 GB     disk3s3
   5:                APFS Volume ⁨Data⁩                    138.5 GB   disk3s5
   6:                APFS Volume ⁨VM⁩                      20.5 KB    disk3s6
   7:                APFS Volume ⁨Nix Store⁩               2.7 GB     disk3s7
   8:                APFS Volume ⁨centos⁩                  20.0 GB    disk3s9
   9:                APFS Volume ⁨centos⁩                  766.0 KB   disk3s8

I unmounted it to be able to write to it:

~ % diskutil unmount disk3s9
Volume centos on disk3s9 unmounted

This is the path to the ISO image:

~ % fp=/Users/____.O.____/Downloads/CentOS-7-aarch64-Minimal-2009.iso

This is where I've gotten stuck:

~ % sudo dd if=$fp of=/dev/disk3s9 
Password:
dd: /dev/disk3s9: Permission denied
1+0 records in
0+0 records out
0 bytes transferred in 0.000498 secs (0 bytes/sec)

I have tried it with different bs values too but it doesn't affect it.

One slight difficulty is that a lot of information is about writing from or booting from a USB drive but I don't want to. I want to learn how to not need one, it's much more convenient. I just want to write the ISO image from my computer's memory into a new partition or volume. Is the problem that I cannot write to a volume inside the container given that I am inside MacOS at the moment, inside the MacOS Container? Can I write the ISO image from "single user mode", outside of MacOS?

I also tried it with the DiskUtility GUI application which seemed a lot simpler and more straightforward. I was able to open an image from a folder with no error message. When I rebooted holding the power key to the boot menu, I saw the MacOS volume, a "Nix Store" volume from I guess when I installed Nix, and I don't see my CentOS volume.

DiskUtility1

DiskUtility2

While it is possible this is some very subtle thing like the File menu options "Image From Folder" and "New image -> Open Disk Image" are different and I chose the wrong one, or I put it in the wrong place: inside the MacOS Volume Group because I thought it had to be inside the APFS system, rather than outside of it, where NixOS is -

It can be difficult to test this stuff out because you have to reboot just for tiny adjustments, and I've done enough for today. Could anyone explain to me the precise details of what must be done here and what would be nice is to confirm as much as possible that it's working before I actually reboot to really see.

Thanks.

2
  • 1
    Sorry, but this feels like the longest run-around-the-houses form of an XY Problem I've seen in a while… Waaay back before you started this you should have asked two basic questions 1. Can I run Centos natively on M1? No. 2. Can I boot a Mac from an ISO image? No. The rest of the problem would then have never arisen. There's also a late 3. Can unix boot from APFS? No.
    – Tetsujin
    Commented Jan 3, 2023 at 12:00
  • Unless things have changed very recently, Asahi is the only nix that can do this, but see You Can Now Install Linux On An M1 Mac, But You Probably Shouldn't
    – Tetsujin
    Commented Jan 3, 2023 at 12:01

1 Answer 1

1

Your various attempts at creating the right kind of "storage" for CentOS are unfortunately in vain. The basic premise of your endeavour is unfortunately incorrect: CentOS does not run natively on the M1 Mac. You simply cannot install it that way.

In general, you cannot just write an ISO image to the disk and expect it to boot. That goes for the M1/M2 Macs - as well as other, Intel-based computers.

If you want to run CentOS on your M1 Mac, you'll want to install it in virtualized environment - using for example the Parallels Desktop or VMware Fusion software (commercial softwares) or for example VirtualBox.

You must log in to answer this question.

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