summaryrefslogtreecommitdiff
path: root/modules.d/98systemd
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-03-06 16:19:29 +0100
committerHarald Hoyer <harald@redhat.com>2013-03-06 17:21:47 +0100
commitdbfaae0e34507d2d1f3c186ffe26af3e8028b9f8 (patch)
tree500c6135cee89c6246104ea3f34c03c9e4dd95af /modules.d/98systemd
parent8d85429a4468df322b1507209cded7f70f7da4dd (diff)
downloaddracut-dbfaae0e34507d2d1f3c186ffe26af3e8028b9f8.tar.gz
dracut-dbfaae0e34507d2d1f3c186ffe26af3e8028b9f8.tar.bz2
dracut-dbfaae0e34507d2d1f3c186ffe26af3e8028b9f8.zip
systemd: changes for new initrd services
Requires systemd >= 198
Diffstat (limited to 'modules.d/98systemd')
-rw-r--r--modules.d/98systemd/dracut-cmdline.service6
-rwxr-xr-xmodules.d/98systemd/dracut-cmdline.sh42
-rw-r--r--modules.d/98systemd/dracut-emergency.service8
-rwxr-xr-xmodules.d/98systemd/dracut-emergency.sh41
-rw-r--r--modules.d/98systemd/dracut-initqueue.service5
-rwxr-xr-xmodules.d/98systemd/dracut-initqueue.sh41
-rw-r--r--modules.d/98systemd/dracut-mount.service.8.asc25
-rw-r--r--modules.d/98systemd/dracut-pre-mount.service.8.asc25
-rw-r--r--modules.d/98systemd/dracut-pre-pivot.service7
-rwxr-xr-xmodules.d/98systemd/dracut-pre-pivot.sh18
-rw-r--r--modules.d/98systemd/dracut-pre-trigger.service1
-rwxr-xr-xmodules.d/98systemd/dracut-pre-trigger.sh3
-rw-r--r--modules.d/98systemd/dracut-pre-udev.service4
-rwxr-xr-xmodules.d/98systemd/dracut-pre-udev.sh41
-rw-r--r--modules.d/98systemd/emergency.service30
-rw-r--r--modules.d/98systemd/initrd-switch-root.service25
-rw-r--r--modules.d/98systemd/initrd-switch-root.service.8.asc25
-rw-r--r--modules.d/98systemd/initrd-switch-root.target18
-rwxr-xr-xmodules.d/98systemd/module-setup.sh56
-rwxr-xr-xmodules.d/98systemd/service-to-run.sh5
20 files changed, 272 insertions, 154 deletions
diff --git a/modules.d/98systemd/dracut-cmdline.service b/modules.d/98systemd/dracut-cmdline.service
index 4aba918b..33a37f9f 100644
--- a/modules.d/98systemd/dracut-cmdline.service
+++ b/modules.d/98systemd/dracut-cmdline.service
@@ -16,6 +16,11 @@ Before=systemd-vconsole-setup.service
After=systemd-journald.socket
Wants=systemd-journald.socket
ConditionPathExists=/etc/initrd-release
+ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
+ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cmdline
+ConditionKernelCommandLine=|rd.break=cmdline
+ConditionKernelCommandLine=|resume
+ConditionKernelCommandLine=|noresume
[Service]
Type=oneshot
@@ -24,6 +29,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
diff --git a/modules.d/98systemd/dracut-cmdline.sh b/modules.d/98systemd/dracut-cmdline.sh
index cec1b644..fb306b23 100755
--- a/modules.d/98systemd/dracut-cmdline.sh
+++ b/modules.d/98systemd/dracut-cmdline.sh
@@ -22,15 +22,57 @@ getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug &&
source_conf /etc/conf.d
+root=$(getarg root=)
+
+rflags="$(getarg rootflags=)"
+getargbool 0 ro && rflags="${rflags},ro"
+getargbool 0 rw && rflags="${rflags},rw"
+rflags="${rflags#,}"
+
+fstype="$(getarg rootfstype=)"
+if [ -z "$fstype" ]; then
+ fstype="auto"
+fi
+
+export root
+export rflags
+export fstype
+
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
# run scriptlets to parse the command line
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline
+[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh
+
+case "$root" in
+ block:LABEL=*|LABEL=*)
+ root="${root#block:}"
+ root="$(echo $root | sed 's,/,\\x2f,g')"
+ root="block:/dev/disk/by-label/${root#LABEL=}"
+ rootok=1 ;;
+ block:UUID=*|UUID=*)
+ root="${root#block:}"
+ root="block:/dev/disk/by-uuid/${root#UUID=}"
+ rootok=1 ;;
+ block:PARTUUID=*|PARTUUID=*)
+ root="${root#block:}"
+ root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
+ rootok=1 ;;
+ /dev/*)
+ root="block:${root}"
+ rootok=1 ;;
+esac
+
+[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
+
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
export root rflags fstype netroot NEWROOT
export -p > /dracut-state.sh
+
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0
diff --git a/modules.d/98systemd/dracut-emergency.service b/modules.d/98systemd/dracut-emergency.service
index b273d84a..153931b2 100644
--- a/modules.d/98systemd/dracut-emergency.service
+++ b/modules.d/98systemd/dracut-emergency.service
@@ -8,18 +8,16 @@
# See systemd.special(7) for details
[Unit]
-Description=Emergency Shell
+Description=Dracut Emergency Shell
DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
+Conflicts=emergency.service emergency.target
[Service]
Environment=HOME=/
WorkingDirectory=/
-ExecStartPre=-/bin/plymouth quit
-ExecStartPre=-/sbin/sosreport
-ExecStartPre=-/bin/echo -e '\n\nEntering emergency mode. Exit the shell to continue.\nType "journalctl" to view system logs.\nYou might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot\nafter mounting them and attach it to a bug report.\n\n'
-ExecStart=-/bin/sh -i -l
+ExecStart=/bin/dracut-emergency
ExecStopPost=-/bin/rm -f /.console_lock
Type=oneshot
StandardInput=tty-force
diff --git a/modules.d/98systemd/dracut-emergency.sh b/modules.d/98systemd/dracut-emergency.sh
new file mode 100755
index 00000000..a0a4b125
--- /dev/null
+++ b/modules.d/98systemd/dracut-emergency.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+export DRACUT_SYSTEMD=1
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh 2>/dev/null
+fi
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+source_conf /etc/conf.d
+
+[ -x /bin/plymouth ] && /bin/plymouth quit
+
+export _rdshell_name="dracut" action="Boot" hook="emergency"
+
+source_hook "$hook"
+
+
+if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
+ echo
+ sosreport
+ echo
+ echo
+ echo 'Entering emergency mode. Exit the shell to continue.'
+ echo 'Type "journalctl" to view system logs.'
+ echo 'You might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot'
+ echo 'after mounting them and attach it to a bug report.'
+ echo
+ echo
+ [ -f /etc/profile ] && . /etc/profile
+ [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
+ exec sh -i -l
+else
+ warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
+ exit 1
+fi
+
+/bin/rm -f /.console_lock
+
+exit 0
diff --git a/modules.d/98systemd/dracut-initqueue.service b/modules.d/98systemd/dracut-initqueue.service
index b852468f..c19cfea5 100644
--- a/modules.d/98systemd/dracut-initqueue.service
+++ b/modules.d/98systemd/dracut-initqueue.service
@@ -13,8 +13,10 @@ Documentation=man:dracut-initqueue.service(8)
DefaultDependencies=no
After=systemd-udev-trigger.service
Wants=systemd-udev-trigger.service
-After=cryptsetup.target
ConditionPathExists=/etc/initrd-release
+ConditionPathExists=|/lib/dracut/need-initqueue
+ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/*.sh
+ConditionKernelCommandLine=|rd.break=pre-mount
[Service]
Type=oneshot
@@ -23,6 +25,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
diff --git a/modules.d/98systemd/dracut-initqueue.sh b/modules.d/98systemd/dracut-initqueue.sh
index ae449fe7..326e2030 100755
--- a/modules.d/98systemd/dracut-initqueue.sh
+++ b/modules.d/98systemd/dracut-initqueue.sh
@@ -14,7 +14,7 @@ make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
-RDRETRY=${RDRETRY:-30}
+RDRETRY=${RDRETRY:-180}
RDRETRY=$(($RDRETRY*2))
export RDRETRY
@@ -57,6 +57,7 @@ while :; do
[ -e "$job" ] || break
job=$job . $job
udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
+ [ -f $hookdir/initqueue/work ] && main_loop=0
done
fi
@@ -69,42 +70,8 @@ unset queuetriggered
unset main_loop
unset RDRETRY
-
-# pre-mount happens before we try to mount the root filesystem,
-# and happens once.
-getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
-source_hook pre-mount
-
-
-getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
-# mount scripts actually try to mount the root filesystem, and may
-# be sourced any number of times. As soon as one suceeds, no more are sourced.
-i=0
-while :; do
- if ismounted "$NEWROOT"; then
- usable_root "$NEWROOT" && break;
- umount "$NEWROOT"
- fi
- for f in $hookdir/mount/*.sh; do
- [ -f "$f" ] && . "$f"
- if ismounted "$NEWROOT"; then
- usable_root "$NEWROOT" && break;
- warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
- umount "$NEWROOT"
- rm -f "$f"
- fi
- done
-
- i=$(($i+1))
- [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
-done
-
-{
- echo -n "Mounted root filesystem "
- while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
-} | vinfo
-
-
export -p > /dracut-state.sh
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0
diff --git a/modules.d/98systemd/dracut-mount.service.8.asc b/modules.d/98systemd/dracut-mount.service.8.asc
new file mode 100644
index 00000000..23437ab8
--- /dev/null
+++ b/modules.d/98systemd/dracut-mount.service.8.asc
@@ -0,0 +1,25 @@
+DRACUT-MOUNT.SERVICE(8)
+===========================
+:doctype: manpage
+:man source: dracut
+:man manual: dracut
+
+NAME
+----
+dracut-mount.service - runs the dracut hooks after /sysroot is mounted
+
+SYNOPSIS
+--------
+dracut-mount.service
+
+DESCRIPTION
+-----------
+This service runs all dracut hooks after the real root is mounted on /sysroot.
+
+AUTHORS
+-------
+Harald Hoyer
+
+SEE ALSO
+--------
+*dracut*(8)
diff --git a/modules.d/98systemd/dracut-pre-mount.service.8.asc b/modules.d/98systemd/dracut-pre-mount.service.8.asc
new file mode 100644
index 00000000..861da531
--- /dev/null
+++ b/modules.d/98systemd/dracut-pre-mount.service.8.asc
@@ -0,0 +1,25 @@
+DRACUT-PRE-MOUNT.SERVICE(8)
+===========================
+:doctype: manpage
+:man source: dracut
+:man manual: dracut
+
+NAME
+----
+dracut-pre-mount.service - runs the dracut hooks before /sysroot is mounted
+
+SYNOPSIS
+--------
+dracut-pre-mount.service
+
+DESCRIPTION
+-----------
+This service runs all dracut hooks before the real root is mounted on /sysroot.
+
+AUTHORS
+-------
+Harald Hoyer
+
+SEE ALSO
+--------
+*dracut*(8)
diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service
index 0221828d..40a0fb15 100644
--- a/modules.d/98systemd/dracut-pre-pivot.service
+++ b/modules.d/98systemd/dracut-pre-pivot.service
@@ -11,13 +11,16 @@
Description=dracut pre-pivot and cleanup hook
Documentation=man:dracut-pre-pivot.service(8)
DefaultDependencies=no
-After=dracut-initqueue.service
+After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target
+Wants=local-fs.target
+Before=initrd-cleanup.service
ConditionPathExists=/etc/initrd-release
+ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
+ConditionKernelCommandLine=|rd.break=pre-pivot
[Service]
Type=oneshot
ExecStart=-/bin/dracut-pre-pivot
-ExecStopPost=-/usr/bin/systemctl --no-block 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 0c259b1b..5d47ce21 100755
--- a/modules.d/98systemd/dracut-pre-pivot.sh
+++ b/modules.d/98systemd/dracut-pre-pivot.sh
@@ -20,25 +20,11 @@ source_hook pre-pivot
getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
source_hook cleanup
-# By the time we get here, the root filesystem should be mounted.
-# Try to find init.
-
-for i in "$(getarg real_init=)" "$(getarg init=)"; do
- [ -n "$i" ] || continue
-
- __p=$(readlink -f "${NEWROOT}/${i}")
- if [ -x "$__p" ]; then
- INIT="$i"
- echo "NEWINIT=\"$INIT\"" > /etc/switch-root.conf
- break
- fi
-done
-
-echo "NEWROOT=\"$NEWROOT\"" >> /etc/switch-root.conf
-
getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
# remove helper symlink
[ -h /dev/root ] && rm -f /dev/root
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0
diff --git a/modules.d/98systemd/dracut-pre-trigger.service b/modules.d/98systemd/dracut-pre-trigger.service
index 55c99386..e49e405a 100644
--- a/modules.d/98systemd/dracut-pre-trigger.service
+++ b/modules.d/98systemd/dracut-pre-trigger.service
@@ -25,6 +25,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
diff --git a/modules.d/98systemd/dracut-pre-trigger.sh b/modules.d/98systemd/dracut-pre-trigger.sh
index 4685c8f9..4e8e8440 100755
--- a/modules.d/98systemd/dracut-pre-trigger.sh
+++ b/modules.d/98systemd/dracut-pre-trigger.sh
@@ -19,4 +19,7 @@ getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-tr
udevadm control --reload >/dev/null 2>&1 || :
export -p > /dracut-state.sh
+
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0
diff --git a/modules.d/98systemd/dracut-pre-udev.service b/modules.d/98systemd/dracut-pre-udev.service
index ee2c2e1b..b3723738 100644
--- a/modules.d/98systemd/dracut-pre-udev.service
+++ b/modules.d/98systemd/dracut-pre-udev.service
@@ -17,6 +17,9 @@ Wants=dracut-cmdline.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
ConditionKernelCommandLine=|rd.break=pre-udev
+ConditionKernelCommandLine=|rd.driver.blacklist
+ConditionKernelCommandLine=|rd.driver.pre
+ConditionKernelCommandLine=|rd.driver.post
[Service]
Type=oneshot
@@ -25,6 +28,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
diff --git a/modules.d/98systemd/dracut-pre-udev.sh b/modules.d/98systemd/dracut-pre-udev.sh
index d20e6137..afbd61f0 100755
--- a/modules.d/98systemd/dracut-pre-udev.sh
+++ b/modules.d/98systemd/dracut-pre-udev.sh
@@ -15,5 +15,46 @@ make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break pre-udev"
source_hook pre-udev
+_modprobe_d=/etc/modprobe.d
+if [ -d /usr/lib/modprobe.d ] ; then
+ _modprobe_d=/usr/lib/modprobe.d
+elif [ -d /lib/modprobe.d ] ; then
+ _modprobe_d=/lib/modprobe.d
+elif [ ! -d $_modprobe_d ] ; then
+ mkdir -p $_modprobe_d
+fi
+
+for i in $(getargs rd.driver.pre -d rdloaddriver=); do
+ (
+ IFS=,
+ for p in $i; do
+ modprobe $p 2>&1 | vinfo
+ done
+ )
+done
+
+
+[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
+
+for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
+ (
+ IFS=,
+ for p in $i; do
+ echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
+ done
+ )
+done
+
+for p in $(getargs rd.driver.post -d rdinsmodpost=); do
+ echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
+ _do_insmodpost=1
+done
+
+[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
+unset _do_insmodpost _modprobe_d
+unset i
+
export -p > /dracut-state.sh
+service="${0##*/}"
+cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0
diff --git a/modules.d/98systemd/emergency.service b/modules.d/98systemd/emergency.service
new file mode 100644
index 00000000..22115be6
--- /dev/null
+++ b/modules.d/98systemd/emergency.service
@@ -0,0 +1,30 @@
+# 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.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Emergency Shell
+DefaultDependencies=no
+After=systemd-vconsole-setup.service
+Wants=systemd-vconsole-setup.service
+
+[Service]
+Environment=HOME=/
+WorkingDirectory=/
+ExecStart=/bin/dracut-emergency
+ExecStopPost=-/usr/bin/systemctl --no-block isolate dracut.target
+Type=oneshot
+StandardInput=tty-force
+StandardOutput=inherit
+StandardError=inherit
+KillMode=process
+IgnoreSIGPIPE=no
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/modules.d/98systemd/initrd-switch-root.service b/modules.d/98systemd/initrd-switch-root.service
deleted file mode 100644
index e263980a..00000000
--- a/modules.d/98systemd/initrd-switch-root.service
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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=Switch Root
-Documentation=man:initrd-switch-root.service(8)
-DefaultDependencies=no
-ConditionPathExists=/etc/initrd-release
-OnFailure=emergency.service
-After=initrd-switch-root.target
-AllowIsolate=yes
-
-[Service]
-Type=oneshot
-EnvironmentFile=/etc/switch-root.conf
-# we have to use "--force" here, otherwise systemd would umount /run
-ExecStart=-/usr/bin/systemctl --no-block --force switch-root ${NEWROOT} ${NEWINIT}
-StandardInput=null
-StandardOutput=null
-StandardError=null
-KillMode=none
diff --git a/modules.d/98systemd/initrd-switch-root.service.8.asc b/modules.d/98systemd/initrd-switch-root.service.8.asc
deleted file mode 100644
index 73d5c919..00000000
--- a/modules.d/98systemd/initrd-switch-root.service.8.asc
+++ /dev/null
@@ -1,25 +0,0 @@
-INITRD-SWITCH-ROOT.SERVICE(8)
-=============================
-:doctype: manpage
-:man source: dracut
-:man manual: dracut
-
-NAME
-----
-initrd-switch-root.service - switches root to the real root
-
-SYNOPSIS
---------
-initrd-switch-root.service
-
-DESCRIPTION
------------
-This service triggers systemd to switch root from the initramfs to the real root.
-
-AUTHORS
--------
-Harald Hoyer
-
-SEE ALSO
---------
-*dracut*(8)
diff --git a/modules.d/98systemd/initrd-switch-root.target b/modules.d/98systemd/initrd-switch-root.target
deleted file mode 100644
index 05e0117f..00000000
--- a/modules.d/98systemd/initrd-switch-root.target
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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.
-
-# See systemd.special(7) for details
-
-[Unit]
-Description=Switch Root
-DefaultDependencies=no
-Requires=initrd-switch-root.service
-Before=initrd-switch-root.service
-After=cryptsetup.target
-AllowIsolate=yes
-Wants=systemd-journald.service
-ConditionPathExists=/etc/initrd-release
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index db1f1b49..ccd4319f 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -31,6 +31,8 @@ install() {
$systemdutildir/systemd-journald \
$systemdutildir/systemd-sysctl \
$systemdutildir/systemd-modules-load \
+ $systemdutildir/system-generators/systemd-fstab-generator \
+ $systemdsystemunitdir/cryptsetup.target \
$systemdsystemunitdir/emergency.target \
$systemdsystemunitdir/sysinit.target \
$systemdsystemunitdir/basic.target \
@@ -59,7 +61,6 @@ install() {
$systemdsystemunitdir/systemd-journald.socket \
$systemdsystemunitdir/systemd-ask-password-console.service \
$systemdsystemunitdir/systemd-modules-load.service \
- $systemdsystemunitdir/emergency.service \
$systemdsystemunitdir/halt.service \
$systemdsystemunitdir/systemd-halt.service \
$systemdsystemunitdir/poweroff.service \
@@ -89,8 +90,12 @@ install() {
$systemdsystemunitdir/syslog.target \
$systemdsystemunitdir/initrd-switch-root.target \
$systemdsystemunitdir/initrd-switch-root.service \
+ $systemdsystemunitdir/initrd-cleanup.service \
+ $systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
+ $systemdsystemunitdir/initrd-parse-etc.service \
+\
$systemdsystemunitdir/umount.target \
- journalctl systemctl echo swapoff
+ journalctl systemctl echo swapoff systemd-cgls
dracut_install -o \
/usr/lib/modules-load.d/*.conf
@@ -120,46 +125,57 @@ install() {
ln -fs $systemdutildir/systemd "$initdir/init"
ln -fs $systemdutildir/systemd "$initdir/sbin/init"
+ inst_script "$moddir/dracut-emergency.sh" /bin/dracut-emergency
+ inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/emergency.service
inst_simple "$moddir/dracut-emergency.service" ${systemdsystemunitdir}/dracut-emergency.service
- inst_simple "$moddir/rescue.service" ${systemdsystemunitdir}/rescue.service
- ln -fs "basic.target" "${initdir}${systemdsystemunitdir}/default.target"
+ inst_simple "$moddir/emergency.service" ${systemdsystemunitdir}/rescue.service
dracutsystemunitdir="/etc/systemd/system"
- mkdir -p "${initdir}${dracutsystemunitdir}/basic.target.wants"
- mkdir -p "${initdir}${dracutsystemunitdir}/sysinit.target.wants"
+ mkdir -p "${initdir}${dracutsystemunitdir}/dracut.target.wants"
+
+ mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.d"
+ {
+ echo "[Unit]"
+ echo "After="
+ echo "After=emergency.service emergency.target"
+ } > "${initdir}${systemdsystemunitdir}/sysinit.target.d/nolocalfs.conf"
- 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_simple "$moddir/dracut.target" ${dracutsystemunitdir}/dracut.target
+ ln -fs ${dracutsystemunitdir}/dracut.target "${initdir}${systemdsystemunitdir}/default.target"
inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
inst_simple "$moddir/dracut-cmdline.service" ${dracutsystemunitdir}/dracut-cmdline.service
- ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/sysinit.target.wants/dracut-cmdline.service"
+ ln -fs ../dracut-cmdline.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-cmdline.service"
inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
inst_simple "$moddir/dracut-pre-udev.service" ${dracutsystemunitdir}/dracut-pre-udev.service
- ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/sysinit.target.wants/dracut-pre-udev.service"
+ ln -fs ../dracut-pre-udev.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-udev.service"
inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
inst_simple "$moddir/dracut-pre-trigger.service" ${dracutsystemunitdir}/dracut-pre-trigger.service
- ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/sysinit.target.wants/dracut-pre-trigger.service"
+ ln -fs ../dracut-pre-trigger.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-trigger.service"
inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
inst_simple "$moddir/dracut-initqueue.service" ${dracutsystemunitdir}/dracut-initqueue.service
- ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/basic.target.wants/dracut-initqueue.service"
+ ln -fs ../dracut-initqueue.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-initqueue.service"
+
+ inst_script "$moddir/dracut-pre-mount.sh" /bin/dracut-pre-mount
+ inst_simple "$moddir/dracut-pre-mount.service" ${dracutsystemunitdir}/dracut-pre-mount.service
+ ln -fs ../dracut-pre-mount.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-mount.service"
+
+ inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount
+ inst_simple "$moddir/dracut-mount.service" ${dracutsystemunitdir}/dracut-mount.service
+ ln -fs ../dracut-mount.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-mount.service"
inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot
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"
+ ln -fs ../dracut-pre-pivot.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/dracut-pre-pivot.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"
+ ln -fs ../initrd-parse-etc.service "${initdir}${dracutsystemunitdir}/dracut.target.wants/initrd-parse-etc.service"
- inst_script "$moddir/service-to-run.sh" "${systemdutildir}/system-generators/service-to-run"
inst_rules 99-systemd.rules
-
for i in \
emergency.target \
dracut-emergency.service \
@@ -167,9 +183,9 @@ install() {
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service \
; do
- mkdir -p "${initdir}${dracutsystemunitdir}/${i}.requires"
+ mkdir -p "${initdir}${dracutsystemunitdir}/${i}.wants"
ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
- "${dracutsystemunitdir}/${i}.requires/systemd-vconsole-setup.service"
+ "${dracutsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
done
# turn off RateLimit for journal
diff --git a/modules.d/98systemd/service-to-run.sh b/modules.d/98systemd/service-to-run.sh
deleted file mode 100755
index d4225be1..00000000
--- a/modules.d/98systemd/service-to-run.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-mkdir -p /run/systemd/system/
-cp -d -t /run/systemd/system/ /etc/systemd/system/* 2>/dev/null
-exit 0
-