dracut-041-10.git20150219

- git snapshot
This commit is contained in:
Harald Hoyer 2015-02-19 14:17:26 +01:00
parent 17a513adc8
commit 43a122877a
10 changed files with 445 additions and 1 deletions

View File

@ -0,0 +1,19 @@
From 38e217704a734cb6ff46d95a46ef04123a6b89e7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 10 Feb 2015 12:21:18 +0100
Subject: [PATCH] fedora.conf: do not store cmdline in image by default
---
dracut.conf.d/fedora.conf.example | 1 +
1 file changed, 1 insertion(+)
diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example
index b6c769c..b126b09 100644
--- a/dracut.conf.d/fedora.conf.example
+++ b/dracut.conf.d/fedora.conf.example
@@ -15,4 +15,5 @@ systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
udevdir=/usr/lib/udev
hostonly="yes"
+hostonly_cmdline="no"
early_microcode="yes"

36
0002-doc-fix-typo.patch Normal file
View File

@ -0,0 +1,36 @@
From 05b879ed2ae2754f4bc49cf5fb915de3e417dbf2 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Mon, 9 Feb 2015 15:35:01 +0100
Subject: [PATCH] doc: fix typo
---
dracut.8.asc | 2 +-
dracut.cmdline.7.asc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.8.asc b/dracut.8.asc
index 7d11f43..9aecbfb 100644
--- a/dracut.8.asc
+++ b/dracut.8.asc
@@ -31,7 +31,7 @@ early userspace.
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
-the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a
+the file _/run/initramfs/rdsosreport.txt_ is created, which can be saved to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel
command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 5ff84ef..60826a1 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -163,7 +163,7 @@ Misc
Debug
~~~~~
If you are dropped to an emergency shell, the file
-_/run/initramfs/rdsosreport.txt_ is created, which can be safed to a (to be
+_/run/initramfs/rdsosreport.txt_ is created, which can be saved to a (to be
mounted by hand) partition (usually /boot) or a USB stick. Additional debugging
info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.

View File

@ -0,0 +1,20 @@
From 6ac2c8357089fdce0876dedc197b96dfa72c4a6a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 19 Feb 2015 09:55:12 +0100
Subject: [PATCH] dracut.sh: call bash with --norc
We don't want any user aliases or functions to be defined in dracut.
---
dracut.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index 5e2feba..17bf8f2 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash --norc
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line

View File

@ -0,0 +1,22 @@
From 7e9341434fca7606d11ffce99bda61a4ccb9ef10 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 19 Feb 2015 10:45:35 +0100
Subject: [PATCH] fips: add drbg kernel module
---
modules.d/01fips/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
index d232d58..aacbc95 100755
--- a/modules.d/01fips/module-setup.sh
+++ b/modules.d/01fips/module-setup.sh
@@ -14,7 +14,7 @@ depends() {
installkernel() {
local _fipsmodules _mod
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
- _fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
+ _fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"

View File

@ -0,0 +1,37 @@
From a7d3ad67c754c3078cd6c228a3807425417c8083 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Date: Mon, 9 Feb 2015 11:55:20 +0000
Subject: [PATCH] Support /usr/lib/kernel/cmdline fallback path for
/etc/kernel/cmdline.
---
50-dracut.install | 2 ++
51-dracut-rescue.install | 2 ++
2 files changed, 4 insertions(+)
diff --git a/50-dracut.install b/50-dracut.install
index 5ac74f1..d05abb9 100755
--- a/50-dracut.install
+++ b/50-dracut.install
@@ -20,6 +20,8 @@ case "$COMMAND" in
if [[ -f /etc/kernel/cmdline ]]; then
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
+ elif [[ -f /usr/lib/kernel/cmdline ]]; then
+ readarray -t BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
index 9fb0c5d..9abd9d7 100755
--- a/51-dracut-rescue.install
+++ b/51-dracut-rescue.install
@@ -41,6 +41,8 @@ fi
if [[ -f /etc/kernel/cmdline ]]; then
readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
+elif [[ -f /usr/lib/kernel/cmdline ]]; then
+ readarray -t BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
read -ar BOOT_OPTIONS < /proc/cmdline

View File

@ -0,0 +1,46 @@
From 5729ae8029f9b19438f210f3e3ead326cf252645 Mon Sep 17 00:00:00 2001
From: Lukas Wunner <lukas@wunner.de>
Date: Tue, 3 Feb 2015 19:32:55 +0100
Subject: [PATCH] 90dm/dm-shutdown.sh: dmsetup remove_all -> dmsetup remove
The function 99shutdown/shutdown.sh:_check_shutdown() assumes that
shutdown scripts report success or failure via their return value.
However, "dmsetup remove_all" always reports success, even if some
of the device mappings could not be removed.
I submitted a patch for dmsetup but the lvm2 folks rejected it,
asserting that its behaviour is correct, that "remove_all" should
only be used by developers and that the proper solution would be
to invoke "dmsetup remove" on each device. This does report success
or failure via the return value.
Apart from fixing that issue, this commit also adds the dmsetup
option "--noudevsync". Without it, dmsetup would hang after removal
of a device while trying to communicate with systemd-udevd, which
is no longer running at this shutdown stage.
[harald: replaces backticks with $() ]
---
modules.d/90dm/dm-shutdown.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh
index dfdb48b..04c89be 100755
--- a/modules.d/90dm/dm-shutdown.sh
+++ b/modules.d/90dm/dm-shutdown.sh
@@ -1,11 +1,12 @@
#!/bin/sh
_do_dm_shutdown() {
- local ret
+ local ret=0
local final=$1
info "Disassembling device-mapper devices"
- dmsetup -v remove_all
- ret=$?
+ for dev in $(dmsetup info -c --noheadings -o name) ; do
+ dmsetup -v --noudevsync remove "$dev" || ret=$?
+ done
if [ "x$final" != "x" ]; then
info "dmsetup ls --tree"
dmsetup ls --tree 2>&1 | vinfo

View File

@ -0,0 +1,32 @@
From 7075a402d741b0bab1f47ffdec130926b38e3004 Mon Sep 17 00:00:00 2001
From: Jonas Jonsson <jonas@websystem.se>
Date: Sun, 28 Dec 2014 01:03:29 +0100
Subject: [PATCH] 99base: Properly remove files with rd.hostonly=0
Dracut will generate systemd units for additional devices that should be
brought up during boot, e.g. swap devices. These unit files are broken
symlinks with \ in the filename, e.g.
/etc/systemd/system/initrd.target.wants/dev-disk-by\x2duuid-e6a54f99\x2da4fd\x2d4931\x2da956\x2d1c642bcfee5e.device.
Both the backslash and the broken symlink causes problems for shell
scripts, [ -e "$file" ] isn't enough and read requires the additional -r
argument to not react on the \.
---
modules.d/99base/dracut-lib.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 5c1504f..079c9a2 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1286,8 +1286,8 @@ show_memstats()
remove_hostonly_files() {
rm -fr /etc/cmdline /etc/cmdline.d/*.conf
if [ -f /lib/dracut/hostonly-files ]; then
- while read line; do
- [ -e "$line" ] || continue
+ while read -r line; do
+ [ -e "$line" ] || [ -h "$line" ] || continue
rm -f "$line"
done < /lib/dracut/hostonly-files
fi

View File

@ -0,0 +1,81 @@
From d6e34d362a05cda61baaf8e231ad3f0e8665a9cc Mon Sep 17 00:00:00 2001
From: Fabian Deutsch <fabiand@fedoraproject.org>
Date: Wed, 18 Feb 2015 14:31:40 +0100
Subject: [PATCH] dmsquash: Add rd.live.overlay.thin
This option changes the underlying mechanism for the overlay in the
dmsquash module.
Instead of a plain dm snapshot a dm thin snapshot is used. The advantage
of the thin snapshot is, that the TRIM command is recognized, which
means that at runtime, only the occupied blocks will be claimed from
memory, and freed blocks will really be freed in ram.
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
---
dracut.cmdline.7.asc | 7 +++++++
modules.d/90dmsquash-live/dmsquash-live-root.sh | 27 ++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 60826a1..9ddad0f 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -834,6 +834,13 @@ Enables debug output from the live boot process.
Specifies the directory within the squashfs where the ext3fs.img or rootfs.img
can be found. By default, this is __LiveOS__.
+**rd.live.overlay.thin=**1::
+Enables the usage of thin snapshots instead of classic dm snapshots.
+The advantage of thin snapshots is, that they support discards, and will free
+blocks which are not claimed by the filesystem. In this use case this means,
+that memory is given back to the kernel, when the filesystem does not claim it
+anymore.
+
**rd.writable.fsimg=**1::
Enables writable filesystem support. The system will boot with a fully
writable filesystem without snapshots __(see notes above about available live boot options)__.
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index 9c08e94..45f724c 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -30,6 +30,8 @@ getargbool 0 rd.writable.fsimg -d -y writable_fsimg && writable_fsimg="yes"
overlay_size=$(getarg rd.live.overlay.size=)
[ -z "$overlay_size" ] && overlay_size=512
+getargbool 0 rd.live.overlay.thin && thin_snapshot="yes"
+
# CD/DVD media check
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
@@ -146,7 +148,30 @@ do_live_overlay() {
base=$BASE_LOOPDEV
over=$OVERLAY_LOOPDEV
fi
- echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
+ if [ -n "$thin_snapshot" ]; then
+ modprobe dm_thin_pool
+ mkdir /run/initramfs/thin-overlay
+
+ # In block units (512b)
+ thin_data_sz=$(( $overlay_size * 1024 * 1024 / 512 ))
+ thin_meta_sz=$(( $thin_data_sz / 10 ))
+
+ # It is important to have the backing file on a tmpfs
+ # this is needed to let the loopdevice support TRIM
+ dd if=/dev/null of=/run/initramfs/thin-overlay/meta bs=1b count=1 seek=$((thin_meta_sz)) 2> /dev/null
+ dd if=/dev/null of=/run/initramfs/thin-overlay/data bs=1b count=1 seek=$((thin_data_sz)) 2> /dev/null
+
+ THIN_META_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/meta )
+ THIN_DATA_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/data )
+
+ echo 0 $thin_data_sz thin-pool $THIN_META_LOOPDEV $THIN_DATA_LOOPDEV 1024 1024 | dmsetup create live-overlay-pool
+ dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0"
+
+ # Create a snapshot of the base image
+ echo 0 $sz thin /dev/mapper/live-overlay-pool 0 $base | dmsetup create live-rw
+ else
+ echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
+ fi
# Create a device that always points to a ro base image
echo 0 $sz linear $base 0 | dmsetup create --readonly live-base

View File

@ -0,0 +1,139 @@
From b0472eac111268e2cae783097d0eccc1986e1762 Mon Sep 17 00:00:00 2001
From: Fabian Deutsch <fabiand@fedoraproject.org>
Date: Thu, 19 Feb 2015 10:09:14 +0100
Subject: [PATCH] dmsquash: Add squashfs support to rd.live.fsimg
Previously rd.live.fsimg only supported filesystems residing in
(compressed) archives.
Now rd.live.fsimg can also be used when a squashfs image is used.
This is achieved by extracting the rootfs image from the squashfs and
then continue with the default routines for rd.live.fsimg.
In addition some code duplication got removed and some documentation
got added.
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
---
dracut.cmdline.7.asc | 9 ++++
modules.d/90dmsquash-live/dmsquash-live-root.sh | 64 +++++++++++++------------
2 files changed, 42 insertions(+), 31 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 9ddad0f..e51fd1b 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -834,6 +834,10 @@ Enables debug output from the live boot process.
Specifies the directory within the squashfs where the ext3fs.img or rootfs.img
can be found. By default, this is __LiveOS__.
+**rd.live.ram=**1::
+Copy the complete image to RAM and use this for booting. This is useful
+when the image resides on i.e. a DVD which needs to be ejected later on.
+
**rd.live.overlay.thin=**1::
Enables the usage of thin snapshots instead of classic dm snapshots.
The advantage of thin snapshots is, that they support discards, and will free
@@ -846,6 +850,11 @@ Enables writable filesystem support. The system will boot with a fully
writable filesystem without snapshots __(see notes above about available live boot options)__.
You can use the **rootflags** option to set mount options for the live
filesystem as well __(see documentation about rootflags in the **Standard** section above)__.
+This implies that the whole image is copied to RAM before the boot continues.
++
+NOTE: There must be enough free RAM available to hold the complete image.
++
+This method is very suitable for diskless boots.
Plymouth Boot Splash
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index 45f724c..b632f6a 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -148,6 +148,7 @@ do_live_overlay() {
base=$BASE_LOOPDEV
over=$OVERLAY_LOOPDEV
fi
+
if [ -n "$thin_snapshot" ]; then
modprobe dm_thin_pool
mkdir /run/initramfs/thin-overlay
@@ -199,29 +200,6 @@ if [ -n "$OSMINSQFS" ]; then
umount -l /run/initramfs/squashfs.osmin
fi
-# we might have an embedded fs image to use as rootfs (uncompressed live)
-if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
- FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
-elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
- FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
-fi
-
-if [ -n "$FSIMG" ] ; then
- BASE_LOOPDEV=$( losetup -f )
-
- if [ -n "$writable_fsimg" ] ; then
- # mount the provided fileysstem read/write
- echo "Unpacking live filesystem (may take some time)"
- unpack_archive $FSIMG /run/initramfs/fsimg/
- losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
- echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
- else
- # mount the filesystem read-only and add a dm snapshot for writes
- losetup -r $BASE_LOOPDEV $FSIMG
- do_live_from_base_loop
- fi
-fi
-
# we might have an embedded fs image on squashfs (compressed live)
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
@@ -242,18 +220,42 @@ if [ -e "$SQUASHED" ] ; then
mkdir -m 0755 -p /run/initramfs/squashfs
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
- BASE_LOOPDEV=$( losetup -f )
- if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
- losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/ext3fs.img
- elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
- losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/rootfs.img
- fi
+fi
+
+# we might have an embedded fs image to use as rootfs (uncompressed live)
+if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
+ FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
+elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
+ FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
+elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
+ FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
+elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
+ FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
+fi
- umount -l /run/initramfs/squashfs
+if [ -n "$FSIMG" ] ; then
+ BASE_LOOPDEV=$( losetup -f )
- do_live_from_base_loop
+ if [ -n "$writable_fsimg" ] ; then
+ # mount the provided fileysstem read/write
+ echo "Unpacking live filesystem (may take some time)"
+ mkdir /run/initramfs/fsimg/
+ if [ -n "$SQUASHED" ]; then
+ cp -v $FSIMG /run/initramfs/fsimg/rootfs.img
+ else
+ unpack_archive $FSIMG /run/initramfs/fsimg/
+ fi
+ losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
+ echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
+ else
+ # mount the filesystem read-only and add a dm snapshot for writes
+ losetup -r $BASE_LOOPDEV $FSIMG
+ do_live_from_base_loop
+ fi
fi
+[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
+
if [ -b "$OSMIN_LOOPDEV" ]; then
# set up the devicemapper snapshot device, which will merge
# the normal live fs image, and the delta, into a minimzied fs image

View File

@ -11,7 +11,7 @@
Name: dracut
Version: 041
Release: 1%{?dist}
Release: 10.git20150219%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -30,6 +30,15 @@ URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
Patch1: 0001-fedora.conf-do-not-store-cmdline-in-image-by-default.patch
Patch2: 0002-doc-fix-typo.patch
Patch3: 0003-dracut.sh-call-bash-with-norc.patch
Patch4: 0004-fips-add-drbg-kernel-module.patch
Patch5: 0005-Support-usr-lib-kernel-cmdline-fallback-path-for-etc.patch
Patch6: 0006-90dm-dm-shutdown.sh-dmsetup-remove_all-dmsetup-remov.patch
Patch7: 0007-99base-Properly-remove-files-with-rd.hostonly-0.patch
Patch8: 0008-dmsquash-Add-rd.live.overlay.thin.patch
Patch9: 0009-dmsquash-Add-squashfs-support-to-rd.live.fsimg.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -478,6 +487,9 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%changelog
* Thu Feb 19 2015 Harald Hoyer <harald@redhat.com> 041-10.git20150219
- git snapshot
* Sat Jan 31 2015 Harald Hoyer <harald@redhat.com> 041-1
- version 041