[systemd-devel] systemd reboot problem
Jérémy Rosen
jeremy.rosen at smile.fr
Fri Mar 31 12:49:31 UTC 2017
Note that if you are calling from C code, you might want to call it
through the Dbus API, rather than the "system" system call.
As for debugging what blocks the shutdown, here are a few clues
* does "systemctl reboot -f" stop the system correctly ?
if yes, one of your daemons is blocking the shutdown, check all the
printed logs for a "Stopping XXXX" with no corresponding "Stoped XXX"
try stopping manually that service and debug what's going on with it
* does "systemctl reboot -f -f" stop shut down the system (this will not
unmount correctly the filesystems and is only for debugging purpose)
if that does not stop the system, your problem is at the
kernel/hardware level. More specifically, your kernel does not know how
to turn the power off on your system.
Jérémy
On 30/03/2017 10:47, Lennart Poettering wrote:
> On Tue, 07.03.17 03:15, lin webber (webberlin at outlook.com) wrote:
>
>> I use “system("reboot")” in my C program and system does not shutdown.I think that systemd is waiting for some services to shutdown which can't shutdown immediately.
>> But I don't want to wait for those services to shutdown.How can I shutdown my system immediately in my C program.which API should I call?
>> Thank you for reply.
> There are several ways to reboot your system:
>
> 1) use the raw reboot() syscall. In this case file systems might end
> up being dirty, and some more complex daemons might not like it
> either.
>
> 2) Use "systemctl reboot -ff", which is pretty much the same as #1,
> but accessible from the shell.
>
> 3) Use "systemctl reboot -f", which is a slightly friendlier version
> than the above. In this mode, systemd won't bother with stopping
> services correctly (instead it will just SIGTERM them all and
> SIGKILL what is left then). However it will still place all file
> systems in a clean state before issuing reboot().
>
> 4) Use "systemctl reboot", which is the friendliest version and
> correctly shuts down all services, i.e. is equivalent to plain
> "reboot" the way you already tried.
>
>
> Unless you have a completely stateless system with all file systems
> either read-only or formatted on each boot #3 is the vastly better
> option than #1/#2.
>
> Lennart
>
--
Logo <http://www.smile.fr/>
20 rue des Jardins
92600 Asnières-sur-Seine
www.smile.fr <http://www.smile.fr/>
*Jérémy ROSEN*
Architecte technique
Email : jeremy.rosen at smile.fr <mailto:jeremy.rosen at smile.fr>
Tel : +33141402967
Facebook <https://www.facebook.com/smileopensource> Google%2B
<http://fr.slideshare.net/SmileOpenSource/presentations> LinkedIn
<https://www.linkedin.com/company/smile> Twitter
<https://twitter.com/GroupeSmile>
bandeaux_mail
<http://www.smile.fr/Offres-services/Offres/Ingenierie?utm_source=signature&utm_medium=email&utm_campaign=signature>
eco Pour la planète, n'imprimez ce mail que si c'est nécessaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Logo.png
Type: image/png
Size: 3775 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Facebook.png
Type: image/png
Size: 835 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Slideshare.png
Type: image/png
Size: 967 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LinkedIn.png
Type: image/png
Size: 816 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Twitter.png
Type: image/png
Size: 989 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OW_devient_Smile_ECS.png
Type: image/png
Size: 83679 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eco.png
Type: image/png
Size: 267 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170331/9804d487/attachment-0013.png>
More information about the systemd-devel
mailing list