mirror of
https://github.com/systemd/systemd.git
synced 2025-01-03 05:18:09 +03:00
utmp: turn systemd-update-utmp-shutdown.service into a normal runtime service
With this change systemd-update-utmp-shutdown.service is replaced by systemd-update-utmp.service which is started at boot and stays around until shutdown. This allows us to properly order the unit against both /var/log and auditd. https://bugzilla.redhat.com/show_bug.cgi?id=853104 https://bugs.freedesktop.org/show_bug.cgi?id=64365
This commit is contained in:
parent
154ff088d3
commit
3f92e4b4b6
@ -72,7 +72,7 @@ MANPAGES += \
|
|||||||
man/systemd-tmpfiles.8 \
|
man/systemd-tmpfiles.8 \
|
||||||
man/systemd-tty-ask-password-agent.1 \
|
man/systemd-tty-ask-password-agent.1 \
|
||||||
man/systemd-udevd.service.8 \
|
man/systemd-udevd.service.8 \
|
||||||
man/systemd-update-utmp-runlevel.service.8 \
|
man/systemd-update-utmp.service.8 \
|
||||||
man/systemd.1 \
|
man/systemd.1 \
|
||||||
man/systemd.automount.5 \
|
man/systemd.automount.5 \
|
||||||
man/systemd.device.5 \
|
man/systemd.device.5 \
|
||||||
@ -191,7 +191,7 @@ MANPAGES_ALIAS += \
|
|||||||
man/systemd-udevd-control.socket.8 \
|
man/systemd-udevd-control.socket.8 \
|
||||||
man/systemd-udevd-kernel.socket.8 \
|
man/systemd-udevd-kernel.socket.8 \
|
||||||
man/systemd-udevd.8 \
|
man/systemd-udevd.8 \
|
||||||
man/systemd-update-utmp-shutdown.service.8 \
|
man/systemd-update-utmp-runlevel.service.8 \
|
||||||
man/systemd-update-utmp.8 \
|
man/systemd-update-utmp.8 \
|
||||||
man/systemd-user.conf.5
|
man/systemd-user.conf.5
|
||||||
man/SD_ALERT.3: man/sd-daemon.3
|
man/SD_ALERT.3: man/sd-daemon.3
|
||||||
@ -289,8 +289,8 @@ man/systemd-tmpfiles-setup.service.8: man/systemd-tmpfiles.8
|
|||||||
man/systemd-udevd-control.socket.8: man/systemd-udevd.service.8
|
man/systemd-udevd-control.socket.8: man/systemd-udevd.service.8
|
||||||
man/systemd-udevd-kernel.socket.8: man/systemd-udevd.service.8
|
man/systemd-udevd-kernel.socket.8: man/systemd-udevd.service.8
|
||||||
man/systemd-udevd.8: man/systemd-udevd.service.8
|
man/systemd-udevd.8: man/systemd-udevd.service.8
|
||||||
man/systemd-update-utmp-shutdown.service.8: man/systemd-update-utmp-runlevel.service.8
|
man/systemd-update-utmp-runlevel.service.8: man/systemd-update-utmp.service.8
|
||||||
man/systemd-update-utmp.8: man/systemd-update-utmp-runlevel.service.8
|
man/systemd-update-utmp.8: man/systemd-update-utmp.service.8
|
||||||
man/systemd-user.conf.5: man/systemd-system.conf.5
|
man/systemd-user.conf.5: man/systemd-system.conf.5
|
||||||
man/SD_ALERT.html: man/sd-daemon.html
|
man/SD_ALERT.html: man/sd-daemon.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
@ -577,10 +577,10 @@ man/systemd-udevd-kernel.socket.html: man/systemd-udevd.service.html
|
|||||||
man/systemd-udevd.html: man/systemd-udevd.service.html
|
man/systemd-udevd.html: man/systemd-udevd.service.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
|
|
||||||
man/systemd-update-utmp-shutdown.service.html: man/systemd-update-utmp-runlevel.service.html
|
man/systemd-update-utmp-runlevel.service.html: man/systemd-update-utmp.service.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
|
|
||||||
man/systemd-update-utmp.html: man/systemd-update-utmp-runlevel.service.html
|
man/systemd-update-utmp.html: man/systemd-update-utmp.service.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
|
|
||||||
man/systemd-user.conf.html: man/systemd-system.conf.html
|
man/systemd-user.conf.html: man/systemd-system.conf.html
|
||||||
|
@ -417,8 +417,8 @@ nodist_systemunit_DATA = \
|
|||||||
units/systemd-initctl.service \
|
units/systemd-initctl.service \
|
||||||
units/systemd-shutdownd.service \
|
units/systemd-shutdownd.service \
|
||||||
units/systemd-remount-fs.service \
|
units/systemd-remount-fs.service \
|
||||||
|
units/systemd-update-utmp.service \
|
||||||
units/systemd-update-utmp-runlevel.service \
|
units/systemd-update-utmp-runlevel.service \
|
||||||
units/systemd-update-utmp-shutdown.service \
|
|
||||||
units/systemd-tmpfiles-setup-dev.service \
|
units/systemd-tmpfiles-setup-dev.service \
|
||||||
units/systemd-tmpfiles-setup.service \
|
units/systemd-tmpfiles-setup.service \
|
||||||
units/systemd-tmpfiles-clean.service \
|
units/systemd-tmpfiles-clean.service \
|
||||||
@ -463,8 +463,8 @@ EXTRA_DIST += \
|
|||||||
units/systemd-initctl.service.in \
|
units/systemd-initctl.service.in \
|
||||||
units/systemd-shutdownd.service.in \
|
units/systemd-shutdownd.service.in \
|
||||||
units/systemd-remount-fs.service.in \
|
units/systemd-remount-fs.service.in \
|
||||||
|
units/systemd-update-utmp.service.in \
|
||||||
units/systemd-update-utmp-runlevel.service.in \
|
units/systemd-update-utmp-runlevel.service.in \
|
||||||
units/systemd-update-utmp-shutdown.service.in \
|
|
||||||
units/systemd-tmpfiles-setup-dev.service.in \
|
units/systemd-tmpfiles-setup-dev.service.in \
|
||||||
units/systemd-tmpfiles-setup.service.in \
|
units/systemd-tmpfiles-setup.service.in \
|
||||||
units/systemd-tmpfiles-clean.service.in \
|
units/systemd-tmpfiles-clean.service.in \
|
||||||
@ -4070,8 +4070,8 @@ RUNLEVEL4_TARGET_WANTS += \
|
|||||||
RUNLEVEL5_TARGET_WANTS += \
|
RUNLEVEL5_TARGET_WANTS += \
|
||||||
systemd-update-utmp-runlevel.service
|
systemd-update-utmp-runlevel.service
|
||||||
endif
|
endif
|
||||||
SHUTDOWN_TARGET_WANTS += \
|
SYSINIT_TARGET_WANTS += \
|
||||||
systemd-update-utmp-shutdown.service
|
systemd-update-utmp.service
|
||||||
LOCAL_FS_TARGET_WANTS += \
|
LOCAL_FS_TARGET_WANTS += \
|
||||||
systemd-remount-fs.service \
|
systemd-remount-fs.service \
|
||||||
systemd-fsck-root.service \
|
systemd-fsck-root.service \
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<refentry id="systemd-update-utmp-runlevel.service">
|
<refentry id="systemd-update-utmp.service">
|
||||||
|
|
||||||
<refentryinfo>
|
<refentryinfo>
|
||||||
<title>systemd-update-utmp-runlevel.service</title>
|
<title>systemd-update-utmp.service</title>
|
||||||
<productname>systemd</productname>
|
<productname>systemd</productname>
|
||||||
|
|
||||||
<authorgroup>
|
<authorgroup>
|
||||||
@ -36,21 +36,21 @@
|
|||||||
</refentryinfo>
|
</refentryinfo>
|
||||||
|
|
||||||
<refmeta>
|
<refmeta>
|
||||||
<refentrytitle>systemd-update-utmp-runlevel.service</refentrytitle>
|
<refentrytitle>systemd-update-utmp.service</refentrytitle>
|
||||||
<manvolnum>8</manvolnum>
|
<manvolnum>8</manvolnum>
|
||||||
</refmeta>
|
</refmeta>
|
||||||
|
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
|
<refname>systemd-update-utmp.service</refname>
|
||||||
<refname>systemd-update-utmp-runlevel.service</refname>
|
<refname>systemd-update-utmp-runlevel.service</refname>
|
||||||
<refname>systemd-update-utmp-shutdown.service</refname>
|
|
||||||
<refname>systemd-update-utmp</refname>
|
<refname>systemd-update-utmp</refname>
|
||||||
<refpurpose>Write audit and utmp updates at runlevel
|
<refpurpose>Write audit and utmp updates at bootup, runlevel
|
||||||
changes and shutdown</refpurpose>
|
changes and shutdown</refpurpose>
|
||||||
</refnamediv>
|
</refnamediv>
|
||||||
|
|
||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
|
<para><filename>systemd-update-utmp.service</filename></para>
|
||||||
<para><filename>systemd-update-utmp-runlevel.service</filename></para>
|
<para><filename>systemd-update-utmp-runlevel.service</filename></para>
|
||||||
<para><filename>systemd-update-utmp-shutdown.service</filename></para>
|
|
||||||
<para><filename>/usr/lib/systemd/systemd-update-utmp</filename></para>
|
<para><filename>/usr/lib/systemd/systemd-update-utmp</filename></para>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
@ -60,8 +60,8 @@
|
|||||||
<para><filename>systemd-update-utmp-runlevel.service</filename>
|
<para><filename>systemd-update-utmp-runlevel.service</filename>
|
||||||
is a service that writes SysV runlevel changes to utmp
|
is a service that writes SysV runlevel changes to utmp
|
||||||
and wtmp, as well as the audit logs, as they
|
and wtmp, as well as the audit logs, as they
|
||||||
occur. <filename>systemd-update-utmp-shutdown.service</filename>
|
occur. <filename>systemd-update-utmp.service</filename>
|
||||||
does the same for shut-down requests.</para>
|
does the same for system reboots and shut-down requests.</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
@ -104,7 +104,7 @@ static int get_current_runlevel(Context *c) {
|
|||||||
{ '3', SPECIAL_RUNLEVEL3_TARGET },
|
{ '3', SPECIAL_RUNLEVEL3_TARGET },
|
||||||
{ '4', SPECIAL_RUNLEVEL4_TARGET },
|
{ '4', SPECIAL_RUNLEVEL4_TARGET },
|
||||||
{ '2', SPECIAL_RUNLEVEL2_TARGET },
|
{ '2', SPECIAL_RUNLEVEL2_TARGET },
|
||||||
{ 'S', SPECIAL_RESCUE_TARGET },
|
{ '1', SPECIAL_RESCUE_TARGET },
|
||||||
};
|
};
|
||||||
const char
|
const char
|
||||||
*interface = "org.freedesktop.systemd1.Unit",
|
*interface = "org.freedesktop.systemd1.Unit",
|
||||||
|
2
units/.gitignore
vendored
2
units/.gitignore
vendored
@ -44,8 +44,8 @@
|
|||||||
/systemd-random-seed.service
|
/systemd-random-seed.service
|
||||||
/systemd-initctl.service
|
/systemd-initctl.service
|
||||||
/getty@.service
|
/getty@.service
|
||||||
|
/systemd-update-utmp.service
|
||||||
/systemd-update-utmp-runlevel.service
|
/systemd-update-utmp-runlevel.service
|
||||||
/systemd-update-utmp-shutdown.service
|
|
||||||
/systemd-binfmt.service
|
/systemd-binfmt.service
|
||||||
/emergency.service
|
/emergency.service
|
||||||
/systemd-udev-settle.service
|
/systemd-udev-settle.service
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Update UTMP about System Runlevel Changes
|
Description=Update UTMP about System Runlevel Changes
|
||||||
Documentation=man:systemd-update-utmp-runlevel.service(8) man:utmp(5)
|
Documentation=man:systemd-update-utmp.service(8) man:utmp(5)
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
RequiresMountsFor=/var/log/wtmp
|
RequiresMountsFor=/var/log/wtmp
|
||||||
After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service
|
Conflicts=shutdown.target
|
||||||
|
Requisite=systemd-update-utmp.service
|
||||||
|
After=systemd-update-utmp.service
|
||||||
After=runlevel1.target runlevel2.target runlevel3.target runlevel4.target runlevel5.target
|
After=runlevel1.target runlevel2.target runlevel3.target runlevel4.target runlevel5.target
|
||||||
Before=final.target
|
Before=shutdown.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
# This file is part of systemd.
|
|
||||||
#
|
|
||||||
# systemd is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=Update UTMP about System Shutdown
|
|
||||||
Documentation=man:systemd-update-utmp-runlevel.service(8) man:utmp(5)
|
|
||||||
DefaultDependencies=no
|
|
||||||
RequiresMountsFor=/var/log/wtmp
|
|
||||||
After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service
|
|
||||||
After=systemd-update-utmp-runlevel.service
|
|
||||||
Before=final.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=@rootlibexecdir@/systemd-update-utmp shutdown
|
|
21
units/systemd-update-utmp.service.in
Normal file
21
units/systemd-update-utmp.service.in
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# This file is part of systemd.
|
||||||
|
#
|
||||||
|
# systemd is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Update UTMP about System Reboot/Shutdown
|
||||||
|
Documentation=man:systemd-update-utmp.service(8) man:utmp(5)
|
||||||
|
DefaultDependencies=no
|
||||||
|
RequiresMountsFor=/var/log/wtmp
|
||||||
|
Conflicts=shutdown.target
|
||||||
|
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service
|
||||||
|
Before=sysinit.target shutdown.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=@rootlibexecdir@/systemd-update-utmp reboot
|
||||||
|
ExecStop=@rootlibexecdir@/systemd-update-utmp shutdown
|
Loading…
Reference in New Issue
Block a user