dracut-026-62.git20130319

- fix dracut service ordering
Resolves: rhbz#922991
This commit is contained in:
Harald Hoyer 2013-03-19 12:27:22 +01:00
parent 93362f99f1
commit 6300332c04
7 changed files with 525 additions and 1 deletions

View File

@ -0,0 +1,22 @@
From a3a8f58d735040f4f800510bf45e6125c98dbae5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 18 Mar 2013 10:58:25 +0100
Subject: [PATCH] Makefile: use -D_FILE_OFFSET_BITS=64 to build dracut-install
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 644d17d..ce40647 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall
-CFLAGS += -std=gnu99
+CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64
bashcompletiondir ?= ${datadir}/bash-completion/completions
man1pages = lsinitrd.1

View File

@ -0,0 +1,23 @@
From d59732004dac2d173e4a5976184813517d043b50 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 18 Mar 2013 14:17:19 +0100
Subject: [PATCH] drm/module-setup.sh: redirect grep to /dev/null
on some architectures, no pci devices exist
---
modules.d/50drm/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh
index e471c11..bf33c5b 100644
--- a/modules.d/50drm/module-setup.sh
+++ b/modules.d/50drm/module-setup.sh
@@ -54,7 +54,7 @@ installkernel() {
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
# loading of the driver if needed
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
- | grep -qxf - /sys/bus/pci/devices/*/modalias; then
+ | grep -qxf - /sys/bus/pci/devices/*/modalias 2>/dev/null; then
hostonly='' instmods $_modname
continue
fi

View File

@ -0,0 +1,68 @@
From e26d76dca1ffded7fb319b66d03e50ef9d906e4f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 19 Mar 2013 12:22:33 +0100
Subject: [PATCH] systemd: add more ordering
---
modules.d/98systemd/dracut-mount.service | 3 +--
modules.d/98systemd/dracut-pre-mount.service | 2 +-
modules.d/98systemd/dracut-pre-pivot.service | 4 ++--
modules.d/98systemd/module-setup.sh | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules.d/98systemd/dracut-mount.service b/modules.d/98systemd/dracut-mount.service
index 5c12683..db18f86 100644
--- a/modules.d/98systemd/dracut-mount.service
+++ b/modules.d/98systemd/dracut-mount.service
@@ -10,9 +10,8 @@
[Unit]
Description=dracut mount hook
Documentation=man:dracut-mount.service(8)
-DefaultDependencies=no
After=initrd-root-fs.target initrd-parse-etc.service
-
+After=dracut-initqueue.service dracut-pre-mount.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
ConditionKernelCommandLine=|rd.break=mount
diff --git a/modules.d/98systemd/dracut-pre-mount.service b/modules.d/98systemd/dracut-pre-mount.service
index 0d76943..bec3c75 100644
--- a/modules.d/98systemd/dracut-pre-mount.service
+++ b/modules.d/98systemd/dracut-pre-mount.service
@@ -11,7 +11,7 @@
Description=dracut pre-mount hook
Documentation=man:dracut-pre-mount.service(8)
DefaultDependencies=no
-Before=initrd-root-fs.target
+Before=initrd-root-fs.target sysroot.mount
After=dracut-initqueue.service
After=cryptsetup.target
ConditionPathExists=/etc/initrd-release
diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service
index 72941c9..9d0143c 100644
--- a/modules.d/98systemd/dracut-pre-pivot.service
+++ b/modules.d/98systemd/dracut-pre-pivot.service
@@ -10,8 +10,8 @@
[Unit]
Description=dracut pre-pivot and cleanup hook
Documentation=man:dracut-pre-pivot.service(8)
-DefaultDependencies=no
-After=initrd-fs.target
+After=initrd.target initrd-parse-etc.service
+After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service
Before=initrd-cleanup.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index 17dbc44..252074f 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -25,7 +25,7 @@ install() {
# fi
if strstr "$prefix" "/run/"; then
- dfatal "systemd does not work a prefix, which contains \"/run\"!!"
+ dfatal "systemd does not work with a prefix, which contains \"/run\"!!"
exit 1
fi

View File

@ -0,0 +1,299 @@
From a1ebd7717957e1e89f5245541c5d2bf308fa5582 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 19 Mar 2013 12:22:58 +0100
Subject: [PATCH] add dracut.bootup.7 man page
---
Makefile | 3 +-
dracut.asc | 29 +++++++------
dracut.bootup.7.asc | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
dracut.spec | 1 +
4 files changed, 141 insertions(+), 14 deletions(-)
create mode 100644 dracut.bootup.7.asc
diff --git a/Makefile b/Makefile
index ce40647..6268772 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,8 @@ man1pages = lsinitrd.1
man5pages = dracut.conf.5
-man7pages = dracut.cmdline.7
+man7pages = dracut.cmdline.7 \
+ dracut.bootup.7
man8pages = dracut.8 \
dracut-catimages.8 \
diff --git a/dracut.asc b/dracut.asc
index d11e95c..359824f 100644
--- a/dracut.asc
+++ b/dracut.asc
@@ -120,6 +120,9 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
rotated away. Instead, it is simply emptied and the final root file system
mounted over the top.
+If the systemd module is used in the initramfs, the ordering of the services
+started looks like <<dracutbootup7>>.
+
== Dracut on shutdown
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
@@ -531,19 +534,19 @@ all files in _/etc/dracut.conf.d/*.conf_
As well as the information from <<all-bug-reports>> include the following
information:
-* Include physical volume information by running the command:
+* Include physical volume information by running the command:
+
----
# lvm pvdisplay
----
+
-* Include volume group information by running the command:
+* Include volume group information by running the command:
+
----
# lvm vgdisplay
----
+
-* Include logical volume information by running the command:
+* Include logical volume information by running the command:
+
----
# lvm lvdisplay
@@ -554,7 +557,7 @@ information:
As well as the information from <<all-bug-reports>>, include the following
information:
-* If using software RAID disk partitions, please include the output of
+* If using software RAID disk partitions, please include the output of
+
----
# cat /proc/mdstat
@@ -659,7 +662,7 @@ title Fedora (2.6.29.5-191.fc11.x86_64)
No root device found
Dropping to debug shell.
-#
+#
----
+
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
@@ -679,7 +682,7 @@ The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
-LVM Logical volume.
+LVM Logical volume.
. Inspect your partitions using parted
+
@@ -695,7 +698,7 @@ Number Start End Size Type File system Flags
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
-any logical volumes.
+any logical volumes.
+
----
# lvm vgscan
@@ -721,7 +724,7 @@ Installation Guide, you unlock your encrypted root volume.
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
-Key slot 0 unlocked.
+Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
@@ -780,7 +783,7 @@ processes, and switches to the real root device for further booting. dracut
modules can insert custom script at various points, to control the boot process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
-Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
+Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
@@ -829,7 +832,7 @@ udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
-devices and subsystems.
+devices and subsystems.
@@ -909,7 +912,6 @@ still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
-
FIXME
@@ -1028,13 +1030,11 @@ instmods
=== Creation Functions
-
FIXME
=== Initramfs Functions
-
FIXME
@@ -1042,6 +1042,9 @@ FIXME
FIXME
+:leveloffset: 1
+[[dracutbootup7]]
+include::dracut.bootup.7.asc[]
:leveloffset: 1
[[dracut8]]
diff --git a/dracut.bootup.7.asc b/dracut.bootup.7.asc
new file mode 100644
index 0000000..c35af19
--- /dev/null
+++ b/dracut.bootup.7.asc
@@ -0,0 +1,122 @@
+DRACUT.BOOTUP(7)
+================
+:doctype: manpage
+:man source: dracut
+:man manual: dracut
+
+NAME
+----
+dracut.bootup - boot ordering in the initramfs
+
+DESCRIPTION
+-----------
+
+This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs.
+----
+
+ systemd-journal.socket
+ |
+ v
+ dracut-cmdline.service
+ |
+ v
+ dracut-pre-udev.service
+ |
+ v
+ systemd-udevd.service
+ |
+ v
+local-fs-pre.target dracut-pre-trigger.service
+ | |
+ v v
+ (various mounts) (various swap systemd-udev-trigger.service
+ | devices...) | (various low-level (various low-level
+ | | | services: seed, API VFS mounts:
+ v v v tmpfiles, random mqueue, configfs,
+ local-fs.target swap.target dracut-initqueue.service sysctl, ...) debugfs, ...)
+ | | | | |
+ \_______________|____________________ | ___________________|____________________/
+ \|/
+ v
+ sysinit.target
+ |
+ _________________/|\___________________
+ / | \
+ | | |
+ v | v
+ (various | rescue.service
+ sockets...) | |
+ | | v
+ v | rescue.target
+ sockets.target |
+ | |
+ \_________________ | emergency.service
+ \| |
+ v v
+ basic.target emergency.target
+ |
+ ______________________/|
+ / |
+ | v
+ | dracut-pre-mount.service
+ | |
+ | v
+ | sysroot.mount
+ | |
+ | v
+ | initrd-root-fs.target
+ (custom initrd services) |
+ | v
+ | dracut-mount.service
+ | |
+ | v
+ | initrd-parse-etc.service
+ | |
+ | v
+ | (sysroot-usr.mount and
+ | various mounts marked
+ | with fstab option
+ | x-initrd.mount)
+ | |
+ | v
+ | initrd-fs.target
+ \______________________ |
+ \|
+ v
+ initrd.target
+ |
+ v
+ dracut-pre-pivot.service
+ |
+ v
+ initrd-cleanup.service
+ isolates to
+ initrd-switch-root.target
+ |
+ v
+ ______________________/|
+ / |
+ | initrd-udevadm-cleanup-db.service
+ | |
+ (custom initrd services) |
+ | |
+ \______________________ |
+ \|
+ v
+ initrd-switch-root.target
+ |
+ v
+ initrd-switch-root.service
+ |
+ v
+ switch-root
+----
+
+
+AUTHOR
+------
+Harald Hoyer
+
+SEE ALSO
+--------
+*dracut*(8) *bootup*(7)
diff --git a/dracut.spec b/dracut.spec
index ac4a786..445463f 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -304,6 +304,7 @@ rm -rf $RPM_BUILD_ROOT
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
+%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5*
%if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart

View File

@ -0,0 +1,21 @@
From db43f56d94bcb87c92b688e708988ef39603cdc2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 19 Mar 2013 12:23:20 +0100
Subject: [PATCH] fs-lib/fs-lib.sh:write_fs_tab() start initrd-root-fs.target
---
modules.d/99fs-lib/fs-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
index 6936bbb..3fa8772 100755
--- a/modules.d/99fs-lib/fs-lib.sh
+++ b/modules.d/99fs-lib/fs-lib.sh
@@ -245,6 +245,6 @@ write_fs_tab() {
if type systemctl >/dev/null 2>/dev/null; then
systemctl daemon-reload
- systemctl --no-block start initrd-fs.target
+ systemctl --no-block start initrd-root-fs.target
fi
}

View File

@ -0,0 +1,80 @@
From 7b6bdc3f943c0e34671faca3b671074c77e64ff0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 19 Mar 2013 12:24:13 +0100
Subject: [PATCH] nbd/nbdroot.sh: fix root != blockdev case
---
modules.d/95nbd/nbdroot.sh | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/modules.d/95nbd/nbdroot.sh b/modules.d/95nbd/nbdroot.sh
index 4aebef0..1a1ed54 100755
--- a/modules.d/95nbd/nbdroot.sh
+++ b/modules.d/95nbd/nbdroot.sh
@@ -17,18 +17,18 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
# root is in the form root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
netif="$1"
-root="$2"
+nroot="$2"
NEWROOT="$3"
# If it's not nbd we don't continue
-[ "${root%%:*}" = "nbd" ] || return
+[ "${nroot%%:*}" = "nbd" ] || return
-root=${root#nbd:}
-nbdserver=${root%%:*}; root=${root#*:}
-nbdport=${root%%:*}; root=${root#*:}
-nbdfstype=${root%%:*}; root=${root#*:}
-nbdflags=${root%%:*}
-nbdopts=${root#*:}
+nroot=${nroot#nbd:}
+nbdserver=${nroot%%:*}; nroot=${nroot#*:}
+nbdport=${nroot%%:*}; nroot=${nroot#*:}
+nbdfstype=${nroot%%:*}; nroot=${nroot#*:}
+nbdflags=${nroot%%:*}
+nbdopts=${nroot#*:}
# If nbdport not an integer, then assume name based import
if [ ! -z $(echo "$nbdport" | sed 's/[0-9]//g') ]; then
@@ -92,26 +92,27 @@ while [ ! -b /dev/nbd0 ]; do
else
sleep 0.1
fi
- i=$(( $i + 1))
+ i=$(($i + 1))
done
-nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
-
# If we didn't get a root= on the command line, then we need to
# add the udev rules for mounting the nbd0 device
-root=$(getarg root=)
-if [ -z "$root" ] || strstr "$root" "nbd:" || strstr "$root" "dhcp"; then
- echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; type systemctl >/dev/null 2>&1 && systemctl --no-block start sysroot.mount;:; };} && rm $job;' \
- > $hookdir/initqueue/settled/nbd.sh
-
+if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then
+ printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules
+ udevadm control --reload
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
- write_fs_tab /dev/nbd0 "$nbdfstype" "$fsopts"
+ write_fs_tab /dev/root "$nbdfstype" "$fsopts"
+ wait_for_dev /dev/root
- printf '/bin/mount %s\n' \
- "$NEWROOT" \
- > $hookdir/mount/01-$$-nbd.sh
+ if [ -z "$DRACUT_SYSTEMD" ]; then
+ printf '/bin/mount %s\n' \
+ "$NEWROOT" \
+ > $hookdir/mount/01-$$-nbd.sh
+ fi
fi
+nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
+
# NBD doesn't emit uevents when it gets connected, so kick it
echo change > /sys/block/nbd0/uevent
udevadm settle

View File

@ -10,7 +10,7 @@
Name: dracut
Version: 026
Release: 56.git20130318%{?dist}
Release: 62.git20130319%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -84,6 +84,12 @@ Patch52: 0052-dmsquash-live-force-load-squashfs-kernel-module.patch
Patch53: 0053-sosreport-mkdir-run-initramfs-if-it-does-not-exist-y.patch
Patch54: 0054-kernel-modules-module-setup.sh-install-all-host-file.patch
Patch55: 0055-kernel-modules-module-setup.sh-don-t-fail-hard-on-a-.patch
Patch56: 0056-Makefile-use-D_FILE_OFFSET_BITS-64-to-build-dracut-i.patch
Patch57: 0057-drm-module-setup.sh-redirect-grep-to-dev-null.patch
Patch58: 0058-systemd-add-more-ordering.patch
Patch59: 0059-add-dracut.bootup.7-man-page.patch
Patch60: 0060-fs-lib-fs-lib.sh-write_fs_tab-start-initrd-root-fs.t.patch
Patch61: 0061-nbd-nbdroot.sh-fix-root-blockdev-case.patch
BuildRequires: dash bash git
@ -360,6 +366,7 @@ rm -rf $RPM_BUILD_ROOT
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5*
%if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart
@ -473,6 +480,10 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/dracut.conf.d/02-norescue.conf
%changelog
* Tue Mar 19 2013 Harald Hoyer <harald@redhat.com> 026-62.git20130319
- fix dracut service ordering
Resolves: rhbz#922991
* Mon Mar 18 2013 Harald Hoyer <harald@redhat.com> 026-56.git20130318
- don't fail hard on kernel modules install
Resolves: rhbz#922565