Thank you everybody!
I was able to chroot and undo the changes and I can now boot normally (yes, with the faulty RAM, I can’t replace it until monday. I know it’s dangerous, but I’ve been using my computer with the faulty ram without knowing it for months).
I found a USB stick with Manjaro that I had forgot I had, and as you suggested I was able to:
- boot from the live USB
- chroot
- undo the changes in /etc/default/grub (i.e. remove the BADRAM line I had added)
- run update-grub
and now it boots.
Now I want to understand why the BADRAM directive in Grub prevents the system from booting.
These were the instructions generated by memtest86 pro which I followed:
Copy & paste the following faulty memory ranges to /etc/default/grub:
GRUB_BADRAM="0x0000001548E6000,0xFFFFFFFFFFFFE000,0x0000001568E6000,0xFFFFFFFFFFFFE000,0x0000001548E2000,0xFFFFFFFFFFFFF000,0x000000123E17000,0xFFFFFFFFFFFFF000"
Open and terminal and run the following command
sudo update-grub
Warning: Masking faulty memory addresses does not fix defective RAM, but provides a temporary workaround for allowing the system to boot. Please consult the FAQ for more details
That doesn’t say where in the file to paste it, so I pasted it at the very end. That is the only thing that I can think of that I can have done wrong. Was that the mistake?
BTW let’s just assume that it’s not because of some random error caused by the faulty RAM itself. (if that is the case, what are the chances that booting from USB, chrooting and restoring grub configuration would all have gone well?) As soon as I get to replace it, I will try the same again with the healthy RAM, and I’m ready to bet it’ll brick the computer again. Until then let’s work under that assumption. (I’m writing from the faulty RAM laptop right now)
EDIT: here’s at least 2 threads (in other forums) where people had the exact same experience, i.e. adding BADRAM directive in grub led to inability to boot:
https://unix.stackexchange.com/questions/746164/grub-hangs-itself-with-64bit-memtest86-badram-pattern
(the first offers a speculative explanation but I don’t quite understand it)