new upstream release

This commit is contained in:
Lennart Poettering 2013-03-26 16:14:39 +01:00
parent 8101ca9e2f
commit 8f03aa77ae
6 changed files with 13 additions and 873 deletions

View File

@ -1,119 +0,0 @@
From 7b40ce553f0ec9487077e53f5bdc46580025901c Mon Sep 17 00:00:00 2001
From: Michael Biebl <biebl@debian.org>
Date: Sat, 9 Mar 2013 09:46:11 +0100
Subject: [PATCH] build-sys: don't hard-code binary paths in initrd-*.service
Instead use @bindir@ for udevadm and @rootbindir@ for systemctl.
---
Makefile.am | 16 ++++++++++------
...{initrd-cleanup.service => initrd-cleanup.service.in} | 2 +-
...trd-parse-etc.service => initrd-parse-etc.service.in} | 6 +++---
...switch-root.service => initrd-switch-root.service.in} | 2 +-
...p-db.service => initrd-udevadm-cleanup-db.service.in} | 2 +-
5 files changed, 16 insertions(+), 12 deletions(-)
rename units/{initrd-cleanup.service => initrd-cleanup.service.in} (87%)
rename units/{initrd-parse-etc.service => initrd-parse-etc.service.in} (75%)
rename units/{initrd-switch-root.service => initrd-switch-root.service.in} (88%)
rename units/{initrd-udevadm-cleanup-db.service => initrd-udevadm-cleanup-db.service.in} (93%)
diff --git a/Makefile.am b/Makefile.am
index 05bf582..afd259a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -382,11 +382,7 @@ dist_systemunit_DATA = \
units/systemd-udevd-control.socket \
units/systemd-udevd-kernel.socket \
units/system-update.target \
- units/initrd-parse-etc.service \
- units/initrd-cleanup.service \
- units/initrd-switch-root.target \
- units/initrd-udevadm-cleanup-db.service \
- units/initrd-switch-root.service
+ units/initrd-switch-root.target
nodist_systemunit_DATA = \
units/getty@.service \
@@ -418,7 +414,11 @@ nodist_systemunit_DATA = \
units/systemd-udevd.service \
units/systemd-udev-trigger.service \
units/systemd-udev-settle.service \
- units/debug-shell.service
+ units/debug-shell.service \
+ units/initrd-parse-etc.service \
+ units/initrd-cleanup.service \
+ units/initrd-udevadm-cleanup-db.service \
+ units/initrd-switch-root.service
dist_userunit_DATA = \
units/user/default.target \
@@ -460,6 +460,10 @@ EXTRA_DIST += \
units/systemd-hybrid-sleep.service.in \
units/systemd-suspend.service.in \
units/quotaon.service.in \
+ units/initrd-parse-etc.service.in \
+ units/initrd-cleanup.service.in \
+ units/initrd-udevadm-cleanup-db.service.in \
+ units/initrd-switch-root.service.in \
introspect.awk \
man/custom-html.xsl
diff --git a/units/initrd-cleanup.service b/units/initrd-cleanup.service.in
similarity index 87%
rename from units/initrd-cleanup.service
rename to units/initrd-cleanup.service.in
index 8998696..e926a1e 100644
--- a/units/initrd-cleanup.service
+++ b/units/initrd-cleanup.service.in
@@ -15,4 +15,4 @@ After=local-fs.target swap.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/systemctl --no-block isolate initrd-switch-root.target
+ExecStart=@rootbindir@/systemctl --no-block isolate initrd-switch-root.target
diff --git a/units/initrd-parse-etc.service b/units/initrd-parse-etc.service.in
similarity index 75%
rename from units/initrd-parse-etc.service
rename to units/initrd-parse-etc.service.in
index 3a71a7e..1a2711a 100644
--- a/units/initrd-parse-etc.service
+++ b/units/initrd-parse-etc.service.in
@@ -15,6 +15,6 @@ ConditionPathExists=/etc/initrd-release
[Service]
Type=oneshot
-ExecStartPre=/usr/bin/systemctl daemon-reload
-ExecStart=/usr/bin/systemctl start local-fs.target
-ExecStart=/usr/bin/systemctl --no-block start initrd-cleanup.service
+ExecStartPre=@rootbindir@/systemctl daemon-reload
+ExecStart=@rootbindir@/systemctl start local-fs.target
+ExecStart=@rootbindir@/systemctl --no-block start initrd-cleanup.service
diff --git a/units/initrd-switch-root.service b/units/initrd-switch-root.service.in
similarity index 88%
rename from units/initrd-switch-root.service
rename to units/initrd-switch-root.service.in
index e076b39..6740264 100644
--- a/units/initrd-switch-root.service
+++ b/units/initrd-switch-root.service.in
@@ -15,5 +15,5 @@ AllowIsolate=yes
[Service]
Type=oneshot
# we have to use "--force" here, otherwise systemd would umount /run
-ExecStart=/usr/bin/systemctl --no-block --force switch-root /sysroot
+ExecStart=@rootbindir@/systemctl --no-block --force switch-root /sysroot
KillMode=none
diff --git a/units/initrd-udevadm-cleanup-db.service b/units/initrd-udevadm-cleanup-db.service.in
similarity index 93%
rename from units/initrd-udevadm-cleanup-db.service
rename to units/initrd-udevadm-cleanup-db.service.in
index 983189e..b800c21 100644
--- a/units/initrd-udevadm-cleanup-db.service
+++ b/units/initrd-udevadm-cleanup-db.service.in
@@ -15,4 +15,4 @@ Before=initrd-switch-root.target
[Service]
Type=oneshot
-ExecStart=-/usr/bin/udevadm info --cleanup-db
+ExecStart=-@bindir@/udevadm info --cleanup-db
--
1.8.1

View File

@ -1,365 +0,0 @@
From 700e07ffd53083114e91bb4ba646ed26d0463f67 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 4 Mar 2013 19:01:05 +0100
Subject: [PATCH] add initrd-fs.target and root-fs.target
Instead of using local-fs*.target in the initrd, use root-fs.target for
sysroot.mount and initrd-fs.target for /sysroot/usr and friends.
Using local-fs.target would mean to carry over the activated
local-fs.target to the isolated initrd-switch-root.target and thus in
the real root. Having local-fs.target already active after
deserialization causes ordering problems with the real root services and
targets.
We better isolate to targets for initrd-switch-root.target, which are
only available in the initrd.
---
Makefile.am | 2 +
man/systemd.special.xml | 30 +++++++++++++
src/core/special.h | 2 +
src/fstab-generator/fstab-generator.c | 79 ++++++++++++++++++++---------------
units/initrd-cleanup.service.in | 4 +-
units/initrd-fs.target | 13 ++++++
units/initrd-parse-etc.service.in | 6 +--
units/initrd-switch-root.target | 4 +-
units/root-fs.target | 11 +++++
9 files changed, 110 insertions(+), 41 deletions(-)
create mode 100644 units/initrd-fs.target
create mode 100644 units/root-fs.target
diff --git a/Makefile.am b/Makefile.am
index b6d3306..2a010c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -347,6 +347,8 @@ dist_systemunit_DATA = \
units/kexec.target \
units/local-fs.target \
units/local-fs-pre.target \
+ units/initrd-fs.target \
+ units/root-fs.target \
units/remote-fs.target \
units/remote-fs-pre.target \
units/network.target \
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
index 0d1df84..7b78099 100644
--- a/man/systemd.special.xml
+++ b/man/systemd.special.xml
@@ -64,6 +64,7 @@
<filename>halt.target</filename>,
<filename>hibernate.target</filename>,
<filename>hybrid-sleep.target</filename>,
+ <filename>initrd-fs.target</filename>,
<filename>kbrequest.target</filename>,
<filename>kexec.target</filename>,
<filename>local-fs.target</filename>,
@@ -78,6 +79,7 @@
<filename>remote-fs.target</filename>,
<filename>remote-fs-pre.target</filename>,
<filename>rescue.target</filename>,
+ <filename>root-fs.target</filename>,
<filename>rpcbind.target</filename>,
<filename>runlevel2.target</filename>,
<filename>runlevel3.target</filename>,
@@ -296,6 +298,22 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><filename>initrd-fs.target</filename></term>
+ <listitem>
+ <para>systemd automatically
+ adds dependencies of type
+ Before to sysroot-usr.mount and
+ all mount points fround in
+ <filename>/etc/fstab</filename>
+ that have the
+ <option>auto</option> and
+ <option>x-initrd.mount</option>
+ mount options set.
+ See also <literal>systemd-fstab-generator</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><filename>kbrequest.target</filename></term>
<listitem>
<para>systemd starts this
@@ -505,6 +523,17 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><filename>root-fs.target</filename></term>
+ <listitem>
+ <para>systemd automatically
+ adds dependencies of type
+ Before to the sysroot.mount unit,
+ which is generated from the kernel command
+ line by the <literal>systemd-fstab-generator</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><filename>rpcbind.target</filename></term>
<listitem>
<para>systemd automatically
@@ -760,6 +789,7 @@
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>bootup</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>
diff --git a/src/core/special.h b/src/core/special.h
index 99c0e12..52e593b 100644
--- a/src/core/special.h
+++ b/src/core/special.h
@@ -48,6 +48,8 @@
#define SPECIAL_SOCKETS_TARGET "sockets.target"
#define SPECIAL_LOCAL_FS_TARGET "local-fs.target"
#define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target"
+#define SPECIAL_INITRD_FS_TARGET "initrd-fs.target"
+#define SPECIAL_ROOT_FS_TARGET "root-fs.target"
#define SPECIAL_REMOTE_FS_TARGET "remote-fs.target" /* LSB's $remote_fs */
#define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target"
#define SPECIAL_SWAP_TARGET "swap.target"
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 910bbc1..b4fb134 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -200,14 +200,13 @@ static bool mount_in_initrd(struct mntent *me) {
}
static int add_mount(const char *what, const char *where, const char *type, const char *opts,
- int passno, bool noauto, bool nofail, bool automount, bool isbind, bool isnetwork,
- const char *source) {
+ int passno, bool noauto, bool nofail, bool automount, bool isbind,
+ const char *pre, const char *post, const char *source) {
char _cleanup_free_
*name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
*automount_name = NULL, *automount_unit = NULL;
FILE _cleanup_fclose_ *f = NULL;
int r;
- const char *post, *pre;
assert(what);
assert(where);
@@ -227,14 +226,6 @@ static int add_mount(const char *what, const char *where, const char *type, cons
mount_point_ignore(where))
return 0;
- if (isnetwork) {
- post = SPECIAL_REMOTE_FS_TARGET;
- pre = SPECIAL_REMOTE_FS_PRE_TARGET;
- } else {
- post = SPECIAL_LOCAL_FS_TARGET;
- pre = SPECIAL_LOCAL_FS_PRE_TARGET;
- }
-
name = unit_name_from_path(where, ".mount");
if (!name)
return log_oom();
@@ -259,17 +250,19 @@ static int add_mount(const char *what, const char *where, const char *type, cons
"DefaultDependencies=no\n",
source);
- if (!path_equal(where, "/"))
+ if (!path_equal(where, "/")) {
+ if (pre)
+ fprintf(f,
+ "After=%s\n"
+ "Wants=%s\n",
+ pre,
+ pre);
fprintf(f,
- "After=%s\n"
- "Wants=%s\n"
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
- "Before=" SPECIAL_UMOUNT_TARGET "\n",
- pre,
- pre);
-
+ "Before=" SPECIAL_UMOUNT_TARGET "\n");
+ }
- if (!noauto && !nofail && !automount)
+ if (post && !noauto && !nofail && !automount)
fprintf(f,
"Before=%s\n",
post);
@@ -299,14 +292,16 @@ static int add_mount(const char *what, const char *where, const char *type, cons
}
if (!noauto) {
- lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
- if (!lnk)
- return log_oom();
+ if (post) {
+ lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
+ if (!lnk)
+ return log_oom();
- mkdir_parents_label(lnk, 0755);
- if (symlink(unit, lnk) < 0) {
- log_error("Failed to create symlink %s: %m", lnk);
- return -errno;
+ mkdir_parents_label(lnk, 0755);
+ if (symlink(unit, lnk) < 0) {
+ log_error("Failed to create symlink %s: %m", lnk);
+ return -errno;
+ }
}
if (!isbind &&
@@ -353,12 +348,17 @@ static int add_mount(const char *what, const char *where, const char *type, cons
"SourcePath=%s\n"
"DefaultDependencies=no\n"
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
- "Before=" SPECIAL_UMOUNT_TARGET " %s\n"
- "\n"
+ "Before=" SPECIAL_UMOUNT_TARGET "\n",
+ source);
+
+ if (post)
+ fprintf(f,
+ "Before= %s\n",
+ post);
+
+ fprintf(f,
"[Automount]\n"
"Where=%s\n",
- source,
- post,
where);
fflush(f);
@@ -421,7 +421,8 @@ static int parse_fstab(const char *prefix, bool initrd) {
if (streq(me->mnt_type, "swap"))
k = add_swap(what, me);
else {
- bool noauto, nofail, automount, isbind, isnetwork;
+ bool noauto, nofail, automount, isbind;
+ const char *pre, *post;
noauto = !!hasmntopt(me, "noauto");
nofail = !!hasmntopt(me, "nofail");
@@ -429,11 +430,21 @@ static int parse_fstab(const char *prefix, bool initrd) {
hasmntopt(me, "comment=systemd.automount") ||
hasmntopt(me, "x-systemd.automount");
isbind = mount_is_bind(me);
- isnetwork = mount_is_network(me);
+
+ if (initrd) {
+ post = SPECIAL_INITRD_FS_TARGET;
+ pre = NULL;
+ } else if (mount_is_network(me)) {
+ post = SPECIAL_REMOTE_FS_TARGET;
+ pre = SPECIAL_REMOTE_FS_PRE_TARGET;
+ } else {
+ post = SPECIAL_LOCAL_FS_TARGET;
+ pre = SPECIAL_LOCAL_FS_PRE_TARGET;
+ }
k = add_mount(what, where, me->mnt_type, me->mnt_opts,
me->mnt_passno, noauto, nofail, automount,
- isbind, isnetwork, fstab_path);
+ isbind, pre, post, fstab_path);
}
if (k < 0)
@@ -514,7 +525,7 @@ static int parse_new_root_from_proc_cmdline(void) {
log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
- false, false, "/proc/cmdline");
+ false, NULL, SPECIAL_ROOT_FS_TARGET, "/proc/cmdline");
return (r < 0) ? r : 0;
}
diff --git a/units/initrd-cleanup.service.in b/units/initrd-cleanup.service.in
index e926a1e..5bef090 100644
--- a/units/initrd-cleanup.service.in
+++ b/units/initrd-cleanup.service.in
@@ -10,8 +10,8 @@ Description=Cleaning Up and Shutting Down Daemons
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
-Requires=local-fs.target swap.target
-After=local-fs.target swap.target
+Wants=root-fs.target initrd-fs.target
+After=root-fs.target initrd-fs.target
[Service]
Type=oneshot
diff --git a/units/initrd-fs.target b/units/initrd-fs.target
new file mode 100644
index 0000000..6ba1758
--- /dev/null
+++ b/units/initrd-fs.target
@@ -0,0 +1,13 @@
+# 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=Initrd File Systems
+Documentation=man:systemd.special(7)
+OnFailure=emergency.target
+OnFailureIsolate=yes
+ConditionPathExists=/etc/initrd-release
diff --git a/units/initrd-parse-etc.service.in b/units/initrd-parse-etc.service.in
index 1a2711a..44fee7b 100644
--- a/units/initrd-parse-etc.service.in
+++ b/units/initrd-parse-etc.service.in
@@ -8,13 +8,13 @@
[Unit]
Description=Reload Configuration from the Real Root
DefaultDependencies=no
-Requires=local-fs.target swap.target
-After=local-fs.target swap.target
+Requires=root-fs.target
+After=root-fs.target
OnFailure=emergency.target
ConditionPathExists=/etc/initrd-release
[Service]
Type=oneshot
ExecStartPre=@rootbindir@/systemctl daemon-reload
-ExecStart=@rootbindir@/systemctl start local-fs.target
+ExecStart=@rootbindir@/systemctl start initrd-fs.target
ExecStart=@rootbindir@/systemctl --no-block start initrd-cleanup.service
diff --git a/units/initrd-switch-root.target b/units/initrd-switch-root.target
index f706d29..cf646c4 100644
--- a/units/initrd-switch-root.target
+++ b/units/initrd-switch-root.target
@@ -12,5 +12,5 @@ DefaultDependencies=no
Requires=initrd-switch-root.service
Before=initrd-switch-root.service
AllowIsolate=yes
-Wants=initrd-udevadm-cleanup-db.service local-fs.target swap.target systemd-journald.service
-After=initrd-udevadm-cleanup-db.service local-fs.target swap.target emergency.service emergency.target
+Wants=initrd-udevadm-cleanup-db.service root-fs.target initrd-fs.target systemd-journald.service
+After=initrd-udevadm-cleanup-db.service root-fs.target initrd-fs.target emergency.service emergency.target
diff --git a/units/root-fs.target b/units/root-fs.target
new file mode 100644
index 0000000..1351534
--- /dev/null
+++ b/units/root-fs.target
@@ -0,0 +1,11 @@
+# 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=Initrd Root File System
+Documentation=man:systemd.special(7)
+ConditionPathExists=/etc/initrd-release
--
1.8.1

View File

@ -1,32 +0,0 @@
From c1dae1b3c9729fb8ab749dd4e2dad07e0fad7ed8 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 14 Mar 2013 21:36:38 +0100
Subject: [PATCH] main: don't mount /sys, /dev and friends when we run with PID
!= 1
Back from old times when we developed systemd on non-systemd hosts we
still mounted the missing directories such as the cgroup stuff even when
running with a PID != 1. There's no point for that anymore, so let's
just do that if we are actually PID 1, and never otherwise.
https://bugs.freedesktop.org/show_bug.cgi?id=62354
---
src/core/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/main.c b/src/core/main.c
index 7b03983..01a6d41 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1437,7 +1437,7 @@ int main(int argc, char *argv[]) {
/* Mount /proc, /sys and friends, so that /proc/cmdline and
* /proc/$PID/fd is available. */
- if (geteuid() == 0 && !getenv("SYSTEMD_SKIP_API_MOUNTS")) {
+ if (getpid() == 1) {
r = mount_setup(loaded_policy);
if (r < 0)
goto finish;
--
1.8.1

View File

@ -1,348 +0,0 @@
From 9e5f0f92915b777308797294c6e103e430957b5d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 14 Mar 2013 13:12:10 +0100
Subject: [PATCH] Make initrd.target the default target in the initrd
First, rename root-fs.target to initrd-root-fs.target to clarify its usage.
Mount units with "x-initrd-rootfs.mount" are now ordered before
initrd-root-fs.target. As we sometimes construct /sysroot mounts in
/etc/fstab in the initrd, we want these to be mounted before the
initrd-root-fs.target is active.
initrd.target can be the default target in the initrd.
(normal startup)
:
:
v
basic.target
|
______________________/|
/ |
| sysroot.mount
| |
| v
| initrd-root-fs.target
| |
| v
| initrd-parse-etc.service
(custom initrd services) |
| v
| (sysroot-usr.mount and
| various mounts marked
| with fstab option
| x-initrd.mount)
| |
| v
| initrd-fs.target
| |
\______________________ |
\|
v
initrd.target
|
v
initrd-cleanup.service
isolates to
initrd-switch-root.target
|
v
______________________/|
/ |
| initrd-udevadm-cleanup-db.service
| |
(custom initrd services) |
| |
\______________________ |
\|
v
initrd-switch-root.target
|
v
initrd-switch-root.service
|
v
switch-root
---
Makefile.am | 3 +-
man/bootup.xml | 73 +++++++++++++++++++++++++
man/systemd.special.xml | 4 +-
src/core/special.h | 2 +-
src/fstab-generator/fstab-generator.c | 11 +++-
units/initrd-cleanup.service.in | 3 +-
units/initrd-fs.target | 1 +
units/initrd-parse-etc.service.in | 7 ++-
units/{root-fs.target => initrd-root-fs.target} | 2 +
units/initrd-switch-root.target | 4 +-
units/initrd.target | 17 ++++++
11 files changed, 115 insertions(+), 12 deletions(-)
rename units/{root-fs.target => initrd-root-fs.target} (89%)
create mode 100644 units/initrd.target
diff --git a/Makefile.am b/Makefile.am
index 175d14b..cf21544 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -347,8 +347,9 @@ dist_systemunit_DATA = \
units/kexec.target \
units/local-fs.target \
units/local-fs-pre.target \
+ units/initrd.target \
units/initrd-fs.target \
- units/root-fs.target \
+ units/initrd-root-fs.target \
units/remote-fs.target \
units/remote-fs-pre.target \
units/network.target \
diff --git a/man/bootup.xml b/man/bootup.xml
index f65abf5..6bd22ef 100644
--- a/man/bootup.xml
+++ b/man/bootup.xml
@@ -174,6 +174,79 @@
</refsect1>
<refsect1>
+ <title>Systemd in the Initrd</title>
+ <para>If the initrd creation tool used the services provided
+ by systemd, the default target in the initrd is the
+ initrd-fs.target. The process is the same as above until the basic.target is reached.
+ Systemd now continues to the initrd.target. If the root device could be mounted
+ on /sysroot, the sysroot.mount unit is active and the initrd-root-fs.target is reached.
+ initrd-parse-etc.service scans /sysroot/etc/fstab for the /usr mountpoint and for entries
+ marked with the <emphasis>x-initrd.mount</emphasis> option set. If these mountpoint are
+ mounted in /sysroot, the initrd-fs.target is reached.
+ The initrd-cleanup.service isolates to the initrd-switch-root.target,
+ where cleanup services can run. At the very last end
+ initrd-switch-root.service is activated, which will cause
+ the system to switch root to /sysroot.
+ </para>
+
+<programlisting>
+ (same as above)
+ :
+ :
+ v
+ basic.target
+ | emergency.service
+ ______________________/| |
+ / | v
+ | sysroot.mount <emphasis>emergency.target</emphasis>
+ | |
+ | v
+ | initrd-root-fs.target
+ | |
+ | v
+ | initrd-parse-etc.service
+ (custom initrd services) |
+ | v
+ | (sysroot-usr.mount and
+ | various mounts marked
+ | with fstab option
+ | x-initrd.mount)
+ | |
+ | v
+ | initrd-fs.target
+ | |
+ \______________________ |
+ \|
+ v
+ initrd.target
+ |
+ v
+ initrd-cleanup.service
+ isolates to
+ initrd-switch-root.target
+ |
+ v
+ ______________________/|
+ / |
+ | initrd-udevadm-cleanup-db.service
+ | |
+ (custom initrd services) |
+ | |
+ \______________________ |
+ \|
+ v
+ initrd-switch-root.target
+ |
+ v
+ initrd-switch-root.service
+ |
+ v
+ switch-root
+</programlisting>
+ </refsect1>
+
+
+ <refsect1>
<title>System Manager Shutdown</title>
<para>System shutdown also consists of various target
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
index 7b78099..67a81b6 100644
--- a/man/systemd.special.xml
+++ b/man/systemd.special.xml
@@ -79,7 +79,7 @@
<filename>remote-fs.target</filename>,
<filename>remote-fs-pre.target</filename>,
<filename>rescue.target</filename>,
- <filename>root-fs.target</filename>,
+ <filename>initrd-root-fs.target</filename>,
<filename>rpcbind.target</filename>,
<filename>runlevel2.target</filename>,
<filename>runlevel3.target</filename>,
@@ -523,7 +523,7 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><filename>root-fs.target</filename></term>
+ <term><filename>initrd-root-fs.target</filename></term>
<listitem>
<para>systemd automatically
adds dependencies of type
diff --git a/src/core/special.h b/src/core/special.h
index 52e593b..c7b856e 100644
--- a/src/core/special.h
+++ b/src/core/special.h
@@ -49,7 +49,7 @@
#define SPECIAL_LOCAL_FS_TARGET "local-fs.target"
#define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target"
#define SPECIAL_INITRD_FS_TARGET "initrd-fs.target"
-#define SPECIAL_ROOT_FS_TARGET "root-fs.target"
+#define SPECIAL_INITRD_ROOT_FS_TARGET "initrd-root-fs.target"
#define SPECIAL_REMOTE_FS_TARGET "remote-fs.target" /* LSB's $remote_fs */
#define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target"
#define SPECIAL_SWAP_TARGET "swap.target"
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index b4fb134..cf85d31 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -199,6 +199,12 @@ static bool mount_in_initrd(struct mntent *me) {
streq(me->mnt_dir, "/usr");
}
+static bool mount_is_rootfs(struct mntent *me) {
+ assert(me);
+
+ return hasmntopt(me, "x-initrd-rootfs.mount");
+}
+
static int add_mount(const char *what, const char *where, const char *type, const char *opts,
int passno, bool noauto, bool nofail, bool automount, bool isbind,
const char *pre, const char *post, const char *source) {
@@ -434,6 +440,9 @@ static int parse_fstab(const char *prefix, bool initrd) {
if (initrd) {
post = SPECIAL_INITRD_FS_TARGET;
pre = NULL;
+ } else if (mount_is_rootfs(me)) {
+ post = SPECIAL_INITRD_ROOT_FS_TARGET;
+ pre = NULL;
} else if (mount_is_network(me)) {
post = SPECIAL_REMOTE_FS_TARGET;
pre = SPECIAL_REMOTE_FS_PRE_TARGET;
@@ -525,7 +534,7 @@ static int parse_new_root_from_proc_cmdline(void) {
log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
- false, NULL, SPECIAL_ROOT_FS_TARGET, "/proc/cmdline");
+ false, NULL, SPECIAL_INITRD_ROOT_FS_TARGET, "/proc/cmdline");
return (r < 0) ? r : 0;
}
diff --git a/units/initrd-cleanup.service.in b/units/initrd-cleanup.service.in
index 5bef090..218ec80 100644
--- a/units/initrd-cleanup.service.in
+++ b/units/initrd-cleanup.service.in
@@ -10,8 +10,7 @@ Description=Cleaning Up and Shutting Down Daemons
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
-Wants=root-fs.target initrd-fs.target
-After=root-fs.target initrd-fs.target
+After=initrd-root-fs.target initrd-fs.target initrd.target
[Service]
Type=oneshot
diff --git a/units/initrd-fs.target b/units/initrd-fs.target
index 6ba1758..7578b88 100644
--- a/units/initrd-fs.target
+++ b/units/initrd-fs.target
@@ -11,3 +11,4 @@ Documentation=man:systemd.special(7)
OnFailure=emergency.target
OnFailureIsolate=yes
ConditionPathExists=/etc/initrd-release
+After=initrd-parse-etc.service
diff --git a/units/initrd-parse-etc.service.in b/units/initrd-parse-etc.service.in
index 44fee7b..07728e2 100644
--- a/units/initrd-parse-etc.service.in
+++ b/units/initrd-parse-etc.service.in
@@ -8,13 +8,14 @@
[Unit]
Description=Reload Configuration from the Real Root
DefaultDependencies=no
-Requires=root-fs.target
-After=root-fs.target
+Requires=initrd-root-fs.target
+After=initrd-root-fs.target
OnFailure=emergency.target
ConditionPathExists=/etc/initrd-release
[Service]
Type=oneshot
ExecStartPre=@rootbindir@/systemctl daemon-reload
-ExecStart=@rootbindir@/systemctl start initrd-fs.target
+# we have to retrigger initrd-fs.target after daemon-reload
+ExecStart=-@rootbindir@/systemctl --no-block start initrd-fs.target
ExecStart=@rootbindir@/systemctl --no-block start initrd-cleanup.service
diff --git a/units/root-fs.target b/units/initrd-root-fs.target
similarity index 89%
rename from units/root-fs.target
rename to units/initrd-root-fs.target
index 1351534..cd189f0 100644
--- a/units/root-fs.target
+++ b/units/initrd-root-fs.target
@@ -9,3 +9,5 @@
Description=Initrd Root File System
Documentation=man:systemd.special(7)
ConditionPathExists=/etc/initrd-release
+OnFailure=emergency.target
+OnFailureIsolate=yes
diff --git a/units/initrd-switch-root.target b/units/initrd-switch-root.target
index cf646c4..f347687 100644
--- a/units/initrd-switch-root.target
+++ b/units/initrd-switch-root.target
@@ -12,5 +12,5 @@ DefaultDependencies=no
Requires=initrd-switch-root.service
Before=initrd-switch-root.service
AllowIsolate=yes
-Wants=initrd-udevadm-cleanup-db.service root-fs.target initrd-fs.target systemd-journald.service
-After=initrd-udevadm-cleanup-db.service root-fs.target initrd-fs.target emergency.service emergency.target
+Wants=initrd-udevadm-cleanup-db.service initrd-root-fs.target initrd-fs.target systemd-journald.service
+After=initrd-udevadm-cleanup-db.service initrd-root-fs.target initrd-fs.target emergency.service emergency.target
diff --git a/units/initrd.target b/units/initrd.target
new file mode 100644
index 0000000..5622de4
--- /dev/null
+++ b/units/initrd.target
@@ -0,0 +1,17 @@
+# 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=Initrd Target
+Documentation=man:systemd.special(7)
+OnFailure=emergency.target
+OnFailureIsolate=yes
+ConditionPathExists=/etc/initrd-release
+Requires=basic.target
+Wants=initrd-root-fs.target initrd-fs.target initrd-parse-etc.service
+After=initrd-root-fs.target initrd-fs.target basic.target rescue.service rescue.target
+AllowIsolate=yes
--
1.8.1

View File

@ -1 +1 @@
26a75e2a310f8c1c1ea9ec26ddb171c5 systemd-198.tar.xz 4bb13f84ce211e93f0141774a90a2322 systemd-199.tar.xz

View File

@ -13,8 +13,8 @@
Name: systemd Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 198 Version: 199
Release: 7%{?gitcommit:.git%{gitcommit}}%{?dist} Release: 1%{?gitcommit:.git%{gitcommit}}%{?dist}
# For a breakdown of the licensing, see README # For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+ License: LGPLv2+ and MIT and GPLv2+
Summary: A System and Service Manager Summary: A System and Service Manager
@ -80,7 +80,7 @@ Provides: systemd-units = %{version}-%{release}
# part of system since f18, drop at f20 # part of system since f18, drop at f20
Provides: udev = %{version} Provides: udev = %{version}
Obsoletes: udev < 183 Obsoletes: udev < 183
Conflicts: dracut < 026-48 Conflicts: dracut < 027
# f18 version, drop at f20 # f18 version, drop at f20
Conflicts: plymouth < 0.8.5.1 Conflicts: plymouth < 0.8.5.1
# Ensures correct multilib updates added F18, drop at F20 # Ensures correct multilib updates added F18, drop at F20
@ -99,10 +99,6 @@ Provides: systemd-analyze = 198
# patches for dracut's initramfs # patches for dracut's initramfs
# remove for new git snapshots or releases # remove for new git snapshots or releases
BuildRequires: git BuildRequires: git
Patch13: 0013-build-sys-don-t-hard-code-binary-paths-in-initrd-.se.patch
Patch45: 0045-add-initrd-fs.target-and-root-fs.target.patch
Patch61: 0061-main-don-t-mount-sys-dev-and-friends-when-we-run-wit.patch
Patch62: 0062-Make-initrd.target-the-default-target-in-the-initrd.patch
# kernel-install patch for grubby, drop if grubby is obsolete # kernel-install patch for grubby, drop if grubby is obsolete
Patch1000: kernel-install-grubby.patch Patch1000: kernel-install-grubby.patch
@ -291,7 +287,7 @@ install -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/yum/protected.d/systemd.co
# kernel.core_pattern setting until systemd-coredump is a part of an actual # kernel.core_pattern setting until systemd-coredump is a part of an actual
# systemd release and it's made clear how to get the core dumps out of the # systemd release and it's made clear how to get the core dumps out of the
# journal. # journal.
rm -f %{buildroot}%{_prefix}/lib/sysctl.d/coredump.conf rm -f %{buildroot}%{_prefix}/lib/sysctl.d/50-coredump.conf
# For now remove /var/log/README since we are not enabling persistant # For now remove /var/log/README since we are not enabling persistant
# logging yet. # logging yet.
@ -639,6 +635,7 @@ fi
%{_prefix}/lib/tmpfiles.d/x11.conf %{_prefix}/lib/tmpfiles.d/x11.conf
%{_prefix}/lib/tmpfiles.d/legacy.conf %{_prefix}/lib/tmpfiles.d/legacy.conf
%{_prefix}/lib/tmpfiles.d/tmp.conf %{_prefix}/lib/tmpfiles.d/tmp.conf
%{_prefix}/lib/sysctl.d/50-default.conf
%{_prefix}/lib/systemd/system-preset/90-default.preset %{_prefix}/lib/systemd/system-preset/90-default.preset
%{_prefix}/lib/systemd/system-preset/90-display-manager.preset %{_prefix}/lib/systemd/system-preset/90-display-manager.preset
%{_prefix}/lib/systemd/catalog/systemd.catalog %{_prefix}/lib/systemd/catalog/systemd.catalog
@ -730,10 +727,14 @@ fi
%{python_sitearch}/systemd/__init__.pyo %{python_sitearch}/systemd/__init__.pyo
%{python_sitearch}/systemd/_journal.so %{python_sitearch}/systemd/_journal.so
%{python_sitearch}/systemd/_reader.so %{python_sitearch}/systemd/_reader.so
%{python_sitearch}/systemd/_daemon.so
%{python_sitearch}/systemd/id128.so %{python_sitearch}/systemd/id128.so
%{python_sitearch}/systemd/journal.py %{python_sitearch}/systemd/journal.py
%{python_sitearch}/systemd/journal.pyc %{python_sitearch}/systemd/journal.pyc
%{python_sitearch}/systemd/journal.pyo %{python_sitearch}/systemd/journal.pyo
%{python_sitearch}/systemd/daemon.py
%{python_sitearch}/systemd/daemon.pyc
%{python_sitearch}/systemd/daemon.pyo
%files -n libgudev1 %files -n libgudev1
%{_libdir}/libgudev-1.0.so.* %{_libdir}/libgudev-1.0.so.*
@ -750,6 +751,9 @@ fi
%{_libdir}/pkgconfig/gudev-1.0* %{_libdir}/pkgconfig/gudev-1.0*
%changelog %changelog
* Tue Mar 26 2013 Lennart Poettering <lpoetter@redhat.com> - 199-1
- New upstream release
* Mon Mar 18 2013 Michal Schmidt <mschmidt@redhat.com> 198-7 * Mon Mar 18 2013 Michal Schmidt <mschmidt@redhat.com> 198-7
- Drop /usr/s?bin/ prefixes. - Drop /usr/s?bin/ prefixes.