diff --git a/SOURCES/0001-src-die-during-shutdown-with-everything-else.patch b/SOURCES/0001-src-die-during-shutdown-with-everything-else.patch index e9e5650..bbdd8a6 100644 --- a/SOURCES/0001-src-die-during-shutdown-with-everything-else.patch +++ b/SOURCES/0001-src-die-during-shutdown-with-everything-else.patch @@ -1,4 +1,4 @@ -From 43b4f60da9b468ffb3e782d91b9c01c845a339af Mon Sep 17 00:00:00 2001 +From f55051678452647e035853ee94a89cb54ea2aa4a Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 17 Jul 2020 16:06:44 -0400 Subject: [PATCH] src: die during shutdown with everything else @@ -9,18 +9,191 @@ filesystems to fail to remount read-only in some cases. This commit changes things up so that plymouthd dies with everyone else, but spawns a process to hold open the drm device that can keep the splash up until the very end. + +In order to keep this process alive until the very end, it gets run +from within the initramfs (if available). This requires adding service +files to jump back into the initramfs at shutdown --- - src/Makefile.am | 7 +++ - src/main.c | 11 ++-- - src/plugins/renderers/drm/Makefile.am | 3 +- - src/plugins/renderers/drm/plugin.c | 62 ++++++++++++++++++++++ - src/plymouthd-drm-escrow.c | 18 +++++++ - systemd-units/plymouth-halt.service.in | 1 + - systemd-units/plymouth-poweroff.service.in | 1 + - systemd-units/plymouth-reboot.service.in | 1 + - 8 files changed, 100 insertions(+), 4 deletions(-) + configure.ac | 1 + + scripts/plymouth-populate-initrd.in | 2 + + src/Makefile.am | 7 +++ + src/main.c | 11 +++- + src/plugins/renderers/drm/Makefile.am | 3 +- + src/plugins/renderers/drm/plugin.c | 62 +++++++++++++++++++ + src/plymouthd-drm-escrow.c | 18 ++++++ + systemd-units/Makefile.am | 28 ++++++--- + systemd-units/plymouth-halt.service.in | 1 + + systemd-units/plymouth-poweroff.service.in | 1 + + systemd-units/plymouth-reboot.service.in | 1 + + .../plymouth-switch-root-initramfs.service.in | 12 ++++ + 12 files changed, 134 insertions(+), 13 deletions(-) create mode 100644 src/plymouthd-drm-escrow.c + create mode 100644 systemd-units/plymouth-switch-root-initramfs.service.in +diff --git a/configure.ac b/configure.ac +index 970e19f..1dc8cdb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -319,36 +319,37 @@ AC_CONFIG_FILES([Makefile po/Makefile.in + src/plugins/controls/label/Makefile + src/Makefile + src/client/ply-boot-client.pc + src/client/Makefile + src/upstart-bridge/Makefile + themes/Makefile + themes/spinfinity/Makefile + themes/fade-in/Makefile + themes/tribar/Makefile + themes/text/Makefile + themes/details/Makefile + themes/solar/Makefile + themes/glow/Makefile + themes/spinner/Makefile + themes/script/Makefile + themes/bgrt/Makefile + images/Makefile + scripts/plymouth-generate-initrd + scripts/plymouth-populate-initrd + scripts/plymouth-set-default-theme + scripts/Makefile + systemd-units/plymouth-halt.service + systemd-units/plymouth-kexec.service + systemd-units/plymouth-poweroff.service + systemd-units/plymouth-quit.service + systemd-units/plymouth-quit-wait.service + systemd-units/plymouth-read-write.service + systemd-units/plymouth-reboot.service + systemd-units/plymouth-start.service + systemd-units/plymouth-switch-root.service ++ systemd-units/plymouth-switch-root-initramfs.service + systemd-units/systemd-ask-password-plymouth.path + systemd-units/systemd-ask-password-plymouth.service + systemd-units/Makefile + docs/Makefile + ]) + AC_OUTPUT +diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in +index 60fd063..535a896 100755 +--- a/scripts/plymouth-populate-initrd.in ++++ b/scripts/plymouth-populate-initrd.in +@@ -1,54 +1,55 @@ + #!/bin/bash + # + # inst bits ruthlessly and viciously stolen from dracut + + [ -z "$DESTDIR" ] || exit 0 + + # For running on a (cross-compiled) sysroot, the following + # settings are needed: + # PLYMOUTH_SYSROOT - the sysroot directory + # PLYMOUTH_LDD - an optional ldd command that works on foreign binaries + # PLYMOUTH_LDD_PATH - optional PATH ldd is run with + + [ -z "$PLYMOUTH_LDD" ] && PLYMOUTH_LDD="ldd" + [ -z "$PLYMOUTH_LDD_PATH" ] && PLYMOUTH_LDD_PATH="$PATH" + [ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@" + [ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@" + [ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)" + [ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@PLYMOUTH_LOGO_FILE@" + [ -n "$PLYMOUTH_THEME_NAME" ] && THEME_OVERRIDE=1 + [ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme) + [ -z "$PLYMOUTH_CONFDIR" ] && PLYMOUTH_CONFDIR="@PLYMOUTH_CONF_DIR@" + [ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@" + [ -z "$PLYMOUTH_DAEMON_PATH" ] && PLYMOUTH_DAEMON_PATH="@PLYMOUTH_DAEMON_DIR@/plymouthd" + [ -z "$PLYMOUTH_CLIENT_PATH" ] && PLYMOUTH_CLIENT_PATH="@PLYMOUTH_CLIENT_DIR@/plymouth" ++[ -z "$PLYMOUTH_DRM_ESCROW_PATH" ] && PLYMOUTH_DRM_ESCROW_PATH="@PLYMOUTH_LIBEXECDIR@/plymouth/plymouth-drm-escrow" + [ -z "$SYSTEMD_UNIT_DIR" ] && SYSTEMD_UNIT_DIR="@SYSTEMD_UNIT_DIR@" + [ -z "$SUPPORTED_LANGUAGES" ] && SUPPORTED_LANGUAGES="pt fr de it ru es en zh ja ko zh as bn gu hi kn ml mr or pa ta te" + + # Generic substring function. If $2 is in $1, return 0. + strstr() { [ "${1#*$2*}" != "$1" ]; } + + ddebug() { + [ "$verbose" = "true" ] && echo "$@" + } + + # normalize_path + # Prints the normalized path, where it removes any duplicated + # and trailing slashes. + # Example: + # $ normalize_path ///test/test// + # /test/test + normalize_path() { + shopt -q -s extglob + set -- "${1//+(\/)//}" + shopt -q -u extglob + echo "${1%/}" + } + + # convert_abs_rel + # Prints the relative path, when creating a symlink to from . + # Example: + # $ convert_abs_rel /usr/bin/test /bin/test-2 + # ../../bin/test-2 + # $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test + convert_abs_rel() { +@@ -390,60 +391,61 @@ verbose=false + INITRDDIR="" + while [ $# -gt 0 ]; do + case $1 in + --verbose|-v) + verbose=true + ;; + --targetdir|-t) + shift + INITRDDIR="$1" + ;; + --help|-h) + usage normal + ;; + *) + usage error + break + ;; + esac + shift + done + + [ -z "$INITRDDIR" ] && usage error + + ddebug "Running with PLYMOUTH_SYSROOT=$PLYMOUTH_SYSROOT" + ddebug "Running with PLYMOUTH_LDD=$PLYMOUTH_LDD" + ddebug "Running with PLYMOUTH_LDD_PATH=$PLYMOUTH_LDD_PATH" + + mkdir -p ${INITRDDIR}${PLYMOUTH_DATADIR}/plymouth/themes + inst ${PLYMOUTH_DAEMON_PATH} $INITRDDIR + inst ${PLYMOUTH_CLIENT_PATH} $INITRDDIR ++inst ${PLYMOUTH_DRM_ESCROW_PATH} $INITRDDIR + inst ${PLYMOUTH_DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR + inst ${PLYMOUTH_PLUGIN_PATH}/text.so $INITRDDIR + inst ${PLYMOUTH_DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR + inst ${PLYMOUTH_PLUGIN_PATH}/details.so $INITRDDIR + inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR + inst @RELEASE_FILE@ $INITRDDIR + inst ${PLYMOUTH_POLICYDIR}/plymouthd.defaults $INITRDDIR + inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR + + if [ -z "$PLYMOUTH_THEME_NAME" ]; then + echo "No default plymouth plugin is set" >&2 + exit 1 + fi + + if [ $THEME_OVERRIDE ]; then + conf=$INITRDDIR/${PLYMOUTH_CONFDIR}/plymouthd.conf + echo "modifying plymouthd.conf: Theme=$PLYMOUTH_THEME_NAME" >&2 + # make sure the section and key exist so we can modify them + grep -q "^ *\[Daemon\]" $conf || echo "[Daemon]" >> $conf + grep -q "^ *Theme *=" $conf || echo "Theme=fade-in" >> $conf + sed -i "s/^ *Theme *=.*/# theme modified by plymouth-populate-initrd\nTheme=$PLYMOUTH_THEME_NAME/" $conf + fi + + PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//') + PLYMOUTH_THEME_DIR="${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}" + PLYMOUTH_IMAGE_DIR=$(grep "ImageDir *= *" ${PLYMOUTH_SYSROOT}${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ImageDir *= *//') + + if [ ! -f ${PLYMOUTH_SYSROOT}${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then + echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" >&2 + exit 1 diff --git a/src/Makefile.am b/src/Makefile.am index 95ed019..78f3f78 100644 --- a/src/Makefile.am @@ -516,6 +689,108 @@ index 0000000..9097db9 + + return 0; +} +diff --git a/systemd-units/Makefile.am b/systemd-units/Makefile.am +index b1d843b..bfede17 100644 +--- a/systemd-units/Makefile.am ++++ b/systemd-units/Makefile.am +@@ -1,78 +1,88 @@ + systemd_unit_templates = \ + plymouth-switch-root.service.in \ ++ plymouth-switch-root-initramfs.service.in \ + plymouth-start.service.in \ + plymouth-read-write.service.in \ + plymouth-quit.service.in \ + plymouth-quit-wait.service.in \ + plymouth-reboot.service.in \ + plymouth-kexec.service.in \ + plymouth-poweroff.service.in \ + plymouth-halt.service.in \ + systemd-ask-password-plymouth.path.in \ + systemd-ask-password-plymouth.service.in + + if ENABLE_SYSTEMD_INTEGRATION + systemdunitdir=$(SYSTEMD_UNIT_DIR) + systemdunit_DATA = $(systemd_unit_templates:.in=) + + install-data-hook: + $(MKDIR_P) -m 0755 \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants\ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants && \ + rm -f plymouth-start.service plymouth-switch-root.service && \ + $(LN_S) ../plymouth-start.service && \ + $(LN_S) ../plymouth-switch-root.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants && \ + rm -f plymouth-start.service plymouth-read-write.service && \ + $(LN_S) ../plymouth-start.service && \ + $(LN_S) ../plymouth-read-write.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants && \ + rm -f plymouth-quit.service plymouth-quit-wait.service && \ + $(LN_S) ../plymouth-quit.service && \ + $(LN_S) ../plymouth-quit-wait.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants && \ +- rm -f plymouth-reboot.service && \ +- $(LN_S) ../plymouth-reboot.service) ++ rm -f plymouth-reboot.service \ ++ plymouth-switch-root-initramfs.service && \ ++ $(LN_S) ../plymouth-reboot.service && \ ++ $(LN_S) ../plymouth-switch-root-initramfs.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants && \ + rm -f plymouth-kexec.service && \ + $(LN_S) ../plymouth-kexec.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants && \ +- rm -f plymouth-poweroff.service && \ +- $(LN_S) ../plymouth-poweroff.service) ++ rm -f plymouth-poweroff.service \ ++ plymouth-switch-root-initramfs.service && \ ++ $(LN_S) ../plymouth-poweroff.service && \ ++ $(LN_S) ../plymouth-switch-root-initramf.services) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants && \ +- rm -f plymouth-halt.service && \ +- $(LN_S) ../plymouth-halt.service) ++ rm -f plymouth-halt.service \ ++ plymouth-switch-root-initramfs.service && \ ++ $(LN_S) ../plymouth-halt.service && \ ++ $(LN_S) ../plymouth-switch-root-initramfs.service) + + uninstall-hook: + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/initrd-switch-root.target.wants && \ + rm -f plymouth-start.service plymouth-switch-root.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants && \ + rm -f plymouth-start.service plymouth-read-write.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants && \ + rm -f plymouth-quit.service plymouth-quit-wait.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants && \ +- rm -f plymouth-reboot.service) ++ rm -f plymouth-reboot.service \ ++ plymouth-switch-root-initramfs.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants && \ + rm -f plymouth-kexec.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants && \ +- rm -f plymouth-poweroff.service) ++ rm -f plymouth-poweroff.service \ ++ plymouth-switch-root-initramfs.service) + (cd $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants && \ +- rm -f plymouth-halt.service) ++ rm -f plymouth-halt.service \ ++ plymouth-switch-root-initramfs.service) + rmdir --ignore-fail-on-non-empty \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysinit.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/multi-user.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/reboot.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/kexec.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/poweroff.target.wants \ + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/halt.target.wants + + endif + + EXTRA_DIST = $(systemd_unit_templates) $(systemdunit_DATA) + DISTCLEANFILES=$(systemdunit_DATA) diff --git a/systemd-units/plymouth-halt.service.in b/systemd-units/plymouth-halt.service.in index cb87c1f..00f7eed 100644 --- a/systemd-units/plymouth-halt.service.in @@ -573,6 +848,24 @@ index 3624550..8fff576 100644 +KillMode=none Type=forking RemainAfterExit=yes +diff --git a/systemd-units/plymouth-switch-root-initramfs.service.in b/systemd-units/plymouth-switch-root-initramfs.service.in +new file mode 100644 +index 0000000..cb20459 +--- /dev/null ++++ b/systemd-units/plymouth-switch-root-initramfs.service.in +@@ -0,0 +1,12 @@ ++[Unit] ++Description=Tell Plymouth To Jump To initramfs ++DefaultDependencies=no ++After=plymouth-halt.service plymouth-reboot.service plymouth-poweroff.service dracut-shutdown.service ++ConditionPathExists=/run/initramfs/bin/sh ++ ++[Service] ++Type=oneshot ++RemainAfterExit=yes ++ExecStart=-@PLYMOUTH_CLIENT_DIR@/plymouth update-root-fs --new-root-dir=/run/initramfs ++Type=oneshot ++RemainAfterExit=yes -- 2.26.0 diff --git a/SPECS/plymouth.spec b/SPECS/plymouth.spec index ac92a6d..6fcfd58 100644 --- a/SPECS/plymouth.spec +++ b/SPECS/plymouth.spec @@ -10,7 +10,7 @@ Summary: Graphical Boot Animation and Logger Name: plymouth Version: 0.9.4 -Release: 3.%{commitdate}git%{shortcommit}%{?dist} +Release: 4.%{commitdate}git%{shortcommit}%{?dist} License: GPLv2+ URL: http://www.freedesktop.org/wiki/Software/Plymouth Group: System Environment/Base @@ -450,6 +450,10 @@ fi %files system-theme %changelog +* Mon Jul 20 2020 Ray Strode - 0.9.4-4.git1688935 +- Fix one last bit of flicker in the shutdown path + Related: #1626342 + * Fri Jul 17 2020 Ray Strode - 0.9.4-3.git1688935 - Die at shutdown with everything else Resolves: #1626342