• Become a Premium Member for $25/year with no ads to improve your community experience.

EliteMacx86

Administrator
Staff member
Joined
Jul 22, 2018
Messages
6,622
Motherboard
Supermicro X11SPA-T
CPU
Intel Xeon W-3275 28 Core
Graphics
2xAMD RX 580 8GB
OS X/macOS
13.x
Bootloader
  1. OpenCore (UEFI)
Mac
  1. Mac mini
  2. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
How to Fix NVRAM on macOS [Clover/OpenCore]
This guide covers the fixing of NVRAM on macOS for Clover or OpenCore Bootloader. By following this guide, you'll be able to fix NVRAM on macOS for Clover or OpenCore Bootloader and also setup an Emulated NVRAM for systems where the Native NVRAM does not work.

What is NVRAM?


NVRAM stands for Non-Volatile Random Access Memory. As the name suggests, it is a non-volatile memory and due to its property, the memory is retained even when the power is turned off. For example, considering a case of a Laptop, if you disconnect the battery, disconnect all the wires and remove the logic board and keep it aside, whenever you install the logic board back and after turning it on, you'll find that some of the data are preserved while all BIOS settings including date and time will be lost. Don't mix NVRAM and CMOS and get confused. NVRAM is not CMOS and you can't just clear it off. Due to this, it has its own danger. If something contrary to macOS is recorded in the NVRAM, then it will not be easy to clean it and you may not be able to boot into macOS/OS X even if you reset the CMOS. To boot into macOS/OS X in such a case, you must remove the variable first. Clover and OpenCore have the feature to clear the NVRAM variables unconditionally.

This memory stores various variables that have a name, a GUID, a length, and a value of the arbitrary format. Access is provided by EFI functions from the RuntimeService group:
GetVariable(), SetVariable() and GetNextVariableName().

Why NVRAM is needed?


NVRAM exists in real Macs, otherwise, why would macOS/OS X would require it? The access to the NVRAM is through the AppleEFINVRAM.kext and it gets the address of the access functions from the IOReg where boot.efi put it, which had access to the UEFI functions.

Back in the era of Chameleon, there was no access for several years as it was kind of unsupported and somehow it worked. A few things did not work, however, the system was operational in general. Starting with Clover (Legacy), support for Emulated NVRAM appeared and that is all variables are stored simply in RAM, and when the system is turned off, they are written to a file (nvram.plist) on disk. At startup, Clover reads this file (nvram.plist) and thus knows what was written into the file (nvram.plist) before the power was turned off. However, with Clover UEFI, a similar approach can be seen but it uses a driver called EmuVariableUefi.efi to serve the purpose.

However, when panicking and going to sleep, the system does not have time to save data to disk, so panic.log and hibernatemode 25 are only possible with direct write access to NVRAM, what is called "Iron NVRAM" in our slang.

Native NVRAM is a requirement for a couple of important functions such as installation, sleep/wake, and saving of brightness (for laptops). Starting with Big Sur 11.0, macOS heavily relies on NVRAM for its functioning and it is required even during the time of installation. A broken NVRAM can cause several issues such as
  • Stuck at 2 minutes remaining (First Stage of Installation)
  • Stuck in a reboot loop (Second Stage of Installation)
  • Lack of Graphics acceleration
  • Sleep/Wake and Shut Down issues. Refer to the Sleep/Wake guide for more information
  • Brightness not saved across reboot and shutdown
  • iServices issues.
  • Startup Disk selection issues
How to Check if you have a working NVRAM?


Before you start following this guide, it is advised to know whether you have a working NVRAM on your target system or not. To check whether you have a working NVRAM, follow the steps below.

STEP 1: Open Terminal and execute the following commands, one at a time

Code:
sudo -s
nvram -c
nvram myvar=elitemacx86
exit

STEP 2: Quit the Terminal and reboot the system.
STEP 3: Open Terminal and execute the following command
Code:
nvram -p | grep -i myvar
  • If the stored value myvar elitemacx86 returns, your NVRAM is working.
  • If nothing returns then your NVRAM is not working.
If the stored value does not return, you need to either fix the NVRAM or set up Emulated NVRAM, depending on your case.

I. Fixing NVRAM


The most commonly affected systems are ASUS Z97, 300 series motherboards (except for Z370) such as H310, H370, B360, B365, Z390, X99, and X299. Fixing NVRAM on 300 series is relatively easy as it requires only SSDT-PMC.aml in EFI/ACPI/patched (Clover) and EFI/ACPI (OpenCore). Follow the steps below to fix NVRAM.

STEP 1: Remove Clover RC Scripts
While installing the Clover bootloader, the system may have installed RC scripts on the target volume for a proper NVRAM emulation. This can conflict with OpenCore's method of NVRAM emulation. Even if you're using Clover and your NVRAM is not working, better to start with this step as during the testing and installation phase, there are chances that you may have tested multiple configurations, and installed Clover multiples and there still can be some junks left and this step will remove all of those.

1. Mount your ESP.
2. Remove the following files.
  • /Volumes/EFI/EFI/CLOVER/drivers64UEFI/EmuVariableUefi-64.efi
  • /Volumes/EFI/nvram.plist
  • /etc/rc.clover.lib
  • /etc/rc.boot.d/10.save_and_rotate_boot_log.local
  • /etc/rc.boot.d/20.mount_ESP.local
  • /etc/rc.boot.d/70.disable_sleep_proxy_client.local.disabled
  • /etc/rc.shutdown.d/80.save_nvram_plist.local
And it may be a good idea to remove the other folders:
  • /etc/rc.boot.d
  • /etc/rc.shutdown.d

For 300 Series Chipsets
This fix will only work for the following chipsets. Note that using this fix on some other chipsets than the 300 series may not benefit and can result in the system being in an unbootable state.
  • H310
  • H370
  • B360
  • B365
  • Z390
1. Download SSDT-PMC.aml from the downloads section of this forum.
2. Mount your ESP.

For Clover:
If you're using Clover, copy SSDT-PMC.aml to EFI/Clover/ACPI/patched directory.

For OpenCore:
If you're using OpenCore, copy SSDT-PMC.aml to EFI/OC/ACPI directory. You'll also need to add the SSDT-PMC.aml entry in ACPI>Add section of your config.plist

NOTE:
Comer Lake users i.e 400 Chipset users don't need this fix.

APTIO Firmwares
It was discovered that several APTIO IV drivers including the latest one have a variable whitelist implemented and disallow writing anything but the variables from the list and it is unclear whether it was intentional or just a logical mistake. Due to this bug, the macOS/OS X cannot be installed using the clean install method. You either need to restore or install the target disk to another working system and once installed, transfer the disk back to the system with broken NVRAM. This can work up to some extent, but when dealing with the macOS/OS X updates is still a nightmare as macOS/OSX requires a working NVRAM to perform such functions, especially since Big Sur and due to the lack of the working NVRAM, you'll be stuck with infinite boot loops, therefore, back to the stage one. The most commonly affected vendor is ASUS with H97, Z97, C603, C612, X99, and X299 chipsets. There could be some other vendors and chipsets as well.

Interestingly, there are some APTIO V firmwares (pre-KBL) with a working NVRAM as these firmwares do not use a new NVRAM driver implementation, but rely on a driver that can be found on older Z87 or Z77 APTIO IV motherboards and as a result, the NVRAM works completely fine on such motherboards. Yet, it should be noted that once the firmware gets upgraded to the latest available one, it is no longer possible to use the old driver, like on Z97 motherboards, due to a completely new stack. Also, do note that there are motherboards with APTIO V firmware with a broken NVRAM.

For APTIO IV firmware, the solution is to replace the new NvramSmi driver with the older firmware (with a working NVRAM) and reflash the firmware. This serves the purpose as the latest firmware has the new microcode to patch vulnerabilities such as Spectre and meltdown. This is an ideal solution where you can have the latest firmware along with a working NVRAM. However, there are downsides when using this method, and can lead to the following issues which have been described below. However, a workaround is available for them.

Broken XMP
  • When flashing a modified BIOS, the XMP will likely break, and even when manually editing the memory frequency or setting the memory to use XMP 2.0 will not work and you'll be stuck with the frequency of 1333MHz, regardless of the frequency you set. If you're using the default speed of 133MHz, you can skip the XMP section. If you're using XMP, you need to fix the XMP first before you can use 1600MHz or higher. However, this can be fixed and a solution has been provided in the Fix XMP section.
Broken MAC Address
  • This is the second issue that was seen when flashing a modified BIOS. Along with the broken XMP, the MAC address also seems to be broken as when flashing the modded BIOS with the old NvramSmi module, the NIC MAC address was changed to 88:88:88:88:87:88 and as a result of this, the internet will not work. However, a fix is to back flash the MAC address again, to the original one.
Non-Working of Mechanical Drives
  • This wasn't expected but as reported by some users, when flashing the modded BIOS, the Mechanical drives does not work. However, a fix is to use CtlnaAHCIPort.kext for Clover or OpenCore and the drives are back to life.
STEP 1: Finding the Correct BIOS with working NVRAM
The very first step is to find the correct BIOS with working NVRAM as replacing the NvramSmi driver is the solution, finding a correct BIOS with working NVRAM is crucial. To find the correct BIOS with working NVRAM, follow the steps below.

1.

For more information, see the BIOS Reference Table below. Note that the list may not be complete.

BIOS Reference Table

MotherboardBIOS VersionBIOS DateNotes
ASUS Z97 ROG Maximus VII Hero
ASUS Z97-A
ASUS Z97-P
ASUS Z97 ROG Maximus VII Gene
ASUS Z97 ROG Maximus VII Ranger
ASUS Z97 ROG Maximus VII Impact
ASUS Z97 ROG Maximus VII Formula
ASUS H97M-E
ASUS Z97-PRO(Wi-Fi ac)
ASUS TUF Sabertooth Z97 Mark S
ASUS TUF Sabertooth Z97 Mark 2
ASUS Z97-Pro (Wi-Fi AC)/USB 3.1
ASUS Z97-K Asus Z97-AR
ASUS Z10PE-D16 WSUse UEFI Patch to remove NVRAM Whitelist
ASUS R5E10Use UEFI Patch to remove NVRAM Whitelist
ASUS X99-Deluxe IIUse UEFI Patch to remove NVRAM Whitelist


STEP 2: Replacing NvramSmi Driver
There are several methods to replace the NvramSmi Driver but only two of them are described here to keep this guide short.

⚠️ WARNING:
  • Modding the firmware can cause several issues and can affect the functionality within the different OS in different ways.
  • The method described below is risky and it may brick your motherboard during this process. The steps provided here may or may not be accurate or applicable to your particular motherboard model. By using this guide, you understand all the risks involved and EliteMacx86 shall not be liable for any of the damages that might occur and takes no responsibility for any of your actions. Please proceed with caution!

1. Method #1: Using UEFI Tool



QUICK INFO:
This method will likely break the XMP.


Flashing Firmware

Now you have the firmware ready for flashing but you can't flash the modified BIOS using the normal approach. You need to use Flashback Utility to flash the firmware. If your motherboard lacks Flashback Utility, you need to flash the firmware using alternative ways.


NOTES:
  • Once you have flashed the modded firmware, test the NVRAM on Windows or Linux. See Verifying NVRAM section for more information.
  • If you were in the process of upgrading the macOS/OS X to a new version or were performing a clean install, it may not work and you need to start over again.

If you're not willing to take the risk and patch or flash the modified firmware, we would suggest you to setup Emulated NVRAM which will serve the purpose.

II. Emulated NVRAM

What is Emulated NVRAM?
As the name suggests, an Emulated NVRAM is not the native NVRAM but uses nvram.plist to store the NVRAM variables which are loaded at startup and are present across reboots and shutdowns, until cleared.

Setting up Emulated NVRAM
For some systems, where the native NVRAM does not work, you need an Emulated NVRAM in such case. Depending on the bootloader you use, either Clover or OpenCore, follow the steps below to set up Emulated NVRAM on your system.


Clover
The Clover mechanism for Emulated NVRAM is quite simple. Using the EmuVariableUefi-64.efi in drivers64UEFI, emulated NVRAM is used and saved to disk nvram.plist at shutdown, and loaded at startup. To set up Emulated NVRAM for Clover, follow the steps below.

OpenCore
Setting up Emulated NVRAM for OpenCore is the same idea as Clover but involves some extra steps.

STEP 1:





for save/restore to work, you must have properly implemented NVRAM. For some laptops native NVRAM does not work, so you need EmuVariableUefi-64.efi. Without EmuVariableUefi-64.efi in drivers64UEFI, native NVRAM is used. With it, emulated NVRAM is used, saved to disk (nvram.plist) at shutdown, and loaded at startup. In order for emulated NVRAM to work, you must have installed "RC scripts" within the Clover installer. Failure to install "RC scripts", but having EmuVariableUefi-64.efi present in drivers64UEFI will cause NVRAM settings to never be saved in nvram.plist.


Verifying NVRAM


III. Managing macOS updates when using emulated NVRAM
 
Last edited:
@EliteMacx86,
I have broken NVRAM on Z690 board. I have followed this guide of Emulated NVRAM but still its not working. All files are in place like NVRAM folder with nvram.plist in EFI disk. What could have gone wrong? I'm ready to provide any info to fix it. Thanks in advance.

Config:
Motherboard: Gigabyte Z690 UD AX DDR5
CPU: i5 12400F
RAM: AData 16 GB
GPU: RX 6600
 
How did you verify if you have a broken NVRAM?
Tried sudo nvram myvar= poles and then after reboot nvram myvar and it doesn't reply my name.
 
Tried sudo nvram myvar= poles and then after reboot nvram myvar and it doesn't reply my name.
No PR files attached.
 

Attachments

  • NVRAM-issue.zip
    34.5 KB · Views: 19
Sorry. What file I'm missing here?
- IOReg is missing
- Kextcache output is missing
- Hackintool>PCIe Export is missing
- BIOS setting is missing
- EFI folder is missing
 
Actually my native NVRAM is working as its Z600 series. Previously I messed up something that why its not working. I have removed emulated NVRAM. Sorry for the trouble.
 

Forum statistics

Threads
1,477
Messages
13,967
Members
21,110
Latest member
Foebesnikao0