Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown
@ 2015-09-11 10:05 bugzilla at busybox.net
  2015-09-13 20:20 ` [Buildroot] [Bug 8331] " bugzilla at busybox.net
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-11 10:05 UTC (permalink / raw)
  To: buildroot

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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
@ 2015-09-13 20:20 ` bugzilla at busybox.net
  2015-09-15  7:40 ` bugzilla at busybox.net
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-13 20:20 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

Peter Korsgaard <jacmet@uclibc.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #1 from Peter Korsgaard <jacmet@uclibc.org> 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?

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
  2015-09-13 20:20 ` [Buildroot] [Bug 8331] " bugzilla at busybox.net
@ 2015-09-15  7:40 ` bugzilla at busybox.net
  2015-09-15  7:48 ` bugzilla at busybox.net
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  7:40 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #2 from Dr I J Ormshaw <ian_ormshaw@waters.com> 2015-09-15 07:40:02 UTC ---
(In reply to comment #1)
> 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?

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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
  2015-09-13 20:20 ` [Buildroot] [Bug 8331] " bugzilla at busybox.net
  2015-09-15  7:40 ` bugzilla at busybox.net
@ 2015-09-15  7:48 ` bugzilla at busybox.net
  2015-09-15  8:20 ` bugzilla at busybox.net
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  7:48 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #3 from Dr I J Ormshaw <ian_ormshaw@waters.com> 2015-09-15 07:48:18 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > 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?
> 
> 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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (2 preceding siblings ...)
  2015-09-15  7:48 ` bugzilla at busybox.net
@ 2015-09-15  8:20 ` bugzilla at busybox.net
  2015-09-15  8:28 ` bugzilla at busybox.net
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  8:20 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #4 from Peter Korsgaard <jacmet@uclibc.org> 2015-09-15 08:20:52 UTC ---
(In reply to comment #2)
> > 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).

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (3 preceding siblings ...)
  2015-09-15  8:20 ` bugzilla at busybox.net
@ 2015-09-15  8:28 ` bugzilla at busybox.net
  2015-09-15  9:22 ` bugzilla at busybox.net
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  8:28 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #5 from Dr I J Ormshaw <ian_ormshaw@waters.com> 2015-09-15 08:28:17 UTC ---
(In reply to comment #4)
> (In reply to comment #2)
> > > 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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (4 preceding siblings ...)
  2015-09-15  8:28 ` bugzilla at busybox.net
@ 2015-09-15  9:22 ` bugzilla at busybox.net
  2015-09-15  9:41 ` bugzilla at busybox.net
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  9:22 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #6 from Vicente Olivert Riera <vincent.riera@imgtec.com> 2015-09-15 09:22:22 UTC ---
(In reply to comment #0)
> Chaining a new kernel using kexec fails as /usr/sbin/shutdown is 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)
> 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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (5 preceding siblings ...)
  2015-09-15  9:22 ` bugzilla at busybox.net
@ 2015-09-15  9:41 ` bugzilla at busybox.net
  2015-09-15  9:42 ` bugzilla at busybox.net
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  9:41 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #7 from Peter Korsgaard <jacmet@uclibc.org> 2015-09-15 09:41:50 UTC ---
(In reply to comment #5)
> 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?

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (6 preceding siblings ...)
  2015-09-15  9:41 ` bugzilla at busybox.net
@ 2015-09-15  9:42 ` bugzilla at busybox.net
  2015-09-15  9:46 ` bugzilla at busybox.net
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  9:42 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #8 from Vicente Olivert Riera <vincent.riera@imgtec.com> 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).

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (7 preceding siblings ...)
  2015-09-15  9:42 ` bugzilla at busybox.net
@ 2015-09-15  9:46 ` bugzilla at busybox.net
  2015-09-15 11:25 ` bugzilla at busybox.net
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15  9:46 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #9 from Vicente Olivert Riera <vincent.riera@imgtec.com> 2015-09-15 09:46:10 UTC ---
(In reply to comment #7)
> 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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec fails due to missing /usr/sbin/shutdown
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (8 preceding siblings ...)
  2015-09-15  9:46 ` bugzilla at busybox.net
@ 2015-09-15 11:25 ` bugzilla at busybox.net
  2015-09-15 13:05 ` [Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin bugzilla at busybox.net
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15 11:25 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #10 from Dr I J Ormshaw <ian_ormshaw@waters.com> 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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (9 preceding siblings ...)
  2015-09-15 11:25 ` bugzilla at busybox.net
@ 2015-09-15 13:05 ` bugzilla at busybox.net
  2015-09-15 13:07 ` bugzilla at busybox.net
  2015-10-14  9:44 ` bugzilla at busybox.net
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15 13:05 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

Vicente Olivert Riera <vincent.riera@imgtec.com> 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 <vincent.riera@imgtec.com> 2015-09-15 13:05:52 UTC ---
(In reply to comment #10)
> 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.

> 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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (10 preceding siblings ...)
  2015-09-15 13:05 ` [Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin bugzilla at busybox.net
@ 2015-09-15 13:07 ` bugzilla at busybox.net
  2015-10-14  9:44 ` bugzilla at busybox.net
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-09-15 13:07 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

--- Comment #12 from Vicente Olivert Riera <vincent.riera@imgtec.com> 2015-09-15 13:07:58 UTC ---
(In reply to comment #11)
> 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.

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin
  2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
                   ` (11 preceding siblings ...)
  2015-09-15 13:07 ` bugzilla at busybox.net
@ 2015-10-14  9:44 ` bugzilla at busybox.net
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2015-10-14  9:44 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=8331

Thomas Petazzoni <thomas.petazzoni@free-electrons.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #13 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2015-10-14 09:44:55 UTC ---


*** This bug has been marked as a duplicate of bug 8336 ***

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-10-14  9:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11 10:05 [Buildroot] [Bug 8331] New: kexec fails due to missing /usr/sbin/shutdown bugzilla at busybox.net
2015-09-13 20:20 ` [Buildroot] [Bug 8331] " bugzilla at busybox.net
2015-09-15  7:40 ` bugzilla at busybox.net
2015-09-15  7:48 ` bugzilla at busybox.net
2015-09-15  8:20 ` bugzilla at busybox.net
2015-09-15  8:28 ` bugzilla at busybox.net
2015-09-15  9:22 ` bugzilla at busybox.net
2015-09-15  9:41 ` bugzilla at busybox.net
2015-09-15  9:42 ` bugzilla at busybox.net
2015-09-15  9:46 ` bugzilla at busybox.net
2015-09-15 11:25 ` bugzilla at busybox.net
2015-09-15 13:05 ` [Buildroot] [Bug 8331] kexec wants shutdown in /sbin, but systemd installs it in /usr/sbin bugzilla at busybox.net
2015-09-15 13:07 ` bugzilla at busybox.net
2015-10-14  9:44 ` bugzilla at busybox.net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox