From: Felipe Sateler Date: Wed, 21 Jun 2017 20:04:38 +0000 (-0400) Subject: nspawn: hook var-lib-machines.mount to machines.target and remote-fs.target X-Git-Tag: v234~116^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78d1039d6b891c41ff68cdaa2bc9e9796e8d14c3;p=thirdparty%2Fsystemd.git nspawn: hook var-lib-machines.mount to machines.target and remote-fs.target /var can be on a remote filesystem, thus hooking it to local-fs.target is not correct. Also, only install the mount unit when machined is enabled, because machined is the one managing the underlying device, and thus makes no sense without machined. Fixes #1175 --- diff --git a/Makefile.am b/Makefile.am index 3b9ed874e5d..07b425eab83 100644 --- a/Makefile.am +++ b/Makefile.am @@ -269,8 +269,10 @@ INSTALL_DIRS = SHUTDOWN_TARGET_WANTS = LOCAL_FS_TARGET_WANTS = +REMOTE_FS_TARGET_WANTS = MULTI_USER_TARGET_WANTS = GRAPHICAL_TARGET_WANTS = +MACHINES_TARGET_WANTS = RESCUE_TARGET_WANTS = SYSINIT_TARGET_WANTS = SOCKETS_TARGET_WANTS = @@ -287,6 +289,8 @@ GENERAL_ALIASES = install-target-wants-hook: what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && dir=$(systemunitdir) && $(add-wants) what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants) + what="$(REMOTE_FS_TARGET_WANTS)" && wants=remote-fs.target && dir=$(systemunitdir) && $(add-wants) + what="$(MACHINES_TARGET_WANTS)" && wants=machines.target && dir=$(systemunitdir) && $(add-wants) what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants) what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants) what="$(RESCUE_TARGET_WANTS)" && wants=rescue.target && dir=$(systemunitdir) && $(add-wants) @@ -539,7 +543,6 @@ dist_systemunit_DATA = \ units/sys-kernel-debug.mount \ units/sys-fs-fuse-connections.mount \ units/tmp.mount \ - units/var-lib-machines.mount \ units/printer.target \ units/sound.target \ units/bluetooth.target \ @@ -5322,6 +5325,10 @@ endif # ------------------------------------------------------------------------------ if ENABLE_MACHINED + +dist_systemunit_DATA += \ + units/var-lib-machines.mount + systemd_machined_SOURCES = \ src/machine/machined.c \ src/machine/machined.h @@ -6568,7 +6575,9 @@ SYSINIT_TARGET_WANTS += \ LOCAL_FS_TARGET_WANTS += \ systemd-remount-fs.service \ - tmp.mount \ + tmp.mount + +REMOTE_FS_TARGET_WANTS += \ var-lib-machines.mount MULTI_USER_TARGET_WANTS += \ @@ -6584,6 +6593,11 @@ SYSINIT_TARGET_WANTS += \ systemd-sysctl.service \ systemd-ask-password-console.path +if ENABLE_MACHINED +MACHINES_TARGET_WANTS += \ + var-lib-machines.mount +endif + if HAVE_SYSV_COMPAT SYSTEM_UNIT_ALIASES += \ poweroff.target runlevel0.target \ diff --git a/units/meson.build b/units/meson.build index 6fb1fa29c9b..e94add6a6f2 100644 --- a/units/meson.build +++ b/units/meson.build @@ -101,8 +101,8 @@ units = [ ['timers.target', ''], ['umount.target', ''], ['user.slice', ''], - ['var-lib-machines.mount', '', - 'local-fs.target.wants/'], + ['var-lib-machines.mount', 'ENABLE_MACHINED', + 'remote-fs.target.wants/ machines.target.wants/'], ] in_units = [