is it possible to reboot directly into the memtest86+ (without giving any input during boot) , like the Windows command mdsched does?
- 349
1 Answers
Using apropos we can see what app is used for the next boot only:
$ apropos "next boot only"
grub-reboot (8) - set the default boot entry for GRUB, for the next boot only
With using grub-reboot for a one-time boot, I have found that it is best to use the name of the entry and not the number of the entry like some of the linked answers here have had. I just cannot get it to work with the numbers of the entries. Here is something that I have found works with using the names of the entries.
If you cat the /boot/grub/grub.cfg there are a lot of entries that we are looking for. The one in particular is the Memory test entry.
$ grep -i "memory test" /boot/grub/grub.cfg
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {
Since all we need is just the first entry and we need the full name of Memory test (memtest86+) to tell the grub-reboot that is what we need, we can use the following line to grab only that name and the first entry, specified by the exit command.
awk -F"'" '/Memory test/ {print $2; exit}' /boot/grub/grub.cfg
Which gives us output like:
$ awk -F"'" '/Memory test/ {print $2; exit}' /boot/grub/grub.cfg
Memory test (memtest86+)
Now we can combine that line into our one line command to reboot our system to Memtest as a one-time boot.
sudo grub-reboot "$(awk -F"'" '/Memory test/ {print $2; exit}' /boot/grub/grub.cfg)"; reboot
The reboot part at the end will go ahead and reboot your system for now.
Hope this helps!
- 43,712