You are not logged in.

#1 2017-12-24 06:15:17

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

[SOLVED] Exiting kernel to grub/bootloader

I've done some searching online and have seen no mentions of "exiting" out of a loaded kernel, back into the bootloader to select another kernel (a la dual booting, minus the rebooting).

Is this just not yet a feature/possibility in Linux?

As an arch user myself, I would like to explore other distros on my hardware rather than in a hypervisor/container/cloud env.

Best, and happy holidays all.

- Arx

Edit: a revised message would read: "Is there currently a way to kill/exit a kernel and return to the bootloader to launch another kernel, while not powering down the hardware?"

Last edited by arx (2017-12-24 07:26:30)

Offline

#2 2017-12-24 06:22:07

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,541

Re: [SOLVED] Exiting kernel to grub/bootloader

Exiting back to the bootloader...that's kind of the definition of rebooting.

Offline

#3 2017-12-24 06:33:15

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

Yes, rebooting is similar but not the solution to my inquiry.

It is ridiculous to think that one would relaunch a browser to access a different site, or relaunch their ui/wm to utilize a different program.

Offline

#4 2017-12-24 06:47:46

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,541

Re: [SOLVED] Exiting kernel to grub/bootloader

It is the solution to your inquiry, since what you're asking about is rebooting. You asking about launching a different OS, not just a different program. That requires either a hypervisor/VM setup or a reboot.

Edit: maybe we should back up a bit. What difference do you see between ""exiting" out of a loaded kernel, back into the bootloader" and rebooting? As far as I can tell, they're synonymous.

Last edited by Scimmia (2017-12-24 06:50:43)

Offline

#5 2017-12-24 07:07:29

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

Hello Scimmia,

The main difference being complete halt to the machine.

I agree that they're synonymous, rather, I am interested in finding an alternative to powering down my computer to launch an image of another variant of the kernel.

Offline

#6 2017-12-24 07:13:35

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,541

Re: [SOLVED] Exiting kernel to grub/bootloader

A reboot and powering down are completely different operations.

Offline

#7 2017-12-24 07:16:55

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

No doubt. When I reboot, my motherboard loses power briefly then "boots" back up through the bios into uefi launching my kernel. Whereas when I power it down, it doesn't come back online.

I want to not "reboot".

Offline

#8 2017-12-24 07:19:09

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: [SOLVED] Exiting kernel to grub/bootloader

Did I understood correctly, that you want to reboot your system directly to the bootloader, not rebooting the actual hardware/firmware, and thus bypassing the time spent on bios reboot?

You can pass argument to 'systemctl reboot' that could enable different reboot "target" on some hardware:

man systemctl wrote:

If the optional argument arg is given, it will be passed as the optional argument to the
reboot(2) system call. The value is architecture and firmware specific. As an example,
"recovery" might be used to trigger system recovery, and "fota" might be used to trigger a
“firmware over the air” update.

I have no idea if that has any real world use on x86_64 hardware though.

Also, you might want to take a look at Kexec if you haven't already.

Offline

#9 2017-12-24 07:21:27

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,541

Re: [SOLVED] Exiting kernel to grub/bootloader

kexec really gains you nothing, though, except a couple of seconds at best. Not really useful in the vast majority of situations.

Offline

#10 2017-12-24 07:22:58

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

Thanks for the reply, Ooo. That look along the lines of my thinking. I'll read into that, do some testing and report back.

Edit: cleaned up a typo

Last edited by arx (2017-12-24 07:23:51)

Offline

#11 2017-12-24 07:25:01

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

Awesome, that's exactly what I was looking for. Thanks Ooo. This forum needs rep.

Offline

#12 2017-12-24 07:25:53

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

Scimmia, not everyone in the Linux community has the same use case. I appreciate the discussion.

Last edited by arx (2017-12-24 07:27:20)

Offline

#13 2017-12-24 07:28:28

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,541

Re: [SOLVED] Exiting kernel to grub/bootloader

I'm well aware of that, but the use-case you specifically gave says you want to reboot. kexec can be useful in some cases, it's useless and needlessly risky here.

Offline

#14 2017-12-24 07:40:40

arx
Member
From: 2730ft above sea level
Registered: 2016-04-30
Posts: 46

Re: [SOLVED] Exiting kernel to grub/bootloader

arx wrote:

I've done some searching online and have seen no mentions of "exiting" out of a loaded kernel, back into the bootloader to select another kernel (a la dual booting, minus the rebooting).

..
..

Edit: a revised message would read: "Is there currently a way to kill/exit a kernel and return to the bootloader to launch another kernel, while not powering down the hardware?"

kexec

Offline

#15 2017-12-24 10:27:02

seth
Member
Registered: 2012-09-03
Posts: 50,957

Re: [SOLVED] Exiting kernel to grub/bootloader

arx wrote:

I would like to explore other distros on my hardware rather than in a hypervisor/container/cloud env.

arx wrote:

kexec

m0946.gif

kexec swaps the kernel, but not the userspace. In addition *any* testing results, notably reg. hardware coverage, are compromised due to the preconfigured hardware.
I'll put it nicely, because it's x-mas: this is absolute nonsense.

Offline

#16 2017-12-24 12:25:38

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] Exiting kernel to grub/bootloader

Kexec is not the same as "exiting" to boot loader. Is the CPU operating mode even the same between bootloader and a running kernel? Can the cpu be put back into the mode used in the bootloader?

I would also have a use for exiting to bootloader, I have searched if it was possible and came up empty and reached the conclusion that its just easier to reboot the machine and let it go through all the motions before booting another OS/kernel.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#17 2017-12-24 12:41:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] Exiting kernel to grub/bootloader

I'd like to approach this from a different direction.  Arx, you compare rebooting to change OSs to restarting a browser to visit a different web page.  That is actually a useful analogy as it can show the differences between the two processes.  When you open a browser and visit a webpage, the browser continues to run.  You can close the webpage and/or navigate to another one, all the while the browser continues to run.  This is a reasonable metaphore for how an operating system works: the OS (browser) boots and allows you run some program (webpage) and the OS continues to run in the background.  You can close the first program and start another (or start many at one time) because the OS is still running in the background.

However, this is not at all how a bootloader works.  When the bootloader loads an OS, it hands everything over to the OS.  The bootloader does not continue to run in the background waiting for the OS to be done.  It's gone.  If you were to exit the OS, there would be no running bootloader there to go back to.

There is a bit of a hybrid bootloader OS though if you want: it's called a hypervisor.  Though you've already ruled out this option.

Last edited by Trilby (2017-12-24 12:43:06)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB