TechSomething

Installing MacOs Ventura on Proxmox

why: #

TL;DR:
I want an always-on macos installation without dedicating new hardware to this test.

more:
Some data, like airtags position, is retrievable reliably only from macos,
we've seen that the iCloud APIs ad not reliable or don't expose the data we need.

With a friend we want to test the retrieval of the airtags position from macos, convert the data and send it to traccar, an open source fleet tracking software.

notes: #

hardware acceleration issues #

There are some rendering issues when hardware acceleration is required, this is a known issue and it seems that is solvable only passing a GPU to the vm (not my use case).

Sonoma in particular has some issues on the desktop, the image is not correctly rendered.

These issues are known, there seem to be some workarounds with intel and nvidia gpus (https://dortania.github.io/OpenCore-Post-Install/gpu-patching/intel-patching/#getting-started) but again, it's not my use case.

virtual (and non) hardware #

The vm are running on a cpu Ryzen Series 3000,
the disks are on an nvme drive.

The vm has been installed using 4 cpu cores and 8gb of ram,
now I am using it with 2 cores and 4gb of ram.

create the ISO: #

(I'm running these commands on macos ventura)

check the available software #

?@machine ventura % softwareupdate --list-full-installers

Finding available software
Software Update found the following full installers:
* Title: macOS Sonoma, Version: 14.1.1, Size: 12604952KiB, Build: 23B81, Deferred: NO
* Title: macOS Sonoma, Version: 14.1, Size: 12603757KiB, Build: 23B74, Deferred: NO
* Title: macOS Sonoma, Version: 14.0, Size: 12555162KiB, Build: 23A344, Deferred: NO
* Title: macOS Ventura, Version: 13.6.1, Size: 11662168KiB, Build: 22G313, Deferred: NO
* Title: macOS Ventura, Version: 13.6, Size: 11657005KiB, Build: 22G120, Deferred: NO
* Title: macOS Ventura, Version: 13.5.2, Size: 11655353KiB, Build: 22G91, Deferred: NO
* Title: macOS Ventura, Version: 13.5.1, Size: 11655520KiB, Build: 22G90, Deferred: NO
* Title: macOS Ventura, Version: 13.5, Size: 11654590KiB, Build: 22G74, Deferred: NO
* Title: macOS Ventura, Version: 13.4.1, Size: 11513284KiB, Build: 22F82, Deferred: NO
* Title: macOS Monterey, Version: 12.7.1, Size: 12110635KiB, Build: 21G920, Deferred: NO
* Title: macOS Monterey, Version: 12.7, Size: 12107687KiB, Build: 21G816, Deferred: NO
* Title: macOS Monterey, Version: 12.6.9, Size: 12111110KiB, Build: 21G726, Deferred: NO
* Title: macOS Monterey, Version: 12.6.8, Size: 12119078KiB, Build: 21G725, Deferred: NO
* Title: macOS Monterey, Version: 12.6.7, Size: 12115649KiB, Build: 21G651, Deferred: NO
* Title: macOS Big Sur, Version: 11.7.10, Size: 12125478KiB, Build: 20G1427, Deferred: NO
* Title: macOS Big Sur, Version: 11.7.9, Size: 12125714KiB, Build: 20G1426, Deferred: NO
* Title: macOS Big Sur, Version: 11.7.8, Size: 12120994KiB, Build: 20G1351, Deferred: NO

instructions for macOS 13 Ventura #

install the software installer to create the iso

softwareupdate --fetch-full-installer --full-installer-version 13.6.1
cd ~/Desktop/Proxmox_Ventura/

DISK_SIZE="15361m"
hdiutil create -o ~/Desktop/Proxmox_Ventura/Ventura.cdr -size $DISK_SIZE -layout GPTSPUD -fs HFS+J
hdiutil attach ~/Desktop/Proxmox_Ventura/Ventura.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo "/Applications/Install macOS Ventura.app/Contents/Resources/createinstallmedia"  --volume /Volumes/install_build --nointeraction --downloadassets
hdiutil detach "/Volumes/Shared Support"
hdiutil detach "/Volumes/Install macOS Ventura"
hdiutil convert Ventura.cdr.dmg -format UDTO -o Ventura.iso
mv Ventura.iso.cdr Ventura.iso
rm Ventura.cdr.dmg

instructions for macOS 14 Sonoma: #

softwareupdate --fetch-full-installer --full-installer-version 14.1.1

cd ~/Desktop/Proxmox_Sonoma/

DISK_SIZE="15361m"
hdiutil create -o ~/Desktop/Proxmox_Sonoma/Sonoma.cdr -size $DISK_SIZE -layout GPTSPUD -fs HFS+J
hdiutil attach ~/Desktop/Proxmox_Sonoma/Sonoma.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo "/Applications/Install macOS Sonoma.app/Contents/Resources/createinstallmedia" --volume /Volumes/install_build --nointeraction --downloadassets
hdiutil detach "/Volumes/Shared Support"
hdiutil detach "/Volumes/Install macOS Sonoma"
hdiutil convert Sonoma.cdr.dmg -format UDTO -o Sonoma.iso
mv Sonoma.iso.cdr Sonoma.iso
rm Sonoma.cdr.dmg

possible issues: #

note the "-layout GPTSPUD" instead of "-layout SPUD", in the command:

hdiutil create -o ~/Desktop/Proxmox_version/version.cdr -size $DISK_SIZE -layout GPTSPUD -fs HFS+J

it seems that was the change that made the script work,
otherwise I received the error:

Erasing disk: 0%... 10%... 20%... 30%... 100%
Copying essential files...
Copying the macOS RecoveryOS...
Making disk bootable...
Failed to extract AssetData/boot/Firmware/Manifests/InstallerBoot/* from update bundle
The bless of the installer disk failed.

sources: #

preparation #

osk key #

recover the osk key:
it's listed in a court document: https://www.rcfp.org/wp-content/uploads/imported/20120105_202426_apple_sealing.pdf

it seems like apple tried to take it down, arguing it was a trade secret.

I tried to generate it randomly but I only came up with this string,
it seems something is missing, maybe needs to be ROT13, I dunno.

bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap

to check I would have needed to run this command to check but I don't have more time for this topic.

echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" | tr 'A-Za-z' 'N-ZA-Mn-za-m'

download opencore #

download the latest release of opencore for proxmox: https://github.com/thenickdude/KVM-Opencore/releases

for this guide I've used the v20

decompress the archive and copy the iso, with the macos one, on proxmox

proxmox #

avoiding bootloops #

to avoid bootloops

echo 1 > /sys/module/kvm/parameters/ignore_msrs

echo "options kvm ignore_msrs=Y" >> /etc/modprobe.d/kvm.conf

update-initramfs -k all -u

source: https://www.nicksherlock.com/2022/10/installing-macos-13-ventura-on-proxmox/ section "Configure Proxmox"

TSC #

check if you have working TSC (time stamp counter):

dmesg | grep -i -e tsc -e clocksource

the output should be:

tsc: Refined TSC clocksource calibration: 3399.998 MHz
clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x31024cfe468, max_idle_ns: 440795307017 ns
clocksource: Switched to clocksource tsc

if you see this, then the TSC is not enabled:

TSC synchronization [CPU#0 -> CPU#1]:
Measured 3358870891203288 cycles TSC warp between CPUs, turning off TSC clock.
tsc: Marking TSC unstable due to check_tsc_sync_source failed
clocksource: Switched to clocksource hpet
kvm: SMP vm created on host with unstable TSC; guest TSC will not be reliable

source: https://www.nicksherlock.com/2022/10/installing-macos-13-ventura-on-proxmox/ section "Requirements"

create the vm #

follow: https://www.nicksherlock.com/2022/10/installing-macos-13-ventura-on-proxmox/
steps "Create the VM" and "Configure Proxmox"

notes #

you'll need to edit the proxmox vm configfile,
I am on AMD so I've added this:

args: -device isa-applesmc,osk="THE_OSK_KEY" -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -global nec-usb-xhci.msi=off -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off -cpu Haswell-noTSX,vendor=GenuineIntel,+invtsc,+hypervisor,kvm=on,vmware-cpuid-freq=on

for intel:

args: -device isa-applesmc,osk="THE_OSK_KEY" -smbios type=2 -device usb-kbd,bus=ehci.0,port=2 -global nec-usb-xhci.msi=off -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off -cpu host,vendor=GenuineIntel,+invtsc,+hypervisor,kvm=on,vmware-cpuid-freq=on

also remember to change “,media=cdrom” to “,cache=unsafe" otherwise it won't correctly boot.

install macOS Ventura #

the main things you want to keep in mind:

make the opencore install permament: #

check the disks:

user@proxmox-sonoma ~ % diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *85.9 GB    disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk3         85.7 GB    disk0s2

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *16.1 GB    disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Install macOS Sonoma    15.8 GB    disk1s2

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *157.3 MB   disk2
   1:                        EFI EFI                     157.2 MB   disk2s1

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +85.7 GB    disk3
                                 Physical Store disk0s2
   1:                APFS Volume proxmox-sonoma - Data   2.2 GB     disk3s1
   2:                APFS Volume Preboot                 2.0 GB     disk3s2
   3:                APFS Volume Recovery                1.2 GB     disk3s3
   4:                APFS Volume proxmox-sonoma          9.9 GB     disk3s4
   5:              APFS Snapshot com.apple.os.update-... 9.9 GB     disk3s4s1
   6:                APFS Volume VM                      1.1 MB     disk3s6

we want to copy the EFI partition from the Opencore iso to our main EFI partition on the macos disk,
in this case the opencore efi partition is /dev/disk2s1 and the macos disk efi partition is /dev/disk0s1,
so we'll copy them with this command:

sudo dd if=/dev/disk2s1 of=/dev/disk0s1

reboot

activate remote management #

since the proxmox console is a bit slugghish it's better if we work remotely on that vm,
once the install is finished go in "System Settings" --> "General" --> "Sharing"
and activate "Screen Sharing" and "Remote Login"

screen sharing #

is VNC

you can define an arbitrary password to access the service

remote login #

is SSH
we can connect simply via ssh using our username and password:

ssh user@192.168.1.16

next steps: enable ssh-key access and disable password login

set the config.plist parameters #

sources:

generate the correct serial number and MLB #

retrieve the tool:

git clone --depth 1 https://github.com/acidanthera/OpenCorePkg.git
cd ./OpenCorePkg/Utilities/macserial/
make
chmod +x ./macserial

generate the serials:

./macserial --num 1 --model "iMacPro1,1"

the output will be like:

V832AKJGA831 | B8562969GHIIUT017

the on on the left is our serial, the right one is the Board Serial (MLB)

choose mac address and create the rom address #

we have to choose a mac address which is tied to Apple,
they start with: 00:16:CB
so for example: 00:16:CB:AA:BB:CC

the rom address is the mac address without ":" and all lowercase:
0016cbaabbcc

generate a uuid #

just run "uudigen" and you will have something like:

0DEE5A61-5BDE-431B-803C-3F8C40BCFE0B

mount EFI partition #

our config.plist file is inside the EFI partition which is not mounted by default,
mount our EFI partition and change to the correct partition:

sudo diskutil mount EFI

configure the config.plist #

then we can edit the config.plist in

/Volumes/EFI/EFI/OC/config.plist

add serials #

[..CUT..]
<key>PlatformInfo</key>
        <dict>
                <key>Automatic</key>
                <true/>
                <key>CustomMemory</key>
                <false/>
                <key>Generic</key>
                <dict>
                        [..CUT..]
                        <key>MLB</key>
                        <string>B8562969GHIIUT017</string>
                        <key>ROM</key>
                        <data>0016cbaabbcc</data>
                        <key>SpoofVendor</key>
                        <true/>
                        <key>SystemProductName</key>
                        <string>iMacPro1,1</string>
                        <key>SystemSerialNumber</key>
                        <string>V832AKJGA831</string>
                        <key>SystemUUID</key>
                        <string>0DEE5A61-5BDE-431B-803C-3F8C40BCFE0B</string>
                        [..CUT..]
    

fix autoboot: #

also set the autoboot, otherwise it will alsways wait foruser input,
in config.plist search Misc -> Boot -> Timeout
and set it to something like "5":

[..CUT..]
        <key>Misc</key>
        <dict>
                <key>BlessOverride</key>
                <array/>
                <key>Boot</key>
                <dict>
                        [..CUT..]
                        <key>Timeout</key>
                        <integer>5</integer> 
                        [..CUT..]

remember to change the mac address on proxmox #

in the hardware section change the macaddress in your vm config

other tips: #

also from: https://www.nicksherlock.com/2022/10/installing-macos-13-ventura-on-proxmox/

Disabling SIP (System Integrity Protection)
Upgrading OpenCore

other #

automatic booting #

other than setting a timeout in the config.plist, if you don't encrypt the disk (that would require you to enter a password to unlock the disk) then the system will be reachable via ssh once booted.

what is working: #

sources: