Bad Memory HowTo
So.. Memtest tells you have bad ram! Here are your easy options:
- Buy new ram
- Turn off everything after the bad memory* (mem=###M option)
- Turn off just the memory around the bad memory* (memmap=#M$###M option)
sudo memtester 750MOption 1 - Buy New Ram Simple. Easy. Safest. Might be cheap if your computer supports new ram. Wastes hardware that we could likely get to work. Some people say that once RAM starts to go, it will just keep getting worse, I personally don't believe them. I will not be liable for you losing data by using bad RAM. Use YOUR own judgment. Option 2 - Turn off everything after the bad memory (mem=###M option) This is simple take the lowest number from memtest, subtract let's say 3 from it for a bit of safety. Then add it to your kernel command line for bootup. Ex. So for bad memory at 797M we would add to the default kernel options:
mem=795MOption 3 - Turn off just the memory around the bad memory (memmap=#M$###M option) WARNING: This is much less tested than Option 2. There may be bugs lurking about. This isn't much more difficult. Instead of just stopping at 795M, we are going to stop at 795M but then only ignore the next 10M. If there are multiple places try to make a range that includes them both. Ex. So for bad memory at 804M and 806M we could use:
memmap=10M$800MBut for this option I will fell better if you use memtester afterwards to make sure you actually got the right memory spot. (And maybe do it before too, too make sure you actually were testing the right spots in the test) HowTo Kernel Default Options Edit the file /boot/grub/menu.lst with sudo/root (ex. sudo nano /boot/grub/menu.lst)\ Navigate to here
## ## Start Default Options ## ## default kernel options ## default kernel options for automagic boot options ## If you want special options for specific kernels use kopt_x_y_z ## where x.y.z is kernel version. Minor versions can be omitted. ## e.g. kopt=root=/dev/hda1 ro ## kopt_2_6_8=root=/dev/hdc1 ro ## kopt_2_6_8_2_686=root=/dev/hdc2 ro # kopt=root=UUID=f0906667-bcde-4b64-86bc-5a47320d5517 roEdit the line (DO NOT GET RID OF THE #):
# kopt=root=UUID=f0906667-bcde-4b64-86bc-5a47320d5517 ro (add mem stuff here)Then run:
sudo update-grubThen reboot. Thanks for following my HowTo. Many happy PCs and memory modules saved from landfills. Comments
- >Hey gQuig, Thanks for the help! You have a well-written tutorial that's a beacon of hope for people with sick computers. I have a quick question. When I try to work around my bad RAM, it looks like top still sees just as much RAM as before. Does that mean that my kernel isn't avoiding the bad ram? My menu.lst file had the following line in it: # kopt=root=UUID=a9f39ac2-c67f-418e-93ce-967bdda5e3a4 ro memmap=100M$1800M and I did remember to sudo update-grub. Thanks for your help! LeDopore
- >@LeDopore: tell me more about your setup. Anything odd? It should definitely report a different amount. Try looking at: cat /proc/meminfo When you are booting up, stop at grub, by pressing escape and try to edit the lines to see what is actually being used. Remove it and double check that it didn't change the amount of ram.
- >Thanks, gQuigs. I hadn't known about editing the boot options with grub. I added the memmap=100M$1800M to grub right at boot and my memory available dropped by 100 megs, so I guess the trouble was that my grub wasn't listening to my /boot/grub/menu.lst file. I'll look into this; thanks a million for the help! Cheers, LeDopore
- >Here's the permanent fix: I have Ubuntu 9.04 running, but I've upgraded a few times so there might be some funny cobwebs in my installation. In any case, I found that adding memmap=100M$1800M under # defoptions (see below) propagates the memory reduction when you run update-grub, even though adding it earlier didn't. ## additional options to use with the default boot option, but not with the ## alternatives ## e.g. defoptions=vga=791 resume=/dev/hda5 # defoptions=quiet splash memmap=100M$1800M Thanks again for the help! LeDopore
- >You can map multiple intervals of your ram. Lets say that you want to "ban" 20 MB from 550 to 570 and 35 MB from 800 to 835 You can write at the end of the line mentioned in the post above "memmap=…" multiple times. Like this: # kopt=root=UUID=a9f39ac2-c67f-418e-93ce-967bdda5e3a4 ro memmap=20M$550M memmap=35M$800M
- >thanks for this really helpful blog – just a question: when, after adding this (multiple) memmap, I start from grub the windows2000 installation I also have on my hard disk, is then the bad memory also blocked for windows? prh
- >Hm… i don't know if this has any effect on Windows. But you can test this easily: just block, for example, 50 MB of ram. IF Windows shows you (yourAmountOfRam-50) MB then you are one lucky guy 😛
- >hello i'm trying to apply this tutorial but i got ubuntu 9.10 karmic (first installation) so that i don't got this menu.lst file i can find a /boot/grub/grub.cfg but there's no kopt=root … in the while content any help ? the grub.cfg file content => # # DO NOT EDIT THIS FILE # # It is automatically generated by /usr/sbin/grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s /boot/grub/grubenv ]; then have_grubenv=true load_env fi set default="0" if [ ${prev_saved_entry} ]; then saved_entry=${prev_saved_entry} save_env saved_entry prev_saved_entry= save_env prev_saved_entry fi insmod ext2 set root=(hd0,6) search –no-floppy –fs-uuid –set 0fac7a3d-ec9c-4cd2-899e-a78a899c973b if loadfont /usr/share/grub/unicode.pf2 ; then set gfxmode=640×480 insmod gfxterm insmod vbe if terminal_output gfxterm ; then true ; else # For backward compatibility with versions of terminal.mod that don't # understand terminal_output terminal gfxterm fi fi if [ ${recordfail} = 1 ]; then set timeout=-1 else set timeout=10 fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ### set menu_color_normal=white/black set menu_color_highlight=black/white ### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_linux ### menuentry "Ubuntu, Linux 2.6.31-16-generic" { recordfail=1 if [ -n ${have_grubenv} ]; then save_env recordfail; fi set quiet=1 insmod ext2 set root=(hd0,1) search –no-floppy –fs-uuid –set f017e4b3-7a62-48d7-a2fe-d3842503a7e3 linux /vmlinuz-2.6.31-16-generic root=UUID=0fac7a3d-ec9c-4cd2-899e-a78a899c973b ro quiet splash initrd /initrd.img-2.6.31-16-generic } menuentry "Ubuntu, Linux 2.6.31-16-generic (recovery mode)" { recordfail=1 if [ -n ${have_grubenv} ]; then save_env recordfail; fi insmod ext2 set root=(hd0,1) search –no-floppy –fs-uuid –set f017e4b3-7a62-48d7-a2fe-d3842503a7e3 linux /vmlinuz-2.6.31-16-generic root=UUID=0fac7a3d-ec9c-4cd2-899e-a78a899c973b ro single initrd /initrd.img-2.6.31-16-generic } menuentry "Ubuntu, Linux 2.6.31-14-generic" { recordfail=1 if [ -n ${have_grubenv} ]; then save_env recordfail; fi set quiet=1 insmod ext2 set root=(hd0,1) search –no-floppy –fs-uuid –set f017e4b3-7a62-48d7-a2fe-d3842503a7e3 linux /vmlinuz-2.6.31-14-generic root=UUID=0fac7a3d-ec9c-4cd2-899e-a78a899c973b ro quiet splash initrd /initrd.img-2.6.31-14-generic } menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" { recordfail=1 if [ -n ${have_grubenv} ]; then save_env recordfail; fi insmod ext2 set root=(hd0,1) search –no-floppy –fs-uuid –set f017e4b3-7a62-48d7-a2fe-d3842503a7e3 linux /vmlinuz-2.6.31-14-generic root=UUID=0fac7a3d-ec9c-4cd2-899e-a78a899c973b ro single initrd /initrd.img-2.6.31-14-generic } ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/20_memtest86+ ### menuentry "Memory test (memtest86+)" { linux16 /memtest86+.bin } menuentry "Memory test (memtest86+, serial console 115200)" { linux16 /memtest86+.bin console=ttyS0,115200n8 } ### END /etc/grub.d/20_memtest86+ ### ### BEGIN /etc/grub.d/30_os-prober ### if [ ${timeout} != -1 ]; then if keystatus; then if keystatus –shift; then set timeout=-1 else set timeout=0 fi else if sleep –interruptible 3 ; then set timeout=0 fi fi fi ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ###
- >Thanks. I got a 1 Gigabyte stick with one bad address and I don't want to throw it out. I'll try this.
-
>Deftronic … i had this problem too. Now (in Ubuntu 9.10) the boot loader is upgraded and the menu.lst file doesn't exist. Stop searching it. The solution is… different now. You have to edit the /etc/default/grub file (or grub.cfg; i don't know exactly… i don't have my computer with linux near me). Of course… you have to have admin rights, so edit this file with sudo. Now… you will se something like this: # If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=false GRUB_TIMEOUT="10" GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash memmap=54M\\\$970M" GRUB_CMDLINE_LINUX="" save the file and run sudo update-grub Those backslashes are important so don't forget them. And 3 of those are now necessary, as you can see in the code posted above. Of course, you can map, as before, more than one part of your memory. In this case the above line will look something like this: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash memmap=14M\\\$170M memmap=54M\\\$340M memmap=34M\\\$670M" Anyway… hope this helped you a little 🙂hi all, Thank you for all the info. I am experiencing problems with my RAM, so I decided to use Memtest86+ to locate the errors and Memtester to double check them. I tried then to use Memtester as you suggest here, but I am not sure about the description you gave. I downloaded the last version and from the web I understood that: sudo memtester 750M is just going to lock (malloc) a block of 750MB in size and test it without consideration of WHERE this block is. If the aim is to test a specific area, it is necessary to give memtester a physical address and then the amount of MB from there onwards. e.g.: for testing 100MB after a certain address 0xfffblabla sudo memtester -p 0xffffblabla 100M Does anybody know how I can get the physical address of the defecting memory? Thanks!
-
Yup, you understand why memtester isn’t as useful as far as I’ve found. I do believe memtester will allocate contiguous memory though, so if you know where it is from memtest86+ you should be able to get it to allocate to cover the bad spot.
- Yes, but I am not sure how to read the memtest86+ output… The list of errors is not very clear to me. I tried to isolate some areas using grub. I’m waiting to see as it goes. fingers crossed.
-
-
I had similar problems, but found the available instructions incomplete and confusing, so I wrote these instructions to assume as little background as possible. 1. Run Memtest86+ in “badram” output (preferably from a bootable external medium). When it starts, type “c” (“configuration”), then “4” (“Error Report Mode”), then “3” (“Bad RAM Patterns”), then “0” (“Continue”). 2. Copy the output that follows any lines beginning with “badram=”. 3. Open a terminal (command line). 4. Change to the directory where the “grub” file is located. For example, “cd /etc/default”. 5. With “root” privileges, use a text editor to open the “grub” file (If you are not signed in as “root,” use “sudo.” You will be asked for the “root” password. In Linux and other Unix derivatives, “root” is equivalent to Windows’ “Administrator.”). For example, type “sudo nano grub” (This temporarily changes the user to “root” and opens the file “grub” with the “nano” text editor.) 6. Find the section describing memtest. Uncomment the last line (Delete the special character at the beginning of the line, such as “#,” “>,” or “!”). This makes it active (for example, “#GRUB_BADRAM=” becomes “GRUB_BADRAM=”). Replace the example addresses (following “GRUB_BADRAM=”), with the “badram=” output that you copied from Memtest86+ (for example, “0x98f548a0,0xfffffffc”). Save (or “write out”) your changes. 7. In the terminal (command line), update the “grub.cfg” file, by typing “sudo update-grub”. 8. Reboot.
- Myron, I found your comment to be quite instructive, thank you.