Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #229615 > unrolled thread

Select which system to boot while rebooting

Started byPstrfZ <pastrufazio@gmail.com>
First post2020-12-10 10:50 +0100
Last post2020-12-10 15:50 +0100
Articles 11 — 8 participants

Back to article view | Back to linux.debian.user


Contents

  Select which system to boot while rebooting PstrfZ <pastrufazio@gmail.com> - 2020-12-10 10:50 +0100
    Re: Select which system to boot while rebooting Andrei POPESCU <andreimpopescu@gmail.com> - 2020-12-10 11:10 +0100
      Re: Select which system to boot while rebooting <tomas@tuxteam.de> - 2020-12-10 11:20 +0100
        Re: Select which system to boot while rebooting Reco <recoverym4n@enotuniq.net> - 2020-12-10 11:50 +0100
          Re: Select which system to boot while rebooting Reco <recoverym4n@enotuniq.net> - 2020-12-10 11:50 +0100
            Re: Select which system to boot while rebooting David Wright <deblis@lionunicorn.co.uk> - 2020-12-18 01:50 +0100
              Re: Select which system to boot while rebooting Reco <recoverym4n@enotuniq.net> - 2020-12-18 07:50 +0100
                Re: Select which system to boot while rebooting David Wright <deblis@lionunicorn.co.uk> - 2020-12-18 18:30 +0100
    Re: Select which system to boot while rebooting didier gaumet <didier.gaumet@gmail.com> - 2020-12-10 12:30 +0100
    Re: Select which system to boot while rebooting Joe <joe@jretrading.com> - 2020-12-10 13:30 +0100
    Re: Select which system to boot while rebooting Anssi Saari <as@sci.fi> - 2020-12-10 15:50 +0100

#229615 — Select which system to boot while rebooting

FromPstrfZ <pastrufazio@gmail.com>
Date2020-12-10 10:50 +0100
SubjectSelect which system to boot while rebooting
Message-ID<BkqKe-6jt-21@gated-at.bofh.it>
On the same machine I need to host three operating systems, all
 debian-based.  Is it possible to select which system to boot
 while rebooting? (My intent is then to reboot the selected system
 by sending the command via SSH)

[toc] | [next] | [standalone]


#229620

FromAndrei POPESCU <andreimpopescu@gmail.com>
Date2020-12-10 11:10 +0100
Message-ID<Bkr3A-6Fd-13@gated-at.bofh.it>
In reply to#229615

[Multipart message — attachments visible in raw view] — view raw

On Jo, 10 dec 20, 10:29:02, PstrfZ wrote:
> On the same machine I need to host three operating systems, all
>  debian-based.  Is it possible to select which system to boot
>  while rebooting? (My intent is then to reboot the selected system
>  by sending the command via SSH)
 
1. Change the default in /boot/grub/grup.cfg[a] before rebooting.

2. As far as I recall grub1 has a 'grub set-default' or similar command 
that could be used for to change the default for the next boot only[b]. 
Maybe this was re-implemented also in grub2?

[a] path and filename is from memory, it's been a while since using 
grub2
[b] useful in combination with a cron script to reboot the system after 
some delay, e.g. if one messed up the network configuration for a remote 
system.

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

[toc] | [prev] | [next] | [standalone]


#229621

From<tomas@tuxteam.de>
Date2020-12-10 11:20 +0100
Message-ID<Bkrdf-6Iw-7@gated-at.bofh.it>
In reply to#229620

[Multipart message — attachments visible in raw view] — view raw

On Thu, Dec 10, 2020 at 12:00:20PM +0200, Andrei POPESCU wrote:

[...]

> 2. As far as I recall grub1 has a 'grub set-default' or similar command 
> that could be used for to change the default for the next boot only[b]. 
> Maybe this was re-implemented also in grub2?

It seems so (note version 2.02+... at man page's footer). Since it's
short and sweet, I take the liberty to include its man page here, as
a special broadcast service :-)

========================================================================
GRUB-SET-DEFAULT(8)   System Administration Utilities   GRUB-SET-DEFAULT(8)

NAME
  grub-set-default - set the saved default boot entry for GRUB

SYNOPSIS
  grub-set-default [OPTION] MENU_ENTRY

DESCRIPTION
  Set the default boot menu entry for GRUB.  This requires setting
  GRUB_DEFAULT=saved in /etc/default/grub.

  -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.

REPORTING BUGS
  Report bugs to <bug-grub@gnu.org>.

SEE ALSO
  grub-reboot(8), grub-editenv(1)

  The full documentation for grub-set-default is maintained as a Texinfo
  manual.  If the info and grub-set-default programs are properly installed
  at your site, the command

    info grub-set-default

  should give you access to the complete manual.

grub-set-default (GRUB) 2.02+dfsg1-20+deb10u2  July 2020   GRUB-SET-DEFAULT(8)
========================================================================


[toc] | [prev] | [next] | [standalone]


#229625

FromReco <recoverym4n@enotuniq.net>
Date2020-12-10 11:50 +0100
Message-ID<BkrGh-6RF-7@gated-at.bofh.it>
In reply to#229621
	Hi.

On Thu, Dec 10, 2020 at 11:12:37AM +0100, tomas@tuxteam.de wrote:
> On Thu, Dec 10, 2020 at 12:00:20PM +0200, Andrei POPESCU wrote:
> 
> [...]
> 
> > 2. As far as I recall grub1 has a 'grub set-default' or similar command 
> > that could be used for to change the default for the next boot only[b]. 
> > Maybe this was re-implemented also in grub2?
> 
> It seems so (note version 2.02+... at man page's footer). Since it's
> short and sweet, I take the liberty to include its man page here, as
> a special broadcast service :-)
> 
> ========================================================================
> GRUB-SET-DEFAULT(8)   System Administration Utilities   GRUB-SET-DEFAULT(8)

Please note that it's required to supply GRUB_DISABLE_SUBMENU=true
option before using grub-set-default, Debian supports it, but does not
use it by default.
Things get really weird with grub-set-default unless you use
GRUB_DISABLE_SUBMENU=true.

Reco

[toc] | [prev] | [next] | [standalone]


#229626

FromReco <recoverym4n@enotuniq.net>
Date2020-12-10 11:50 +0100
Message-ID<BkrGi-6RF-9@gated-at.bofh.it>
In reply to#229625
	Hi.

On Thu, Dec 10, 2020 at 01:46:18PM +0300, Reco wrote:
> On Thu, Dec 10, 2020 at 11:12:37AM +0100, tomas@tuxteam.de wrote:
> > On Thu, Dec 10, 2020 at 12:00:20PM +0200, Andrei POPESCU wrote:
> > 
> > [...]
> > 
> > > 2. As far as I recall grub1 has a 'grub set-default' or similar command 
> > > that could be used for to change the default for the next boot only[b]. 
> > > Maybe this was re-implemented also in grub2?
> > 
> > It seems so (note version 2.02+... at man page's footer). Since it's
> > short and sweet, I take the liberty to include its man page here, as
> > a special broadcast service :-)
> > 
> > ========================================================================
> > GRUB-SET-DEFAULT(8)   System Administration Utilities   GRUB-SET-DEFAULT(8)
> 
> Please note that it's required to supply GRUB_DISABLE_SUBMENU=true
> option before using grub-set-default, Debian supports it, but does not
> use it by default.
> Things get really weird with grub-set-default unless you use
> GRUB_DISABLE_SUBMENU=true.

A correction - GRUB_DISABLE_SUBMENU=true should be put into
/etc/default/grub.

Reco

[toc] | [prev] | [next] | [standalone]


#229816

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2020-12-18 01:50 +0100
Message-ID<Bnc81-1eP-7@gated-at.bofh.it>
In reply to#229626
On Thu 10 Dec 2020 at 13:47:28 (+0300), Reco wrote:
> On Thu, Dec 10, 2020 at 01:46:18PM +0300, Reco wrote:
> > On Thu, Dec 10, 2020 at 11:12:37AM +0100, tomas@tuxteam.de wrote:
> > > On Thu, Dec 10, 2020 at 12:00:20PM +0200, Andrei POPESCU wrote:
> > > 
> > > [...]
> > > 
> > > > 2. As far as I recall grub1 has a 'grub set-default' or similar command 
> > > > that could be used for to change the default for the next boot only[b]. 
> > > > Maybe this was re-implemented also in grub2?
> > > 
> > > It seems so (note version 2.02+... at man page's footer). Since it's
> > > short and sweet, I take the liberty to include its man page here, as
> > > a special broadcast service :-)
> > > 
> > > ========================================================================
> > > GRUB-SET-DEFAULT(8)   System Administration Utilities   GRUB-SET-DEFAULT(8)
> > 
> > Please note that it's required to supply GRUB_DISABLE_SUBMENU=true
> > option before using grub-set-default, Debian supports it, but does not
> > use it by default.
> > Things get really weird with grub-set-default unless you use
> > GRUB_DISABLE_SUBMENU=true.
> 
> A correction - GRUB_DISABLE_SUBMENU=true should be put into
> /etc/default/grub.

I've been using grub-set-default and grub-reboot with submenus
ever since shutdown stopped supporting -F (which was the
up-until-wheezy way of forcing a full fsck, and whose mechanism
I never really thought about).

What sort of weirdness happens? Is the problem with writing
/boot/grub/grubenv (where the strings reside), or with Grub's
reading and parsing it? I've not had any problems myself.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#229817

FromReco <recoverym4n@enotuniq.net>
Date2020-12-18 07:50 +0100
Message-ID<BnhKq-4QA-3@gated-at.bofh.it>
In reply to#229816
	Hi.

On Thu, Dec 17, 2020 at 06:45:47PM -0600, David Wright wrote:
> > A correction - GRUB_DISABLE_SUBMENU=true should be put into
> > /etc/default/grub.
> 
> What sort of weirdness happens? Is the problem with writing
> /boot/grub/grubenv (where the strings reside), or with Grub's
> reading and parsing it? I've not had any problems myself.

It's the selection of a top level menu instead of a menuentry that can
happen, unless you disable submenus.
While it does allow unattended boot, it does not allow the selection of
an old kernel, for instance. At least, in a easy way.

Reco

[toc] | [prev] | [next] | [standalone]


#229821

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2020-12-18 18:30 +0100
Message-ID<BnrJM-2J9-5@gated-at.bofh.it>
In reply to#229817

[Multipart message — attachments visible in raw view] — view raw

On Fri 18 Dec 2020 at 09:45:22 (+0300), Reco wrote:
> 	Hi.
> 
> On Thu, Dec 17, 2020 at 06:45:47PM -0600, David Wright wrote:
> > > A correction - GRUB_DISABLE_SUBMENU=true should be put into
> > > /etc/default/grub.
> > 
> > What sort of weirdness happens? Is the problem with writing
> > /boot/grub/grubenv (where the strings reside), or with Grub's
> > reading and parsing it? I've not had any problems myself.
> 
> It's the selection of a top level menu instead of a menuentry that can
> happen, unless you disable submenus.

Let me just rephrase that, but clarifying the terminology:

  "It's the selection of a top level menu[entry] instead of
   a [submenu's] menuentry that can happen".

That sounds as if you're using a submenu's menuentry ID without
specifying the ID of the submenu itself, as in
    grub-reboot 'submenuentry-id>menuentry-id'
rather than
    grub-reboot 'menuentry-id'

But even then, the top level menuentry's ID strings are typically
quite different from the submenu's ones, the latter having the kernel
version number, the former lacking it.

> While it does allow unattended boot, it does not allow the selection of
> an old kernel, for instance. At least, in a easy way.

As can be seen from the attached, the submenu's IDs all include the
versions of the old kernels. (The top level menu IDs run the default
kernel for that system.) Are you possibly compiling custom kernels
that don't distinguish themselves in the version string?

Cheers,
David.

The attachment has been reduced to just the menu entries and their
ID strings, removing the human label and all the --options.
In addition, the UUIDS have been shortened to the first 8 characters,
as the strings do get very long. The duplications that are seen are
just that, duplications: the top level entry is duplicated by the
first advanced entry, for whatever reason, and they get copied in
from the other partitions by the osprober.

[toc] | [prev] | [next] | [standalone]


#229627

Fromdidier gaumet <didier.gaumet@gmail.com>
Date2020-12-10 12:30 +0100
Message-ID<BksiZ-7js-1@gated-at.bofh.it>
In reply to#229615
Le jeudi 10 décembre 2020 à 10:50:06 UTC+1, PstrfZ a écrit :
> On the same machine I need to host three operating systems, all 
> debian-based. Is it possible to select which system to boot 
> while rebooting? (My intent is then to reboot the selected system 
> by sending the command via SSH)

Hello,

look at the grub-reboot comand

[toc] | [prev] | [next] | [standalone]


#229629

FromJoe <joe@jretrading.com>
Date2020-12-10 13:30 +0100
Message-ID<Bktf3-7RG-1@gated-at.bofh.it>
In reply to#229615
On Thu, 10 Dec 2020 10:29:02 +0100 (GMT+01:00)
PstrfZ <pastrufazio@gmail.com> wrote:

> On the same machine I need to host three operating systems, all
>  debian-based.  Is it possible to select which system to boot
>  while rebooting? (My intent is then to reboot the selected system
>  by sending the command via SSH)
> 

In addition to the other replies about grub, if your machine uses UEFI
booting, the efibootmgr utility can set the next boot OS, and on some
machines (e.g. not my Acer netbook) can set the default boot OS.

-- 
Joe

[toc] | [prev] | [next] | [standalone]


#229634

FromAnssi Saari <as@sci.fi>
Date2020-12-10 15:50 +0100
Message-ID<Bkvqy-EO-13@gated-at.bofh.it>
In reply to#229615
PstrfZ <pastrufazio@gmail.com> writes:

> On the same machine I need to host three operating systems, all
>  debian-based.  Is it possible to select which system to boot
>  while rebooting? (My intent is then to reboot the selected system
>  by sending the command via SSH)

Yes, I do this a lot in a script which hibernates Debian and reboots the
system to Windows. Part of this process selecting the OS to boot for the
next reboot only. So for my system that command is actually

grub-reboot osprober-chain-5482E5003C6F80FB

The osprober string I dug out from /boot/grub/grub.cfg. The osprober
string handy in that it doesn't change that often while the name of the
OS sometimes does.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web