<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
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.<br>
<br>
As for debugging what blocks the shutdown, here are a few clues <br>
<br>
* does "systemctl reboot -f" stop the system correctly ?<br>
if yes, one of your daemons is blocking the shutdown, check all
the printed logs for a "Stopping XXXX" with no corresponding "Stoped
XXX"<br>
try stopping manually that service and debug what's going on with
it<br>
* does "systemctl reboot -f -f" stop shut down the system (this will
not unmount correctly the filesystems and is only for debugging
purpose)<br>
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.<br>
<br>
Jérémy<br>
<br>
<div class="moz-cite-prefix">On 30/03/2017 10:47, Lennart Poettering
wrote:<br>
</div>
<blockquote cite="mid:20170330084738.GA20207@gardel-login"
type="cite">
<pre wrap="">On Tue, 07.03.17 03:15, lin webber (<a class="moz-txt-link-abbreviated" href="mailto:webberlin@outlook.com">webberlin@outlook.com</a>) wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap="">
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
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<div style="border-bottom: 1px solid #ccd4d7; margin:0 10px 10px
0; width:600px"> </div>
<div>
<table style="; padding: 15px 0 0 0" border="0">
<tbody>
<tr>
<td style="font-size:11px; color:#56707d; text-align:
center; "> <a href="http://www.smile.fr/"><img
src="cid:part1.04986A67.93E5FF1A@smile.fr"
alt="Logo" height="47" width="129"></a><br>
<br>
<font face="century gothic, arial, sans-serif">20 rue
des Jardins<br>
92600 Asnières-sur-Seine<br>
<a href="http://www.smile.fr/" style="font-size:14px;
color:#ec6608 ; text-decoration:none;">www.smile.fr</a></font>
</td>
<td style="padding-left:35px; font-size:12px;
color:#56707d">
<div style="color:#153358; font-size:12px;"><font
face="century gothic, arial, sans-serif"><b>Jérémy
ROSEN</b></font></div>
<div style="color:#117eb4; font-size:12px;"><font
face="century gothic, arial, sans-serif">Architecte
technique<br>
</font></div>
<div style="color:#56707d; font-size:12px;"><font
face="century gothic, arial, sans-serif">Email : <a
href="mailto:jeremy.rosen@smile.fr"
style="color:#56707d; font-size:12px;
text-decoration:none;">jeremy.rosen@smile.fr</a> <br>
Tel : +33141402967 </font></div>
<br>
<div> <span><a
href="https://www.facebook.com/smileopensource"><img
src="cid:part5.81BD4EAC.23C2793D@smile.fr"
alt="Facebook" height="24" width="25"></a></span>
<span><a
href="http://fr.slideshare.net/SmileOpenSource/presentations"><img
src="cid:part7.53A5D103.E499FFF1@smile.fr"
alt="Google%2B" height="24" width="25"></a></span>
<span><a href="https://www.linkedin.com/company/smile"><img
src="cid:part9.B875F094.0D0F76B2@smile.fr"
alt="LinkedIn" height="24" width="25"></a></span>
<span><a href="https://twitter.com/GroupeSmile"><img
src="cid:part11.9BA27BF2.701B4A60@smile.fr"
alt="Twitter" height="24" width="25"></a></span>
</div>
</td>
</tr>
</tbody>
</table>
<div style="border-bottom: 1px solid #ccd4d7; margin:0 10px 0 0;
width:600px"> </div>
<br>
<div> <a
href="http://www.smile.fr/Offres-services/Offres/Ingenierie?utm_source=signature&utm_medium=email&utm_campaign=signature"><img
src="cid:part13.6918F8E1.1963534F@smile.fr"
alt="bandeaux_mail" border="0"></a></div>
<br>
<div style="color:#a3acb5; font-size:10px;"> <img
src="cid:part15.DFA08807.B0868B0C@smile.fr" alt="eco"
height="11" width="13"> <font face="century gothic, arial,
sans-serif"> Pour la planète, n'imprimez ce mail que si
c'est nécessaire </font> </div>
</div>
</div>
</body>
</html>