summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/systemd-remount-fs.service.xml11
-rw-r--r--src/fstab-generator/fstab-generator.c2
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c7
-rw-r--r--src/shared/generator.c6
-rw-r--r--src/shared/generator.h2
-rw-r--r--units/meson.build3
-rw-r--r--units/systemd-remount-fs.service.in1
7 files changed, 26 insertions, 6 deletions
diff --git a/man/systemd-remount-fs.service.xml b/man/systemd-remount-fs.service.xml
index 988a617406..0c1562142f 100644
--- a/man/systemd-remount-fs.service.xml
+++ b/man/systemd-remount-fs.service.xml
@@ -50,6 +50,13 @@
<para>For a longer discussion of kernel API file systems see
<ulink url="https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems">API
File Systems</ulink>.</para>
+
+ <para>Note: <filename>systemd-remount-fs.service</filename> is usually pulled in by
+ <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ hence it is also affected by the kernel command line option <varname>fstab=</varname>, which may be used
+ to disable the generator. It may also pulled in by
+ <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ which is affected by <varname>systemd.gpt_auto</varname> and other options.</para>
</refsect1>
<refsect1>
@@ -57,7 +64,9 @@
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
- <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
</para>
</refsect1>
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index cebfed25cb..b5084c955c 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -890,6 +890,8 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
/* If running in the initrd also parse the /etc/fstab from the host */
if (in_initrd())
r3 = parse_fstab(true);
+ else
+ r3 = generator_enable_remount_fs_service(arg_dest);
}
return r < 0 ? r : r2 < 0 ? r2 : r3;
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index d9e29c47f3..09c0bcba2d 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -467,13 +467,13 @@ static int add_root_rw(DissectedPartition *p) {
return 0;
}
+ (void) generator_enable_remount_fs_service(arg_dest);
+
path = strjoina(arg_dest, "/systemd-remount-fs.service.d/50-remount-rw.conf");
(void) mkdir_parents(path, 0755);
r = write_string_file(path,
"# Automatically generated by systemd-gpt-generator\n\n"
- "[Unit]\n"
- "ConditionPathExists=\n\n" /* We need to turn off the ConditionPathExist= in the main unit file */
"[Service]\n"
"Environment=SYSTEMD_REMOUNT_ROOT_RW=1\n",
WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_NOFOLLOW);
@@ -678,6 +678,9 @@ static int add_root_mount(void) {
return r;
}
+ /* Note that we do not need to enable systemd-remount-fs.service here. If
+ * /etc/fstab exists, systemd-fstab-generator will pull it in for us. */
+
return add_mount(
"root",
"/dev/gpt-auto-root",
diff --git a/src/shared/generator.c b/src/shared/generator.c
index ce8305c236..55bd024f9e 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -499,6 +499,12 @@ int generator_hook_up_growfs(
return generator_add_symlink(dir, where_unit, "wants", unit);
}
+int generator_enable_remount_fs_service(const char *dir) {
+ /* Pull in systemd-remount-fs.service */
+ return generator_add_symlink(dir, SPECIAL_LOCAL_FS_TARGET, "wants",
+ SYSTEM_DATA_UNIT_PATH "/" SPECIAL_REMOUNT_FS_SERVICE);
+}
+
void log_setup_generator(void) {
log_set_prohibit_ipc(true);
log_setup_service();
diff --git a/src/shared/generator.h b/src/shared/generator.h
index e2209657cd..fa002a9114 100644
--- a/src/shared/generator.h
+++ b/src/shared/generator.h
@@ -50,6 +50,8 @@ int generator_hook_up_growfs(
const char *where,
const char *target);
+int generator_enable_remount_fs_service(const char *dir);
+
void log_setup_generator(void);
/* Similar to DEFINE_MAIN_FUNCTION, but initializes logging and assigns positional arguments. */
diff --git a/units/meson.build b/units/meson.build
index d69508467f..3820585051 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -186,8 +186,7 @@ in_units = [
['systemd-quotacheck.service', 'ENABLE_QUOTACHECK'],
['systemd-random-seed.service', 'ENABLE_RANDOMSEED',
'sysinit.target.wants/'],
- ['systemd-remount-fs.service', '',
- 'local-fs.target.wants/'],
+ ['systemd-remount-fs.service', ''],
['systemd-resolved.service', 'ENABLE_RESOLVE',
join_paths(pkgsysconfdir, 'system/dbus-org.freedesktop.resolve1.service') + ' ' +
join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')],
diff --git a/units/systemd-remount-fs.service.in b/units/systemd-remount-fs.service.in
index 2e5b75ec03..4f4304d68e 100644
--- a/units/systemd-remount-fs.service.in
+++ b/units/systemd-remount-fs.service.in
@@ -16,7 +16,6 @@ Conflicts=shutdown.target
After=systemd-fsck-root.service
Before=local-fs-pre.target local-fs.target shutdown.target
Wants=local-fs-pre.target
-ConditionPathExists=/etc/fstab
[Service]
Type=oneshot