* How to exit from linux kernel and return to then grub?
@ 2014-05-18 5:33 Z C
2014-05-18 14:43 ` Lennart Sorensen
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Z C @ 2014-05-18 5:33 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
If I boot into a linux kernel using a grub command like "linux /vmlinuz;
inirtd /initrd; boot", how do I shutdown linux itself (but do not power off
or reboot the computer hardware) and return back to the grub directly?
What I meant is something equivalent to the "exit" command in most shells:
If you are within one shell and you enter another shell, then if you want
to quit the second shell and return back to the first shell, just simply
type exit. All env variables and commands you previous typed in the first
shell are completely intact.
Suppose I am now in the grub shell, and then I boot into a tiny linux
kernel, say, a busybox shell, then what can I do to exit the second shell
(i.e. busybox shell) and return to the first shell (i.e. grub shell)? Of
course I can enter the grub shell again by simply rebooting the hardware,
but this is not what I want.
[-- Attachment #2: Type: text/html, Size: 969 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to exit from linux kernel and return to then grub?
2014-05-18 5:33 How to exit from linux kernel and return to then grub? Z C
@ 2014-05-18 14:43 ` Lennart Sorensen
2014-05-18 17:16 ` SevenBits
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Lennart Sorensen @ 2014-05-18 14:43 UTC (permalink / raw)
To: The development of GNU GRUB
On Sun, May 18, 2014 at 01:33:15PM +0800, Z C wrote:
> If I boot into a linux kernel using a grub command like "linux /vmlinuz;
> inirtd /initrd; boot", how do I shutdown linux itself (but do not power off
> or reboot the computer hardware) and return back to the grub directly?
>
> What I meant is something equivalent to the "exit" command in most shells:
> If you are within one shell and you enter another shell, then if you want
> to quit the second shell and return back to the first shell, just simply
> type exit. All env variables and commands you previous typed in the first
> shell are completely intact.
>
> Suppose I am now in the grub shell, and then I boot into a tiny linux
> kernel, say, a busybox shell, then what can I do to exit the second shell
> (i.e. busybox shell) and return to the first shell (i.e. grub shell)? Of
> course I can enter the grub shell again by simply rebooting the hardware,
> but this is not what I want.
Once linux boots, it does not preserve the boot loader in memory (whyever
would it do that?)
If you want to invent a way to load grub using kexec so you can switch
back to grub fropm a running linux system, well have fun, but why bother?
Where is the use? It is so hard to deal with what the state of all the
hardware is without doing a reset.
--
Len Sorensen
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to exit from linux kernel and return to then grub?
2014-05-18 5:33 How to exit from linux kernel and return to then grub? Z C
2014-05-18 14:43 ` Lennart Sorensen
@ 2014-05-18 17:16 ` SevenBits
2014-05-18 17:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-05-18 17:23 ` SevenBits
2014-05-18 17:59 ` Chris Jones
3 siblings, 1 reply; 7+ messages in thread
From: SevenBits @ 2014-05-18 17:16 UTC (permalink / raw)
To: The development of GNU GRUB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/18/2014 01:33 AM, Z C wrote:
> If I boot into a linux kernel using a grub command like "linux
> /vmlinuz; inirtd /initrd; boot", how do I shutdown linux itself
> (but do not power off or reboot the computer hardware) and return
> back to the grub directly?
You can't.
>
> What I meant is something equivalent to the "exit" command in most
> shells: If you are within one shell and you enter another shell,
> then if you want to quit the second shell and return back to the
> first shell, just simply type exit. All env variables and commands
> you previous typed in the first shell are completely intact.
>
> Suppose I am now in the grub shell, and then I boot into a tiny
> linux kernel, say, a busybox shell, then what can I do to exit the
> second shell (i.e. busybox shell) and return to the first shell
> (i.e. grub shell)? Of course I can enter the grub shell again by
> simply rebooting the hardware, but this is not what I want.
When Linux boots, the kernel takes over the management of the computer
completely. The boot loader is not preserved in memory. Why would it
be? The function of the boot loader really is to just boot up the
computer and then get the heck out.
There are many, many obstacles to implementing something like this.
Not to mention the fact that in order to return to GRUB, you would
need to set the processor to return from protected mode into real
mode. All modern processors can do from real mode to protected mode
(which you must do to enabled 32 bit processing).
So, no. It isn't possible.
>
>
>
> _______________________________________________ Grub-devel mailing
> list Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJTeOrsAAoJEFbRvtGxmFPEkRcIAIXPLokSPvjmBW/1xCVdsOqn
3AP7ZP/IQwNsFvvXUWczpjGDZAZIWSykHdB0zTl7xIYeT9cwEqzgVcZxNnV7riUr
lAKc8viq1ZpZpwR+9k3KOFXzeL63tpNOi2JYaRxnsVHuk/s7ASoDD80KfO+LoqYd
BoJ5XL/yxhYy7EoKkHAElgSQ68RFg3pdix2q4tjN205WvJoP1nfakITyhdiifxLW
Dm7l6LFUv2wn7HWpvJw722UHz6M5/wenXNLZwHejp/561gW+hiKzhT5pTs//p4y/
NOqFrY9W+Q5z8PyIH0AYFDCDmg6Pi04dezEoEGr4c4SFs2N9weMRlVnJpqN48pc=
=rftU
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to exit from linux kernel and return to then grub?
2014-05-18 5:33 How to exit from linux kernel and return to then grub? Z C
2014-05-18 14:43 ` Lennart Sorensen
2014-05-18 17:16 ` SevenBits
@ 2014-05-18 17:23 ` SevenBits
2014-05-18 17:59 ` Chris Jones
3 siblings, 0 replies; 7+ messages in thread
From: SevenBits @ 2014-05-18 17:23 UTC (permalink / raw)
To: The development of GNU GRUB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Actually, a correction to what I just said. A processor can return
from protected mode to real mode. Read more here:
https://en.wikipedia.org/wiki/Protected_mode#Entering_and_exiting_protected_mode
I don't know if GRUB supports this (I would assume not) but generally
speaking it is still not possible to do what you want because the
Linux kernel as far as I know does not have the functionality that
would be required. If you want to try and do this, go ahead and
attempt it, but the roadblocks will be so large that it probably is
not worth trying, and just simply rebooting the machine is the best
way to get to GRUB.
If you tell us what are _trying_ to do, i.e what you need this
functionality for, perhaps we can suggest an alternative way to
achieve what you need.
- -- SevenBits
P.S: Since this topic is not about the development of GRUB, it
probably doesn't belong in this list. Please consider posting to
grub-users instead.
On 05/18/2014 01:33 AM, Z C wrote:
> If I boot into a linux kernel using a grub command like "linux
> /vmlinuz; inirtd /initrd; boot", how do I shutdown linux itself
> (but do not power off or reboot the computer hardware) and return
> back to the grub directly?
>
> What I meant is something equivalent to the "exit" command in most
> shells: If you are within one shell and you enter another shell,
> then if you want to quit the second shell and return back to the
> first shell, just simply type exit. All env variables and commands
> you previous typed in the first shell are completely intact.
>
> Suppose I am now in the grub shell, and then I boot into a tiny
> linux kernel, say, a busybox shell, then what can I do to exit the
> second shell (i.e. busybox shell) and return to the first shell
> (i.e. grub shell)? Of course I can enter the grub shell again by
> simply rebooting the hardware, but this is not what I want.
>
>
>
> _______________________________________________ Grub-devel mailing
> list Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJTeOyJAAoJEFbRvtGxmFPEykoH/3cw/hYn+kdJLKrJeTh9SgJy
+2z8KKbPgX5H71NqUUAN7bU5yE+AyAvVh2F8K9PAk1HxVFu3edGD6Wmr4DRnwY6m
i9nS+gnq+5enS/9xj7LHtvuEm/6xbYJkI54i9U6EGYBR6gJneRkd2yoJqmJsKUum
eh7TIjTmrXPW6Kd2ZcoO7GyR/hjR+GWNDQRJeaVmj2wlZM00et+ei3AXzpvOzJ3l
9IOd3gkhkkt77DxYFPkxnJk7HtsHl1rnvqW4ct07ByzlFgCsFo8/ddbgEE6l6Zlm
U1OvndApeofKoznXtNmrMpquHhqnTE9mr8asIua5962s9HdBkxPtHU+4a0VvBYw=
=QTsj
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to exit from linux kernel and return to then grub?
2014-05-18 17:16 ` SevenBits
@ 2014-05-18 17:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-05-18 17:52 ` SevenBits
0 siblings, 1 reply; 7+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2014-05-18 17:46 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 2423 bytes --]
On 18.05.2014 19:16, SevenBits wrote:
> On 05/18/2014 01:33 AM, Z C wrote:
>> If I boot into a linux kernel using a grub command like "linux
>> /vmlinuz; inirtd /initrd; boot", how do I shutdown linux itself
>> (but do not power off or reboot the computer hardware) and return
>> back to the grub directly?
>
> You can't.
>
>
>> What I meant is something equivalent to the "exit" command in most
>> shells: If you are within one shell and you enter another shell,
>> then if you want to quit the second shell and return back to the
>> first shell, just simply type exit. All env variables and commands
>> you previous typed in the first shell are completely intact.
>
>> Suppose I am now in the grub shell, and then I boot into a tiny
>> linux kernel, say, a busybox shell, then what can I do to exit the
>> second shell (i.e. busybox shell) and return to the first shell
>> (i.e. grub shell)? Of course I can enter the grub shell again by
>> simply rebooting the hardware, but this is not what I want.
>
> When Linux boots, the kernel takes over the management of the computer
> completely. The boot loader is not preserved in memory. Why would it
> be? The function of the boot loader really is to just boot up the
> computer and then get the heck out.
>
> There are many, many obstacles to implementing something like this.
> Not to mention the fact that in order to return to GRUB, you would
> need to set the processor to return from protected mode into real
> mode. All modern processors can do from real mode to protected mode
> (which you must do to enabled 32 bit processing).
>
Please update your sources. Last CPU that behaved like this is 286. 386
and later can switch between modes in any direction.
GRUB itself run in protected (but not paged mode) and switches to real
mode to call BIOS functions.
"Returning" to GRUB would be technically feasible but very cumbersome.
Original requester didn't even tell what his end goal is and it probably
can be achieved in much less cumbersome way.
> So, no. It isn't possible.
>
>
>
>
>> _______________________________________________ Grub-devel mailing
>> list Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> .
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 274 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to exit from linux kernel and return to then grub?
2014-05-18 17:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2014-05-18 17:52 ` SevenBits
0 siblings, 0 replies; 7+ messages in thread
From: SevenBits @ 2014-05-18 17:52 UTC (permalink / raw)
To: The development of GNU GRUB
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/18/2014 01:46 PM, Vladimir '?-coder/phcoder' Serbinenko wrote:
> On 18.05.2014 19:16, SevenBits wrote:
>> On 05/18/2014 01:33 AM, Z C wrote:
>>> If I boot into a linux kernel using a grub command like "linux
>>> /vmlinuz; inirtd /initrd; boot", how do I shutdown linux
>>> itself (but do not power off or reboot the computer hardware)
>>> and return back to the grub directly?
>>
>> You can't.
>>
>>
>>> What I meant is something equivalent to the "exit" command in
>>> most shells: If you are within one shell and you enter another
>>> shell, then if you want to quit the second shell and return
>>> back to the first shell, just simply type exit. All env
>>> variables and commands you previous typed in the first shell
>>> are completely intact.
>>
>>> Suppose I am now in the grub shell, and then I boot into a
>>> tiny linux kernel, say, a busybox shell, then what can I do to
>>> exit the second shell (i.e. busybox shell) and return to the
>>> first shell (i.e. grub shell)? Of course I can enter the grub
>>> shell again by simply rebooting the hardware, but this is not
>>> what I want.
>>
>> When Linux boots, the kernel takes over the management of the
>> computer completely. The boot loader is not preserved in memory.
>> Why would it be? The function of the boot loader really is to
>> just boot up the computer and then get the heck out.
>>
>> There are many, many obstacles to implementing something like
>> this. Not to mention the fact that in order to return to GRUB,
>> you would need to set the processor to return from protected mode
>> into real mode. All modern processors can do from real mode to
>> protected mode (which you must do to enabled 32 bit processing).
>>
> Please update your sources. Last CPU that behaved like this is 286.
> 386 and later can switch between modes in any direction.
Hi, yes, I actually realized this and posted an addendum to this
message shortly afterwards. I don't know if you received it, but here
is what I wrote:
> Actually, a correction to what I just said. A processor can return
> from protected mode to real mode. Read more here:
>
> https://en.wikipedia.org/wiki/Protected_mode#Entering_and_exiting_protected_mode
>
> I don't know if GRUB supports this (I would assume so) but
> generally speaking it is still not possible to do what you want
> because the Linux kernel as far as I know does not have the
> functionality that would be required. If you want to try and do
> this, go ahead and attempt it, but the roadblocks will be so large
> that it probably is not worth trying, and just simply rebooting the
> machine is the best way to get to GRUB.
>
> If you tell us what are _trying_ to do, i.e what you need this
> functionality for, perhaps we can suggest an alternative way to
> achieve what you need.
So, yes, I realized after I posted my message that what I said was
wrong. My apologies.
> GRUB itself run in protected (but not paged mode) and switches to
> real mode to call BIOS functions. "Returning" to GRUB would be
> technically feasible but very cumbersome. Original requester didn't
> even tell what his end goal is and it probably can be achieved in
> much less cumbersome way.
My thoughts exactly.
>> So, no. It isn't possible.
>>
>>
>>
>>
>>> _______________________________________________ Grub-devel
>>> mailing list Grub-devel@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/grub-devel
>>
>>
>> _______________________________________________ Grub-devel
>> mailing list Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel .
>>
>
>
>
>
> _______________________________________________ Grub-devel mailing
> list Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJTePN6AAoJEFbRvtGxmFPE7coH/12UTfimb2bONnDsJY3dFbTu
Ti/xJ85n60fk3DFdCZ03ksqXfzGLjCeMHK8CzyhSCsUr7yFSAgB/9wEnxyc1XDDM
4msE6864xWHlzGSwzGkDyzdbbe0GiPIEGeVbgsnACsSF9JzsC3H08Y6bBF6DOF75
hGkgSJff8Su6oGTZPJpRV99MaKdThjgQkU6B7olOpGSbIzhf6/mrlCfTkJh14bdu
PqsnVcdTSR8xkiZjn5aUGRkXapwl2IE+2jE+lmrFZRWDSRsCggykESa7gMUArCvg
aTd66lj1gex6LmmujT9tsxwewYQnBYZC6JcXQB3KamISaJghPhB8eVvA5Ps3V2I=
=G998
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to exit from linux kernel and return to then grub?
2014-05-18 5:33 How to exit from linux kernel and return to then grub? Z C
` (2 preceding siblings ...)
2014-05-18 17:23 ` SevenBits
@ 2014-05-18 17:59 ` Chris Jones
3 siblings, 0 replies; 7+ messages in thread
From: Chris Jones @ 2014-05-18 17:59 UTC (permalink / raw)
To: grub-devel
On Sun, May 18, 2014 at 01:33:15AM EDT, Z C wrote:
[..]
> If you are within one shell and you enter another shell, then if you want
> to quit the second shell and return back to the first shell, just simply
> type exit. All env variables and commands you previous typed in the first
> shell are completely intact.
A more valid metaphor would be to start an xterm (or such)... type 'exec
bash'.. type 'exit'... see what happens.
CJ
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-05-18 17:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-18 5:33 How to exit from linux kernel and return to then grub? Z C
2014-05-18 14:43 ` Lennart Sorensen
2014-05-18 17:16 ` SevenBits
2014-05-18 17:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-05-18 17:52 ` SevenBits
2014-05-18 17:23 ` SevenBits
2014-05-18 17:59 ` Chris Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).