1. I have a laptop that has thousands of memory errors, making it impossible to even install ubuntu, there is always an error during installation.I was able to run a 4 pass memtest. which provided these results in order to make the machine usable.

      edit and add   /etc/default/grub:

      then   sudo update-grub

     for windows bcdedit /set {badmemory} badmemorylist 0x5A00C 0x5A00D 0x5A00E 0x5C00C 0x5C00D 0x5C00E 

2. My idea was to install ubuntu on a perfectly fine machine on an ssd, modify grub with that new line using sudo nautilus, and then do a sudo update-grub. then take out the ssd and insert it on the broken laptop. I did all that, but the Computer that is perfectly fine and has no errors refused to boot after that GRUB_BADRAM= line addition. it never boots and gives no menu at al.

3. I took a look at How do I tell ubuntu not to use certain memory addresses?

where someone did a comment about using memmap instead of GRUB_BADRAM, but the solution i get from Memtest is different from what the user explained, for example my memtest results have many more characters on the first address 0x00000005A00C000 and i don´t know how to convert it as a valid memmap line or memmap lines in order to tell ubuntu NOT to use those areas

does anyone know how could i fix this? GRUB_BADRAM was supposed to be an easy fix but i have no idea why the machine does not boot with that added, and i would like to try the memmap method to see if i can at least use the laptop.


Update -- FIXED !!

I have edited the grub file now thanks to the comments provided, with the following format ( i hope i have the correct format)

  GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
  GRUB_CMDLINE_LINUX_DEFAULT="quiet splash memmap=8K\\\$0x00000005A00C000,4K\\\$0x00000005A00E000,8K\\\$0x00000005C00C000,4K\\\$0x00000005C00E000"


The computer accepted it and i was able to boot into ubuntu., so i went to /proc/iomem and opened, it, and i saw reserved records for 00000005A00C000 and 00000005A00E000 and 00000005C00C000 and 00000005C00E000

Now the laptop has the hard drive in it, i could boot UBUNTU! i will test it for hours watching youtube and web browsing


UPDATE#2 i would like if someone can double check this calculation



a memtest bad memory like this one that ends with FFC000:


1)You take the mask FFC000 and flip all the bits in FFC000 to FFFFFF

2)This gives us the FFFC000 ^ FFFFFF = 003fff in decimal 3fff is 16383 bytes of bad ram.

3)I round up to the next power of 2, which is 16384 bytes of bad ram.

4)so the value for memmap would be 16K$0x0000000B4018000

im i correct? those 16k get multiplied by 1024, and that is how you get 16384


- I learned the hard way, while using ubuntu and suddently tabs started to crash, etc. because i expanded the memory with a another sodimm stick added.

so i fired up another memtest86 scan, the new report shows the new faulty addresses and im fixing that since i got all the information i need now.


when i look at the memtest86 html report i see also 2 things on that report listed.

Lowest Error Address 0xB2018170 (2848MB)

Highest Error Address 0xB401C648 (2880MB)

Plus a graph. picture

  1. Does this mean that my ram is faulty from 2848MB to 2880MB ?

  2. instead of using all the calculated code, isn´t it better to use something more simple like memmap=100M$2800M ( This will blacklist 100M after the 2800M address i rounded up in order to try not to use near that broken area as much as possible)

  3. Once you run the memmap in ubuntu. How do you double check that there are no more memory errors in ubuntu? since if you run memtest again it will scan the full memory again and give the errors that we fixed


  • 2
    Have you simply considered buying replacement RAM?
    – Thomas Ward
    Oct 15, 2022 at 15:15
  • 6
    its impossible, the ram on almost all new lenovo laptops come soldered to the motherboard. that is why i opened this topic, since this will affect thousands of people in the near future of all these e-waste laptops Oct 15, 2022 at 15:25
  • 3
    I only asked because the 'cheaper' laptops across most providers have that problem, but wasn't sure because there's still quite a few machines out there "new" that have removable RAM chips. That's all I was asking for. Have you also talked to Lenovo support indicating the RAM arrived in the system bad? They may have a replacement program for hardware. (I'm not aware of any BADRAM fixes other than the Grub one, though, just trying to collect more info and ask the obvious questions :P)
    – Thomas Ward
    Oct 15, 2022 at 16:18
  • 2
    Laptops like the lenovo E14 cost around 800 dollars and the ryzen one has soldered memory already, also asus has oled laptops that come with soldered memory. Brands are all going to that dark area. Sadly my laptop is out of warranty. and i know people managed to fix this using ubuntu, For some reason it is not working for me. Don´t know why. Oct 15, 2022 at 17:53
  • Did you check how the GRUB_BADRAM line in /etc/default/grub affected /boot/grub/grub.cfg?
    – jarno
    Oct 24 at 21:09

1 Answer 1


someone did a comment about using memmap instead of GRUB_BADRAM

To convert from BADRAM to memmap you do the following:

You have the [address,mask]:

  • 0x00000005A00C000,0xFFFFFFFFFFFFE000

You take the mask FFE000 and flip all the bits in FFE000 ^ FFFFFF with a xor calculator.

This gives us the FFE000 ^ FFFFFF = 001FFF. In decimal 1FFF is 8191 bytes of bad ram.

We round up to the next power of 2, which is 8192. So the value for memmap would be 8K$0x00000005A00C000

Now for your 0xFFFFFFFFFFFFF000 mask, you take FFF000, flip the bytes:

FFF000 ^ FFFFFF = 0x000FFF.

That's 4095 bytes of bad RAM.

So you write 4K$0x00000005A00E000

Good luck.


My idea was to install ubuntu on a perfectly fine machine on an ssd, modify grub with that new line using sudo nautilus, and then do a sudo update-grub. then take out the ssd and insert it on the broken laptop. I did all that, but the Computer that is perfectly fine and has no errors refused to boot after that GRUB_BADRAM= line addition. it never boots and gives no menu at al.

You can create a LiveUSB with custom boot options and thus test your GRUB_BADRAM/memmap options on the actual machine (just in case your healthy machine won't boot with those options but your failing machine would).

Update 2

I see what you're struggling it is with the syntax. What you're struggling with is with escape codes.

The backlash character \ is used to escape reserved keywords.

If you want to type $, then you need to type \$ because otherwise $ has a special meaning.

If you want to type \, then you need to type \\.

And if you want to type \& then you need to type \\\$

Sometimes it gets weird because when you are editing /etc/default/grub some shell script tries to interpret the text; which means you have to escape it twice (once for the bash script, another for grub). That means that what you want to type is either (try it until the correct syntax appears fine in cat /proc/cmdline, or when hitting 'e' while selecting choices inside GRUB):

  • 4K\$0x00000005A00E000
    • Try this just in case, but I don't think it will work
  • 4K\\\$0x00000005A00E000
    • This escaping will make the script to see 4K\$0x00000005A00E000 and pass it to grub
    • Grub will see 4K\$0x00000005A00E000 and pass 4K$0x00000005A00E000 to the Kernel.

Try adding or removing a 0

First, I just noticed you're missing a zero in the ranges you're supplying to GRUB_BADRAM:

  • 0x000 0000 5A00 C000

It's supposed to be 0x0000 0000 5A00 C000 to be a full 64-bit address. However the mask correctly has all 16 characters.

Double check your addresses.

Second, if that doesn't work, try trimming it down to 32 bit addresses:

  • 0x5A00 C000
  • 0xFFFF E000

(and so on; with no spaces, obviously). That may actually work.

And last but not least, try lowercase addresses just in case:

  • 0x5a00 c000
  • 0xffff e000

Disable secure boot

Digging through the documentation I found about GRUB_BADRAM:

Note: The command is not allowed when lockdown is enforced (see Lockdown). This prevents removing EFI memory regions to potentially subvert the security mechanisms provided by the UEFI secure boot.

Having secure-boot enabled may be the reason your system refused to boot with GRUB_BADRAM.

Unfortunately not all modern laptops will allow you to turn secure boot off. If that's your case then you're screwed.

  • I've updated my post to answer your question. It's understandable, grub's escaping method is hard to get right sometimes I struggle with it myself (specially because you can't tell if it's correct until you've rebooted) Oct 15, 2022 at 21:54
  • 1
    "If that's the case then you're screwed" - well, not quite. You can use shim, make a custom build of GRUB that doesn't enable lockdown, and enroll it in MokManager. (or, boot the kernel directly using systemd's efi stub) You might be compromising some of the secure boot guarantees but an insecure boot is better than none at all. Oct 16, 2022 at 15:16
  • Hi Matias, i have edited the original question and included a mask of 0xFFFFFFFFFFFFC000, i wanted to double check my results, can you please let me know if update#2 is correct? thanks Oct 19, 2022 at 3:20
  • Yup. Looks alright. Btw rounding up is as a precaution. Usually it's rounding up to a multiple of page block size, but finding that out requires a lot of trial and error, so power of 2 is quicker because it achives the same result even if it wastes a bit of RAM Oct 19, 2022 at 4:59
  • Thanks matias, i have added an update#3 , do you think this approach is better from what we did since start? i read that on a website and perhaps the solution is more simple? what do you think? Oct 19, 2022 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .