systemd/avoid-random-seed-cycle.patch
Cristian Rodríguez f761eae17d Accepting request 100588 from home:tittiatcoke:branches:Base:System
Package needs OK from fcrozat. Update to the latest systemd-38 version. Additional listen.conf so that rsyslog keeps working. Also added xz as an explicit buildrequires to ensure that the tarball can be unpacked.

OBS-URL: https://build.opensuse.org/request/show/100588
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=232
2012-01-18 16:44:20 +00:00

110 lines
3.7 KiB
Diff

Rather than ordering systemd-random-seed-load.service after local-fs.target,
start it by path-activation.
We need write access to the seed, so we order the path unit after
remount-rootfs.service (in case /var is on the root fs).
A better solution might be to introduce PathIsWritable=, but that is not
necessary in order to solve the problem, and I don't know of any other
usecases for it.
Cc: Frederic Crozat <fcrozat@suse.com>
Cc: Michal Schmidt <mschmidt@redhat.com>
---
This is my second attempt at solving this problem. The first one had
some issues as pointed out by Frederic and Michael.
Makefile.am | 7 +++++--
TODO | 2 --
units/.gitignore | 1 +
units/systemd-random-seed-load.path.in | 18 ++++++++++++++++++
units/systemd-random-seed-load.service.in | 3 +--
5 files changed, 25 insertions(+), 6 deletions(-)
create mode 100644 units/systemd-random-seed-load.path.in
diff -urB systemd-38/Makefile.am new/Makefile.am
--- systemd-38/Makefile.am 2012-01-11 04:01:36.734404653 +0100
+++ new/Makefile.am 2012-01-18 09:53:12.763115731 +0100
@@ -1530,11 +1530,14 @@
nodist_systemunit_DATA += \
units/systemd-random-seed-save.service \
- units/systemd-random-seed-load.service
+ units/systemd-random-seed-load.service \
+ units/systemd-random-seed-load.path
+
EXTRA_DIST += \
units/systemd-random-seed-save.service.in \
- units/systemd-random-seed-load.service.in
+ units/systemd-random-seed-load.service.in \
+ units/systemd-random-seed-load.path.in
systemd_random_seed_SOURCES = \
src/random-seed.c
@@ -1550,8 +1553,8 @@
rm -f systemd-random-seed-save.service && \
$(LN_S) ../systemd-random-seed-save.service systemd-random-seed-save.service )
( cd $(DESTDIR)$(systemunitdir)/sysinit.target.wants && \
- rm -f systemd-random-seed-load.service && \
- $(LN_S) ../systemd-random-seed-load.service systemd-random-seed-load.service )
+ rm -f systemd-random-seed-load.path && \
+ $(LN_S) ../systemd-random-seed-load.path systemd-random-seed-load.path )
INSTALL_DATA_HOOKS += \
randomseed-install-data-hook
@@ -2052,6 +2055,7 @@
-e 's,@exec_prefix\@,$(exec_prefix),g' \
-e 's,@libdir\@,$(libdir),g' \
-e 's,@includedir\@,$(includedir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
< $< > $@ || rm $@
units/%: units/%.in Makefile
diff --git a/units/systemd-random-seed-load.path.in b/units/systemd-random-seed-load.path.in
new file mode 100644
index 0000000..614c1d4
--- /dev/null
+++ b/units/systemd-random-seed-load.path.in
@@ -0,0 +1,18 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Random Seed
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=basic.target shutdown.target
+# in case the seed is on the rootfs, we must
+# wait for the rootfs to be remonuted rw
+After=remount-rootfs.service
+
+[Path]
+PathExists=@localstatedir@/lib/random-seed
diff --git a/units/systemd-random-seed-load.service.in b/units/systemd-random-seed-load.service.in
index a2b6a55..2bcf1aa 100644
--- a/units/systemd-random-seed-load.service.in
+++ b/units/systemd-random-seed-load.service.in
@@ -8,9 +8,8 @@
[Unit]
Description=Load Random Seed
DefaultDependencies=no
-Wants=local-fs.target
Conflicts=shutdown.target
-After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target
+After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-random-seed-load.path
Before=sysinit.target shutdown.target
[Service]
--
1.7.8