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

Lennart Poettering lennart at poettering.net
Fri Apr 10 08:58:59 PDT 2015


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.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list