Blame 0043-systemd-switch-to-new-initrd.target.patch

Harald Hoyer 61c497
From 85c85f07e27234d305a2995ef059aa1241d4875d Mon Sep 17 00:00:00 2001
Harald Hoyer 61c497
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 61c497
Date: Thu, 14 Mar 2013 15:35:54 +0100
Harald Hoyer 61c497
Subject: [PATCH] systemd: switch to new initrd.target
Harald Hoyer 61c497
Harald Hoyer 61c497
                             (normal startup)
Harald Hoyer 61c497
                                    :
Harald Hoyer 61c497
                                    :
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
                              basic.target
Harald Hoyer 61c497
                                    |
Harald Hoyer 61c497
             ______________________/|
Harald Hoyer 61c497
            /                       |
Harald Hoyer 61c497
            |                  sysroot.mount
Harald Hoyer 61c497
            |                       |
Harald Hoyer 61c497
            |                       v
Harald Hoyer 61c497
            |             initrd-root-fs.target
Harald Hoyer 61c497
            |                       |
Harald Hoyer 61c497
            |                       v
Harald Hoyer 61c497
            |            initrd-parse-etc.service
Harald Hoyer 61c497
(custom initrd services)            |
Harald Hoyer 61c497
            |                       v
Harald Hoyer 61c497
            |            (sysroot-usr.mount and
Harald Hoyer 61c497
            |             various mounts marked
Harald Hoyer 61c497
            |               with fstab option
Harald Hoyer 61c497
            |                x-initrd.mount)
Harald Hoyer 61c497
            |                       |
Harald Hoyer 61c497
            |                       v
Harald Hoyer 61c497
            |                initrd-fs.target
Harald Hoyer 61c497
            |                       |
Harald Hoyer 61c497
            \______________________ |
Harald Hoyer 61c497
                                   \|
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
                               initrd.target
Harald Hoyer 61c497
                                    |
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
                          initrd-cleanup.service
Harald Hoyer 61c497
                               isolates to
Harald Hoyer 61c497
                         initrd-switch-root.target
Harald Hoyer 61c497
                                    |
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
             ______________________/|
Harald Hoyer 61c497
            /                       |
Harald Hoyer 61c497
            |        initrd-udevadm-cleanup-db.service
Harald Hoyer 61c497
            |                       |
Harald Hoyer 61c497
(custom initrd services)            |
Harald Hoyer 61c497
            |                       |
Harald Hoyer 61c497
            \______________________ |
Harald Hoyer 61c497
                                   \|
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
                        initrd-switch-root.target
Harald Hoyer 61c497
                                    |
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
                        initrd-switch-root.service
Harald Hoyer 61c497
                                    |
Harald Hoyer 61c497
                                    v
Harald Hoyer 61c497
                               switch-root
Harald Hoyer 61c497
---
Harald Hoyer 61c497
 modules.d/98systemd/dracut-mount.service       |  4 ++--
Harald Hoyer 61c497
 modules.d/98systemd/dracut-pre-mount.service   |  2 +-
Harald Hoyer 61c497
 modules.d/98systemd/dracut-pre-pivot.service   |  4 ++--
Harald Hoyer 61c497
 modules.d/98systemd/emergency.service          |  2 +-
Harald Hoyer 61c497
 modules.d/98systemd/module-setup.sh            | 20 +++++---------------
Harald Hoyer 61c497
 modules.d/98systemd/udevadm-cleanup-db.service | 22 ----------------------
Harald Hoyer 61c497
 modules.d/99fs-lib/fs-lib.sh                   |  4 ++--
Harald Hoyer 61c497
 7 files changed, 13 insertions(+), 45 deletions(-)
Harald Hoyer 61c497
 delete mode 100644 modules.d/98systemd/udevadm-cleanup-db.service
Harald Hoyer 61c497
Harald Hoyer 61c497
diff --git a/modules.d/98systemd/dracut-mount.service b/modules.d/98systemd/dracut-mount.service
Harald Hoyer 61c497
index b26b8a5..5c12683 100644
Harald Hoyer 61c497
--- a/modules.d/98systemd/dracut-mount.service
Harald Hoyer 61c497
+++ b/modules.d/98systemd/dracut-mount.service
Harald Hoyer 61c497
@@ -11,8 +11,8 @@
Harald Hoyer 61c497
 Description=dracut mount hook
Harald Hoyer 61c497
 Documentation=man:dracut-mount.service(8)
Harald Hoyer 61c497
 DefaultDependencies=no
Harald Hoyer 61c497
-After=dracut-pre-mount.service dracut-initqueue.service initrd-parse-etc.service root-fs.target initrd-fs.target
Harald Hoyer 61c497
-Wants=root-fs.target initrd-fs.target
Harald Hoyer 61c497
+After=initrd-root-fs.target initrd-parse-etc.service
Harald Hoyer 61c497
+
Harald Hoyer 61c497
 ConditionPathExists=/etc/initrd-release
Harald Hoyer 61c497
 ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
Harald Hoyer 61c497
 ConditionKernelCommandLine=|rd.break=mount
Harald Hoyer 61c497
diff --git a/modules.d/98systemd/dracut-pre-mount.service b/modules.d/98systemd/dracut-pre-mount.service
Harald Hoyer 61c497
index 17bfda9..0d76943 100644
Harald Hoyer 61c497
--- a/modules.d/98systemd/dracut-pre-mount.service
Harald Hoyer 61c497
+++ b/modules.d/98systemd/dracut-pre-mount.service
Harald Hoyer 61c497
@@ -11,7 +11,7 @@
Harald Hoyer 61c497
 Description=dracut pre-mount hook
Harald Hoyer 61c497
 Documentation=man:dracut-pre-mount.service(8)
Harald Hoyer 61c497
 DefaultDependencies=no
Harald Hoyer 61c497
-Before=sysroot.mount root-fs.target
Harald Hoyer 61c497
+Before=initrd-root-fs.target
Harald Hoyer 61c497
 After=dracut-initqueue.service
Harald Hoyer 61c497
 After=cryptsetup.target
Harald Hoyer 61c497
 ConditionPathExists=/etc/initrd-release
Harald Hoyer 61c497
diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service
Harald Hoyer 61c497
index 49f76ef..72941c9 100644
Harald Hoyer 61c497
--- a/modules.d/98systemd/dracut-pre-pivot.service
Harald Hoyer 61c497
+++ b/modules.d/98systemd/dracut-pre-pivot.service
Harald Hoyer 61c497
@@ -11,8 +11,7 @@
Harald Hoyer 61c497
 Description=dracut pre-pivot and cleanup hook
Harald Hoyer 61c497
 Documentation=man:dracut-pre-pivot.service(8)
Harald Hoyer 61c497
 DefaultDependencies=no
Harald Hoyer 61c497
-After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service initrd-fs.target root-fs.target
Harald Hoyer 61c497
-Wants=initrd-fs.target root-fs.target
Harald Hoyer 61c497
+After=initrd-fs.target
Harald Hoyer 61c497
 Before=initrd-cleanup.service
Harald Hoyer 61c497
 ConditionPathExists=/etc/initrd-release
Harald Hoyer 61c497
 ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
Harald Hoyer 61c497
@@ -25,6 +24,7 @@ StandardInput=null
Harald Hoyer 61c497
 StandardOutput=syslog
Harald Hoyer 61c497
 StandardError=syslog+console
Harald Hoyer 61c497
 KillMode=process
Harald Hoyer 61c497
+RemainAfterExit=yes
Harald Hoyer 61c497
 
Harald Hoyer 61c497
 # Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
Harald Hoyer 61c497
 # terminates cleanly.
Harald Hoyer 61c497
diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
Harald Hoyer 61c497
index 18bb45f..a932739 100644
Harald Hoyer 61c497
--- a/modules.d/98systemd/emergency.service
Harald Hoyer 61c497
+++ b/modules.d/98systemd/emergency.service
Harald Hoyer 61c497
@@ -17,7 +17,7 @@ Wants=systemd-vconsole-setup.service
Harald Hoyer 61c497
 Environment=HOME=/
Harald Hoyer 61c497
 WorkingDirectory=/
Harald Hoyer 61c497
 ExecStart=/bin/dracut-emergency
Harald Hoyer 61c497
-ExecStopPost=-/usr/bin/systemctl --no-block isolate initrd.target
Harald Hoyer 61c497
+ExecStopPost=-/usr/bin/systemctl --fail --no-block default
Harald Hoyer 61c497
 Type=oneshot
Harald Hoyer 61c497
 StandardInput=tty-force
Harald Hoyer 61c497
 StandardOutput=inherit
Harald Hoyer 61c497
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
Harald Hoyer 61c497
index 0119291..f74ae88 100755
Harald Hoyer 61c497
--- a/modules.d/98systemd/module-setup.sh
Harald Hoyer 61c497
+++ b/modules.d/98systemd/module-setup.sh
Harald Hoyer 61c497
@@ -46,8 +46,9 @@ install() {
Harald Hoyer 61c497
         $systemdsystemunitdir/basic.target \
Harald Hoyer 61c497
         $systemdsystemunitdir/halt.target \
Harald Hoyer 61c497
         $systemdsystemunitdir/kexec.target \
Harald Hoyer 61c497
+        $systemdsystemunitdir/initrd.target \
Harald Hoyer 61c497
         $systemdsystemunitdir/initrd-fs.target \
Harald Hoyer 61c497
-        $systemdsystemunitdir/root-fs.target \
Harald Hoyer 61c497
+        $systemdsystemunitdir/initrd-root-fs.target \
Harald Hoyer 61c497
         $systemdsystemunitdir/local-fs.target \
Harald Hoyer 61c497
         $systemdsystemunitdir/local-fs-pre.target \
Harald Hoyer 61c497
         $systemdsystemunitdir/remote-fs.target \
Harald Hoyer 61c497
@@ -148,8 +149,8 @@ install() {
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     # install adm user/group for journald
Harald Hoyer 61c497
     dracut_install nologin
Harald Hoyer 61c497
-    egrep '^adm:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer 61c497
-    egrep '^adm:' /etc/group >> "$initdir/etc/group"
Harald Hoyer 61c497
+    egrep '^systemd-journal:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer 61c497
+    egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     ln -fs $systemdutildir/systemd "$initdir/init"
Harald Hoyer 61c497
     ln -fs $systemdutildir/systemd "$initdir/sbin/init"
Harald Hoyer 61c497
@@ -163,15 +164,7 @@ install() {
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     mkdir -p "${initdir}${dracutsystemunitdir}/initrd.target.wants"
Harald Hoyer 61c497
 
Harald Hoyer 61c497
-    mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.d"
Harald Hoyer 61c497
-    {
Harald Hoyer 61c497
-        echo "[Unit]"
Harald Hoyer 61c497
-        echo "After="
Harald Hoyer 61c497
-        echo "After=emergency.service emergency.target"
Harald Hoyer 61c497
-    } > "${initdir}${systemdsystemunitdir}/sysinit.target.d/nolocalfs.conf"
Harald Hoyer 61c497
-
Harald Hoyer 61c497
-    inst_simple "$moddir/initrd.target" ${dracutsystemunitdir}/initrd.target
Harald Hoyer 61c497
-    ln -fs ${dracutsystemunitdir}/initrd.target "${initdir}${systemdsystemunitdir}/default.target"
Harald Hoyer 61c497
+    ln -fs initrd.target "${initdir}${systemdsystemunitdir}/default.target"
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
Harald Hoyer 61c497
     inst_simple "$moddir/dracut-cmdline.service" ${dracutsystemunitdir}/dracut-cmdline.service
Harald Hoyer 61c497
@@ -201,8 +194,6 @@ install() {
Harald Hoyer 61c497
     inst_simple "$moddir/dracut-pre-pivot.service" ${dracutsystemunitdir}/dracut-pre-pivot.service
Harald Hoyer 61c497
     ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/dracut-pre-pivot.service"
Harald Hoyer 61c497
 
Harald Hoyer 61c497
-    ln -fs ../initrd-parse-etc.service "${initdir}${dracutsystemunitdir}/initrd.target.wants/initrd-parse-etc.service"
Harald Hoyer 61c497
-
Harald Hoyer 61c497
     inst_rules 99-systemd.rules
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     for i in \
Harald Hoyer 61c497
@@ -224,6 +215,5 @@ install() {
Harald Hoyer 61c497
         echo "RateLimitBurst=0"
Harald Hoyer 61c497
     } >> "$initdir/etc/systemd/journald.conf"
Harald Hoyer 61c497
 
Harald Hoyer 61c497
-
Harald Hoyer 61c497
 }
Harald Hoyer 61c497
 
Harald Hoyer 61c497
diff --git a/modules.d/98systemd/udevadm-cleanup-db.service b/modules.d/98systemd/udevadm-cleanup-db.service
Harald Hoyer 61c497
deleted file mode 100644
Harald Hoyer 61c497
index fba032a..0000000
Harald Hoyer 61c497
--- a/modules.d/98systemd/udevadm-cleanup-db.service
Harald Hoyer 61c497
+++ /dev/null
Harald Hoyer 61c497
@@ -1,22 +0,0 @@
Harald Hoyer 61c497
-#  This file is part of systemd.
Harald Hoyer 61c497
-#
Harald Hoyer 61c497
-#  systemd is free software; you can redistribute it and/or modify it
Harald Hoyer 61c497
-#  under the terms of the GNU Lesser General Public License as published by
Harald Hoyer 61c497
-#  the Free Software Foundation; either version 2.1 of the License, or
Harald Hoyer 61c497
-#  (at your option) any later version.
Harald Hoyer 61c497
-
Harald Hoyer 61c497
-[Unit]
Harald Hoyer 61c497
-Description=Cleanup udevd DB
Harald Hoyer 61c497
-Documentation=man:udevadm-cleanup-db.service(8)
Harald Hoyer 61c497
-DefaultDependencies=no
Harald Hoyer 61c497
-ConditionPathExists=/etc/initrd-release
Harald Hoyer 61c497
-Conflicts=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket
Harald Hoyer 61c497
-After=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket
Harald Hoyer 61c497
-Before=initrd-switch-root.target
Harald Hoyer 61c497
-
Harald Hoyer 61c497
-[Service]
Harald Hoyer 61c497
-Type=oneshot
Harald Hoyer 61c497
-ExecStart=-/usr/bin/udevadm info --cleanup-db
Harald Hoyer 61c497
-StandardInput=null
Harald Hoyer 61c497
-StandardOutput=null
Harald Hoyer 61c497
-StandardError=null
Harald Hoyer 61c497
diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
Harald Hoyer 61c497
index 838ffa6..6936bbb 100755
Harald Hoyer 61c497
--- a/modules.d/99fs-lib/fs-lib.sh
Harald Hoyer 61c497
+++ b/modules.d/99fs-lib/fs-lib.sh
Harald Hoyer 61c497
@@ -220,9 +220,9 @@ write_fs_tab() {
Harald Hoyer 61c497
     [ -z "$_rootfstype" ] && _rootfstype="auto"
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     if [ -z "$_rootflags" ]; then
Harald Hoyer 61c497
-        _rootflags="ro"
Harald Hoyer 61c497
+        _rootflags="ro,x-initrd-rootfs.mount"
Harald Hoyer 61c497
     else
Harald Hoyer 61c497
-        _rootflags="ro,$_rootflags"
Harald Hoyer 61c497
+        _rootflags="ro,$_rootflags,x-initrd-rootfs.mount"
Harald Hoyer 61c497
     fi
Harald Hoyer 61c497
 
Harald Hoyer 61c497
     _rw=0