[systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount
WANG Chao
chaowang at redhat.com
Tue Jul 30 04:53:11 PDT 2013
If specified kernel command line rd.weak_sysroot, fstab-generate will
generate a weaker version of sysroot.mount:
- It's not required by initrd-root-fs.target.
- It's not before initrd-root-fs.target.
So that failure in the weaker sysroot.mount will not fail
initrd-root-fs.target. And systemd will try continue rather than
entering isolated emergency mode.
Signed-off-by: WANG Chao <chaowang at redhat.com>
---
man/kernel-command-line.xml | 10 ++++++++++
man/systemd-fstab-generator.xml | 10 ++++++++++
src/fstab-generator/fstab-generator.c | 5 ++++-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index a4b7d13..0c2e97d 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -274,6 +274,16 @@
</varlistentry>
<varlistentry>
+ <term><varname>rd.weak_sysroot</varname></term>
+
+ <listitem>
+ <para>Configures the sysroot.mount
+ logic in initrd. For details, see
+ <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>modules-load=</varname></term>
<term><varname>rd.modules-load=</varname></term>
diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
index 4bd25bf..de0ed2f 100644
--- a/man/systemd-fstab-generator.xml
+++ b/man/systemd-fstab-generator.xml
@@ -101,6 +101,16 @@
the initrd. </para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>rd.weak_sysroot</varname></term>
+
+ <listitem><para>If specified, systemd will
+ ingore failures in sysroot.mount and try to
+ continue rather than enter emergency mode.
+ It is honored only by initial RAM disk
+ (initrd). </para></listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index c17299f..449e725 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -492,6 +492,7 @@ static int parse_new_root_from_proc_cmdline(void) {
char *w, *state;
int r;
size_t l;
+ bool weak = false;
r = read_one_line_file("/proc/cmdline", &line);
if (r < 0) {
@@ -544,6 +545,8 @@ static int parse_new_root_from_proc_cmdline(void) {
free(opts);
opts = o;
+ } else if (streq(word, "rd.weak_sysroot")) {
+ weak=true;
}
}
@@ -558,7 +561,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,
+ r = add_mount(what, "/sysroot", type, opts, 0, false, weak, false,
false, NULL, NULL, NULL, SPECIAL_INITRD_ROOT_FS_TARGET, "/proc/cmdline");
return (r < 0) ? r : 0;
--
1.8.3.1
More information about the systemd-devel
mailing list