3

My Linux machine is having issues with faulty RAM. I ran PCMemTest-64, and I determined the following patterns: enter image description here

Now, I have stock Ubuntu which doesn't seem to have the BadRAM patch, and I'm a bit nervous about compiling Linux from scratch. So I'm wondering if there is an easy way to disable these fault RAM addresses using existing tools in GRUB and Linux, for example using the memmap kernel parameter. I'm happy to lose a bit of RAM other than the faulty addresses (in the order of kilobytes and not gigabytes ideally) to take this shortcut.

Some versions:

  • Linux 5.19.0-32
  • Grub 2.06
  • Ubuntu 22.04

What should I do?

4
  • You can also try your luck with memtest=17 kernel parameter (check dmesg for early_memtest ff.) Commented Mar 24, 2023 at 11:55
  • I tried that, but it seems that memtest is not part of the default kernel? Commented Mar 24, 2023 at 11:57
  • 2
    Hmmm, it worked on the 22.04 Live CD. But yes, it only works with CONFIG_MEMTEST=y in kernel. Commented Mar 24, 2023 at 11:58
  • See forums.gentoo.org/viewtopic-p-8855846.html#8855846. Doesn't look like there's a user friendly way to do it, memtest would be the closest. Commented Mar 1 at 2:04

1 Answer 1

9

Something like memmap=1M!2399M will reserve a slice of memory from 0x95f00000 to 0x95ffffff and should do the job. We can surely be finer with the K unit : memmap=32K!2457344K (from 0x95fc0000 to 0x95fc7fff).

You can verify the reservation with the command dmesg | grep user. Something like :

[ 0.000000] user: [mem 0x0000000100000000-0x00000003ffffffff] persistent (type 12) 

Should be displayed (the actual values should reflect the range you have shown). See https://docs.pmem.io/persistent-memory/getting-started-guide/creating-development-environments/linux-environments/linux-memmap

You can also see badram kernel parameter not working?

3
  • It shows [ 0.000000] user: [mem 0x0000000095f00000-0x0000000095ffffff] persistent (type 12) which seems to indicate it was successful. Thanks! Also for future reference I had to add the memmap flag to GRUB_CMDLINE_LINUX_DEFAULT= in /etc/default/grub, and then run sudo update-grub. Commented Mar 24, 2023 at 12:20
  • 3
    Also a useful way to get these numbers from the memory addresses is just to convert from hex to decimal using python: python -c 'print(f"Start: {int(0x95fc0000 / 1024)}K")' and python -c 'print(f"Length: {int((0x95fd0000 - 0x95fc0000) / 1024)}K")'. Commented Mar 24, 2023 at 12:28
  • I would recommend using syntax memmap=1M$2399M because the $ always means that the segment is reserved and must not be touched and the semantics of ! are a bit more complex and may sometimes mean something else but reserved memory. If you use Ubuntu and set this in /etc/default/grub note that you need to encode $ as \\\$ or it will end up being interpreted incorrectly. Commented Nov 13 at 10:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.