From 2265b4cd57b4437fc8f2b64ea6597ee3a1f481e5 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Jul 10 2012 10:45:52 +0000 Subject: dracut-020-70.git20120710 +- more systemd unit fixups +- restart systemd-journald in switch-root post +- fixed dracut-install loader ldd error message --- diff --git a/0064-TEST-99-RPM-test-trap.patch b/0064-TEST-99-RPM-test-trap.patch new file mode 100644 index 0000000..7241ec5 --- /dev/null +++ b/0064-TEST-99-RPM-test-trap.patch @@ -0,0 +1,23 @@ +From 43bac63e33a31f4d86ca8f16b439dd33336a374b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 9 Jul 2012 20:44:48 +0200 +Subject: [PATCH] TEST-99-RPM test trap + +--- + test/TEST-99-RPM/test.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/test/TEST-99-RPM/test.sh b/test/TEST-99-RPM/test.sh +index 25c1895..66f0beb 100755 +--- a/test/TEST-99-RPM/test.sh ++++ b/test/TEST-99-RPM/test.sh +@@ -14,6 +14,9 @@ test_run() { + mkdir -p "$rootdir/sys" + mkdir -p "$rootdir/dev" + ++trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit $ret;' EXIT ++trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit 1;' SIGINT ++ + mount --bind /proc "$rootdir/proc" + mount --bind /sys "$rootdir/sys" + mount -t devtmpfs devtmpfs "$rootdir/dev" diff --git a/0065-systemd-service-cleanup.patch b/0065-systemd-service-cleanup.patch new file mode 100644 index 0000000..ba91614 --- /dev/null +++ b/0065-systemd-service-cleanup.patch @@ -0,0 +1,280 @@ +From 792b189317068202aba16d1fc2371d605a6c715c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 9 Jul 2012 20:46:20 +0200 +Subject: [PATCH] systemd service cleanup + +--- + modules.d/95rootfs-block/block-genrules.sh | 28 ++++++++++++------------ + modules.d/98systemd/dracut-cmdline.service | 4 +--- + modules.d/98systemd/dracut-initqueue.service | 4 +--- + modules.d/98systemd/dracut-initqueue.sh | 1 - + modules.d/98systemd/dracut-pre-pivot.service | 7 +++--- + modules.d/98systemd/dracut-pre-pivot.sh | 11 ---------- + modules.d/98systemd/dracut-pre-trigger.service | 4 +--- + modules.d/98systemd/dracut-pre-udev.service | 4 +--- + modules.d/98systemd/initrd-switch-root.service | 6 ++++- + modules.d/98systemd/initrd-switch-root.target | 2 +- + modules.d/98systemd/module-setup.sh | 10 ++++++--- + modules.d/98systemd/service-to-run.sh | 6 +++++ + modules.d/98systemd/udevadm-cleanup-db.service | 20 +++++++++++++++++ + 13 files changed, 60 insertions(+), 47 deletions(-) + create mode 100755 modules.d/98systemd/service-to-run.sh + create mode 100644 modules.d/98systemd/udevadm-cleanup-db.service + +diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh +index fe6e331..7f894ee 100755 +--- a/modules.d/95rootfs-block/block-genrules.sh ++++ b/modules.d/95rootfs-block/block-genrules.sh +@@ -13,22 +13,22 @@ if [ "${root%%:*}" = "block" ]; then + printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \ + "${root#block:}" "${root#block:}" > $hookdir/initqueue/settled/blocksymlink.sh + +- if [ -d /lib/systemd/system/ ]; then +- echo "${root#block:} $NEWROOT ${fstype:-auto} ${rflags:-defaults} 1 1" >> /etc/fstab +- { +- echo '[Unit]' +- echo 'Description=New Root File System' +- echo 'DefaultDependencies=no' +- echo 'Before=switch-root.service' +- echo '[Mount]' +- echo "What=${root#block:}" +- echo "Where=$NEWROOT" ++ # if [ -d /lib/systemd/system/ ]; then ++ # echo "${root#block:} $NEWROOT ${fstype:-auto} ${rflags:-defaults} 1 1" >> /etc/fstab ++ # { ++ # echo '[Unit]' ++ # echo 'Description=New Root File System' ++ # echo 'DefaultDependencies=no' ++ # echo 'Before=initrd-switch-root.service' ++ # echo '[Mount]' ++ # echo "What=${root#block:}" ++ # echo "Where=$NEWROOT" + +- } >/lib/systemd/system/${NEWROOT#/}.mount ++ # } >/lib/systemd/system/${NEWROOT#/}.mount + +- mkdir -p /lib/systemd/system/switch-root.target.wants +- ln -s ../${NEWROOT#/}.mount /lib/systemd/system/switch-root.target.wants/${NEWROOT#/}.mount +- fi ++ # mkdir -p /lib/systemd/system/initrd-switch-root.target.requires ++ # ln -s ../${NEWROOT#/}.mount /lib/systemd/system/initrd-switch-root.target.requires/${NEWROOT#/}.mount ++ # fi + + wait_for_dev "${root#block:}" + fi +diff --git a/modules.d/98systemd/dracut-cmdline.service b/modules.d/98systemd/dracut-cmdline.service +index 13671e4..1ed50a9 100644 +--- a/modules.d/98systemd/dracut-cmdline.service ++++ b/modules.d/98systemd/dracut-cmdline.service +@@ -16,10 +16,8 @@ Wants=systemd-journald.socket + ConditionPathExists=/etc/initrd-release + + [Service] +-Environment=HOME=/ +-WorkingDirectory=/ +-ExecStart=-/bin/dracut-cmdline + Type=oneshot ++ExecStart=-/bin/dracut-cmdline + StandardInput=null + StandardOutput=syslog + StandardError=syslog+console +diff --git a/modules.d/98systemd/dracut-initqueue.service b/modules.d/98systemd/dracut-initqueue.service +index 5168677..e611e93 100644 +--- a/modules.d/98systemd/dracut-initqueue.service ++++ b/modules.d/98systemd/dracut-initqueue.service +@@ -15,10 +15,8 @@ Wants=systemd-udev-trigger.service + ConditionPathExists=/etc/initrd-release + + [Service] +-Environment=HOME=/ +-WorkingDirectory=/ ++Type=oneshot + ExecStart=-/bin/dracut-initqueue +-Type=simple + StandardInput=null + StandardOutput=syslog + StandardError=syslog+console +diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh +index bc63582..cfdb12d 100755 +--- a/modules.d/98systemd/dracut-initqueue.sh ++++ b/modules.d/98systemd/dracut-initqueue.sh +@@ -106,5 +106,4 @@ done + + export -p > /dracut-state.sh + +-systemctl isolate initrd-switch-root.target + exit 0 +diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service +index 27cb7de..61257cf 100644 +--- a/modules.d/98systemd/dracut-pre-pivot.service ++++ b/modules.d/98systemd/dracut-pre-pivot.service +@@ -10,14 +10,13 @@ + [Unit] + Description=Dracut pre-pivot and cleanup hook + DefaultDependencies=no +-Before=initrd-switch-root.service ++After=dracut-initqueue.service + ConditionPathExists=/etc/initrd-release + + [Service] +-Environment=HOME=/ +-WorkingDirectory=/ +-ExecStart=-/bin/dracut-pre-pivot + Type=oneshot ++ExecStart=-/bin/dracut-pre-pivot ++ExecStopPost=-/usr/bin/systemctl isolate initrd-switch-root.target + StandardInput=null + StandardOutput=syslog + StandardError=syslog+console +diff --git a/modules.d/98systemd/dracut-pre-pivot.sh b/modules.d/98systemd/dracut-pre-pivot.sh +index 06642d0..31dded5 100755 +--- a/modules.d/98systemd/dracut-pre-pivot.sh ++++ b/modules.d/98systemd/dracut-pre-pivot.sh +@@ -34,20 +34,9 @@ done + + echo "NEWROOT=\"$NEWROOT\"" >> /run/initramfs/switch-root.conf + +-udevadm control --stop-exec-queue +- +-for i in systemd-udevd.service; do +- systemctl is-active $i >/dev/null 2>&1 && systemctl stop $i +-done +- +-udevadm info --cleanup-db +- + # remove helper symlink + [ -h /dev/root ] && rm -f /dev/root + + getarg rd.break rdbreak && emergency_shell -n switch_root "Break before switch_root" + +-cp -avr /lib/systemd/system/dracut*.service /run/systemd/system/ +- +-export -p > /dracut-state.sh + exit 0 +diff --git a/modules.d/98systemd/dracut-pre-trigger.service b/modules.d/98systemd/dracut-pre-trigger.service +index 86c7c5e..b2dcf68 100644 +--- a/modules.d/98systemd/dracut-pre-trigger.service ++++ b/modules.d/98systemd/dracut-pre-trigger.service +@@ -16,10 +16,8 @@ Wants=dracut-pre-udev.service systemd-udevd.service + ConditionPathExists=/etc/initrd-release + + [Service] +-Environment=HOME=/ +-WorkingDirectory=/ +-ExecStart=-/bin/dracut-pre-trigger + Type=oneshot ++ExecStart=-/bin/dracut-pre-trigger + StandardInput=null + StandardOutput=syslog + StandardError=syslog+console +diff --git a/modules.d/98systemd/dracut-pre-udev.service b/modules.d/98systemd/dracut-pre-udev.service +index a320498..cc14f88 100644 +--- a/modules.d/98systemd/dracut-pre-udev.service ++++ b/modules.d/98systemd/dracut-pre-udev.service +@@ -16,10 +16,8 @@ Wants=dracut-cmdline.service + ConditionPathExists=/etc/initrd-release + + [Service] +-Environment=HOME=/ +-WorkingDirectory=/ +-ExecStart=-/bin/dracut-pre-udev + Type=oneshot ++ExecStart=-/bin/dracut-pre-udev + StandardInput=null + StandardOutput=syslog + StandardError=syslog+console +diff --git a/modules.d/98systemd/initrd-switch-root.service b/modules.d/98systemd/initrd-switch-root.service +index b00292f..84fc11e 100644 +--- a/modules.d/98systemd/initrd-switch-root.service ++++ b/modules.d/98systemd/initrd-switch-root.service +@@ -9,9 +9,13 @@ + Description=Switch Root + DefaultDependencies=no + ConditionPathExists=/etc/initrd-release ++OnFailure=emergency.service + + [Service] + Type=oneshot + EnvironmentFile=/run/initramfs/switch-root.conf + ExecStart=/usr/bin/systemctl --force switch-root ${NEWROOT} ${NEWINIT} +-ExecStopPost=-/usr/bin/systemctl isolate default.target ++ExecStopPost=-/usr/bin/systemctl restart systemd-journald.service ++StandardInput=null ++StandardOutput=null ++StandardError=null +diff --git a/modules.d/98systemd/initrd-switch-root.target b/modules.d/98systemd/initrd-switch-root.target +index 5f39711..feb7162 100644 +--- a/modules.d/98systemd/initrd-switch-root.target ++++ b/modules.d/98systemd/initrd-switch-root.target +@@ -13,4 +13,4 @@ DefaultDependencies=no + Requires=initrd-switch-root.service + Before=initrd-switch-root.service + AllowIsolate=yes +- ++Wants=systemd-journald.service +diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh +index 0387ec4..f9bb799 100755 +--- a/modules.d/98systemd/module-setup.sh ++++ b/modules.d/98systemd/module-setup.sh +@@ -63,7 +63,7 @@ install() { + $systemdsystemunitdir/systemd-ask-password-console.service \ + $systemdsystemunitdir/halt.service \ + $systemdsystemunitdir/poweroff.service \ +- $systemdsystemunitdir/reboot.service \ ++ $systemdsystemunitdir/systemd-reboot.service \ + $systemdsystemunitdir/kexec.service \ + $systemdsystemunitdir/fsck@.service \ + $systemdsystemunitdir/systemd-udevd.service \ +@@ -142,8 +142,12 @@ install() { + + inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot + inst_simple "$moddir/dracut-pre-pivot.service" ${systemdsystemunitdir}/dracut-pre-pivot.service +- mkdir -p "${initdir}${systemdsystemunitdir}/initrd-switch-root.target.wants" +- ln -fs ../dracut-pre-pivot.service "${initdir}${systemdsystemunitdir}/initrd-switch-root.target.wants/dracut-pre-pivot.service" ++ ln -fs ../dracut-pre-pivot.service "${initdir}${systemdsystemunitdir}/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_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 +new file mode 100755 +index 0000000..3e46ba4 +--- /dev/null ++++ b/modules.d/98systemd/service-to-run.sh +@@ -0,0 +1,6 @@ ++#!/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/ ++ +diff --git a/modules.d/98systemd/udevadm-cleanup-db.service b/modules.d/98systemd/udevadm-cleanup-db.service +new file mode 100644 +index 0000000..368a0dd +--- /dev/null ++++ b/modules.d/98systemd/udevadm-cleanup-db.service +@@ -0,0 +1,20 @@ ++# This file is part of systemd. ++# ++# systemd is free software; you can redistribute it and/or modify it ++# under the terms of the GNU Lesser General Public License as published by ++# the Free Software Foundation; either version 2.1 of the License, or ++# (at your option) any later version. ++ ++[Unit] ++Description=Cleanup udevd DB ++DefaultDependencies=no ++ConditionPathExists=/etc/initrd-release ++Conflicts=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket ++Before=initrd-switch-root.service ++ ++[Service] ++Type=oneshot ++ExecStart=-/usr/bin/udevadm info --cleanup-db ++StandardInput=null ++StandardOutput=null ++StandardError=null diff --git a/0066-plymouth-add-plymouth-wait-quit.service-to-initrd.patch b/0066-plymouth-add-plymouth-wait-quit.service-to-initrd.patch new file mode 100644 index 0000000..895a72e --- /dev/null +++ b/0066-plymouth-add-plymouth-wait-quit.service-to-initrd.patch @@ -0,0 +1,23 @@ +From 0028ffac74574e39e54507f4903ca93b042a04a1 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 9 Jul 2012 20:49:24 +0200 +Subject: [PATCH] plymouth: add plymouth-wait-quit.service to initrd + +--- + modules.d/50plymouth/module-setup.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh +index 10aa0da..14d9e59 100755 +--- a/modules.d/50plymouth/module-setup.sh ++++ b/modules.d/50plymouth/module-setup.sh +@@ -76,5 +76,9 @@ install() { + inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh + inst_hook emergency 50 "$moddir"/plymouth-emergency.sh + dracut_install readlink ++ ++ if [[ -x $systemdutildir/systemd ]]; then ++ dracut_install -o $systemdsystemunitdir/plymouth-quit-wait.service ++ fi + } + diff --git a/0067-TEST-01-BASIC-turn-on-systemd-debugging.patch b/0067-TEST-01-BASIC-turn-on-systemd-debugging.patch new file mode 100644 index 0000000..3a60a83 --- /dev/null +++ b/0067-TEST-01-BASIC-turn-on-systemd-debugging.patch @@ -0,0 +1,22 @@ +From fe5f8d0074a4a4bba11053450c71acce607f8b22 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Jul 2012 09:17:48 +0200 +Subject: [PATCH] TEST-01-BASIC: turn on systemd debugging + +--- + test/TEST-01-BASIC/test.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh +index f8522e6..22feab5 100755 +--- a/test/TEST-01-BASIC/test.sh ++++ b/test/TEST-01-BASIC/test.sh +@@ -14,7 +14,7 @@ test_run() { + -m 256M -nographic \ + -net none -kernel /boot/vmlinuz-$KVERSION \ + -watchdog ib700 -watchdog-action poweroff \ +- -append "root=LABEL=dracut rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ ++ -append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ + -initrd $TESTDIR/initramfs.testing || return 1 + grep -m 1 -q dracut-root-block-success $TESTDIR/result || return 1 + } diff --git a/0068-TEST-01-BASIC-enable-selinux.patch b/0068-TEST-01-BASIC-enable-selinux.patch new file mode 100644 index 0000000..774a551 --- /dev/null +++ b/0068-TEST-01-BASIC-enable-selinux.patch @@ -0,0 +1,22 @@ +From 9ede75b1ce0ecbeb103fe5960d3d91f53e5bbb91 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Jul 2012 10:32:43 +0200 +Subject: [PATCH] TEST-01-BASIC: enable selinux + +--- + test/TEST-01-BASIC/test.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh +index 22feab5..850da77 100755 +--- a/test/TEST-01-BASIC/test.sh ++++ b/test/TEST-01-BASIC/test.sh +@@ -14,7 +14,7 @@ test_run() { + -m 256M -nographic \ + -net none -kernel /boot/vmlinuz-$KVERSION \ + -watchdog ib700 -watchdog-action poweroff \ +- -append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ ++ -append "root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 $DEBUGFAIL" \ + -initrd $TESTDIR/initramfs.testing || return 1 + grep -m 1 -q dracut-root-block-success $TESTDIR/result || return 1 + } diff --git a/0069-install-dracut-install.c-redirect-stderr-to-stdout-a.patch b/0069-install-dracut-install.c-redirect-stderr-to-stdout-a.patch new file mode 100644 index 0000000..3432206 --- /dev/null +++ b/0069-install-dracut-install.c-redirect-stderr-to-stdout-a.patch @@ -0,0 +1,34 @@ +From a92311074b487608bfd632ae3b443067d237b6f8 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 10 Jul 2012 10:53:28 +0200 +Subject: [PATCH] install/dracut-install.c: redirect stderr to stdout and skip + loader + +skip if ldd was run on the loader +--- + install/dracut-install.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 1d5748d..ee6950a 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -268,7 +268,7 @@ static int resolve_deps(const char *src) + } + + /* run ldd */ +- asprintf(&cmd, "ldd %s", src); ++ asprintf(&cmd, "ldd %s 2>&1", src); + fptr = popen(cmd, "r"); + + while (!feof(fptr)) { +@@ -282,6 +282,9 @@ static int resolve_deps(const char *src) + if (strstr(buf, "not a dynamic executable")) + break; + ++ if (strstr(buf, "loader cannot load itself")) ++ break; ++ + p = strstr(buf, "/"); + if (p) { + int r; diff --git a/dracut.spec b/dracut.spec index da392e0..ec1b3f3 100644 --- a/dracut.spec +++ b/dracut.spec @@ -10,7 +10,7 @@ Name: dracut Version: 020 -Release: 64.git20120709%{?dist} +Release: 70.git20120710%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -92,6 +92,12 @@ Patch60: 0060-plymouth-Use-latest-plymouth-s-populate-script.patch Patch61: 0061-test-export-initdir.patch Patch62: 0062-test-new-test-TEST-99-RPM.patch Patch63: 0063-resume-move-resume-process-to-initqueue.patch +Patch64: 0064-TEST-99-RPM-test-trap.patch +Patch65: 0065-systemd-service-cleanup.patch +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 BuildRequires: dash bash git @@ -418,6 +424,11 @@ rm -rf $RPM_BUILD_ROOT %dir /var/lib/dracut/overlay %changelog +* Tue Jul 10 2012 Harald Hoyer 020-70.git20120710 +- more systemd unit fixups +- restart systemd-journald in switch-root post +- fixed dracut-install loader ldd error message + * Mon Jul 09 2012 Harald Hoyer 020-64.git20120709 - fixed plymouth install - fixed resume