Answer the question
In order to leave comments, you need to log in
How to tell GRUB to load a specific OS one time?
I have a computer that has Windows8.1 and Debian installed. Remote access is configured to this computer: to Linux - SSH, to Windows - RDP. The bootloader is GRUB. Linux is loaded by default.
Is there any possibility, by connecting via SSH, to indicate that the next time (only once) Windows should boot by default? Example: I worked in Linux, I needed Windows, I reboot, let's say, with some flag or specify something in the GRUB setup that I need to start Windows next time. The computer is rebooted, Windows is loaded, I cling to it via rdp. Having done everything that is needed in Windows, I reboot, and Linux is loaded first again.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
We look at what order your item is in rough:
sudo grep menuentry /boot/grub/grub.cfg
Numbering starts from 0.
We look for the
GRUB_DEFAULT=saved item to
look exactly like this, in the file: /etc/default/grub
sudo grub-reboot Х
Where X is the number of your timing in the bootloader.
sudo reboot
Only relevant for GRUB2.
using load_env/save_env
is not exactly what you need, just a standard piece for example:
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question