New: kexec fails due to missing /usr/sbin/shutdown
https://bugs.busybox.net/show_bug.cgi?id=8331
Summary: kexec fails due to missing /usr/sbin/shutdown
Product: buildroot
Version: 2015.05
Platform: PC
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P5
Component: Other
AssignedTo: unassigned at buildroot.uclibc.org
ReportedBy: ian_ormshaw at waters.com
CC: buildroot at uclibc.org
Estimated Hours: 0.0
Chaining a new kernel using kexec fails as /usr/sbin/shutdown is missing.
creating a link in the skeleton, or overlay file system from /usr/sbin/shutdown to /sbin/shutdown fixes the problem.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
https://bugs.busybox.net/show_bug.cgi?id=8331
Peter Korsgaard <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #1 from Peter Korsgaard <[email protected]> 2015-09-13 20:20:49 UTC --- Hmm, looking at the kexec source code I see:
static int my_shutdown(void)
{
char *args[] = {
"shutdown",
"-r",
"now",
NULL
};
execv("/sbin/shutdown", args);
execv("/etc/shutdown", args);
execv("/bin/shutdown", args);
perror("shutdown");
return -1;
}So having shutdown in /sbin seems fine?
Can you please provide more info about your config and what goes wrong?
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #2 from Dr I J Ormshaw <[email protected]> 2015-09-15 07:40:02 UTC --- (In reply to comment #1)
Quoted 19 lines
Hmm, looking at the kexec source code I see:
static int
my_shutdown(void){ char *args[] = { "shutdown", "-r", "now", NULL }; execv("/sbin/shutdown", args); execv("/etc/shutdown", args); execv("/bin/shutdown", args); perror("shutdown"); return -1; }
Quoted 3 lines
So having shutdown in /sbin seems fine?
Can you please provide more info about your config and what goes wrong?
The problem is that there is no shutdown in /sbin, shutdown is in /usr/sbin. I had to create a link in /sbin to /usr/sbin/shutdown.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #3 from Dr I J Ormshaw <[email protected]> 2015-09-15 07:48:18 UTC --- (In reply to comment #2)
Quoted 20 lines
(In reply to comment #1)
Quoted 19 lines
Hmm, looking at the kexec source code I see:
static int
my_shutdown(void){ char *args[] = { "shutdown", "-r", "now", NULL }; execv("/sbin/shutdown", args); execv("/etc/shutdown", args); execv("/bin/shutdown", args); perror("shutdown"); return -1; }
Quoted 6 lines
Quoted 3 lines
So having shutdown in /sbin seems fine?
Can you please provide more info about your config and what goes wrong?
The problem is that there is no shutdown in /sbin, shutdown is in
/usr/sbin. I had to create a link in /sbin to/usr/sbin/shutdown.
I also raised a similay bug report 8336, to which I had a responce citing
http://patchwork.ozlabs.org/patch/514750/ as a fix. That patch should also fix this bug.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #4 from Peter Korsgaard <[email protected]> 2015-09-15 08:20:52 UTC --- (In reply to comment #2)
Quoted 4 lines
Quoted 1 line
Can you please provide more info about your config and what goes wrong?
The problem is that there is no shutdown in /sbin, shutdown is in
/usr/sbin. I had to create a link in /sbin to/usr/sbin/shutdown.
Ok, what package do you have providing /usr/sbin/shutdown? I see that busybox doesn't provide a shutdown applet at all (it does provide halt/poweroff/reboot though).
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #5 from Dr I J Ormshaw <[email protected]> 2015-09-15 08:28:17 UTC --- (In reply to comment #4)
Quoted 9 lines
(In reply to comment #2)
Quoted 4 lines
Quoted 1 line
Can you please provide more info about your config and what goes wrong?
The problem is that there is no shutdown in /sbin, shutdown is in
/usr/sbin. I had to create a link in /sbin to/usr/sbin/shutdown.Ok, what package do you have providing
/usr/sbin/shutdown? I see that busybox doesn't provide a shutdown applet at all (it does provide halt/poweroff/reboot though).
Systemd is providing /usr/sbin/shutdown
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #6 from Vicente Olivert Riera <[email protected]> 2015-09-15 09:22:22 UTC --- (In reply to comment #0)
Quoted 1 line
Chaining a new kernel using kexec fails as
/usr/sbin/shutdownis missing.
That's not correct. /usr/sbin/shutdown does exists. The problem is that kexec is trying to find it at /sbin instead of /usr/sbin.
(In reply to comment #3)
Quoted 3 lines
I also raised a similay bug report 8336, to which I had a responce citing
http://patchwork.ozlabs.org/patch/514750/ as a fix. That patch should also fix this bug.
Currently in Buildroot there are two ways to have shutdown installed in your target. The first one is using sysvinit as you init system, which will install shutdown in /sbin. The second one is using systemd as your init system, which will install shutdown in /usr/sbin.
Once we get the patch from Yann merged, kexec will be able to find shutdown because /sbin will be a symlink to /usr/sbin if you use systemd as your init system. So, yes, that patches fixes your problem.
The thing is that here we have highlighted a different problem. Busybox doesn't install shutdown, so kexec will never be able to find it, either if you have /sbin as a real directory or being a symlink to /usr/sbin. It simply doesn't exist.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #7 from Peter Korsgaard <[email protected]> 2015-09-15 09:41:50 UTC --- (In reply to comment #5)
Quoted 1 line
Systemd is providing
/usr/sbin/shutdown
Ok, so there's two issues:
- Not all of our init implementations provide shutdown (busybox doesn't, sysvinit has /sbin/shutdown, systemd has /usr/sbin/shutdown
- Systemd doesn't install it where kexec looks for it
I see that kexec-lite doesn't have such code.
I've never used kexec, but looking at the kexec code I'm not sure what the shutdown code is for, it seems to just be a wrapper around shutting down that isn't normally used (as it gets checked before do_exec).
What is your use case for needing it?
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #8 from Vicente Olivert Riera <[email protected]> 2015-09-15 09:42:19 UTC --- By the way, is this helpful for you?
http://unix.stackexchange.com/questions/37323/kexec-from-within-initramfs
From the kexec man page:
-e (--exec)
Run the currently loaded kernel. Note that it will reboot into the loaded kernel without calling shutdown(8).
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #9 from Vicente Olivert Riera <[email protected]> 2015-09-15 09:46:10 UTC --- (In reply to comment #7)
Quoted 1 line
What is your use case for needing it?
I think he is loading a new kernel image using "kexec --load", and then he wants to reboot the board in order to boot with that kernel image, which should be able to do it with "kexec --exec", without calling shutdown.
Dr I J Ormshaw, please confirm.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #10 from Dr I J Ormshaw <[email protected]> 2015-09-15 11:25:10 UTC --- I was trying
/usr/sbin/kexec --command-line="@kernelCommandLine@" "${mountPoint}"/boot/@kernelName@
Using kexec -l followed bu kexec -e will not shut down services correctly.
but I think I should be able to use:
kexec -l
followed by
systemctl isolate kexec.target
to achieve what I want, as I think systemd should kexec the loaded kernel once services are shutdown.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
Vicente Olivert Riera <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Summary|kexec fails due to missing |kexec wants shutdown in
|/usr/sbin/shutdown |/sbin, but systemd installs
| |it in /usr/sbin--- Comment #11 from Vicente Olivert Riera <[email protected]> 2015-09-15 13:05:52 UTC --- (In reply to comment #10)
Quoted 1 line
Using kexec -l followed bu kexec -e will not shut down services correctly.
Well, but that's because you are using systemd, right? That would work with busybox.
Quoted 10 lines
but I think I should be able to use:
kexec -l
followed by
systemctl isolate kexec.target
to achieve what I want, as I think systemd should kexec the loaded kernel once services are shutdown.
Or, in the meantime, you can create the symlink to workaround the problem until the patch from Yann gets applied.
You could also send a patch to kexec upstream in order to add...
execv("/usr/sbin/shutdown", args);
...to the my_shutdown() function, so it would also work on systemd although you don't have the /bin, /sbin and /lib symlinks stuff.
So, to summarize and make progress on this issue:
- systemd: symlink workaround until Yann's patch OR fix kexec upstream
- sysvinit: already works
- busybox: use "kexec -e"
Should we mark this bug as RESOLVED DUPLICATE (of #8336), Peter? For busybox you can use the "-e (--exec)" option
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
--- Comment #12 from Vicente Olivert Riera <[email protected]> 2015-09-15 13:07:58 UTC --- (In reply to comment #11)
Quoted 1 line
For busybox you can use the "-e (--exec)" option
Ignore that line (the last one of my previous comment). I forgot to remove it before sending my message.
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
[Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin
In reply to bugzilla at busybox.nethttps://bugs.busybox.net/show_bug.cgi?id=8331
Thomas Petazzoni <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE--- Comment #13 from Thomas Petazzoni <[email protected]> 2015-10-14 09:44:55 UTC ---
*** This bug has been marked as a duplicate of bug 8336 ***
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.