From 79ba087fa8b849248a9f02087ca3dd561e9f49c3 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 10 Jul 2012 17:27:26 +0200 Subject: [PATCH] dracut-020-72.git20120710 - stop journal rather than restart - copy over dracut services to /run/systemd/system --- ...witch-root.service-stop-journald-rat.patch | 23 ++++ ...all-dracut-units-in-etc-and-let-the-.patch | 108 ++++++++++++++++++ dracut.spec | 8 +- 3 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 0070-systemd-initrd-switch-root.service-stop-journald-rat.patch create mode 100644 0071-systemd-install-all-dracut-units-in-etc-and-let-the-.patch diff --git a/0070-systemd-initrd-switch-root.service-stop-journald-rat.patch b/0070-systemd-initrd-switch-root.service-stop-journald-rat.patch new file mode 100644 index 0000000..1610e83 --- /dev/null +++ b/0070-systemd-initrd-switch-root.service-stop-journald-rat.patch @@ -0,0 +1,23 @@ +From ad401d1eaf51677ac324523f9e11869cb29fee11 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Jul 2012 16:19:56 +0200 +Subject: [PATCH] systemd/initrd-switch-root.service: stop journald, rather + than restart + +--- + modules.d/98systemd/initrd-switch-root.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/98systemd/initrd-switch-root.service b/modules.d/98systemd/initrd-switch-root.service +index 84fc11e..493b085 100644 +--- a/modules.d/98systemd/initrd-switch-root.service ++++ b/modules.d/98systemd/initrd-switch-root.service +@@ -15,7 +15,7 @@ OnFailure=emergency.service + Type=oneshot + EnvironmentFile=/run/initramfs/switch-root.conf + ExecStart=/usr/bin/systemctl --force switch-root ${NEWROOT} ${NEWINIT} +-ExecStopPost=-/usr/bin/systemctl restart systemd-journald.service ++ExecStopPost=-/usr/bin/systemctl stop systemd-journald.service + StandardInput=null + StandardOutput=null + StandardError=null diff --git a/0071-systemd-install-all-dracut-units-in-etc-and-let-the-.patch b/0071-systemd-install-all-dracut-units-in-etc-and-let-the-.patch new file mode 100644 index 0000000..f39d691 --- /dev/null +++ b/0071-systemd-install-all-dracut-units-in-etc-and-let-the-.patch @@ -0,0 +1,108 @@ +From bef2fd9722c6f2fd972515c41963639e3bae0bc7 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Jul 2012 16:20:23 +0200 +Subject: [PATCH] systemd: install all dracut units in /etc and let the + generator cp to /run + +All custom units, which should appear in the system later on should be +installed in /etc/systemd. They should have a guard like: +ConditionPathExists=/etc/initrd-release + +So, we can later query via systemctl: + +$ systemctl status dracut-initqueue.service +dracut-initqueue.service - Dracut initqueue hook + Loaded: loaded (/run/systemd/system/dracut-initqueue.service; enabled-runtime) + Active: inactive (dead) since Tue, 10 Jul 2012 16:01:22 +0200; 1min 37s ago + start condition failed at Tue, 10 Jul 2012 16:01:23 +0200; 1min 36s ago + Main PID: 173 (code=exited, status=0/SUCCESS) + CGroup: name=systemd:/system/dracut-initqueue.service + +Jul 10 16:01:22 lenovo dracut-initqueue[173]: Checking, if btrfs device complete +Jul 10 16:01:22 lenovo dracut-initqueue[173]: Remounting /dev/disk/by-uuid/ade13292-d23f-45be-b732-fa9a391a56b0 with -o compress=lzo,ssd,rw +Jul 10 16:01:22 lenovo dracut-initqueue[173]: Mounted root filesystem /dev/sda3 +--- + modules.d/98systemd/module-setup.sh | 41 ++++++++++++++++----------------- + modules.d/98systemd/service-to-run.sh | 6 ++--- + 2 files changed, 22 insertions(+), 25 deletions(-) + +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index f9bb799..5cb236c 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -112,42 +112,41 @@ install() { + + ln -fs $systemdutildir/systemd "$initdir/init" + +- rm -f "${initdir}${systemdsystemunitdir}/emergency.service" + inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/emergency.service +- +- rm -f "${initdir}${systemdsystemunitdir}/rescue.service" + inst_simple "$moddir/rescue.service" ${systemdsystemunitdir}/rescue.service ++ ln -fs "basic.target" "${initdir}${systemdsystemunitdir}/default.target" ++ ++ dracutsystemunitdir="/etc/systemd/system" + +- inst_simple "$moddir/initrd-switch-root.target" ${systemdsystemunitdir}/initrd-switch-root.target +- inst_simple "$moddir/initrd-switch-root.service" ${systemdsystemunitdir}/initrd-switch-root.service +- ln -fs basic.target "${initdir}${systemdsystemunitdir}/default.target" ++ mkdir -p "${initdir}${dracutsystemunitdir}/basic.target.wants" + +- mkdir -p "${initdir}${systemdsystemunitdir}/basic.target.wants" ++ inst_simple "$moddir/initrd-switch-root.target" ${dracutsystemunitdir}/initrd-switch-root.target ++ inst_simple "$moddir/initrd-switch-root.service" ${dracutsystemunitdir}/initrd-switch-root.service + + inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline +- inst_simple "$moddir/dracut-cmdline.service" ${systemdsystemunitdir}/dracut-cmdline.service +- ln -fs ../dracut-cmdline.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-cmdline.service" ++ inst_simple "$moddir/dracut-cmdline.service" ${dracutsystemunitdir}/dracut-cmdline.service ++ ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-cmdline.service" + + inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev +- inst_simple "$moddir/dracut-pre-udev.service" ${systemdsystemunitdir}/dracut-pre-udev.service +- ln -fs ../dracut-pre-udev.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-pre-udev.service" ++ inst_simple "$moddir/dracut-pre-udev.service" ${dracutsystemunitdir}/dracut-pre-udev.service ++ ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-pre-udev.service" + + inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger +- inst_simple "$moddir/dracut-pre-trigger.service" ${systemdsystemunitdir}/dracut-pre-trigger.service +- ln -fs ../dracut-pre-trigger.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-pre-trigger.service" ++ inst_simple "$moddir/dracut-pre-trigger.service" ${dracutsystemunitdir}/dracut-pre-trigger.service ++ ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-pre-trigger.service" + + inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue +- inst_simple "$moddir/dracut-initqueue.service" ${systemdsystemunitdir}/dracut-initqueue.service +- ln -fs ../dracut-initqueue.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-initqueue.service" ++ inst_simple "$moddir/dracut-initqueue.service" ${dracutsystemunitdir}/dracut-initqueue.service ++ ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-initqueue.service" + + inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot +- inst_simple "$moddir/dracut-pre-pivot.service" ${systemdsystemunitdir}/dracut-pre-pivot.service +- ln -fs ../dracut-pre-pivot.service "${initdir}${systemdsystemunitdir}/basic.target.wants/dracut-pre-pivot.service" ++ inst_simple "$moddir/dracut-pre-pivot.service" ${dracutsystemunitdir}/dracut-pre-pivot.service ++ ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-pre-pivot.service" + +- inst_simple "$moddir/udevadm-cleanup-db.service" ${systemdsystemunitdir}/udevadm-cleanup-db.service +- mkdir -p "${initdir}${systemdsystemunitdir}/initrd-switch-root.target.requires" +- ln -fs ../udevadm-cleanup-db.service "${initdir}${systemdsystemunitdir}/initrd-switch-root.target.requires/udevadm-cleanup-db.service" ++ inst_simple "$moddir/udevadm-cleanup-db.service" ${dracutsystemunitdir}/udevadm-cleanup-db.service ++ mkdir -p "${initdir}${dracutsystemunitdir}/initrd-switch-root.target.requires" ++ ln -fs ../udevadm-cleanup-db.service "${initdir}${dracutsystemunitdir}/initrd-switch-root.target.requires/udevadm-cleanup-db.service" + +- inst_script "$moddir/service-to-run.sh" $systemdutildir/system-generators/service-to-run ++ inst_script "$moddir/service-to-run.sh" "${systemdutildir}/system-generators/service-to-run" + } + +diff --git a/modules.d/98systemd/service-to-run.sh b/modules.d/98systemd/service-to-run.sh +index 3e46ba4..797958e 100755 +--- a/modules.d/98systemd/service-to-run.sh ++++ b/modules.d/98systemd/service-to-run.sh +@@ -1,6 +1,4 @@ + #!/bin/sh +- +-cp -a /lib/systemd/system/dracut*.service /run/systemd/system/ +-cp -a /lib/systemd/system/initrd-* /run/systemd/system/ +-cp -a /lib/systemd/system/udevadm*.service /run/systemd/system/ ++mkdir -p /run/systemd/system/ ++cp -a -t /run/systemd/system/ /etc/systemd/system/* + diff --git a/dracut.spec b/dracut.spec index ec1b3f3..92977c2 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 020 -Release: 70.git20120710%{?dist} +Release: 72.git20120710%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -98,6 +98,8 @@ Patch66: 0066-plymouth-add-plymouth-wait-quit.service-to-initrd.patch Patch67: 0067-TEST-01-BASIC-turn-on-systemd-debugging.patch Patch68: 0068-TEST-01-BASIC-enable-selinux.patch Patch69: 0069-install-dracut-install.c-redirect-stderr-to-stdout-a.patch +Patch70: 0070-systemd-initrd-switch-root.service-stop-journald-rat.patch +Patch71: 0071-systemd-install-all-dracut-units-in-etc-and-let-the-.patch BuildRequires: dash bash git @@ -424,6 +426,10 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Tue Jul 10 2012 Harald Hoyer 020-72.git20120710 +- stop journal rather than restart +- copy over dracut services to /run/systemd/system + * Tue Jul 10 2012 Harald Hoyer 020-70.git20120710 - more systemd unit fixups - restart systemd-journald in switch-root post