View previous topic :: View next topic |
Author |
Message |
fingolfin0 n00b
Joined: 02 Dec 2022 Posts: 3
|
Posted: Fri Dec 02, 2022 5:06 pm Post subject: Error when reboot with kexec |
|
|
Hello, I want to set up rebooting via kexec. I've compiled the kernel width kexec support and installed kexec-tools. When I use reboot -k, it throws the error:
Code: | ERROR: using -k at this runlevel requires also -f
(You probably want instead to reboot normally and let your reboot
script, usually /etc/init.d/reboot, specify -k) |
Output of command runlevel: "N 3".
I read mans -- "reboot", "runlevel", sysvinit wiki page and initscripts chapter from handbook, but I still can’t understand what I am doing wrong. |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3914
|
Posted: Fri Dec 02, 2022 5:18 pm Post subject: |
|
|
Welcome to Gentoo.
Why dont you follow your system's advice
? _________________
|
|
Back to top |
|
|
fingolfin0 n00b
Joined: 02 Dec 2022 Posts: 3
|
Posted: Fri Dec 02, 2022 5:53 pm Post subject: |
|
|
Thanks, alamahant
Because with "-k" option reboot does not proper unmounting, stopping services, etc. I want a normal reboot, but via kexec. In addition, in my case, for some reason reboot -fk does usual reboot through the BIOS. |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1652 Location: South America
|
Posted: Fri Dec 02, 2022 7:21 pm Post subject: |
|
|
fingolfin0 wrote: | Because with "-k" option reboot does not proper unmounting, stopping services, etc. I want a normal reboot, but via kexec. |
In that case, just use reboot without -k. From runlevel 3, the reboot will then go through /etc/inittab, and Gentoo's inittab should trigger a kexec reboot if the kernel supports it. _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
sublogic Apprentice
Joined: 21 Mar 2022 Posts: 266 Location: Pennsylvania, USA
|
Posted: Sat Dec 03, 2022 3:57 am Post subject: |
|
|
fingolfin0, did you run the appropriate "kexec -l" to preload a kernel before rebooting ?
Edited 2022-12-03: Okay, I just tested this on the laptop on which I had to use kexec before. (See topic 1147842)
Back then I did everything from single-user mode, but this time I tried from runlevel 3 (aka default). Something like this:
Code: | # mount -o ro /boot
# kexec -l /boot/vmlinuz-5.15.75-gentoo-x86 --initrd=/boot/initramfs-5.15.75-gentoo-x86.img \
> --append="root=/dev/vg0/root ro dolvm crypt_root=/dev/sda3 hpet=force"
# reboot |
... and, it worked. Orderly shutdown to runlevel S, then normal boot without going through the power-on self test.
The above, especially the "--append", is of course idiosyncratic to my laptop. Also, my kernels now have the final video driver built-in, with the required firmware embedded (see the topic linked above). Otherwise the video hardware wouldn't re-initialize properly, the screen would be all garbled during early userspace, and I would have to guess when cryptsetup was waiting for a passphrase and enter it blind.
YMMV. Anyway, the proper sequence is "kexec -l", then "reboot". Practice from single-user mode first. Good luck. |
|
Back to top |
|
|
sublogic Apprentice
Joined: 21 Mar 2022 Posts: 266 Location: Pennsylvania, USA
|
Posted: Sun Dec 04, 2022 7:51 pm Post subject: |
|
|
Okay, I see what @GDH-gentoo was saying. sys-apps/kexec-tools installs a "kexec" service that will run the "kexec -l" command for you during the shutdown phase. The Gentoo wiki says to start the service, then reboot. (It also says to use "reboot -k", but the "-k" is not necessary, the /etc/inittab does a "/sbin/shutdown -dkn" at runlevel 6.)
Hm. Would it make sense to add the kexec service to runlevel 3 ? |
|
Back to top |
|
|
fingolfin0 n00b
Joined: 02 Dec 2022 Posts: 3
|
Posted: Mon Dec 05, 2022 1:03 pm Post subject: |
|
|
Thans @GDH-gentoo, @sublogic! The gentoo community is very friendly
My problem solved. As @GDH-gentoo said, I can to use reboot without -k. I emphasize that we need to use it without a "-k" option. It turned out that while the reboot -k gives an error, just reboot works correctly.
sublogic wrote: | Hm. Would it make sense to add the kexec service to runlevel 3 ? |
I do not think. The use of a kexec can lead to errors with video divers, so it should not be turned on by default.
Now I see two problems:
1. The wiki page tells to use reboot -k while we need use it without "-k". Do I need to start discussion on that page about this, or maybe I should edit the wiki myself?
2. I don't know why the option is really needed. But it seems to me that it works incorrectly, or an error message is confusing and does not tell the actual reason for the error. Should I create a bugreport?
I like gentoo and want to make it better. |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1652 Location: South America
|
Posted: Mon Dec 05, 2022 4:45 pm Post subject: |
|
|
fingolfin0 wrote: | 1. The wiki page tells to use reboot -k while we need use it without "-k". Do I need to start discussion on that page about this, or maybe I should edit the wiki myself? |
If you have a Wiki account, just edit the article. Correcting wrong information does not require a permission.
fingolfin0 wrote: | 2. I don't know why the option is really needed. But it seems to me that it works incorrectly, or an error message is confusing and does not tell the actual reason for the error. Should I create a bugreport? |
The -k option is needed to request a kexec reboot, if possible, instead of a 'normal' reboot, but it can only be used either in sysvinit runlevel 6, or with -f (i. e. when bypassing the init system). When you run reboot from an interactive shell, you are usually in sysvinit runlevel 3, so you can't use it.
In any runlevel that is not 6, reboot with no options is equivalent to shutdown -r now, which, among other things, asks init to switch to runlevel 6. And then, Gentoo's /etc/inittab specifies that, in runlevel 6, reboot -k be called. _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|