Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 16348  / 2 Years ago, sun, november 28, 2021, 3:43:06

This is a weird question. I read how to set the default OS choice for GRUB (How do I set the grub timeout and the grub default boot entry?) and I did that, but since I often work from home, I'd like to switch from Windows 7 to Ubuntu 13 and from Ubuntu 13 to Windows 7 automatically by VNC.



I can edit manually the file /etc/default/grub, but I can't do the sudo update-grub from inside the Windows environment.



My question is: is there any way to do this from inside a Windows environment or to use a workaround to be able to change the default bootloader choice and boot into another operating system remotely ?


More From » boot

 Answers
6

The default menu choice is (or can be) stored in the GRUB "environment block", a little 1024 byte file that lives in /boot/grub/grubenv by default. You could easily put that on a drive accessible from both Windows and Linux (e.g. a FAT or NTFS partition) and modify it accordingly. I've done this already one-way (Linux -> Windows) for my mother's laptop using a little script:



#! /bin/bash
sudo /usr/sbin/grub-set-default 0
nohup bash -c "sleep 15s && sudo /sbin/reboot" &
gnome-session-quit --no-prompt --logout


Also added the following to /etc/sudoers to make the necessary commands execute without prompting:



%adm ALL=(root) NOPASSWD: /usr/sbin/grub-set-default, /sbin/reboot


Alternatively, it looks like someone may already have done the heavy lifting:



http://de.mcbf.net/david/grubchoosedefault/



Haven't tried this yet though ..


[#28284] Monday, November 29, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darpose

Total Points: 424
Total Questions: 99
Total Answers: 121

Location: Jersey
Member since Fri, Oct 1, 2021
3 Years ago
;