[systemd-devel] issuing 'reboot' command does not print the familiar 'Restarting system.' message

Ani Sinha ani at arista.com
Fri Apr 10 12:35:27 PDT 2015


On Fri, Apr 10, 2015 at 10:18 AM, Ani Sinha <ani at arista.com> wrote:
> Thanks Lennart for the clarification. Much appreciated!
>
> Ani
>
>
> On Fri, Apr 10, 2015 at 8:58 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
>> On Fri, 10.04.15 08:40, Ani Sinha (ani at arista.com) wrote:
>>
>>> On Fri, Apr 10, 2015 at 1:13 AM, Daniel Mack <daniel at zonque.org> wrote:
>>> > On 04/10/2015 04:18 AM, Ani Sinha wrote:
>>> >> OK I have one more question. Does every call path in the reboot
>>> >> command use the Linux reboot() sys call? I'm not familiar with dbus
>>> >> stuff but looking at the code seems to indicate that there might be
>>> >> some paths where reboot() is not issued. Just wanted to run by you
>>> >> guys since you guys know the code best.
>>> >
>>> > The reboot command is symlinked to systemctl, which is a multi-call
>>> > binary. When invoked as 'reboot', 'shutdown', 'halt', 'poweroff' etc, it
>>> > communicates with PID1 and tells it to start one of the shutdown
>>> > targets. This way, the system will shut down and stop services in a
>>> > clean way. Once the target is reached, the reboot() syscall is issued to
>>> > the kernel.
>>>
>>> Can you please point me to the code and function call that processes
>>> the 'reboot' target from PID 1?
>>
>> reboot.target pulls in systemd-reboot.service, which wraps
>> "/usr/bin/systemctl --force reboot", which issues the Reboot() call on
>> PID1's bus API, which causes it to execute /usr/lib/systemd-shutdown
>> as PID 1 which then kills everything and reboots.

OK I see it now. shutdownd.c eventually issues 'shutdown -r now'. This
gets parsed by shutdown_parse_argv(). Eventually we end up calling
halt_main() ->halt_now() ->reboot(RB_AUTOBOOT).

good stuff!


More information about the systemd-devel mailing list