[systemd-devel] [PATCH] fstab-generator: mask systemd-fsck-root for /sysroot unit

Andrei Borzenkov arvidjaar at gmail.com
Sat Feb 21 03:44:23 PST 2015


В Fri, 20 Feb 2015 12:24:33 +0100
harald at redhat.com пишет:

> From: Harald Hoyer <harald at redhat.com>
> 
> If the fstab-generator generates a mount unit for /sysroot, we shall not
> run systemd-fsck-root in the real root.
> ---
>  Makefile.am                           |  1 +
>  src/fstab-generator/fstab-generator.c | 11 +++++++++++

But this does not solve problem if dracut runs without systemd module.
Why not revert 956eaf2b8d6c9999024705ddadc7393bc707de02 and make dracut
create /run/initramfs/root-fsck instead in both cases?

>  2 files changed, 12 insertions(+)
> 
> diff --git a/Makefile.am b/Makefile.am
> index ba63f68..f28a984 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -2427,6 +2427,7 @@ systemd_fstab_generator_SOURCES = \
>  	src/core/mount-setup.c
>  
>  systemd_fstab_generator_LDADD = \
> +	libsystemd-units.la \
>  	libsystemd-label.la \
>  	libsystemd-shared.la
>  
> diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
> index 5662b5f..a5e763c 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -37,6 +37,7 @@
>  #include "generator.h"
>  #include "strv.h"
>  #include "virt.h"
> +#include "install.h"
>  
>  static const char *arg_dest = "/tmp";
>  static bool arg_fstab_enabled = true;
> @@ -388,6 +389,10 @@ static int parse_fstab(bool initrd) {
>  static int add_root_mount(void) {
>          _cleanup_free_ char *what = NULL;
>          const char *opts;
> +        int r;
> +        const char *const files[] = { "systemd-fsck-root.service", NULL };
> +        UnitFileChange *changes = NULL;
> +        unsigned n_changes = 0;
>  
>          if (isempty(arg_root_what)) {
>                  log_debug("Could not find a root= entry on the kernel command line.");
> @@ -409,6 +414,12 @@ static int add_root_mount(void) {
>                  opts = arg_root_options;
>  
>          log_debug("Found entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype));
> +
> +        /* mask systemd-fsck-root.service */
> +        r = unit_file_mask(UNIT_FILE_SYSTEM, true, NULL, (char**) files, true, &changes, &n_changes);
> +        if (r < 0)
> +                log_error("Failed to mask systemd-fsck-root.service: %m");
> +
>          return add_mount(what,
>                           "/sysroot",
>                           arg_root_fstype,



More information about the systemd-devel mailing list