Score:0

Set next boot to kernel

br flag

I'm trying to automate a way to set the next boot to be the stock ubuntu kernel. Using a script called list_kernels.sh which I found on stackoverflow, I can get the number of the menu including the submenu. However, when I run grub-reboot *number* I get the following:

root@prod150:~# /tmp/list_kernels.sh 
0: Ubuntu
  0>0 Ubuntu, with Linux 4.9.24
  0>1 Ubuntu, with Linux 4.9.24 (recovery mode)
  0>2 Ubuntu, with Linux 4.4.0-81-generic
  0>3 Ubuntu, with Linux 4.4.0-81-generic (recovery mode)
1: Advanced options for Ubuntu
2: Memory test (memtest86+)
3: Memory test (memtest86+, serial console 115200)




root@prod150:~# grub-reboot 0>2

Menu entry not specified.
Usage: grub-reboot [OPTION] MENU_ENTRY
Set the default boot menu entry for GRUB, for the next boot only.
  -h, --help              print this message and exit
  -v, --version           print the version information and exit
  --boot-directory=DIR    expect GRUB images under the directory DIR/grub
                          instead of the /boot/grub directory

MENU_ENTRY is a number, a menu item title or a menu item identifier. Please note that menu items in
submenus or sub-submenus require specifying the submenu components and then the
menu item component. The titles should be separated using the greater-than
character (>) with no extra spaces. Depending on your shell some characters including > may need escaping. More information about this is available
in the GRUB Manual in the section about the 'default' command. 

Report bugs to <[email protected]>.

Does anyone happen to know what's happening? Stackoverflow suggestion online suggest it should work.

Thanks ahead!

hr flag
The key phrase appears to be *"Depending on your shell some characters including > may need escaping."* so try `grub-reboot 0\>2` or `grub-reboot 0'>'2` or `grub-reboot '0>2'`
rogersjoshmac avatar
br flag
YES! Thank you so much!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.