How to avoid to use faulty Ram Areas with EfiUnusableMemory

Hi, ive a macbook with soldered Ram and some are faulty so i want to tell Macos not to use this Areas.


ive installed Ubuntu and thers a kernel option memmap to go around faulty ram


but how do i get this done for macos?


ive heard of EfiUnusableMemory command, but where can i put this in?


maybe this will help many with faulty soldered Ram to use their MacBooks a bit longer

Posted on Sep 17, 2023 7:37 AM

Reply

Similar questions

27 replies

Sep 19, 2023 7:26 PM in response to John Galt

John Galt wrote:

I doubt there is any way to segregate any particular hardware address space in macOS due to its implementation of ALSR since Lion (at least). Apple used to discuss it in Apple Platform Security but that passage no longer appears.

Memtest86+ and Memtest86 (two different utilities, first one is open source, the second is from a commercial company) are not running within macOS, but from a bootable USB stick which only has a bootloader to put the memory test utility into memory. These utilities are only utilizing about 10MB of RAM for the actual utility. They are also not subject to macOS in any way so those ALSR concerns are irrelevant.


History of Memtest86 and Memtest86+:

https://en.wikipedia.org/wiki/Memtest86


There is another "memtest" command line utility available which can run within macOS (most people will use Rember which provides a GUI wrapper...very outdated version of the app too...it is the only pre-compiled binary version I know of for macOS). This utility that runs within macOS will try to reserve as much contiguous memory as it can for its test area (user can specify the amount of RAM as well, but the utility must still be able to reserve a contiguous memory zone). The memory test run within macOS is extremely limited because only a small portion of memory can actually be tested plus there is always a chance another app could possibly modify memory within the test zone which makes it much less reliable. I don't know if ALSR has any effect on this utility running within macOS since I've rarely seen (perhaps never seen) any memory test utility report a failure when run within any OS (macOS/Windows/Linux).


I have found that Memtest86 (non-plus version) has been pretty good for checking memory. Of course, there is always a chance of a false positive which is why it is important to be able to test another identical computer to see if it also has the same error.


I have utilized Memtest86 (non-plus version) (v7.5 and v8.x, v9.x) on 2015 - 2019 Apple laptops without seeing any issues probably because these Intel systems are pretty much the same as non-Apple systems since the memory controllers are on the CPU these days lessening the chances of odd issues here.


I have had some recent computers (both Apple & Dell) where I suspected a memory issue, but could not prove it since the Apple Diagnostics passed. The problems with these computers were intermittent. Some times it will report a memory failure with a bit flip just like the OP showed here, but other times the test will just freeze the system which I have found is just as useful to identify a hardware issue (especially if it is easily repeatable) as long as it can be confirmed another identical model does not have the same issue with the test.


I'm a little skeptical of Memtest86+ right now since developement on it only resumed a few months ago (after being dormant for a decade), but if Memtest86 also shows the same errors, then I would think it is safe to say that the memory on this Mac is bad. The Apple Diagnostics utilize similar test algorithms which Memtest86 and Memtest86+ also utilize. These apps generally write a specific pattern to the memory area, then confirm the memory still holds the same values at a later time. Sometimes the check is made quickly, while other times it may wait minutes to make sure the memory cells holds the pattern. Any potential programming/test issues would revolve around using any special characteristics of the memory controller. Basic memory test functionality has been around for decades, but has evolved into a few more advanced memory tests.


I never put 100% faith into any diagnostic app or test, but they can be a useful tool when you are having intermittent odd issues and everything else has been eliminated. It is nice being able to confirm a hardware issue instead of wondering if you have overlooked some software or configuration issue.


If Memtest86 also shows memory errors, then I agree with the OP that this Mac very likely has bad memory. If only Memtest86+ is showing these errors, then I would suspect a possible issue with that utility.


The results of Memtest86+ do seem a bit odd to me since the supposed bit flips seem a bit random which is unusual since most memory failures I have seen will tend to have the same bits failing. The bit either sticks on or it sticks off. I don't see that in the results shown by the OP.


Sep 19, 2023 2:43 PM in response to HWTech

I'm not aware of any way of marking a range of memory off-limits in macOS as you can in Linux, although the OP can use boot-args maxmem to constrain available memory to some lesser amount.


I doubt there is any way to segregate any particular hardware address space in macOS due to its implementation of ALSR since Lion (at least). Apple used to discuss it in Apple Platform Security but that passage no longer appears.


I also doubt there's anything wrong with that Mac.

Sep 18, 2023 1:33 AM in response to Aikawa24

Aikawa24 wrote:

ive heard of EfiUnusableMemory command, but where can i put this in?


EFI (Extensible Firmware Interface) is something that Intel developed to replace BIOS, and that Intel-based Macs use in place of BIOS. So we'd be talking about something that runs before macOS boots, if there is a way to add your own code (a way not supported by Apple, pretty obviously!) to run at that time.


EfiUnusableMemory is not a command. It, and kEfiUnusableMemory, are enumeration constants.

EfiUnusableMemory | Apple Developer Documentation


Presumably related to the UEFI / EFI Specification. You would use the constant in connection with some UEFI API

https://www.intel.com/content/www/us/en/architecture-and-technology/unified-extensible-firmware-interface/efi-homepage-general-technology.html

https://uefi.org/specifications


Since you would be playing around with the interface between the OS loader and the firmware, it could be hard for you to recover if you made changes that had bugs in them that broke the boot loading process.


I'm not going to go there. I'm just going to point out that if you go there, you'll need to learn more about software development than it appears that you know now, AND there will still be a risk of turning your laptop into a brick.

Sep 18, 2023 12:56 AM in response to Aikawa24

Your screen shot indicates that your laptop has an Intel Core i7-4770HQ running at 2.20 GHz. A search using MacTracker turned up two matches for 4770HQ:


  • MacBook Pro (Retina, 15-inch, Mid 2014)
  • MacBook Pro (Retina, 15-inch, Mid 2015)


Based on the clock speed, you have a 15" Mid 2014 MBP with the entry-level CPU. That Mac is old enough to have a support status of "Obsolete" – which means that as a rule, Apple no longer carries repair parts for it, or offers hardware repair service for it, with the possible exception of battery replacement service.


If the identification of the machine is correct, I'm surprised that Apple even offered to perform (expensive) logic board exchange service on it. Maybe they have a few spare repair parts they haven't thrown out yet – or maybe the guy who suggested a logic board exchange wasn't completely aware of the age of the machine and the likely parts situation.


In any event, I think you have a rather unusual problem. It may be a real problem, but because it's so unusual, it may be either that (a) there are no controls in macOS to exclude just the defective memory from use, or (b) said controls are buried so deeply that only a developer (maybe only one working for Apple), would know where they are and how to use them.


If it is in working condition, a 15" Mid-2014 MacBook Pro can run Big Sur (but no higher).


If you really believe that this computer has failing RAM – that the failure to install Big Sur has to do with RAM that has gone bad, and not with some other cause TBD – then the best course of action may be to give up on running macOS on it. If you believe that the installation could have failed for some reason not involving bad RAM, then tell us the specifics of what went wrong with the installation, and maybe someone can figure it out.


Sep 19, 2023 2:07 PM in response to Aikawa24

Try running Memtest86 instead of Memtest86+. Development of Memtest86+ only recently resumed after decades of lying dormant, so I would not completely trust the plus version at this time. Hard to say if there are any false positives with it...you would want to compare results on another identical computer to be certain. Compare the results of using Memtest86 (without the plus) since I know I have used the non-plus one on multiple Macs over the last few years without encountering any issues.


I'm not aware of any way of marking memory as bad in macOS. Remember, macOS is not Linux even though they may some similarities on the command line. You also have to consider that the memory failure may change over time as well....I personally would not want to trust a system with faulty memory if that memory cannot be easily physically removed.


As the others have mentioned, the 2015 model is now considered "Vintage" and not worth replacing the MLB. The RAM is soldered onto the Logic Board of all Apple Retina laptops.


I can appreciate wanting to keep systems running for as long as possible, however, it seems the time has come to retire this laptop. Or you can install Linux on it and try excluding that section of RAM to see how it works.



Sep 19, 2023 7:34 PM in response to Aikawa24

The results of Memtest86+ do seem a bit odd to me since the supposed bit flips seem a bit random which is unusual since most memory failures I have seen will tend to have the same bits failing. The bit either sticks on or it sticks off. I don't see that in your results. I think you are seeing an error with the test. I haven't tried Memtest86+ recently and would not trust it until I have tried it on multiple systems.


Here is what your Memtest86+ errors are saying...these are the bits which Memtest86+ is saying are on, when it expected them to be off. There is no pattern here which is very unusual in my experience. I highly recommend testing with Memtest86 instead to see if it also shows the same errors. I converted the values to binary so it is easier to see the differences in the bits.


d5			1101 0101
55			0101 0101
ec			1110 1100
30			0011 0000
b9			1011 1001
dc			1101 1100
f3		    1111 0011
65			0110 0101
90			1001 0000
c4			1100 0100
26			0010 0110
69			0110 1001

Sep 20, 2023 2:50 AM in response to HWTech

Hi,


I used the Memtest86+ with a bootable USB and run it 10-15 Times.


to be clear, ive run the alle Diagnostic and it was fine


the main reason I go with memtest86+ was, im run out of options.

the catalina should be updated to Bigsur but it fails every time, the logs says many different errors, some time trust cache, some time supportshare.dmg verify failed and then only the update can not load.


ive downloaded the update file more than 50 times on 5 different machines and used 8 different USB Sticks and changed installdisks, then I came to memtest86+ which leads me to the Problem of Ram failure (which some of you don't believe ) but fact is memtest86+ shows me the bad area and I could separate it with maxmem boot-args.

another fact is, now I can update to bigsur without problems.


with all these symptoms in the background, bad ram seems a very good reason.


but I have to say after I set back the maxmem boot-args to maximum there are no failures at all with installed Bigsur so the macOS runs flawless and I don't get any hints that there was a problem with the Ram

Oct 7, 2023 12:02 PM in response to Aikawa24

I run rEFInd Boot Manager to execute a very small EFI-Script which disables the faulty RAM-Area before I boot MacOS (works on Big Sur on MacBook Pro Late 2013).

Of my 16GB RAM only 128MB are damaged, so I didn't gave up on implementing this great Idea.

I also filled Apple Product Feedback to make them aware that throwing away an otherwise flawless device is not good for the environment.

I use this solution for years now, but at this moment I don't remember where the Source Code (with the hardcoded area) is. I will check tomorrow and will update you here as soon as I found it.

Sep 17, 2023 10:59 AM in response to Aikawa24

Aikawa24 wrote:

Memtest86+ is the Best app to test Ram and its highly accurate,


It appears you have been misled.


It is not possible to reliably test memory on the system in which the app performing the test is running. Apple Diagnostics is as close to a reliable memory testing utility there is, short of removing the installed memory and testing it using equipment designed for the task.


Use Apple Diagnostics to test your Mac - Apple Support

Oct 7, 2023 3:09 PM in response to Servant of Cats

Servant of Cats wrote:

I'm glad to hear that it worked out for you.

One question: How have you used this solution "for years now" when your original post (from before when you applied it) isn't even one month old?


Hmm.. I don't understand your question. I am not the original author of this thread - in case you missed it.

I only stumbled across this thread and wanted to contribute my solution to this problem. To be more specific, I use a compiled version of my script since 2019 when I expirienced the same problem as the author of this thread. It is executed before every boot of macOs.


I found the sourcecode now and uploaded it (in case someone misses my other post on this Thread):

https://github.com/0nelight/macOs-Disable-RAM-Areas

Sep 17, 2023 8:08 AM in response to Aikawa24

Aikawa24 wrote:

Hi, ive a macbook with soldered Ram and some are faulty so i want to tell Macos not to use this Areas.

ive installed Ubuntu and thers a kernel option memmap to go around faulty ram

but how do i get this done for macos?

ive heard of EfiUnusableMemory command, but where can i put this in?

maybe this will help many with faulty soldered Ram to use their MacBooks a bit longer

If there was a RAM issue the MacOS would alert you and the computer would no longer function.


Sep 17, 2023 10:45 AM in response to Aikawa24

You said "Macos has not warned me, it wont install bigsur so i tryed out everything to get rid of the problem." If you have RAM issues then the MacOS will let you know. Your computer will start up with "beeping" sounds. How did the MacOS warn you not to install BigSur? Is your hardware too old to support BigSur?

If Linux is running natively on your Mac, uninstall it and start over with a new installation of the MacOS.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to avoid to use faulty Ram Areas with EfiUnusableMemory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.