|
|
572a44 |
From 8610788332cb6492d8e5275b32200db4138401bb Mon Sep 17 00:00:00 2001
|
|
|
572a44 |
From: Tom Gundersen <teg@jklm.no>
|
|
|
572a44 |
Date: Sat, 19 Oct 2013 11:38:42 +0200
|
|
|
572a44 |
Subject: [PATCH] fsck-root: only run when requested in fstab
|
|
|
572a44 |
|
|
|
572a44 |
fsck-root is redundant in case an initrd is used, or in case the rootfs
|
|
|
572a44 |
is never remounted 'rw', so the new default is the correct behavior for
|
|
|
572a44 |
most users. For the rest, they should enable it in fstab.
|
|
|
572a44 |
---
|
|
|
572a44 |
Makefile.am | 1 -
|
|
|
572a44 |
man/systemd-fsck@.service.xml | 4 +++-
|
|
|
572a44 |
src/fstab-generator/fstab-generator.c | 31 ++++++++++++++++++++++---------
|
|
|
572a44 |
3 files changed, 25 insertions(+), 11 deletions(-)
|
|
|
572a44 |
|
|
|
572a44 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
572a44 |
index df63275..fa2fba6 100644
|
|
|
572a44 |
--- a/Makefile.am
|
|
|
572a44 |
+++ b/Makefile.am
|
|
|
572a44 |
@@ -4415,7 +4415,6 @@ SYSINIT_TARGET_WANTS += \
|
|
|
572a44 |
systemd-update-utmp.service
|
|
|
572a44 |
LOCAL_FS_TARGET_WANTS += \
|
|
|
572a44 |
systemd-remount-fs.service \
|
|
|
572a44 |
- systemd-fsck-root.service \
|
|
|
572a44 |
tmp.mount
|
|
|
572a44 |
MULTI_USER_TARGET_WANTS += \
|
|
|
572a44 |
getty.target \
|
|
|
572a44 |
diff --git a/man/systemd-fsck@.service.xml b/man/systemd-fsck@.service.xml
|
|
|
572a44 |
index 17bd1c0..811392b 100644
|
|
|
572a44 |
--- a/man/systemd-fsck@.service.xml
|
|
|
572a44 |
+++ b/man/systemd-fsck@.service.xml
|
|
|
572a44 |
@@ -63,7 +63,9 @@
|
|
|
572a44 |
check. <filename>systemd-fsck-root.service</filename> is
|
|
|
572a44 |
responsible for file system checks on the root
|
|
|
572a44 |
file system. The root file system check is performed
|
|
|
572a44 |
- before the other file systems.</para>
|
|
|
572a44 |
+ before the other file systems. Either service is enabled
|
|
|
572a44 |
+ at boot if passno in <filename>/etc/fstab</filename> for
|
|
|
572a44 |
+ the filesystem is set to a value greater than zero.</para>
|
|
|
572a44 |
|
|
|
572a44 |
<para><filename>systemd-fsck</filename> will
|
|
|
572a44 |
forward file system checking progress to the
|
|
|
572a44 |
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
|
|
|
572a44 |
index 7874ff1..c0c2992 100644
|
|
|
572a44 |
--- a/src/fstab-generator/fstab-generator.c
|
|
|
572a44 |
+++ b/src/fstab-generator/fstab-generator.c
|
|
|
572a44 |
@@ -210,17 +210,29 @@ static int add_mount(
|
|
|
572a44 |
post);
|
|
|
572a44 |
|
|
|
572a44 |
if (passno > 0) {
|
|
|
572a44 |
- _cleanup_free_ char *fsck = NULL;
|
|
|
572a44 |
+ if (streq(where, "/")) {
|
|
|
572a44 |
+ lnk = strjoin(arg_dest, "/", SPECIAL_LOCAL_FS_TARGET, ".wants/", "systemd-fsck-root.service", NULL);
|
|
|
572a44 |
+ if (!lnk)
|
|
|
572a44 |
+ return log_oom();
|
|
|
572a44 |
|
|
|
572a44 |
- fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
|
|
|
572a44 |
- if (!fsck)
|
|
|
572a44 |
- return log_oom();
|
|
|
572a44 |
+ mkdir_parents_label(lnk, 0755);
|
|
|
572a44 |
+ if (symlink("systemd-fsck-root.service", lnk) < 0) {
|
|
|
572a44 |
+ log_error("Failed to create symlink %s: %m", lnk);
|
|
|
572a44 |
+ return -errno;
|
|
|
572a44 |
+ }
|
|
|
572a44 |
+ } else {
|
|
|
572a44 |
+ _cleanup_free_ char *fsck = NULL;
|
|
|
572a44 |
|
|
|
572a44 |
- fprintf(f,
|
|
|
572a44 |
- "Requires=%s\n"
|
|
|
572a44 |
- "After=%s\n",
|
|
|
572a44 |
- fsck,
|
|
|
572a44 |
- fsck);
|
|
|
572a44 |
+ fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
|
|
|
572a44 |
+ if (!fsck)
|
|
|
572a44 |
+ return log_oom();
|
|
|
572a44 |
+
|
|
|
572a44 |
+ fprintf(f,
|
|
|
572a44 |
+ "Requires=%s\n"
|
|
|
572a44 |
+ "After=%s\n",
|
|
|
572a44 |
+ fsck,
|
|
|
572a44 |
+ fsck);
|
|
|
572a44 |
+ }
|
|
|
572a44 |
}
|
|
|
572a44 |
|
|
|
572a44 |
|
|
|
572a44 |
@@ -248,6 +260,7 @@ static int add_mount(
|
|
|
572a44 |
|
|
|
572a44 |
if (!noauto) {
|
|
|
572a44 |
if (post) {
|
|
|
572a44 |
+ free(lnk);
|
|
|
572a44 |
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
|
|
|
572a44 |
if (!lnk)
|
|
|
572a44 |
return log_oom();
|