Memtest, often available as MemTest86+ or MemTest86, is a vital diagnostic tool used to test the integrity of your system’s RAM. It operates independently of the main operating system, making it an essential tool for troubleshooting hardware issues. The GRUB bootloader allows you to run Memtest by adding it as a boot option or directly running it from the GRUB command-line interface (CLI). Both approaches have their merits. Running Memtest from the GRUB menu is typically straightforward; however, using the GRUB CLI can be useful for manual control, custom configurations, or advanced troubleshooting.
In order to run Memtest from GRUB CLI, you need to first access the GRUB boot menu. When you power on or restart your computer, there is a small window of time during which you can interrupt the boot process to invoke the GRUB menu. Typically, this is done by holding down the Shift key. However, on some systems, especially those using UEFI boot, you might need to press the Esc key instead.
• Restart your computer.
• As the system begins to boot, press and hold the Shift key (or Esc if you are on a UEFI system).
• This action will invoke the GRUB boot menu, which displays several boot options including the regular OS entry and a Memtest entry if installed.
If a Memtest option is present in your GRUB menu—which it often is if MemTest86+ has been properly installed—simply use the arrow keys to navigate to the “Memory test (memtest86+.elf)” or a similarly labeled option and press Enter to launch the test. The test will immediately start running and continue until you decide to stop it by pressing the Esc key.
Alternatively, if you prefer to use the GRUB command-line interface, you can enter it directly by selecting the CLI option in the GRUB menu:
• Once the GRUB menu is displayed, press c to switch to the command-line mode.
In the GRUB CLI, you can manually instruct the bootloader to run Memtest if you have the path to the Memtest executable. Typically, the command is simply:
# At the GRUB command line, type:
memtest86+
Note that on some systems you might need to explicitly load the binary file. For example, if the file is located in /boot, you might execute:
linux16 /boot/memtest86+.bin
boot
Ensure that the path (e.g., /boot/memtest86+.bin) aligns with your system’s configuration.
Many Linux distributions include MemTest86+ by default. However, if the option is missing from the GRUB menu, you may need to install it manually. In most Ubuntu-based systems, you can install MemTest86+ using the following commands:
# Update your package manager and install MemTest86+
sudo apt update
sudo apt install memtest86+
After the installation completes, update the GRUB configuration to include MemTest86+ in your boot menu:
sudo update-grub
This sequence of commands ensures that the necessary memory testing tool is installed and recognized by GRUB.
On some occasions, especially when using different versions like MemTest86 x64, you might want to create a custom GRUB entry. This involves editing the GRUB configuration file directly. For example, to create a custom entry:
# Open the custom configuration file for editing
sudo nano /etc/grub.d/40_custom
# Add the following entry:
menuentry 'MemTest86 x64' {
set root='hd0,gpt1'
chainloader /EFI/BOOT/BOOTX64.EFI
}
Remember to replace hd0,gpt1 and the path /EFI/BOOT/BOOTX64.EFI with the correct disk and partition details for your EFI system. Once the configuration is complete, update GRUB:
sudo update-grub
While the most straightforward method remains launching Memtest from the boot menu, it is possible to execute it from the GRUB CLI. This requires careful attention to the command syntax and system configuration. The generalized method involves identifying the appropriate binary file path on your system and loading it using GRUB commands. The sequence for this manual approach is:
set root=(hd0,1)
linux16 /boot/memtest86+.bin
boot
Be mindful that this method may require adjusting for specific parameters or boot configurations and might not work in all environments due to various requirements of the memory test software.
If you do not see a Memtest option at boot, verify that the memory test package (e.g., MemTest86+) is installed. Using the command:
sudo apt install memtest86+
then updating GRUB with:
sudo update-grub
should refresh and display the memory test option in the boot menu.
When working directly with the GRUB CLI, you must accurately input commands and paths. There can be variations due to GRUB versions and filesystem setups. Always verify the exact location of the memtest binary on your /boot directory. If you encounter errors, reconnecting to the GRUB CLI and verifying device paths and root settings is advised.
Note that the approach may differ on UEFI systems. For UEFI-based systems running MemTest86 x64, ensure your machine is set to boot in UEFI mode. A custom GRUB entry using the chainloader command can be more appropriate for these cases, as the binary file might be an EFI application rather than a legacy boot image.
Step | Description | Commands/Actions |
---|---|---|
1. Access GRUB | Boot your computer and invoke the GRUB menu by pressing the Shift key (or Esc for UEFI systems). | N/A |
2. Navigate to CLI | In the GRUB menu, press c to access the CLI if you prefer manual commands. | N/A |
3. Run Memtest from CLI | Directly run Memtest by entering its command or by loading the binary. Verify the path. |
|
4. Install/update if missing | If no Memtest option is visible, install MemTest86+: then update GRUB. |
|
5. Custom GRUB entry (UEFI) | Create or modify a custom boot entry for MemTest86 x64. |
|
For advanced troubleshooting, using the GRUB CLI can be particularly effective. In cases where you need to test specific RAM segments or pass custom parameters, modifying your GRUB command sequence may be necessary. Always double-check the binary file location in your /boot directory and ensure that the correct GRUB commands (such as linux16 for BIOS systems) are used.
When creating custom boot entries in the /etc/grub.d/40_custom file, it’s important to specify the correct device and partition information using GRUB’s naming conventions (e.g., (hd0,1) for BIOS or hd0,gpt1 for UEFI systems). Post-editing, always remember to update GRUB to apply your modifications.
Advanced users might also consider scripting these setups in order to facilitate rapid testing on multiple systems, ensuring a smooth diagnostic process.