How can one choose a new kernel on boot, running a dedicated server?

6,875

Set the GRUB_DEFAULT variable in /etc/default/grub. You can use the title of the kernel entry instead of an index, so it's not disturbed by subsequent kernel installs/removals. Then you need to run update-grub. From the Grub manual:

‘GRUB_DEFAULT’
The default menu entry. This may be a number, in which case it identifies the
Nth entry in the generated menu counted from zero, or the title of a menu entry,
or the special string ‘saved’. Using the title may be useful if you want to set
a menu entry as the default even though there may be a variable number of entries 
before it.

For example, if you have:

     menuentry 'Example GNU/Linux distribution' --class gnu-linux {
     ...
     }

then you can make this the default using:

    GRUB_DEFAULT='Example GNU/Linux distribution'

If you set this to ‘saved’, then the default menu entry will be that saved by
‘GRUB_SAVEDEFAULT’, grub-set-default, or grub-reboot. 
Share:
6,875

Related videos on Youtube

Joel G Mathew
Author by

Joel G Mathew

Updated on September 18, 2022

Comments

  • Joel G Mathew
    Joel G Mathew almost 2 years

    As part of installing proxmox on a dedicated server running Debian, it installed a new kernel. As part of the install instructions, I am supposed to choose the new kernel in grub. However I dont have a virtual console for accessing the server at the time of boot. The only thing I can do, is to run an ssh console to the server after it boots. How can I select the pv kernel as default for boot time?

    I am running Debian Wheezy on the server, and installed proxmox 3.

    • TomTom
      TomTom almost 11 years
      "server" and no virtual console? Bad - maybe return it to the seller and ask for a server? What do you do if you need to reinstall totally, or do a bios upgrade? Remoete viortual consoles are standard even on low end servers these days.
  • Joel G Mathew
    Joel G Mathew almost 11 years
    But that will be reset on running a update-grub, wont it?
  • Qian Chen
    Qian Chen almost 9 years
    How to get the title of the kernel entry?
  • Paulo Almeida
    Paulo Almeida almost 9 years
    @ElgsQianChen On my system you can do it with this command: grep "menuentry " /boot/grub/grub.cfg|cut -d"'" -f2. But I don't know if it's universal, and if you have submenus it may also be different. You can also just look at the grub menu.