Skip to content

Commit 122b1b8

Browse files
committed
OK
0 parents  commit 122b1b8

14 files changed

Lines changed: 1062 additions & 0 deletions

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Recommedations from GitHub help pages
2+
# Set the default behavior, in case people don't have core.autocrlf set.
3+
* text=auto
4+
5+
# Declare files that will always have CRLF line endings on checkout.
6+
*.cmd text eol=crlf
7+
8+
# Declare files that will always have LF line endings on checkout.
9+
*.sh text eol=lf
10+
*.py text eol=lf
11+
12+
# Declare files that are binary on checkout.
13+
*.exe binary

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
backup/
2+
tools/
3+
.idea/
4+
samples/
5+
tests/
6+
build/
7+
dist/
8+
*.spec
9+
*.pyc
10+
*.tar
11+
*.tgz
12+
*.vmtar
13+
*.vgz
14+
*.v00

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Changes
2+
3+
All dates are UK DD/MM/YY format.
4+
5+
## 09/01/23 4.0.5
6+
7+
_drdonk:_
8+
9+
* Fixed permissions error correctly this time!
10+
11+
## 03/01/23 4.0.4
12+
13+
_drdonk:_
14+
15+
* `check` command correctly reports if system not patched
16+
* `unlock` command checks for free disk space before patching
17+
* `unlock` command checks for previous V3 installation before patching
18+
* Fixed error if libvmkctl.so already patched
19+
* Removed an unused unlocker flag (KPPW/KPST) to match Go version
20+
* Update all copyright dates to 2023
21+
* Make sure the files to be patched have write permissions before patching as NFS datastores correctly enforce
22+
R/W permissions but VMFS3 does not and can patch with read only flag set.
23+
24+
## 22/10/22 4.0.3
25+
26+
_drdonk:_
27+
28+
* Reinstate libvmkctl patch to allow vCenter to boot macOS VMs on ESXi host
29+
* Reinstate boot time load so the libvmkctl patch is loaded when hostd starts
30+
* Store ESXi version with patched files
31+
* `check` command compares current and stored ESXi versions
32+
33+
## 22/09/22 4.0.2
34+
35+
Thanks to _lucaskamp_ and an _anonymous_ tester for testing.
36+
37+
_drdonk:_
38+
39+
* Revert to binary file read/writes in patchsmc instead of using mmap, which caused silent errors during the patching
40+
process leading to failed patches.
41+
* Modified VMTAR format from PSIGNED-XZ to GZIP
42+
* Commands are now required to be run each boot of ESXi to avoid possible "Purple Screens of Death" (PSOD).
43+
* Ensure vmx files have correct permissions, 4555/-r-sr-xr-x, in apple.v00 archive
44+
45+
## 26/01/22 4.0.1
46+
47+
_drdonk:_
48+
49+
* Fix missing +x bit on checksmc, dumpsmc and relock
50+
51+
## 03/08/22 4.0.0
52+
53+
* Initial release

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2011-2023 David Parsons
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# macOS Unlocker V4 for VMware ESXi
2+
3+
Original repositories: [DrDonk](https://github.com/DrDonk)/**[esxi-unlocker](https://github.com/DrDonk/esxi-unlocker)**
4+
5+
(c) 2011-2022 David Parsons
6+
7+
## Download ESXi 8.0 (integrated Unlocker & OEM BIOS)
8+
9+
Powered by [sysin.org](https://sysin.org/)
10+
11+
- [VMware ESXi 8.0 Unlocker standard & Custom Image](https://sysin.org/blog/vmware-esxi-8-oem/)
12+
- [VMware ESXi 8.0 Unlocker with driver](https://sysin.org/blog/vmware-esxi-8-sysin/)
13+
14+
## Download ESXi 7.0 (integrated Unlocker & OEM BIOS)
15+
16+
- [VMware ESXi 7.0 U3 & Unlocker standard & Custom Image](https://sysin.org/blog/vmware-esxi-7-u3-oem/)
17+
- [VMware ESXi 7.0 U3 & Unlocker with driver](https://sysin.org/blog/vmware-esxi-7-u3-nuc-usb-nvme/)
18+
- [VMware ESXi 7.0 U2 & Unlocker standard & Custom Image](https://sysin.org/blog/vmware-esxi-7-u2-oem/)
19+
- [VMware ESXi 7.0 U2 & Unlocker with driver](https://sysin.org/blog/vmware-esxi-7-u2-nuc-usb-nvme/)
20+
- [VMware ESXi 7.0 U1 Unlocker standard & Custom Image](https://sysin.org/blog/vmware-esxi-7-u1-oem/)
21+
- [VMware ESXi 7.0 Unlocker standard & Custom Image](https://sysin.org/blog/vmware-esxi-7-ome/)
22+
23+
---
24+
25+
**IMPORTANT PLEASE READ!**
26+
27+
## macOS Ventura Guests
28+
29+
There are a known issues that Ventura guests boot loop in VMware Workstation. The situation after extensive testing is:
30+
31+
1. Intel pre-Haswell CPUs dropped by Apple in Ventura - no way to patch need to look at OCLP
32+
2. AMD CPUs n o longer work in Ventura possibly due to how CPUID leaf 4 is read - no way to patch need to look at OpenCore and other solutions
33+
3. Intel Haswell+ CPUS, which are supported, make sure you set
34+
35+
`ethernet0.virtualDev = "e1000e`
36+
37+
to
38+
39+
`ethernet0.virtualDev = "vmxnet3"`
40+
41+
<https://github.com/DrDonk/unlocker/issues/47>
42+
43+
Please do not upgrade to Ventura at this time if you have AMD or Intel pre-Haswell CPUs.
44+
45+
VMware will stop supporting new macOS versions as guests starting with Fusion 13 and the next version of ESXi.
46+
47+
This is documented at the VMware KB for Fusion:
48+
<https://kb.vmware.com/s/article/88697>
49+
50+
And for ESXi:
51+
<https://kb.vmware.com/s/article/88698>
52+
53+
This will likely impact Workstation Pro/Player as well. Currently the exact details of what may change are not clear, but
54+
it is safe to say we should look for alternative approaches to the unlocker.
55+
56+
## Upgrading ESXi 8
57+
58+
There is an issue with ESXi 8 which stops macOS from booting and is probably related to the news that VMware nolonger support macOS as host and guest
59+
for ESXi8. The workaround is to keep existing VMs as 7U2 variants and create new ones as ESXi 7 U2 VMs. This can be done in the dialogs when creating a new VM.
60+
61+
---
62+
63+
## 1. Introduction
64+
65+
Unlocker 4 is designed for VMware ESXi 7.
66+
67+
The Unlocker enables certain flags and data tables that are required to see the macOS type when setting
68+
the guest OS type, and modify the implmentation of the virtual SMC controller device. These capabiltiites are normally
69+
exposed in Fusion and ESXi when running on Apple hardware.
70+
71+
The patch code carries out the following modifications dependent on the product being patched:
72+
73+
- Patch vmx and derivatives to allow macOS to boot
74+
- Patch libvmkctl.so to allow vCenter to boot macOS guests
75+
76+
It is important to understand that the Unlocker cannot add any new capabilities to VMware ESXi
77+
but enables support for macOS that is disabled in the VMware products when run on non-Apple hardware.
78+
79+
The Unlocker cannot:
80+
81+
- add support for new versions of macOS
82+
- add paravirtualized Apple GPU support
83+
- add older (non-Ryzen) AMD CPU support
84+
85+
or any other features that are not already in the VMware compiled code.
86+
87+
## 2. Running the patcher
88+
89+
**The ESXi unlocker will need to be run each time the ESXi Server is upgraded**.
90+
91+
**It is also best to switch ESXi to Maintanence mode and make sure you do not have any VMs running**.
92+
93+
The code is written in Python and has no pre-requisites and should run directly from the release zip download.
94+
95+
- Download a binary release from <https://github.com/DrDonk/esxi-unlocker/releases>
96+
- Unload the archive to a folder on the ESXi server datastore and extract the files
97+
- Navigate to the folder with the extracted files
98+
99+
You will then need to run one of the following commands to patch or unpatch the ESXi software.
100+
101+
- unlock - apply patches to VMware ESXi
102+
- relock - remove patches from VMware ESXi
103+
- check - check the patch status of your VMware installation
104+
105+
## 3. FAQS
106+
107+
### 3.1 Remove older versions of ESXi unlocker
108+
109+
If you hve previously used an earlier version of the ESXi Unlocker please uninstall it by logging into the
110+
support console and running:
111+
112+
```BootModuleConfig.sh --verbose --remove=unlocker.tgz```
113+
114+
and then rebooting the ESXi server.
115+
116+
### 3.2 AMD CPUs
117+
118+
A patched macOS AMD kernel must be used to run on older AMD systems, but there is a workaround if you have a modern
119+
AMD Ryzen CPU. The unlocker cannot patch this but we can recommend settings for the VMX file that allows macOS to
120+
run on recent AMD CPUs. The tests are being recorded in this issue, and it would be useful if more can report
121+
success or failures in that issue.
122+
123+
<https://github.com/DrDonk/unlocker/issues/33>
124+
125+
1. Read this KB article to learn how to edit a guest's VMX file safely <https://kb.vmware.com/s/article/2057902>
126+
127+
2. Add the following lines were to the VMX file:
128+
129+
```txt
130+
cpuid.0.eax = "0000:0000:0000:0000:0000:0000:0000:1011"
131+
cpuid.0.ebx = "0111:0101:0110:1110:0110:0101:0100:0111"
132+
cpuid.0.ecx = "0110:1100:0110:0101:0111:0100:0110:1110"
133+
cpuid.0.edx = "0100:1001:0110:0101:0110:1110:0110:1001"
134+
cpuid.1.eax = "0000:0000:0000:0001:0000:0110:0111:0001"
135+
cpuid.1.ebx = "0000:0010:0000:0001:0000:1000:0000:0000"
136+
cpuid.1.ecx = "1000:0010:1001:1000:0010:0010:0000:0011"
137+
cpuid.1.edx = "0000:0111:1000:1011:1111:1011:1111:1111"
138+
vhv.enable = "FALSE"
139+
vpmc.enable = "FALSE"
140+
```
141+
142+
3. Make sure there are no duplicate lines in the VMX file or the guest will not start and a dictionary error will be displayed by VMware.
143+
144+
4. You can now install and run macOS as a guest.
145+
146+
## 4. Thanks
147+
148+
Thanks to Zenith432 for originally building the C++ Unlocker and Mac Son of Knife
149+
(MSoK) for all the testing and support.
150+
151+
Thanks also to Sam B for finding the solution for ESXi 6 and helping me with
152+
debugging expertise. Sam also wrote the code for patching ESXi ELF files and
153+
modified the Unlocker code to run on Python 3 in the ESXi 6.5 environment.
154+
155+
Thanks to lucaskamp for testing the new version 4 of ESXi Unlocker.
156+
157+
(c) 2011-2023 David Parsons

TROUBLESHOOTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Troubleshooting Notes
2+
3+
## Patch checker
4+
It is important to re-patch ESXi after any upgrade or patches have been deployed. The status of the unlocker patches
5+
can be checked using the `check` command in the unlocker folder.
6+
7+
If the patch is installed and matches the current ESXi version, the output would look like this but the version numbers
8+
may differ on your host depending on any patches installed.
9+
```
10+
VMware ESXi Unlocker 4.0.3
11+
==========================
12+
(c) 2011-2022 David Parsons
13+
14+
Checking unlocker...
15+
Current version of ESXi: VMware ESXi 7.0.3 build-20328353
16+
Patch built for ESXi: VMware ESXi 7.0.3 build-20328353
17+
Checking VMTAR loaded...
18+
apple.v00 loaded
19+
Checking vmx vSMC status...
20+
/bin/vmx
21+
/bin/vmx-debug
22+
/bin/vmx-stats
23+
vmx patched
24+
Checking smcPresent status...
25+
smcPresent = true
26+
```
27+
If the patch is installed and does _*NOT*_ match the current ESXi version, the output would look like this and an error
28+
is displayed. You must relock, reboot and unlock the host to ensure patches are applied to the correct version.
29+
30+
```
31+
VMware ESXi Unlocker 4.0.3
32+
==========================
33+
(c) 2011-2022 David Parsons
34+
35+
Checking unlocker...
36+
Current version of ESXi: VMware ESXi 7.0.3 build-20328353
37+
Patch built for ESXi: VMware ESXi 7.0.3 build-20036589
38+
>>> ERROR: Mis-matched files please relock/unlock to update patches <<<
39+
```
40+
41+
## VMware vCenter
42+
The unlocker from 4.0.3 should allow macOS guests to be started from vCenter on the patched host. If you get an error
43+
in vCenter you may need to do the following:
44+
1. Disconnect and reconnect the ESXi host in vCenter
45+
2. Remove and re-add the ESXi host in vCenter
46+
47+
## Set a specific macOS Guest resolution
48+
49+
Installing the VMWare Tools should allow different video modes to be selected. If you have already installed them and still does not change resolution you can try this. Open Terminal and run:
50+
51+
`sudo /Library/Application Support/VMware Tools/vmware-resolutionSet <width> <height>`
52+
53+
where width and height are the pixel size you want. For example to get 1440x900:
54+
55+
`sudo /Library/Application Support/VMware Tools/vmware-resolutionSet 1440 900`
56+
57+
## AMD CPUs
58+
A patched macOS AMD kernel must be used to run on older AMD systems, but there is a workaround if you have a modern
59+
AMD Ryzen CPU. The unlocker cannot patch this but we can recommend settings for the VMX file that allows macOS to
60+
run on recent AMD CPUs. The tests are being recorded in this issue, and it would be useful if more can report
61+
success or failures in that issue.
62+
63+
https://github.com/DrDonk/unlocker/issues/33
64+
65+
1. Read this KB article to learn how to edit a guest's VMX file safely https://kb.vmware.com/s/article/2057902
66+
2. Add the following lines were to the VMX file:
67+
```
68+
cpuid.0.eax = "0000:0000:0000:0000:0000:0000:0000:1011"
69+
cpuid.0.ebx = "0111:0101:0110:1110:0110:0101:0100:0111"
70+
cpuid.0.ecx = "0110:1100:0110:0101:0111:0100:0110:1110"
71+
cpuid.0.edx = "0100:1001:0110:0101:0110:1110:0110:1001"
72+
cpuid.1.eax = "0000:0000:0000:0001:0000:0110:0111:0001"
73+
cpuid.1.ebx = "0000:0010:0000:0001:0000:1000:0000:0000"
74+
cpuid.1.ecx = "1000:0010:1001:1000:0010:0010:0000:0011"
75+
cpuid.1.edx = "0000:0111:1000:1011:1111:1011:1111:1111"
76+
vhv.enable = "FALSE"
77+
vpmc.enable = "FALSE"
78+
```
79+
3. Make sure there are no duplicate lines in the VMX file or the guest will not start and a dictionary error will
80+
be displayed by VMware.
81+
4. You can now install and run macOS as a guest.

check

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
# SPDX-FileCopyrightText: © 2014-2023 David Parsons
3+
# SPDX-License-Identifier: MIT
4+
5+
#set -e
6+
#set -x
7+
8+
printf "VMware ESXi Unlocker 4.0.5\n"
9+
printf "==========================\n"
10+
printf "(c) 2011-2023 David Parsons\n"
11+
printf "\nChecking unlocker...\n"
12+
13+
# Ensure we only use unmodified commands
14+
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
15+
16+
ESXI=$(vmware -v)
17+
printf "Current version of ESXi: $ESXI\n"
18+
19+
if [ ! -f "/etc/unlock.conf" ]; then
20+
printf "System has not been patched\n"
21+
exit 1
22+
fi
23+
24+
PATCH=$(cat /etc/unlock.conf)
25+
printf "Patch built for ESXi: $PATCH\n"
26+
27+
if [[ "$ESXI" != "$PATCH" ]]; then
28+
printf "\x1B[41m\x1B[37m>>> ERROR: Mis-matched files please relock/unlock to update patches <<<\x1B[0m\n"
29+
exit 1
30+
fi
31+
32+
printf "Checking VMTAR loaded...\n"
33+
esxcli system visorfs tardisk list | grep apple.v00 >/dev/null
34+
35+
if [[ $? == 0 ]]
36+
then
37+
printf "apple.v00 loaded\n"
38+
else
39+
printf "apple.v00 not loaded\n"
40+
fi
41+
42+
printf "Checking vmx vSMC status...\n"
43+
grep -il \(c\)AppleComputerInc /bin/vmx*
44+
if [[ $? == 0 ]]
45+
then
46+
printf "vmx patched\n"
47+
else
48+
printf "vmx not patched\n"
49+
fi
50+
51+
printf "Checking smcPresent status...\n"
52+
vim-cmd hostsvc/hosthardware | grep smcPresent | cut -d ',' -f 1 | sed 's/^[ \t]*//'
53+
exit

0 commit comments

Comments
 (0)