Coopydood / ultimate-macOS-KVM

Helping noobs and pros alike build the ultimate macOS virtual machine with easy automation, powered by KVM. Now with macOS Sequoia support!
https://coopydood.github.io/ultimate-macOS-KVM/
GNU General Public License v3.0
441 stars 25 forks source link

[macOS] "This disc is locked' when installing MacOS from autopilot generated qemu script #129

Closed metronidazole closed 4 weeks ago

metronidazole commented 1 month ago

Describe the Issue

After making a qemu script largely using the defaults in the autopilot feature, when running the VM and doing the initial install, I am unable to select the disc as it says "this disc is locked". It also doesn't seem to recognise the 80G max size for the disc image. See attached picture

Reproduce the Issue

Use autopilot feature to generate a qemu script and try to do initial MacOS install

Expectation

Mac OS installs

Screenshots

image

Operating System

Arch Linux

Kernel

6.11.2

Processor

3700X

RAM (in GB)

32GB

GPU(s)

No response

Version

v0.12.4

Branch

main

Generated Script File

#!/usr/bin/env bash
# shellcheck disable=SC2054

#
#   APC-RUN_14-10-2024_20-52-50
#
#   THIS FILE WAS GENERATED USING AUTOPILOT.
#
#   To boot this script, run the following command:
#   $ ./boot.sh
#

#
#   boot.sh
#   Created by Coopydood as part of the ultimate-macOS-KVM project.
#
#   Profile: https://github.com/Coopydood
#   Repo: https://github.com/Coopydood/ultimate-macOS-KVM
#
#   Adapted from OSX-KVM among others.
#   Greetz to TheNickDude, Dortania, khoalia, foxlet, and other contributors :]
#

ID="macOS"
NAME="macOS 12"
FILE="boot.sh"

ULTMOS=0.12.4
IGNORE_FILE=0
REQUIRES_SUDO=0
VFIO_PTA=0
VFIO_DEVICES=0
GEN_EPOCH=1728903170
FEATURE_LEVEL=7
VERBOSE=1
DISCORD_RPC=1
DISCORD_RPC_IMG="default"

SCREEN_RES="1280x720"

ALLOCATED_RAM="8G"
CPU_SOCKETS="1"
CPU_CORES="4"
CPU_THREADS="8"
CPU_MODEL="Haswell-noTSX"
CPU_FEATURE_ARGS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"

REPO_PATH="/home/alex/vm/ultimate-macOS-KVM"
OVMF_DIR="/home/alex/vm/ultimate-macOS-KVM/ovmf"

VFIO_ID_0="$USR_VFIO_ID_0"
VFIO_ID_1="$USR_VFIO_ID_1"
VFIO_ROM="$USR_VFIO_ROM"

USB_DEVICES="$USR_USB_DEVICES"

NETWORK_DEVICE="vmxnet3"
MAC_ADDRESS="00:16:cb:00:21:09"

OS_ID="Monterey"

HDD_PATH="$REPO_PATH/HDD.qcow2"
DISK_TYPE="SSD"

#   You should not have to touch anything below this line, especially if you
#   don't really know what you're doing. It'll probably break something.

args=(
-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off
-enable-kvm -m "$ALLOCATED_RAM" -cpu "$CPU_MODEL",kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$CPU_FEATURE_ARGS"
-machine q35
-boot menu=on,splash-time=5
#-device usb-ehci,id=ehci
#-device qemu-xhci,id=xhci
-usb -device usb-kbd -device usb-tablet 
#USB_DEV_BEGIN
#USB_DEV_END
-smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS"
-device pcie-root-port,bus=pcie.0,slot=1,x-speed=16,x-width=32
#VFIO_DEV_BEGIN
#VFIO_DEV_END
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
-drive if=pflash,format=raw,readonly=on,file="$OVMF_DIR/OVMF_CODE.fd"
-drive if=pflash,format=raw,file="$OVMF_DIR/OVMF_VARS.fd"
-smbios type=2
-device ich9-intel-hda -device hda-duplex
-device ich9-ahci,id=sata
-drive id=OpenCore,if=none,format=qcow2,file="$REPO_PATH/boot/OpenCore.qcow2"
-drive id=HDD,if=none,file="$HDD_PATH",format=qcow2
-device ide-hd,bus=sata.2,drive=OpenCore,bootindex=1
-device ide-hd,bus=sata.3,drive=HDD,rotation_rate=1

############## REMOVE THESE LINES AFTER MACOS INSTALLATION ###############
-drive id=BaseSystem,if=none,file="$REPO_PATH/BaseSystem.img",format=raw
-device ide-hd,bus=sata.4,drive=BaseSystem
##########################################################################

-netdev user,id=net0 -device "$NETWORK_DEVICE",netdev=net0,id=net0,mac="$MAC_ADDRESS"
-device qxl-vga,vgamem_mb=128,vram_size_mb=128    
-monitor stdio
#-display none
#-vga qxl

################ UNCOMMENT IF YOU WANT TO USE VNC MONITOR ################
#-vnc 0.0.0.0:1,password=on -k en-us
##########################################################################

)

while getopts d: flag
do
    case "${flag}" in
        d) DISCORD_RPC=${OPTARG};;
    esac
done

if [ $VERBOSE = 1 ]
then
echo
echo \ \ \──────────────────────────────────────────────
echo \ \ \ \ \ $FILE
echo \ \ \ \ \ $ID $OS_ID
echo
echo \ \ \ \ \ Built with ULTMOS v$ULTMOS
echo \ \ \ \ \ Using $CPU_MODEL CPU model
if [ $REQUIRES_SUDO = 1 ]
then
echo \ \ \ \ \ Superuser privileges enabled
fi
if [ $VFIO_PTA = 1 ]
then
echo \ \ \ \ \ Passthrough enabled
else
echo \ \ \ \ \ Passthrough disabled
fi
if [ $DISCORD_RPC = 1 ]
then
echo \ \ \ \ \ Discord RPC enabled
else
echo \ \ \ \ \ Discord RPC disabled
fi
echo \ \ \──────────────────────────────────────────────
echo
fi

if [ $DISCORD_RPC = 1 ]
then
"$REPO_PATH/scripts/drpc.py" --os "$OS_ID" --pt $VFIO_DEVICES --wd "$REPO_PATH" --show "$DISCORD_RPC_IMG" &
fi

qemu-system-x86_64 "${args[@]}"

if [ $DISCORD_RPC = 1 ]
then
pkill -f drpc.py
fi

Generated XML File (if applicable)

No response

Generated Log File

ULTMOS AUTOPILOT LOG 14-10-2024 20:50:39
───────────────────────────────────────────────────────────────────
[20:50:39.226][ INFO ]:  ULTMOS v0.12.4
[20:50:39.226][ INFO ]:   
[20:50:39.226][ INFO ]:  Name       : AutoPilot
[20:50:39.226][ INFO ]:  File       : autopilot.py
[20:50:39.226][ INFO ]:  Identifier : APC
[20:50:39.226][ INFO ]:  Vendor     : Coopydood
[20:50:39.226][ INFO ]:   
[20:50:39.226][ INFO ]:  Logging to ./logs/APC_RUN_14-10-2024_20-50-39.log
[20:50:39.227][ INFO ]:  Downloading notice list
[20:50:39.830][  OK  ]:  Notice list downloaded
[20:50:39.830][ INFO ]:  Checking notice list
[20:50:39.830][  OK  ]:  Notice list loaded
[20:50:39.830][ INFO ]:  Marking spark timestamp
[20:50:39.830][ INFO ]:  Displaying menu
[20:50:39.830][  OK  ]:  Menu displayed
[20:50:39.830][ WAIT ]:  Waiting on user input
[20:50:41.217][  OK  ]:  User input received
[20:50:41.217][  OK  ]:  ───────────────── STARTING INTERROGATION SEQUENCE ─────────────────
[20:50:41.217][ INFO ]:  FEATURE LEVEL 7
[20:50:41.217][  OK  ]:  Stage 1 sequence initiated
[20:50:41.217][  OK  ]:  Removing stale blobs
[20:50:42.847][  OK  ]:  Using default value of boot.sh
[20:50:42.847][ WARN ]:  Notice hook has been hit
[20:50:42.847][ WARN ]:  Arming notice selection trigger
[20:50:42.847][  OK  ]:  Stage 2 sequence initiated
[20:50:45.094][ WARN ]:  Notice hook has been hit
[20:50:45.094][ WARN ]:  Arming notice selection trigger
[20:50:45.094][  OK  ]:  Stage 2 sequence initiated
[20:50:45.094][ INFO ]:  Custom value requested, setting up
[20:50:46.652][  OK  ]:  Custom value was set to 12
[20:50:46.652][  OK  ]:  Stage 3 sequence initiated
[20:50:49.485][  OK  ]:  Stage 3 sequence initiated
[20:50:49.485][ INFO ]:  Custom value requested, setting up
[20:50:50.206][  OK  ]:  Custom value was set to 4
[20:50:50.206][  OK  ]:  Stage 4 sequence initiated
[20:50:51.014][  OK  ]:  Using default value of 2
[20:50:51.014][  OK  ]:  Stage 5 sequence initiated
[20:50:52.138][  OK  ]:  Using default value of Haswell-noTSX
[20:50:52.138][  OK  ]:  Stage 6 sequence initiated
[20:50:52.741][  OK  ]:  Using default value of +ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check
[20:50:52.741][  OK  ]:  Stage 7 sequence initiated
[20:50:53.697][  OK  ]:  Stage 7 sequence initiated
[20:50:53.697][ INFO ]:  Custom value requested, setting up
[20:50:53.697][ WAIT ]:  Waiting for user input
[20:50:54.736][  OK  ]:  User input received
[20:50:54.736][  OK  ]:  Custom value was set to 8G
[20:50:54.736][  OK  ]:  Stage 8 sequence initiated
[20:50:56.786][  OK  ]:  Stage 8 sequence initiated
[20:50:56.786][ INFO ]:  Custom value requested, setting up
[20:50:56.786][ WAIT ]:  Waiting for user input
[20:50:58.555][  OK  ]:  User input received
[20:50:58.555][  OK  ]:  Custom value was set to 60G
[20:50:58.555][ WARN ]:  Notice hook has been hit
[20:50:58.555][ WARN ]:  Arming notice selection trigger
[20:50:58.555][  OK  ]:  Stage 9 sequence initiated
[20:51:02.402][  OK  ]:  Will set disk up as an SSD
[20:51:02.402][  OK  ]:  Stage 10 sequence initiated
[20:51:04.505][  OK  ]:  Using default value of vmxnet3
[20:51:04.505][  OK  ]:  Stage 11 sequence initiated
[20:51:05.210][  OK  ]:  Using default value of 00:16:cb:00:21:09
[20:51:05.210][  OK  ]:  Stage 12 sequence initiated
[20:51:06.136][ INFO ]:  Arming download mechanism
[20:51:06.136][  OK  ]:  Downloader armed, will be triggered by AP flow
[20:51:06.136][  OK  ]:  Stage 13 sequence initiated
[20:51:06.902][  OK  ]:  Using default value of 1280x720
[20:51:06.902][  OK  ]:  Stage 14 sequence initiated
[20:51:08.155][  OK  ]:  XML generation will be skipped from AP flow
[20:51:08.155][  OK  ]:  Interrogation complete, displaying summary and AP autoflow sliproad
[20:51:08.910][ INFO ]:  Handoff started, user preferences saved
[20:51:08.910][  OK  ]:  ───────────────── STARTING AUTOPILOT AUTOFLOW ─────────────────
[20:51:08.910][ INFO ]:  Here we go!
[20:51:10.910][  OK  ]:  Updating status UI
[20:51:13.911][ INFO ]:  STARTING PREPARE PHASE
[20:51:13.911][  OK  ]:  Updating status UI
[20:51:13.911][ INFO ]:  Setting up environment
[20:51:13.919][  OK  ]:  Copied baseConfig into live working file
[20:51:14.920][ INFO ]:  Setting up OpenCore image
[20:51:14.920][ WARN ]:  Existing OpenCore image found
[20:51:14.920][ INFO ]:  Backing up existing image to ./boot/14-10-2024_20-51-14
[20:51:14.923][  OK  ]:  Existing image backed up to ./boot/14-10-2024_20-51-14
[20:51:16.924][ INFO ]:  Selecting appropriate OpenCore image
[20:51:16.924][  OK  ]:  Selected NEW OpenCore image
[20:51:16.924][ INFO ]:  Copying OpenCore image in place
[20:51:16.944][  OK  ]:  OpenCore image copied
[20:51:16.944][ INFO ]:  Copying OVMF code into place
[20:51:16.952][ INFO ]:  Copying OVMF vars for resolution 1280x720
[20:51:16.958][  OK  ]:  OVMF files copied
[20:51:16.958][ INFO ]:  Creating local OVMF variable store
[20:51:16.960][ INFO ]:  Performing integrity check
[20:51:17.460][  OK  ]:  Integrity check PASSED
[20:51:17.460][  OK  ]:  Updated stage status, handing off to next stage
[20:51:18.460][  OK  ]:  Updating status UI
[20:51:18.461][ INFO ]:  STARTING INTEGRITY PHASE
[20:51:18.461][  OK  ]:  Updating status UI
[20:51:22.461][  OK  ]:  Integrity check PASSED
[20:51:22.461][  OK  ]:  Updated stage status, handing off to next stage
[20:51:23.461][  OK  ]:  Updating status UI
[20:51:23.462][ INFO ]:  STARTING GENERATION PHASE
[20:51:23.462][ INFO ]:  Working directory was captured as /home/alex/vm/ultimate-macOS-KVM
[20:51:23.462][  OK  ]:  Updating status UI
[20:51:23.462][ INFO ]:  Scanning for file conflict
[20:51:26.462][ INFO ]:  Beginning variable injection
[20:51:26.462][ INFO ]:  Checking disk type
[20:51:26.462][  OK  ]:  Disk type is HDD, leaving rotation rate as default
[20:51:26.462][  OK  ]:  Rotation rate updated
[20:51:26.462][  OK  ]:  Variable injection complete
[20:51:26.462][ INFO ]:  Stamping with ULTMOS version
[20:51:26.462][  OK  ]:  Marked working script as using ULTMOS v0.12.4
[20:51:26.462][ INFO ]:  Stamping with feature level
[20:51:26.462][  OK  ]:  Marked working script as feature level 7
[20:51:26.462][ INFO ]:  Checking if Discord rich presence is available
[20:51:26.462][  OK  ]:  Discord rich presence is available, will enable in script
[20:51:26.463][  OK  ]:  Updating status UI
[20:51:26.463][ INFO ]:  Adding OS ID marker
[20:51:26.463][ INFO ]:  Setting up BaseSystem image attachment
[20:51:26.463][ INFO ]:  Writing changes
[20:51:26.463][  OK  ]:  Changes written to file
[20:51:26.463][ INFO ]:  Performing integrity check
[20:51:26.463][  OK  ]:  Integrity check PASSED
[20:51:26.963][  OK  ]:  Updated stage status, handing off to next stage
[20:51:27.163][  OK  ]:  Updating status UI
[20:51:28.164][  OK  ]:  User requested a new macOS recovery image, arming downloader
[20:51:28.164][ INFO ]:  STARTING REMOTE RECOVERY PHASE
[20:51:28.164][  OK  ]:  Updating status UI
[20:51:30.164][ INFO ]:  Setting target OS to 12
[20:51:30.164][  OK  ]:  OS ID is valid, sending to dlosx script
[20:52:38.468][ INFO ]:  Checking BaseSystem with a size of 3220185088
[20:52:38.468][  OK  ]:  Integrity check PASSED
[20:52:38.468][  OK  ]:  Updated stage status, handing off to next stage
[20:52:38.468][  OK  ]:  Updating status UI
[20:52:41.469][  OK  ]:  User requested a new HDD file, generation will go ahead
[20:52:41.469][ INFO ]:  STARTING HARDDISK PHASE
[20:52:41.469][  OK  ]:  Updating status UI
[20:52:43.469][ INFO ]:  Scanning for file conflict
[20:52:43.469][ INFO ]:  Generating hard disk image file
[20:52:46.503][  OK  ]:  Hard disk image file generation verified
[20:52:46.503][  OK  ]:  Updated stage status, handing off to next stage
[20:52:46.904][  OK  ]:  Updating status UI
[20:52:48.904][ INFO ]:  STARTING APPLY PHASE
[20:52:48.904][  OK  ]:  Updating status UI
[20:52:50.904][  OK  ]:  Integrity check PASSED
[20:52:50.905][ INFO ]:  Dumping contents of baseConfig to memory
[20:52:50.905][ INFO ]:  Stripping warning headers
[20:52:50.905][ INFO ]:  Generating epoch timestamp
[20:52:50.905][  OK  ]:  Epoch timestamped as 1728903170
[20:52:50.905][ INFO ]:  Writing to file
[20:52:50.905][  OK  ]:  Header verification complete
[20:52:50.905][ INFO ]:  Moving working file into place
[20:52:50.907][  OK  ]:  Moved working file into boot.sh successfully
[20:52:51.507][  OK  ]:  Updated stage status, handing off to next stage
[20:52:51.507][  OK  ]:  Updating status UI
[20:52:53.508][ INFO ]:  STARTING PERMISSIONS PHASE
[20:52:53.508][  OK  ]:  Updating status UI
[20:52:55.508][ INFO ]:  Setting execute permissions
[20:52:55.510][ INFO ]:  Setting readwrite permissions
[20:52:55.512][  OK  ]:  Permissons set for new user files
[20:52:55.512][  OK  ]:  Updated stage status, handing off to next stage
[20:52:55.813][  OK  ]:  Updating status UI
[20:52:57.813][  OK  ]:  Updating status UI
[20:52:57.813][ INFO ]:  STARTING CLEANUP PHASE
[20:52:58.813][ INFO ]:  Copying current session blobs into user backdir
[20:52:58.816][ INFO ]:  Marking blobs as stale
[20:52:58.816][ INFO ]:  Moving blobs into stale folder
[20:52:58.818][  OK  ]:  Blob cleanup complete
[20:52:58.819][  OK  ]:  Updated stage status, handing off to next stage
[20:52:59.019][  OK  ]:  Updating status UI
[20:53:00.019][ INFO ]:  Stopping timer
[20:53:02.019][ INFO ]:  Updating variable definition
[20:53:02.019][  OK  ]:  Timer was stopped with a recorded time of 111 seconds in live mode
[20:53:02.020][  OK  ]:  AutoPilot stages complete, displaying user summary screen
[20:53:02.020][  OK  ]:  ───────────────── AUTOPILOT COMPLETE! SESSION TIME WAS 111 SEC ─────────────────
[20:53:02.020][ INFO ]:  XML generation was not included in AP flow, offering direct boot
[20:53:02.020][ WAIT ]:  Waiting for user input
[20:53:15.010][  OK  ]:  User input received
[20:53:15.010][ INFO ]:  Handing off to QEMU; booting boot.sh
[20:53:15.010][ FATAL ]: bye
[20:53:15.010][ FATAL ]: ───────────────── END OF LOGFILE ─────────────────

Additional Information

I've tried sequoia and the version before that too which all have the same issue.

Here is a possibly relevant part from the installer log in macos

image

Coopydood commented 4 weeks ago

This is because you haven't formatted the disk in Disk Utility.

On the main macOS Recovery screen, click Disk Utility, find the 80GB QEMU disk, and click Erase. Name it whatever you want, and keep it as APFS.

Regards

metronidazole commented 4 weeks ago

Thanks that was it. The need for partitioning wasn't mentioned in the readme.

eversiege commented 4 weeks ago

Thanks that was it. The need for partitioning wasn't mentioned in the readme.

TODO: finish documentation website