summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch
blob: 86fab9734c70dfcf4fe012877a55b22910831ab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
Upstream-Status: Backport
Signed-off-by: Jonathan Liu <net147@gmail.com>

From 3f92e4b4b61042391bd44de4dceb18177df0dd57 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 16 May 2013 00:19:03 +0200
Subject: [PATCH] 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
---
 Makefile-man.am                               | 12 ++---
 Makefile.am                                   |  8 +--
 man/systemd-update-utmp-runlevel.service.xml  | 76 ---------------------------
 man/systemd-update-utmp.service.xml           | 76 +++++++++++++++++++++++++++
 src/update-utmp/update-utmp.c                 |  2 +-
 units/.gitignore                              |  2 +-
 units/systemd-update-utmp-runlevel.service.in |  8 +--
 units/systemd-update-utmp-shutdown.service.in | 19 -------
 units/systemd-update-utmp.service.in          | 21 ++++++++
 9 files changed, 114 insertions(+), 110 deletions(-)
 delete mode 100644 man/systemd-update-utmp-runlevel.service.xml
 create mode 100644 man/systemd-update-utmp.service.xml
 delete mode 100644 units/systemd-update-utmp-shutdown.service.in
 create mode 100644 units/systemd-update-utmp.service.in

diff --git a/Makefile-man.am b/Makefile-man.am
index 7d62094..5888158 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -72,7 +72,7 @@ MANPAGES += \
 	man/systemd-tmpfiles.8 \
 	man/systemd-tty-ask-password-agent.1 \
 	man/systemd-udevd.service.8 \
-	man/systemd-update-utmp-runlevel.service.8 \
+	man/systemd-update-utmp.service.8 \
 	man/systemd.1 \
 	man/systemd.automount.5 \
 	man/systemd.device.5 \
@@ -191,7 +191,7 @@ MANPAGES_ALIAS += \
 	man/systemd-udevd-control.socket.8 \
 	man/systemd-udevd-kernel.socket.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-user.conf.5
 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-kernel.socket.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.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.service.8
 man/systemd-user.conf.5: man/systemd-system.conf.5
 man/SD_ALERT.html: man/sd-daemon.html
 	$(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
 	$(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)
 
-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)
 
 man/systemd-user.conf.html: man/systemd-system.conf.html
diff --git a/Makefile.am b/Makefile.am
index 8d8139c..4c5e6fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -417,8 +417,8 @@ nodist_systemunit_DATA = \
 	units/systemd-initctl.service \
 	units/systemd-shutdownd.service \
 	units/systemd-remount-fs.service \
+	units/systemd-update-utmp.service \
 	units/systemd-update-utmp-runlevel.service \
-	units/systemd-update-utmp-shutdown.service \
 	units/systemd-tmpfiles-setup-dev.service \
 	units/systemd-tmpfiles-setup.service \
 	units/systemd-tmpfiles-clean.service \
@@ -463,8 +463,8 @@ EXTRA_DIST += \
 	units/systemd-initctl.service.in \
 	units/systemd-shutdownd.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-shutdown.service.in \
 	units/systemd-tmpfiles-setup-dev.service.in \
 	units/systemd-tmpfiles-setup.service.in \
 	units/systemd-tmpfiles-clean.service.in \
@@ -4070,8 +4070,8 @@ RUNLEVEL4_TARGET_WANTS += \
 RUNLEVEL5_TARGET_WANTS += \
 	systemd-update-utmp-runlevel.service
 endif
-SHUTDOWN_TARGET_WANTS += \
-	systemd-update-utmp-shutdown.service
+SYSINIT_TARGET_WANTS += \
+	systemd-update-utmp.service
 LOCAL_FS_TARGET_WANTS += \
 	systemd-remount-fs.service \
 	systemd-fsck-root.service \
diff --git a/man/systemd-update-utmp-runlevel.service.xml b/man/systemd-update-utmp-runlevel.service.xml
deleted file mode 100644
index 867b958..0000000
--- a/man/systemd-update-utmp-runlevel.service.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--*-nxml-*-->
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-<!--
-  This file is part of systemd.
-
-  Copyright 2012 Lennart Poettering
-
-  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.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
--->
-<refentry id="systemd-update-utmp-runlevel.service">
-
-        <refentryinfo>
-                <title>systemd-update-utmp-runlevel.service</title>
-                <productname>systemd</productname>
-
-                <authorgroup>
-                        <author>
-                                <contrib>Developer</contrib>
-                                <firstname>Lennart</firstname>
-                                <surname>Poettering</surname>
-                                <email>lennart@poettering.net</email>
-                        </author>
-                </authorgroup>
-        </refentryinfo>
-
-        <refmeta>
-                <refentrytitle>systemd-update-utmp-runlevel.service</refentrytitle>
-                <manvolnum>8</manvolnum>
-        </refmeta>
-
-        <refnamediv>
-                <refname>systemd-update-utmp-runlevel.service</refname>
-                <refname>systemd-update-utmp-shutdown.service</refname>
-                <refname>systemd-update-utmp</refname>
-                <refpurpose>Write audit and utmp updates at runlevel
-                changes and shutdown</refpurpose>
-        </refnamediv>
-
-        <refsynopsisdiv>
-                <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>
-        </refsynopsisdiv>
-
-        <refsect1>
-                <title>Description</title>
-
-                <para><filename>systemd-update-utmp-runlevel.service</filename>
-                is a service that writes SysV runlevel changes to utmp
-                and wtmp, as well as the audit logs, as they
-                occur. <filename>systemd-update-utmp-shutdown.service</filename>
-                does the same for shut-down requests.</para>
-        </refsect1>
-
-        <refsect1>
-                <title>See Also</title>
-                <para>
-                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
-                        <citerefentry><refentrytitle>auditd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-                </para>
-        </refsect1>
-
-</refentry>
diff --git a/man/systemd-update-utmp.service.xml b/man/systemd-update-utmp.service.xml
new file mode 100644
index 0000000..846fc95
--- /dev/null
+++ b/man/systemd-update-utmp.service.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!--
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  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.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+<refentry id="systemd-update-utmp.service">
+
+        <refentryinfo>
+                <title>systemd-update-utmp.service</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart@poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd-update-utmp.service</refentrytitle>
+                <manvolnum>8</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd-update-utmp.service</refname>
+                <refname>systemd-update-utmp-runlevel.service</refname>
+                <refname>systemd-update-utmp</refname>
+                <refpurpose>Write audit and utmp updates at bootup, runlevel
+                changes and shutdown</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd-update-utmp.service</filename></para>
+                <para><filename>systemd-update-utmp-runlevel.service</filename></para>
+                <para><filename>/usr/lib/systemd/systemd-update-utmp</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para><filename>systemd-update-utmp-runlevel.service</filename>
+                is a service that writes SysV runlevel changes to utmp
+                and wtmp, as well as the audit logs, as they
+                occur. <filename>systemd-update-utmp.service</filename>
+                does the same for system reboots and shut-down requests.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>See Also</title>
+                <para>
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                        <citerefentry><refentrytitle>auditd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                </para>
+        </refsect1>
+
+</refentry>
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index 9184025..202aa98 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -104,7 +104,7 @@ static int get_current_runlevel(Context *c) {
                 { '3', SPECIAL_RUNLEVEL3_TARGET },
                 { '4', SPECIAL_RUNLEVEL4_TARGET },
                 { '2', SPECIAL_RUNLEVEL2_TARGET },
-                { 'S', SPECIAL_RESCUE_TARGET },
+                { '1', SPECIAL_RESCUE_TARGET },
         };
         const char
                 *interface = "org.freedesktop.systemd1.Unit",
diff --git a/units/systemd-update-utmp-runlevel.service.in b/units/systemd-update-utmp-runlevel.service.in
index 27fae2c..99783e2 100644
--- a/units/systemd-update-utmp-runlevel.service.in
+++ b/units/systemd-update-utmp-runlevel.service.in
@@ -7,12 +7,14 @@
 
 [Unit]
 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
 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
-Before=final.target
+Before=shutdown.target
 
 [Service]
 Type=oneshot
diff --git a/units/systemd-update-utmp-shutdown.service.in b/units/systemd-update-utmp-shutdown.service.in
deleted file mode 100644
index aa93562..0000000
--- a/units/systemd-update-utmp-shutdown.service.in
+++ /dev/null
@@ -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
diff --git a/units/systemd-update-utmp.service.in b/units/systemd-update-utmp.service.in
new file mode 100644
index 0000000..e7c20a5
--- /dev/null
+++ b/units/systemd-update-utmp.service.in
@@ -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
-- 
1.8.2.3