dracut/dracut_v041_to_HEAD.patch
Thomas Renninger 9f28177407 Accepting request 293267 from home:trenn:branches:Base:System
- Update to dracut mainline version 041.
  Half of the patches got integrated mainline.
  Some others have been merged together when it made sense some have
  been left out, but are still in the repository as they need some special
  treating and mainline discussion whether/how they get added. These are
  also not urgently needed, but are debugging patches.
  I broke the rule here to mention every added/deleted/modified patch as
  every patch is touched and every 2nd  got removed (mainline integrated).
  I also re-ordered the patches in the PatchXY: area for easier merging them
  and get them discussed and posted mainline easier, topic by topic.

OBS-URL: https://build.opensuse.org/request/show/293267
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=214
2015-03-31 14:12:12 +00:00

317 lines
13 KiB
Diff

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
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..e51fd1b 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.
@@ -834,11 +834,27 @@ 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
+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)__.
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/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"
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
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"
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
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index 9c08e94..b632f6a 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,31 @@ 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
@@ -174,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}"
@@ -217,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
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index c799a1c..8269078 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -67,6 +67,20 @@ install() {
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' ${initdir}/etc/lvm/lvm.conf
fi
+
+ export LVM_SUPPRESS_FD_WARNINGS=1
+ # Also install any files needed for LVM system id support.
+ if [ -f /etc/lvm/lvmlocal.conf ]; then
+ inst_simple -H /etc/lvm/lvmlocal.conf
+ fi
+ eval $(lvm dumpconfig global/system_id_source)
+ if [ "$system_id_source" == "file" ]; then
+ eval $(lvm dumpconfig global/system_id_file)
+ if [ -f "$system_id_file" ]; then
+ inst_simple -H $system_id_file
+ fi
+ fi
+ unset LVM_SUPPRESS_FD_WARNINGS
fi
if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index 51ea288..761349f 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -176,7 +176,11 @@ install() {
# install adm user/group for journald
inst_multiple nologin
egrep '^systemd-journal:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
+ egrep '^wheel:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
+ egrep '^adm:' "$initdir/etc/passwd" 2>/dev/null >> "$initdir/etc/passwd"
egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
+ egrep '^wheel:' /etc/group >> "$initdir/etc/group"
+ egrep '^adm:' /etc/group >> "$initdir/etc/group"
ln_r $systemdutildir/systemd "/init"
ln_r $systemdutildir/systemd "/sbin/init"
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