modules.d/98systemd/dracut-pre-pivot.service.8 \
modules.d/98systemd/dracut-pre-trigger.service.8 \
modules.d/98systemd/dracut-pre-udev.service.8 \
- modules.d/98systemd/initrd-switch-root.service.8 \
modules.d/98systemd/udevadm-cleanup-db.service.8
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
Requires: kbd kbd-misc
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
-Conflicts: systemd < 187
+Conflicts: systemd < 198
%else
Requires: util-linux-ng >= 2.21
%endif
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
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
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
# 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
--- /dev/null
+#!/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
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
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
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
[ -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
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
--- /dev/null
+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)
--- /dev/null
+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)
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
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
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
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
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
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
+RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
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
--- /dev/null
+# 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
+++ /dev/null
-# 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
+++ /dev/null
-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)
+++ /dev/null
-# 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
$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 \
$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 \
$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
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 \
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
+++ /dev/null
-#!/bin/sh
-mkdir -p /run/systemd/system/
-cp -d -t /run/systemd/system/ /etc/systemd/system/* 2>/dev/null
-exit 0
-