From 9ed2a0c55be8ee9919953efbacedc079a7428358 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 7 Aug 2018 10:15:56 +0200
Subject: [PATCH 045/142] systemd-units: Add
 "ConditionVirtualization=!container"

When running in a container with plymouth installed, plymouth is started
unnecessarily and systemd prints warnings:

[  OK  ] Reached target Shutdown.
Sending SIGTERM to remaining processes...
Sending SIGKILL to remaining processes...
Process 253 (plymouthd) has been been marked to be excluded from killing. It is running from the root file system, and thus likely to block re-mounting of the root file system to read-only. Please consider moving it into an initrd file system instead.

It makes little sense to start plymouth in contains, so add
'ConditionVirtualization=!container' everywhere where
ConditionKernelCommandLine=!plymouth.enable=0 appears to disable plymouth
in containers.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1337611
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Closes: https://gitlab.freedesktop.org/plymouth/plymouth/issues/27
---
 systemd-units/plymouth-halt.service.in                 | 1 +
 systemd-units/plymouth-kexec.service.in                | 1 +
 systemd-units/plymouth-poweroff.service.in             | 1 +
 systemd-units/plymouth-reboot.service.in               | 1 +
 systemd-units/plymouth-start.service.in                | 1 +
 systemd-units/systemd-ask-password-plymouth.service.in | 1 +
 6 files changed, 6 insertions(+)

diff --git a/systemd-units/plymouth-halt.service.in b/systemd-units/plymouth-halt.service.in
index 59a1912..38ae98c 100644
--- a/systemd-units/plymouth-halt.service.in
+++ b/systemd-units/plymouth-halt.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service
 Before=systemd-halt.service
 DefaultDependencies=no
 ConditionKernelCommandLine=!plymouth.enable=0
+ConditionVirtualization=!container
 
 [Service]
 ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
diff --git a/systemd-units/plymouth-kexec.service.in b/systemd-units/plymouth-kexec.service.in
index 5a39037..bed5eb7 100644
--- a/systemd-units/plymouth-kexec.service.in
+++ b/systemd-units/plymouth-kexec.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service
 Before=systemd-kexec.service
 DefaultDependencies=no
 ConditionKernelCommandLine=!plymouth.enable=0
+ConditionVirtualization=!container
 
 [Service]
 ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
diff --git a/systemd-units/plymouth-poweroff.service.in b/systemd-units/plymouth-poweroff.service.in
index 8ebaf76..7891e97 100644
--- a/systemd-units/plymouth-poweroff.service.in
+++ b/systemd-units/plymouth-poweroff.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service
 Before=systemd-poweroff.service
 DefaultDependencies=no
 ConditionKernelCommandLine=!plymouth.enable=0
+ConditionVirtualization=!container
 
 [Service]
 ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
diff --git a/systemd-units/plymouth-reboot.service.in b/systemd-units/plymouth-reboot.service.in
index 6d5309f..1d57789 100644
--- a/systemd-units/plymouth-reboot.service.in
+++ b/systemd-units/plymouth-reboot.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager.service plymouth-start.service
 Before=systemd-reboot.service
 DefaultDependencies=no
 ConditionKernelCommandLine=!plymouth.enable=0
+ConditionVirtualization=!container
 
 [Service]
 ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=shutdown --attach-to-session
diff --git a/systemd-units/plymouth-start.service.in b/systemd-units/plymouth-start.service.in
index ddfb08f..5d88f60 100644
--- a/systemd-units/plymouth-start.service.in
+++ b/systemd-units/plymouth-start.service.in
@@ -5,6 +5,7 @@ Wants=systemd-ask-password-plymouth.path systemd-vconsole-setup.service
 After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service
 Before=systemd-ask-password-plymouth.service
 ConditionKernelCommandLine=!plymouth.enable=0
+ConditionVirtualization=!container
 
 [Service]
 ExecStart=@PLYMOUTH_DAEMON_DIR@/plymouthd --mode=boot --pid-file=@plymouthruntimedir@/pid --attach-to-session
diff --git a/systemd-units/systemd-ask-password-plymouth.service.in b/systemd-units/systemd-ask-password-plymouth.service.in
index 0c3acde..242b733 100644
--- a/systemd-units/systemd-ask-password-plymouth.service.in
+++ b/systemd-units/systemd-ask-password-plymouth.service.in
@@ -6,6 +6,7 @@ Conflicts=shutdown.target
 After=plymouth-start.service
 Before=shutdown.target
 ConditionKernelCommandLine=!plymouth.enable=0
+ConditionVirtualization=!container
 ConditionPathExists=/run/plymouth/pid
 
 [Service]
-- 
2.7.4

