DrDonk / esxi-unlocker

VMware macOS utilities
MIT License
246 stars 66 forks source link

Opencore for ESXi 7 legacy CPUs - macOS Ventura 13.1 working solution #16

Closed macchrome closed 1 year ago

macchrome commented 1 year ago

ESImage profile: ESXi-7.0U3f-20036589-standard (VMware, Inc.)

Manufacturer HP Model ProLiant DL380 G7 CPU Logical processors 24 Processor type Intel(R) Xeon(R) CPU X5670 @ 2.93GHz (Westmere no AVX nevermind AVX2!) Sockets 2 Cores per socket 6 Hyperthreading Yes, enabled Memory 103.99 GB

NB: USB controller 1 must be of type USB3.1 (USB 1.1 is deprecated under macOS Ventura)

Procedure is quite simple:

https://github.com/macchrome/compilers/releases/download/Opencore-esxi-legacy-cpu-0.01/Opencore-esxi-legacy-cpu-rev2.7z

DrDonk commented 1 year ago

Very interesting. I do not have anything I can test on but this should be useful on ESXi and Workstation.

Shall I add to my wiki pages and point to your repo? I personally do not have time to look after this, but happy to point people in your direction.

macchrome commented 1 year ago

I have no objections of your adding this to your wiki: someone might find this information useful.

DrDonk commented 1 year ago

Whilst I can't test as I don't have an older CPU, I will re-create the setup and see if I can streamline it and write something to create a OCLP installer. I won't be supporting this moving forward, as I'm now retired and reducing time spent on computers, but may help others get this working.

macchrome commented 1 year ago

Generic OpenCore macOS installer - ESXi 7 & VMW 17

  1. Create macOS VM - Hard disk at least 40Gb (USB Controller 3.1 required for Ventura VM)

  2. Add second hard disk: OC.ESXi.vmdk (ESXi 7 requires this to be an IDE Controller - ESP created under Windows! OR vmkfstools -i OC.ESXi.vmdk -d zeroedthick OC-2.ESXi.vmdk for SATA compatibility)

  3. Add virtual macOS Monterey/Ventura installer iso

  4. If installing Ventura add the following to .vmx, make sure there are no duplicate entries.

smc.present = "TRUE" smc.version = "0" board-id.reflectHost = "FALSE" board-id = "Mac-BE088AF8C5EB4FA2" hw.model.reflectHost = "FALSE" hw.model = "iMac18,3"

  1. Boot into VM EFI bios, boot from file: OC.ESXi.vmdk\OC.ESXi-f001.vmdk\EFI\OC\OpenCore.efi (locate it!)

  2. Boot installer iso from OpenCore GUI

  3. Install macOS

OC.ESXi.vmdk.7z https://github.com/macchrome/compilers/releases/download/Opencore-esxi-legacy-cpu-0.01/OC.ESXi.vmdk.7z SHA1 91B7E7F36CF784211A19E3C01B42097F74E82EF7

DrDonk commented 1 year ago

I have been busy looking at this and have a simplified VMDK with OpenCore that contains only the required OpenCore files to boot and fixup the Cryptexs. No need for OCLP now or spoofing a real Mac.

I have attached Workstation versions of a debug and release version of the OC VMDK. Would you be able to test for me by uploading to your ESXi system and seeing if they boot your macOS guests? They will need converting with vmkfstools.

I suggest you just use the release version and use debug one only of there is an issue. The debug version uses virtual serial port so the VMX file would require these lines adding:

answer.msg.serial.file.open = "Replace"
serial0.fileName = "serial.log"
serial0.fileType = "file"
serial0.present = "TRUE"
serial0.tryNoRxLoss = "FALSE"
serial0.yieldOnMsrRead = "TRUE"

I also have other OC images including ones that do not require the ESXi system to be unlocked which may be of interest.

oc-dbg-vmware-avx2.vmdk.zip oc-rel-vmware-avx2.vmdk.zip

macchrome commented 1 year ago

I've only tried the release version: oc-rel-vmware-avx2.vmdk.zip

An attempt to boot macOS Ventura, using ESXi 7 om my legacy pre-AVX rig, was not successful.

OCLP was initially used to get a basic working configuration; subsequently it is not used. If performing a fresh macOS Ventura install it is not necessary to spoof a real Mac (smc.present = "TRUE" is sufficient): I once forgot to spoof and the install was successful. AirportBrcmFixup.kext in a virtual environment is probably redundant. USB-Map.kext is essential: otherwise no USB mouse or keyboard input. VirtualSMC.kext has no place in a "virtual" environment. The kernel patches are essential.

The initial OCLP configuraion obtained under macOS Big Sur is robust, all that was required for macOS Ventura was the addition of NoAVXFSCompressionTypeZlib-AVXpel.kext and CryptexFixup.kext: the only possible redundancy, as stated before, is AirportBrcmFixup.kext.

Refinement of the config.plist is perhaps possible.

ulm.disableMitigations="TRUE" in the .vmx results in a performance increase.

DrDonk commented 1 year ago

Thanks for that. I understood you used OCLP to get a working setup. I was removing those parts that were not needed such as ACPI and kernel patches. Trying to keep to as minimal a setup as possible.

I’ve been quietly working for a couple of months and have a set of OC images just in case unlocker becomes unviable and added the AVX2 fixes, the 2 KEXTS and CSR stuff from OCLP version you have built.

Debugging showed the KEXTS working and booted but I don’t have any non-AVX2 kit.

Did the OC boot picker actually display when you tested it? When changing OC VMDK you may have to remove the existing OpenCore boot option from the VMware EFI settings.

DrDonk commented 1 year ago

The OC VMDK may need the legacy HFS driver for your CPU as it is pre Sandy Bridge. oc-rel-vmware-avx2.vmdk.zip

macchrome commented 1 year ago

The OC boot picker does not display.

OC.ESXi.vmdk-rev2.7z - incorporates HfsPlusLegacy https://github.com/macchrome/compilers/releases/download/Opencore-esxi-legacy-cpu-0.01/OC.ESXi.vmdk-rev2.7z SHA1 FF69159C4191F210C203C543FD0B59AA68F1EE81

DrDonk commented 1 year ago

Sorry for late reply. That is probably because the opencore VMDK has changed and has a different disk UUID. The NVRAM contents need clearing out.

mikeyo commented 1 year ago

Are those of us with AMD CPU still out of luck even with OC vmdk from this thread? Just tried on my esxi 8 host and ventura boot stalls a few seconds in.

DrDonk commented 1 year ago

I have something coming soon but currently on holiday and will be towards end of month before I can do anything about releasing it.

mikeyo commented 1 year ago

I have something coming soon but currently on holiday and will be towards end of month before I can do anything about releasing it.

Excellent, let me know if you need me to 'test' anything in the mean time.

DrDonk commented 1 year ago

@mikeyo Can you try using this OpenCore based boot disk to boot Ventura? It is AMD specific image. Add it to your VM and make sure it is first in boot order.

You will need to convert it in ESXi via SSH to format for ESXi VMs as it is from Workstation.

vmkfstools -i opencore.vmdk -d thin new-filename.vmdk

opencore.vmdk.zip

mikeyo commented 1 year ago

@mikeyo Can you try using this OpenCore based boot disk to boot Ventura? It is AMD specific image. Add it to your VM and make sure it is first in boot order.

You will need to convert it in ESXi via SSH to format for ESXi VMs as it is from Workstation.

vmkfstools -i opencore.vmdk -d thin new-filename.vmdk

opencore.vmdk.zip

I did the conversion - but get

Reconfigure failed: (vim.fault.InvalidDatastore) { faultCause = (vmodl.MethodFault) null, faultMessage = , datastore = , name = "[] amd.vmdk" msg = "Invalid datastore format '[] amd.vmdk'."

I used the following to attach the disk to the VM vim-cmd vmsvc/device.diskaddexisting 13 amd.vmdk 0 1

DrDonk commented 1 year ago

Did you use full path to datastore for src and dest vmdks?

Here's a different VMDK type which shouldn't need converting.

Archive.zip

It worked in VMware Workstation on my son's Ryzen 3200U laptop.

mikeyo commented 1 year ago

Did you use full path to datastore for src and dest vmdks?

Here's a different VMDK type which shouldn't need converting.

Archive.zip

It worked in VMware Workstation on my son's Ryzen 3200U laptop.

Still the same error.

This is what I did -

1 uploaded opencore.vmdk to my datastore 2 vmkfstools -i /vmfs/volumes/DS01/MO/AMD_OSX/opencore.vmdk -d thin /vmfs/volumes/DS01/MO/AMD_OSX/amd.vmd k 3 vim-cmd vmsvc/device.diskaddexisting 13 amd.vmdk 0 1

then i get the error -

Reconfigure failed: (vim.fault.InvalidDatastore) { faultCause = (vmodl.MethodFault) null, faultMessage = , datastore = , name = "[] amd.vmdk" msg = "Invalid datastore format '[] amd.vmdk'."

DrDonk commented 1 year ago

You don't need to convert the archive.zip as it's in a format ESXi can use. Just extract to datastore and should be 2 files:

  1. opencore.vmdk
  2. opencore.dmg

Just add opencore.vmdk to the VM. Can you try via ESXi web ui?

mikeyo commented 1 year ago

I tried without converting also, same error. The vmdk's linked earlier in the thread converted and added OK so I am not sure why this one is not working. I cannot use the web UI as I am on ESXi 8.0 and it has a bug that prevents me from adding the disk. The only way is to use CLI which as I said worked OK for the other vmdks in this thread.

DrDonk commented 1 year ago

OK I don't have any AMD kit but I will try with my Intel version. BTW this is a new project of mine which hasn't been revealed called OpenCore 4 VMware (OC4VM).

DrDonk commented 1 year ago

Well the file works but you can't use vim-cmd to add it. I had to manually edit the VMX file to add it in. Now I think there are a whole host of other issues with ESXi 8 due to macOS now being unsupported such as not being able to edit settings and also creating a new macOS VM fails.

I have an idea on how to fix it so I will have a look at some config files used by the APIs used to manage ESXi.

Do you want to attach the VMX file for your VM and I'll hand edit it to add the VMDK? I have also reconverted the VMDK which will send back as well.

mikeyo commented 1 year ago

new 19.txt There you go.

thanks

DrDonk commented 1 year ago

I've sorted the lines in the vmx file so I could see what I was doing. Also note that I have commented out cpuid and smc lines in the vmx file as they are not needed for this boot disk. Indeed the plan is to not need unlocker at all which has been acheived.

So txt file is new VMX and also another attempt at the correct VMDK type in opencore.vmdk.

opencore.zip MOVMACOS02.vmx.txt

However I'm not sure about moving forward with this on ESXi as it is getting pretty complicated as I am going to have to write something to alter other files on the host for proper support.

All this was designed just for Workstation.

mikeyo commented 1 year ago

I've sorted the lines in the vmx file so I could see what I was doing. Also note that I have commented out cpuid and smc lines in the vmx file as they are not needed for this boot disk. Indeed the plan is to not need unlocker at all which has been acheived.

So txt file is new VMX and also another attempt at the correct VMDK type in opencore.vmdk.

opencore.zip MOVMACOS02.vmx.txt

However I'm not sure about moving forward with this on ESXi as it is getting pretty complicated as I am going to have to write something to alter other files on the host for proper support.

All this was designed just for Workstation.

Replaced the vmx but vim-cmd still fails. Why am I able to attach other vmdks in this thread but not this one?

DrDonk commented 1 year ago

You don't need to use vim-cmd I added the opencore.vmdk directly into the VMX file. Just copy the opencore.vmdk files to the vm folder in the datastore

DrDonk commented 1 year ago

vim-cmd is as broken as editing settings in Web UI and also using something like Fusion to connect to the ESXi host. Basically VMware have marked everything as unsupported and it's causing these issues.

Frankly I think ESXi 8 is a lost cause and should keep ESXi 7 for any macOS stuff.

mikeyo commented 1 year ago

vim-cmd is as broken as editing settings in Web UI and also using something like Fusion to connect to the ESXi host. Basically VMware have marked everything as unsupported and it's causing these issues.

Frankly I think ESXi 8 is a lost cause and should keep ESXi 7 for any macOS stuff.

The opencore disk you added to the vmx is not showing in the web ui. image

mikeyo commented 1 year ago

i checked the vmx and it's defo in there

DrDonk commented 1 year ago

Well I'm stumped. The web ui is properly broken for macOS and ESXi 8. I know the VMDK is working at least on Workstation with Ryzen 3. I will have to think about next steps, but seriously considering this a lost cause as I am stepping back from this work.

mikeyo commented 1 year ago

Well I'm stumped. The web ui is properly broken for macOS and ESXi 8. I know the VMDK is working at least on Workstation with Ryzen 3. I will have to think about next steps, but seriously considering this a lost cause as I am stepping back from this work.

Shame, you're so knowledgable in all of this, not sure who can take over from you :-(

Anyways, I got the oc boot picker to display in uefi settings but when launched the remote console stays blank. Previous to all of this work on Ventura I do have a Monterey working in ESXi 8, no issues.

mikeyo commented 1 year ago

Well I'm stumped. The web ui is properly broken for macOS and ESXi 8. I know the VMDK is working at least on Workstation with Ryzen 3. I will have to think about next steps, but seriously considering this a lost cause as I am stepping back from this work.

Do you think it's worth the effort to create a nested esxi 7u2 vm to see if it works?

DrDonk commented 1 year ago

I think I have fixed the web ui. Upload this file to your datastore and then run:

BootModuleConfig.sh --add=darwin.tgz --verbose

then reboot the ESXi host. Now go into web ui and you can edit settings for macOS VMs.

darwin.tgz

If this works I'll make it part of the next ESXi unlocker release.

I am still trying to fathom out the vmdk issue, as I can now re-create it.

DrDonk commented 1 year ago

Well I'm stumped. The web ui is properly broken for macOS and ESXi 8. I know the VMDK is working at least on Workstation with Ryzen 3. I will have to think about next steps, but seriously considering this a lost cause as I am stepping back from this work.

Do you think it's worth the effort to create a nested esxi 7u2 vm to see if it works?

Hang tight for now. I'm looking at the vmdk descriptor file and trying to see if I screwed something up there.

DrDonk commented 1 year ago

Right forget all the previous stuff. Have you upgraded to ESXi 8.0b? It fixes all the problems we are seeing.

mikeyo commented 1 year ago

Right forget all the previous stuff. Have you upgraded to ESXi 8.0b? It fixes all the problems we are seeing.

not yet, funnily enough was going to do that today but other stuff got in the way. Will do it now.

mikeyo commented 1 year ago

OK, the update fixed the issues we were seeing before, however, I still get the black console screen when booting opencore. I read somewhere it maybe because the res/display isnt supported with esxi svga adaptor and basic vga needs to be enabled in opencore plist, well, at least something along those lines....

I think this is it

https://www.reddit.com/r/hackintosh/comments/oqba59/black_screen_when_booting_with_opencore/

DrDonk commented 1 year ago

No that is likely not the problem. You need to reset the boot order. Try deleting the nvram file then boot to the EFI setup screen and select the drive which is mapped to the OpenCore.

mikeyo commented 1 year ago

No that is likely not the problem. You need to reset the boot order. Try deleting the nvram file then boot to the EFI setup screen and select the drive which is mapped to the OpenCore.

OK, deleted nvram add bootx64.efi or whatever its called to boot menu, still get a blank screen. What version of O/C you using?

DrDonk commented 1 year ago

Try again but just select the drive from the main screen. No need to specify EFI file directly. I’ll have to pick this up again tomorrow.

mikeyo commented 1 year ago

Try again but just select the drive from the main screen. No need to specify EFI file directly. I’ll have to pick this up again tomorrow.

Nope, still blank screen. I tried replacing the latest OC over the top of yours, repaired the plist but that also shows a blank sreen.

DrDonk commented 1 year ago

I have uploaded a VM for ESXi 8 with OpenCore and the Ventura Recovery image ~ 700MB

Can you download and add to your ESXi server please? It seemed like a good test as it works for me.

Let me know once you have downloaded it so I can remove it from Google Drive.

DrDonk commented 1 year ago

BTW it's a debug version of OC so there will be lots of screen output and you will need to select image at boot time as no defaults set.

image

There is also a serial port present which will write all the logging info from OC and macOS. It will be in the VM folder and called serial.log. I can use it if there are any issues.

mikeyo commented 1 year ago

BTW it's a debug version of OC so there will be lots of screen output and you will need to select image at boot time as no defaults set.

image

There is also a serial port present which will write all the logging info from OC and macOS. It will be in the VM folder and called serial.log. I can use it if there are any issues.

ok, i am doing this now. BTW, i forgot to run unlocker after updating to esxi 8.0b, do i still need to do this?

DrDonk commented 1 year ago

Not with this VM. OC deals with SMC etc. Of course it may be you have other VMs that need it.

mikeyo commented 1 year ago

I have uploaded a VM for ESXi 8 with OpenCore and the Ventura Recovery image ~ 700MB

Can you download and add to your ESXi server please? It seemed like a good test as it works for me.

Let me know once you have downloaded it so I can remove it from Google Drive. downloaded , please remove.

mikeyo commented 1 year ago

Not with this VM. OC deals with SMC etc. Of course it may be you have other VMs that need it.

Tried booting it.

image

DrDonk commented 1 year ago

I don't get it. Not sure what to do next.

DrDonk commented 1 year ago

Damn something screwed up the plist formatting. Hang on I'll create a replacement once I find the culprit.

mikeyo commented 1 year ago

I noticed that macOS 14 is now an option when creating a VM since the update to 8.0b. However my system isnt patched - how is the macOS option visible if ESXi isnt patched?

VMware ESXi Unlocker 4.0.5

Checking unlocker... Current version of ESXi: VMware ESXi 8.0.0 build-21203435 System has not been patched

DrDonk commented 1 year ago

ESXi has always shown the macOS options without the unlocker. Only VMware know why!

Can you replace the opencore files in the Vm I gave you with these please? My fault I'm using Jinja2 and templates to create plists and I had a typo.

Archive.zip