diff -Nru dracut-050+65/51-dracut-rescue-postinst.sh dracut-051/51-dracut-rescue-postinst.sh --- dracut-050+65/51-dracut-rescue-postinst.sh 2018-08-10 20:28:40.000000000 +0000 +++ dracut-051/51-dracut-rescue-postinst.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -#!/bin/bash - -export LANG=C - -KERNEL_VERSION="$1" -KERNEL_IMAGE="$2" - -[[ -f /etc/os-release ]] && . /etc/os-release - -if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then - systemd-machine-id-setup -fi - -[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id - -[[ $MACHINE_ID ]] || exit 1 -[[ -f $KERNEL_IMAGE ]] || exit 1 - -INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img" -NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}" - -[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0 - -dropindirs_sort() -{ - suffix=$1; shift - args=("$@") - files=$( - while (( $# > 0 )); do - for i in ${1}/*${suffix}; do - [[ -f $i ]] && echo ${i##*/} - done - shift - done | sort -Vu - ) - - for f in $files; do - for d in "${args[@]}"; do - if [[ -f "$d/$f" ]]; then - echo "$d/$f" - continue 2 - fi - done - done -} - -# source our config dir -for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do - [[ -e $f ]] && . "$f" -done - -[[ $dracut_rescue_image != "yes" ]] && exit 0 - -if [[ ! -f $INITRDFILE ]]; then - dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION" - ((ret+=$?)) -fi - -if [[ ! -f $NEW_KERNEL_IMAGE ]]; then - cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE" - ((ret+=$?)) -fi - -new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID" - -((ret+=$?)) - -exit $ret diff -Nru dracut-050+65/AUTHORS dracut-051/AUTHORS --- dracut-050+65/AUTHORS 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/AUTHORS 2020-12-14 17:54:26.000000000 +0000 @@ -2,74 +2,82 @@ Victor Lowther Amadeusz Żołnowski Hannes Reinecke +Daniel Molkentin Will Woods Philippe Seewer Warren Togami -Daniel Molkentin +Kairui Song Dave Young Jeremy Katz David Dillow -Lubomir Rintel Lukas Nykryn +Lubomir Rintel Michal Soltys Colin Guthrie -Kairui Song +Jóhann B. Guðmundsson Amerigo Wang Thomas Renninger Alexander Tsoy +Martin Wilck Frederick Grose WANG Chao Yu Watanabe Andrey Borzenkov Hans de Goede +Jonathan Lebon Peter Jones Andreas Thienemann -Martin Wilck -Frantisek Sumsal Peter Robinson +Frantisek Sumsal Fabian Vogt +Colin Walters John Reiser Luca Berra +Nicolas Chauvet Xunlei Pang -Colin Walters +Brian C. Lane Daniel Drake Angelo "pallotron" Failla -Brian C. Lane +Thomas Blume Ville Skyttä +Beniamino Galvani Böszörményi Zoltán Cristian Rodríguez Dan Horák -Jonathan Lebon Renaud Métrich Baoquan He Brendan Germain +Javier Martinez Canillas Jonas Witschel Leho Kraav Moritz Maxeiner Nathan Rini -Nicolas Chauvet Ondrej Mosnacek +Radek Vykydal Fabian Deutsch -Javier Martinez Canillas Kamil Rytarowski Lidong Zhong Marc Grimme Mike Gilbert NeilBrown Peter Rajnoha -Radek Vykydal Thorsten Behrens Zbigniew Jędrzejewski-Szmek +q66 +Đoàn Trần Công Danh Chao Wang +David Tardon Frederic Crozat James Lee Jesse Keating +Mikhail Novosyolov Milan Broz Mimi Zohar +Norbert Lange Roberto Sassu Stefan Reimer Takashi Iwai -Thomas Blume +Tomasz Paweł Gajc tpgxyz Adam Williamson Anton Blanchard @@ -79,7 +87,9 @@ David Cantrell Dennis Gilmore Doan Tran Cong Danh +Gaël PORTAY Jan Synacek +Jiri Konecny Jon Ander Hernandez Juan RP Lance Albertson @@ -88,12 +98,12 @@ Matthias Gerstner Max Resch Michael Ploujnikov -Norbert Lange Pratyush Anand Silvio Fricke Steven Brudenell Stig Telfer Thomas Backlund +Topi Miettinen Vasiliy Tolstov Wim Muskee Alan Jenkins @@ -107,6 +117,7 @@ Daniel Schaal Denis Silakov Dimitri John Ledkov +Dusty Mabe Erwan Velu Evgeny Vereshchagin Guido Trentalancia @@ -115,7 +126,6 @@ Imran Haider James Buren Jan Macku -Jiri Konecny Joey Boggs Julian Wolf Koen Kooi @@ -125,9 +135,9 @@ Marko Myllynen Michal Koutný Mike Snitzer -Mikhail Novosyolov Minfei Huang Nikoli +Patrick Talbert Pedro Monreal Pingfan Liu Przemysław Rudy @@ -136,26 +146,29 @@ Stefan Berger Thomas Lange Till Maas -Tomasz Paweł Gajc Tony Asleson -Topi Miettinen Vivek Goyal Vladislav Bogdanov +Érico Rolim +наб +A. Wilcox Alexander Kurtz Alexander Miroshnichenko +Alexander Sosedkin Alexander Todorov Alexey Kodanev Andreas Schwab Andreas Stieger Andy Lutomirski Anssi Hannula +Antz Arnaud Rebillout Artem Savkov Attila Bruncsak B. Wilson +Ben Howard Benjamin Marzinski Brandon Philips -Brian C. Lane Bruno E. O. Meneguele Bryn M. Reeves Canek Peláez Valdés @@ -164,24 +177,29 @@ Christian Heinz Cong Wang Dan Fuhry +Daniel Molkentin Dave Jones David Disseldorp David Michael +Denis Volkov Dennis Schridde +Derek Hageman Derek Higgins Donovan Tremura Duane Griffin -Dusty Mabe Elan Ruusamäe Enno Boland +Enzo Matsumiya Eugene S. Sobolev Eugene Syromiatnikov +Fabian Vogt Florian Albrechtskirchinger Florian Gamböck Frank Deng François Cami Gerd von Egidy Glen Gray +GuoChuang HATAYAMA Daisuke Hendrik Brueckner Hermann Gausterer @@ -199,6 +217,7 @@ Joe Lawrence Johannes Thumshirn Jonas Jonsson +Jonas Witschel Kevin Yung Lars R. Damerow Lee Duncan @@ -226,11 +245,12 @@ Ondrej Dubaj P J P Paolo Bonzini -Patrick Talbert Paul Robins Pavel Zhukov Pawel Wieczorkiewicz Pekka Wallendahl +Peter Georg +Petr Pavlu Petr Tesarik Petr Vorel Prarit Bhargava @@ -239,7 +259,9 @@ Quentin Armitage Robert Buchholz Ruben Kerkhof +Rumbaut Thomas Rusty Bird +Sebastian Mitterle Sergey Fionov Shawn W Dunn Srinivasa T N @@ -265,13 +287,14 @@ jloeser johannes jonathan-teh <30538043+jonathan-teh@users.noreply.github.com> +leo-lb logan masem maximilian attems +mulhern +mwberry nabijaczleweli privb0x23 -q66 tpg xtraeme -Đoàn Trần Công Danh Дамјан Георгиевски diff -Nru dracut-050+65/configure dracut-051/configure --- dracut-050+65/configure 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/configure 2020-12-14 17:54:26.000000000 +0000 @@ -85,7 +85,7 @@ found=no for lib in "-lc" "-lfts"; do - ${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1 + ${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib >/dev/null 2>&1 ret=$? if test $ret -eq 0; then FTS_LIBS="$lib" diff -Nru dracut-050+65/debian/changelog dracut-051/debian/changelog --- dracut-050+65/debian/changelog 2020-07-01 10:13:36.000000000 +0000 +++ dracut-051/debian/changelog 2020-12-15 15:23:33.000000000 +0000 @@ -1,3 +1,16 @@ +dracut (051-1) unstable; urgency=low + + * new upstream version + * control: change description, Closes: #967923 + * source/options: add pattern for files to ignore by dpkg-source + * fix-revdate: update modification dates + + [ Antonio Russo ] + * Patch occurrences of /boot/initramfs to /boot/initrd to match Debian + default names, Closes: #972809 + + -- Thomas Lange Tue, 15 Dec 2020 16:23:33 +0100 + dracut (050+65-1) unstable; urgency=medium * control: add breaks and replaces, Closes: #959852 diff -Nru dracut-050+65/debian/control dracut-051/debian/control --- dracut-050+65/debian/control 2020-07-01 09:50:20.000000000 +0000 +++ dracut-051/debian/control 2020-12-15 14:29:17.000000000 +0000 @@ -43,15 +43,8 @@ Recommends: nfs-common, open-iscsi, nbd-client, curl Depends: dracut-core, iputils-arping, isc-dhcp-client, ${misc:Depends} Description: dracut is an event driven initramfs infrastructure (network modules) - Unlike existing initramfs's, this is an attempt at having as little as - possible hard-coded into the initramfs as possible. The initramfs has - (basically) one purpose in life -- getting the rootfs mounted so that - we can transition to the real rootfs. This is all driven off of - device availability. Therefore, instead of scripts hard-coded to do - various things, we depend on udev to create device nodes for us and - then when we have the rootfs's device node, we mount and carry on. - Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI, - NBD and FCOE with dracut-network. + Package to build a dracut initramfs with network support. This + includes dracut modules for NFS, CIFS, iSCSI, HTTP, NBD, FCP and FCOE. Package: dracut-squash Architecture: all diff -Nru dracut-050+65/debian/dracut-core.README.Debian dracut-051/debian/dracut-core.README.Debian --- dracut-050+65/debian/dracut-core.README.Debian 2020-07-01 09:50:20.000000000 +0000 +++ dracut-051/debian/dracut-core.README.Debian 2020-12-15 14:29:17.000000000 +0000 @@ -3,7 +3,7 @@ 1. Give it a try -Currently dracut is not the default initrd craetion tool in Debian. +Currently dracut is not the default initrd creation tool in Debian. You can try dracut without removing initramfs-tools from your machine by following these steps: diff -Nru dracut-050+65/debian/fix-revdate dracut-051/debian/fix-revdate --- dracut-050+65/debian/fix-revdate 2020-07-01 09:50:20.000000000 +0000 +++ dracut-051/debian/fix-revdate 2020-12-15 14:29:17.000000000 +0000 @@ -1,12 +1,12 @@ sed -i -e '3i:revdate: 2012-03-14' dracut-catimages.8.asc -sed -i -e '3i:revdate: 2017-09-05' dracut.8.asc -sed -i -e '3i:revdate: 2014-01-13' dracut.bootup.7.asc -sed -i -e '3i:revdate: 2018-01-18' dracut.cmdline.7.asc -sed -i -e '3i:revdate: 2018-01-18' dracut.conf.5.asc -sed -i -e '3i:revdate: 2017-01-03' dracut.modules.7.asc -sed -i -e '3i:revdate: 2016-03-17' lsinitrd.1.asc -sed -i -e '3i:revdate: 2016-12-02' mkinitrd-suse.8.asc -sed -i -e '3i:revdate: 2014-01-13' mkinitrd.8.asc +sed -i -e '3i:revdate: 2020-12-14' dracut.8.asc +sed -i -e '3i:revdate: 2019-11-12' dracut.bootup.7.asc +sed -i -e '3i:revdate: 2020-12-01' dracut.cmdline.7.asc +sed -i -e '3i:revdate: 2020-05-29' dracut.conf.5.asc +sed -i -e '3i:revdate: 2020-08-21' dracut.modules.7.asc +sed -i -e '3i:revdate: 2019-11-12' lsinitrd.1.asc +sed -i -e '3i:revdate: 2018-08-30' mkinitrd-suse.8.asc +sed -i -e '3i:revdate: 2019-11-12' mkinitrd.8.asc sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-cmdline.service.8.asc sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-initqueue.service.8.asc sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-mount.service.8.asc @@ -14,4 +14,4 @@ sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-pre-pivot.service.8.asc sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-pre-trigger.service.8.asc sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-pre-udev.service.8.asc -sed -i -e '3i:revdate: 2015-03-19' modules.d/98dracut-systemd/dracut-shutdown.service.8.asc +sed -i -e '3i:revdate: 2018-11-08' modules.d/98dracut-systemd/dracut-shutdown.service.8.asc diff -Nru dracut-050+65/debian/patches/initramfs-restore dracut-051/debian/patches/initramfs-restore --- dracut-050+65/debian/patches/initramfs-restore 2020-07-01 09:50:20.000000000 +0000 +++ dracut-051/debian/patches/initramfs-restore 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---- a/dracut-initramfs-restore.sh -+++ b/dracut-initramfs-restore.sh -@@ -19,7 +19,7 @@ - if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then - IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" - fi --[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img" -+[[ -f $IMG ]] || IMG="/boot/initrd.img-${KERNEL_VERSION}" - - cd /run/initramfs - diff -Nru dracut-050+65/debian/patches/initrd-not-initramfs.patch dracut-051/debian/patches/initrd-not-initramfs.patch --- dracut-050+65/debian/patches/initrd-not-initramfs.patch 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/debian/patches/initrd-not-initramfs.patch 2020-12-15 14:29:17.000000000 +0000 @@ -0,0 +1,93 @@ +--- a/dracut-initramfs-restore.sh ++++ b/dracut-initramfs-restore.sh +@@ -19,7 +19,7 @@ + if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then + IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + fi +-[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img" ++[[ -f $IMG ]] || IMG="/boot/initrd.img-${KERNEL_VERSION}" + + cd /run/initramfs + +--- a/dracut.8.asc ++++ b/dracut.8.asc +@@ -19,7 +19,7 @@ + Create an initramfs for the kernel with the version . + If is omitted, then the version of the actual running + kernel is used. If is omitted or empty, then the default location +-/boot/initramfs-.img is used. ++/boot/initrd.img- is used. + + dracut creates an initial image used by the kernel for preloading the block + device modules (such as IDE, SCSI or RAID) which are needed to access the root +--- a/dracut.sh ++++ b/dracut.sh +@@ -836,11 +836,11 @@ + outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi" + else + if [[ -e "$dracutsysrootdir/boot/vmlinuz-$kernel" ]]; then +- outfile="/boot/initramfs-$kernel.img" ++ outfile="/boot/initrd.img-$kernel" + elif [[ $MACHINE_ID ]] && ( [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]] ); then + outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd" + else +- outfile="$dracutsysrootdir/boot/initramfs-$kernel.img" ++ outfile="$dracutsysrootdir/boot/initrd.img-$kernel" + fi + fi + fi +--- a/dracut.usage.asc ++++ b/dracut.usage.asc +@@ -5,7 +5,7 @@ + + This will generate a general purpose initramfs image, with all possible + functionality resulting of the combination of the installed dracut modules and +-system tools. The image is /boot/initramfs-_++++_.img and ++system tools. The image is /boot/initrd.img-_++++_ and + contains the kernel modules of the currently active kernel with version + _++++_. + +--- a/lsinitrd.1.asc ++++ b/lsinitrd.1.asc +@@ -19,7 +19,7 @@ + ----------- + lsinitrd shows the contents of an initramfs image. if is omitted, then + lsinitrd uses the default image _/boot///initrd_ or +-_/boot/initramfs-.img_. ++_/boot/initrd.img-. + + OPTIONS + ------- +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -102,7 +102,7 @@ + && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then + image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd" + else +- image="/boot/initramfs-${KERNEL_VERSION}.img" ++ image="/boot/initrd.img-${KERNEL_VERSION}" + fi + fi + +--- a/mkinitrd-dracut.sh ++++ b/mkinitrd-dracut.sh +@@ -16,7 +16,7 @@ + $cmd " [--nocompress]" + $cmd " " + $cmd "" +- $cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)" ++ $cmd " (ex: ${0##*/} /boot/initrd.img-$kver $kver)" + + [[ $1 = '-n' ]] && exit 0 + exit 1 +--- a/test/TEST-16-DMSQUASH/test.sh ++++ b/test/TEST-16-DMSQUASH/test.sh +@@ -86,7 +86,7 @@ + done + inst_simple /etc/os-release + inst ./test-init.sh /sbin/init +- inst "$TESTDIR"/initramfs.testing "/boot/initramfs-$KVERSION.img" ++ inst "$TESTDIR"/initramfs.testing "/boot/initrd.img-$KVERSION" + [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id + + VMLINUZ="/lib/modules/${KVERSION}/vmlinuz" diff -Nru dracut-050+65/debian/patches/multipath dracut-051/debian/patches/multipath --- dracut-050+65/debian/patches/multipath 2020-07-01 09:50:20.000000000 +0000 +++ dracut-051/debian/patches/multipath 2020-12-15 14:29:17.000000000 +0000 @@ -1,6 +1,6 @@ --- a/modules.d/90multipath/module-setup.sh +++ b/modules.d/90multipath/module-setup.sh -@@ -101,7 +101,7 @@ +@@ -102,7 +102,7 @@ inst $(command -v partx) /sbin/partx inst_libdir_file "libmultipath*" "multipath/*" diff -Nru dracut-050+65/debian/patches/series dracut-051/debian/patches/series --- dracut-050+65/debian/patches/series 2020-07-01 09:50:20.000000000 +0000 +++ dracut-051/debian/patches/series 2020-12-15 14:29:17.000000000 +0000 @@ -3,5 +3,5 @@ crc32c plymouth multipath -initramfs-restore +initrd-not-initramfs.patch dev-shm-mount diff -Nru dracut-050+65/debian/source/options dracut-051/debian/source/options --- dracut-050+65/debian/source/options 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/debian/source/options 2020-12-15 14:29:17.000000000 +0000 @@ -0,0 +1 @@ +extend-diff-ignore = "(^|/).+(\.asc)$" diff -Nru dracut-050+65/dracut.8.asc dracut-051/dracut.8.asc --- dracut-050+65/dracut.8.asc 2020-04-24 20:49:15.000000000 +0000 +++ dracut-051/dracut.8.asc 2020-12-14 17:54:26.000000000 +0000 @@ -265,6 +265,9 @@ **-v, --verbose**:: increase verbosity level (default is info(4)) +**--version**:: + display version and exit + **-q, --quiet**:: decrease verbosity level (default is info(4)) **-c, --conf** __:: @@ -659,18 +662,18 @@ Victor Lowther -Philippe Seewer - -Warren Togami - Amadeusz Żołnowski -Jeremy Katz +Hannes Reinecke -David Dillow +Daniel Molkentin Will Woods +Philippe Seewer + +Warren Togami + SEE ALSO -------- *dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1) diff -Nru dracut-050+65/dracut-bash-completion.sh dracut-051/dracut-bash-completion.sh --- dracut-050+65/dracut-bash-completion.sh 2018-08-10 20:28:40.000000000 +0000 +++ dracut-051/dracut-bash-completion.sh 2020-12-14 17:54:26.000000000 +0000 @@ -73,6 +73,17 @@ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) return 0 fi + + local args + _count_args + if [[ $args -eq 1 ]]; then + _filedir + return 0 + elif [[ $args -eq 2 ]]; then + comps=$(cd /lib/modules; echo [0-9]*) + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + fi } complete -F _dracut dracut diff -Nru dracut-050+65/dracut.cmdline.7.asc dracut-051/dracut.cmdline.7.asc --- dracut-050+65/dracut.cmdline.7.asc 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/dracut.cmdline.7.asc 2020-12-14 17:54:26.000000000 +0000 @@ -113,6 +113,9 @@ iso-scan/filename ~~~~~~~~~~~~~~~~~ +Mount all mountable devices and search for ISO pointed by the argument. When +the ISO is found set it up as a loop device. Device containing this ISO +image will stay mounted at /run/initramfs/isoscandev. Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work by copying the original kernel cmdline parameters. @@ -302,6 +305,8 @@ The comparisons also matches, if __ is only the beginning of the LUKS UUID, so you don't have to specify the full UUID. This parameter can be specified multiple times. + __ may be prefixed by the keyword `keysource:`, see + _rd.luks.key_ below. **rd.luks.allow-discards=**____:: Allow using of discards (TRIM) requests for LUKS partitions with the given @@ -397,6 +402,49 @@ cryptsetup --batch-mode --key-file rootkey.key \ luksFormat /dev/sda47 -- + +You can also use regular key files on an encrypted _keydev_. + +Compared to using GPG encrypted keyfiles on an unencrypted +device this provides the following advantages: + +- you can unlock your disk(s) using multiple passphrases +- better security by not loosing the key stretching mechanism + +To use an encrypted _keydev_ you *must* ensure that it becomes +available by using the keyword `keysource`, e.g. +`rd.luks.uuid=keysource:aaaa` +_aaaa_ being the uuid of the encrypted _keydev_. + +Example: + +Lets assume you have three disks _A_, _B_ and _C_ with the uuids +_aaaa_, _bbbb_ and _cccc_. + +You want to unlock _A_ and _B_ using keyfile _keyfile_. + +The unlocked volumes be _A'_, _B'_ and _C'_ with the uuids +_AAAA_, _BBBB_ and _CCCC_. + +_keyfile_ is saved on _C'_ as _/keyfile_. + +One luks keyslot of each _A_, _B_ and _C_ is setup with a +passphrase. + +Another luks keyslot of each _A_ and _B_ is setup with _keyfile_. + +To boot this configuration you could use: +[listing] +-- +rd.luks.uuid=aaaa +rd.luks.uuid=bbbb +rd.luks.uuid=keysource:cccc +rd.luks.key=/keyfile:UUID=CCCC +-- +Dracut asks for the passphrase for _C_ and uses the +keyfile to unlock _A_ and _B_. + +If getting the passphrase for _C_ fails it falls back to +asking for the passphrases for _A_ and _B_. + +If you want _C'_ to stay unlocked, specify a luks name for +it, e.g. `rd.luks.name=cccc=mykeys`, otherwise it gets closed +when not needed anymore. =============================== MD RAID @@ -607,7 +655,7 @@ boolean, bring up network even without netroot set **vlan=**____:____:: - Setup vlan device named on . + Setup vlan device named on . We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5) @@ -622,9 +670,13 @@ Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr -**team=**____:____:: +**team=**____:____[:____]:: Setup team device on top of . is a comma-separated list of physical (ethernet) interfaces. + is the runner type to be used (see *teamd.conf*(5)); defaults to + activebackup. + Team without parameters assumes + team=team0:eth0,eth1:activebackup **bridge=**____:____:: Setup bridge with . is a comma-separated @@ -816,6 +868,23 @@ + NOTE: letters in the MAC-address must be lowercase! +NVMf +~~~~ +**rd.nvmf.hostnqn=**____:: + NVMe host NQN to use + +**rd.nvmf.hostid=**____:: + NVMe host id to use + +**rd.nvmf.discover=**__{rdma|fc|tcp}__,____,[____],[____]:: + Discover and connect to a NVMe-over-Fabric controller specified by + __ and the optionally __ or __. + The first argument specifies the transport to use; currently only + 'rdma', 'fc', or 'tcp' are supported. + The __ parameter can be set to 'auto' to select + autodiscovery; in that case all other parameters are ignored. + This parameter can be specified multiple times. + NBD ~~~ **root=**??? **netroot=**nbd:____:____[:____[:____[:____]]]:: diff -Nru dracut-050+65/dracut-functions.sh dracut-051/dracut-functions.sh --- dracut-050+65/dracut-functions.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/dracut-functions.sh 2020-12-14 17:54:26.000000000 +0000 @@ -526,7 +526,6 @@ if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0 fi - [[ -d /sys/dev/block/$2/slaves ]] || return 1 for _x in /sys/dev/block/$2/slaves/*; do [[ -f $_x/dev ]] || continue [[ $_x/subsystem -ef /sys/class/block ]] || continue @@ -545,7 +544,6 @@ if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0 fi - [[ -d /sys/dev/block/$2/slaves ]] || return 1 for _x in /sys/dev/block/$2/slaves/*; do [[ -f $_x/dev ]] || continue [[ $_x/subsystem -ef /sys/class/block ]] || continue @@ -674,6 +672,11 @@ return 1 } +# 0 if the kernel module is either built-in or available +# 1 if the kernel module is not enabled +check_kernel_module() { + modprobe -S $kernel --dry-run $1 &>/dev/null || return 1 +} # get_cpu_vendor # Only two values are returned: AMD or Intel @@ -728,3 +731,166 @@ printf -- "%s\n" "$_dev" done } + +iface_for_remote_addr() { + set -- $(ip -o route get to "$1") + echo $3 +} + +local_addr_for_remote_addr() { + set -- $(ip -o route get to "$1") + echo $5 +} + +peer_for_addr() { + local addr=$1 + local qtd + + # quote periods in IPv4 address + qtd=${addr//./\\.} + ip -o addr show | \ + sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p' +} + +netmask_for_addr() { + local addr=$1 + local qtd + + # quote periods in IPv4 address + qtd=${addr//./\\.} + ip -o addr show | sed -n 's,^.* '"$qtd"'/\([0-9]*\) .*$,\1,p' +} + +gateway_for_iface() { + local ifname=$1 addr=$2 + + case $addr in + *.*) proto=4;; + *:*) proto=6;; + *) return;; + esac + ip -o -$proto route show | \ + sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p" +} + +# This works only for ifcfg-style network configuration! +bootproto_for_iface() { + local ifname=$1 + local dir + + # follow ifcfg settings for boot protocol + for dir in network-scripts network; do + [ -f "/etc/sysconfig/$dir/ifcfg-$ifname" ] && { + sed -n "s/BOOTPROTO=[\"']\?\([[:alnum:]]\{1,\}\)[\"']\?.*\$/\1/p" \ + "/etc/sysconfig/$dir/ifcfg-$ifname" + return + } + done +} + +is_unbracketed_ipv6_address() { + strglob "$1" '*:*' && ! strglob "$1" '\[*:*\]' +} + +# Create an ip= string to set up networking such that the given +# remote address can be reached +ip_params_for_remote_addr() { + local remote_addr=$1 + local ifname local_addr peer netmask= gateway ifmac + + [[ $remote_addr ]] || return 1 + ifname=$(iface_for_remote_addr "$remote_addr") + [[ $ifname ]] || { + berror "failed to determine interface to connect to $remote_addr" + return 1 + } + + # ifname clause to bind the interface name to a MAC address + if [ -d "/sys/class/net/$ifname/bonding" ]; then + dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline." + elif [ -e "/sys/class/net/$ifname/address" ] ; then + ifmac=$(cat "/sys/class/net/$ifname/address") + [[ $ifmac ]] && printf 'ifname=%s:%s ' "${ifname}" "${ifmac}" + fi + + bootproto=$(bootproto_for_iface "$ifname") + case $bootproto in + dhcp|dhcp6|auto6) ;; + dhcp4) + bootproto=dhcp;; + static*|"") + bootproto=;; + *) + derror "bootproto \"$bootproto\" is unsupported by dracut, trying static configuration" + bootproto=;; + esac + if [[ $bootproto ]]; then + printf 'ip=%s:%s ' "${ifname}" "${bootproto}" + else + local_addr=$(local_addr_for_remote_addr "$remote_addr") + [[ $local_addr ]] || { + berror "failed to determine local address to connect to $remote_addr" + return 1 + } + peer=$(peer_for_addr "$local_addr") + # Set peer or netmask, but not both + [[ $peer ]] || netmask=$(netmask_for_addr "$local_addr") + gateway=$(gateway_for_iface "$ifname" "$local_addr") + # Quote IPv6 addresses with brackets + is_unbracketed_ipv6_address "$local_addr" && local_addr="[$local_addr]" + is_unbracketed_ipv6_address "$peer" && peer="[$peer]" + is_unbracketed_ipv6_address "$gateway" && gateway="[$gateway]" + printf 'ip=%s:%s:%s:%s::%s:none ' \ + "${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}" + fi + +} + +# block_is_nbd +# Check whether $1 is an nbd device +block_is_nbd() { + [[ -b /dev/block/$1 && $1 == 43:* ]] +} + +# block_is_iscsi +# Check whether $1 is an nbd device +block_is_iscsi() { + local _dir + local _dev=$1 + [[ -L "/sys/dev/block/$_dev" ]] || return + _dir="$(readlink -f "/sys/dev/block/$_dev")" || return + until [[ -d "$_dir/sys" || -d "$_dir/iscsi_session" ]]; do + _dir="$_dir/.." + done + [[ -d "$_dir/iscsi_session" ]] +} + +# block_is_fcoe +# Check whether $1 is an FCoE device +# Will not work for HBAs that hide the ethernet aspect +# completely and present a pure FC device +block_is_fcoe() { + local _dir + local _dev=$1 + [[ -L "/sys/dev/block/$_dev" ]] || return + _dir="$(readlink -f "/sys/dev/block/$_dev")" + until [[ -d "$_dir/sys" ]]; do + _dir="$_dir/.." + if [[ -d "$_dir/subsystem" ]]; then + subsystem=$(basename $(readlink $_dir/subsystem)) + [[ $subsystem == "fcoe" ]] && return 0 + fi + done + return 1 +} + +# block_is_netdevice +# Check whether $1 is a net device +block_is_netdevice() { + block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1" +} + +# get the corresponding kernel modules of a /sys/class/*/* or/dev/* device +get_dev_module() { + udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p' +} diff -Nru dracut-050+65/dracut-init.sh dracut-051/dracut-init.sh --- dracut-050+65/dracut-init.sh 2020-02-27 15:56:22.000000000 +0000 +++ dracut-051/dracut-init.sh 2020-12-14 17:54:26.000000000 +0000 @@ -183,7 +183,7 @@ DRINSTALLPARTS=$(($DRINSTALLPARTS+1)) done -if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then +if [[ $DRINSTALLPARTS = 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1 ; then dfatal "dracut-install not found!" exit 10 fi @@ -839,7 +839,7 @@ [[ $2 ]] || mods_checked_as_dep+=" $_mod " if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then - dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!" + ddebug "dracut module '$_mod' will not be installed, because it's in the list to be omitted!" return 1 fi diff -Nru dracut-050+65/dracut.modules.7.asc dracut-051/dracut.modules.7.asc --- dracut-050+65/dracut.modules.7.asc 2020-04-24 20:49:15.000000000 +0000 +++ dracut-051/dracut.modules.7.asc 2020-12-14 17:54:26.000000000 +0000 @@ -93,13 +93,18 @@ ==== Initqueue settled -This hooks (initqueue/settled) gets executed every time udev has settled. +This hook (initqueue/settled) gets executed every time udev has settled. ==== Initqueue timeout -This hooks (initqueue/timeout) gets executed, when the main loop counter becomes +This hook (initqueue/timeout) gets executed, when the main loop counter becomes half of the rd.retry counter. +==== Initqueue online + +This hook (initqueue/online) gets executed whenever a network interface comes online +(that is, once it is up and configured by the configured network module). + ==== Initqueue finished This hook (initqueue/finished) is called after udev has settled and @@ -146,8 +151,8 @@ == Writing a Module -A simple example module is _96insmodpost_, which modprobes a kernel module after -udev has settled and the basic device drivers have been loaded. +A simple example module is _90kernel-modules_, which modprobes a kernel module +after udev has settled and the basic device drivers have been loaded. All module installation information is in the file module-setup.sh. @@ -159,7 +164,7 @@ return 0 ---- -The we create the install() function, which installs a cmdline hook with +Then we create the install() function, which installs a cmdline hook with priority number 20 called _parse-insmodpost.sh_. It also installs the _insmodpost.sh_ script in _/sbin_. diff -Nru dracut-050+65/dracut.sh dracut-051/dracut.sh --- dracut-050+65/dracut.sh 2020-04-22 20:15:46.000000000 +0000 +++ dracut-051/dracut.sh 2020-12-14 17:54:26.000000000 +0000 @@ -37,7 +37,7 @@ set -o pipefail usage() { - [[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l" + [[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l" [[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut if [[ -f $dracutbasedir/dracut-version.sh ]]; then . $dracutbasedir/dracut-version.sh @@ -175,6 +175,8 @@ --hostonly-i18n Install only needed keyboard and font files according to the host configuration (default). --no-hostonly-i18n Install all keyboard and font files available. + --hostonly-nics [LIST] + Only enable listed NICs in the initramfs. --persistent-policy [POLICY] Use [POLICY] to address disks and partitions. POLICY can be any directory name found in /dev/disk. @@ -242,6 +244,7 @@ --kernel-image [FILE] location of the kernel image --regenerate-all Regenerate all initramfs images at the default location for the kernel versions found on the system + --version Display version If [LIST] has multiple arguments, then you have to put these in quotes. @@ -252,6 +255,14 @@ EOF } +long_version() { + [[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut + if [[ -f $dracutbasedir/dracut-version.sh ]]; then + . $dracutbasedir/dracut-version.sh + fi + echo "dracut $DRACUT_VERSION" +} + # Fills up host_devs stack variable and makes sure there are no duplicates push_host_devs() { local _dev @@ -415,7 +426,9 @@ --long kernel-image: \ --long no-hostonly-i18n \ --long hostonly-i18n \ + --long hostonly-nics: \ --long no-machineid \ + --long version \ -- "$@") if (( $? != 0 )); then @@ -436,20 +449,20 @@ unset rebuild_file while : do - if [ "$1" == "--" ]; then - shift; break - fi - if [ "$1" == "--rebuild" ]; then - append_args_l="yes" + if [ "$1" == "--" ]; then + shift; break + fi + if [ "$1" == "--rebuild" ]; then + append_args_l="yes" rebuild_file=$2 if [ ! -e $rebuild_file ]; then echo "Image file '$rebuild_file', for rebuild, does not exist!" exit 1 fi abs_rebuild_file=$(readlink -f "$rebuild_file") && rebuild_file="$abs_rebuild_file" - shift; continue - fi - shift + shift; continue + fi + shift done # get output file name and kernel version from command line arguments @@ -577,6 +590,8 @@ hostonly_cmdline_l="yes" ;; --hostonly-i18n) i18n_install_all_l="no" ;; + --hostonly-nics) + hostonly_nics_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;; --no-hostonly-i18n) i18n_install_all_l="yes" ;; --no-hostonly-cmdline) @@ -616,6 +631,7 @@ kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;; --no-machineid) machine_id_l="no";; + --version) long_version; exit 1 ;; --) shift; break;; *) # should not even reach this point @@ -744,6 +760,7 @@ (( ${#fstab_lines_l[@]} )) && fstab_lines+=( "${fstab_lines_l[@]}" ) (( ${#install_items_l[@]} )) && install_items+=" ${install_items_l[@]} " (( ${#install_optional_items_l[@]} )) && install_optional_items+=" ${install_optional_items_l[@]} " +(( ${#hostonly_nics_l[@]} )) && hostonly_nics+=" ${hostonly_nics_l[@]} " # these options override the stuff in the config file (( ${#dracutmodules_l[@]} )) && dracutmodules="${dracutmodules_l[@]}" @@ -944,15 +961,15 @@ ''|*lib/modules/${kernel}|*lib/modules/${kernel}/) ;; *) [[ "$DRACUT_KMODDIR_OVERRIDE" ]] || { - printf "%s\n" "dracut: -k/--kmoddir path must contain \"lib/modules\" as a parent of your kernel module directory," - printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs." - printf "%s\n" "dracut: was given: ${drivers_dir}" - printf "%s\n" "dracut: expected: $(dirname ${drivers_dir})/lib/modules/${kernel}" - printf "%s\n" "dracut: Please move your modules into the correct directory structure and pass the new location," - printf "%s\n" "dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check." - exit 1 - } - ;; + printf "%s\n" "dracut: -k/--kmoddir path must contain \"lib/modules\" as a parent of your kernel module directory," + printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs." + printf "%s\n" "dracut: was given: ${drivers_dir}" + printf "%s\n" "dracut: expected: $(dirname ${drivers_dir})/lib/modules/${kernel}" + printf "%s\n" "dracut: Please move your modules into the correct directory structure and pass the new location," + printf "%s\n" "dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check." + exit 1 + } + ;; esac readonly TMPDIR="$(realpath -e "$tmpdir")" @@ -1153,7 +1170,7 @@ case $(uname -m) in x86_64) EFI_MACHINE_TYPE_NAME=x64;; - ia32) + i?86) EFI_MACHINE_TYPE_NAME=ia32;; *) dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable" @@ -1194,19 +1211,26 @@ if [[ $early_microcode = yes ]]; then if [[ $hostonly ]]; then - [[ $(get_cpu_vendor) == "AMD" ]] \ - && ! check_kernel_config CONFIG_MICROCODE_AMD \ - && unset early_microcode - [[ $(get_cpu_vendor) == "Intel" ]] \ - && ! check_kernel_config CONFIG_MICROCODE_INTEL \ - && unset early_microcode + if [[ $(get_cpu_vendor) == "AMD" ]]; then + check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode + elif [[ $(get_cpu_vendor) == "Intel" ]]; then + check_kernel_config CONFIG_MICROCODE_INTEL || unset early_microcode + else + unset early_microcode + fi else ! check_kernel_config CONFIG_MICROCODE_AMD \ && ! check_kernel_config CONFIG_MICROCODE_INTEL \ && unset early_microcode fi - [[ $early_microcode != yes ]] \ - && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y" + # Do not complain on non-x86 architectures as it makes no sense + case $(uname -m) in + x86_64|i?86) + [[ $early_microcode != yes ]] \ + && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y" + ;; + *) ;; + esac fi # Need to be able to have non-root users read stuff (rpcbind etc) @@ -1613,7 +1637,9 @@ (( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]} (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]} - [[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf" + if [[ $kernel_cmdline ]] && [[ $uefi != yes ]]; then + printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf" + fi for line in "${fstab_lines[@]}"; do line=($line) @@ -1661,15 +1687,6 @@ # Now we are done with lazy resolving, always install dependencies unset DRACUT_RESOLVE_LAZY export DRACUT_RESOLVE_DEPS=1 - - # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so - for _dir in $libdirs; do - for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do - [[ -e "$_f" ]] || continue - inst_libdir_file "libgcc_s.so*" - break 2 - done - done fi for ((i=0; i < ${#include_src[@]}; i++)); do @@ -1731,7 +1748,7 @@ if [[ $do_strip = yes ]] ; then # Prefer strip from elfutils for package size declare strip_cmd=$(command -v eu-strip) - test -z "$strip_cmd" && strip_cmd="strip" + [ -z "$strip_cmd" ] && strip_cmd="strip" for p in $strip_cmd xargs find; do if ! type -P $p >/dev/null; then @@ -1824,7 +1841,7 @@ dinfo "Stored kernel commandline:" for conf in $initdir/etc/cmdline.d/*.conf ; do [ -e "$conf" ] || continue - dinfo "$(< $conf)" + dinfo "$(< "$conf")" _stored_cmdline=1 done fi @@ -1835,23 +1852,8 @@ if dracut_module_included "squash"; then dinfo "*** Install squash loader ***" - if ! check_kernel_config CONFIG_SQUASHFS; then - dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work" - exit 1 - fi - if ! check_kernel_config CONFIG_OVERLAY_FS; then - dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work" - exit 1 - fi - if ! check_kernel_config CONFIG_DEVTMPFS; then - dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work" - exit 1 - fi - readonly squash_dir="$initdir/squash/root" - readonly squash_img=$initdir/squash/root.img - - # Currently only move "usr" "etc" to squashdir + readonly squash_img="$initdir/squash/root.img" readonly squash_candidate=( "usr" "etc" ) mkdir -m 0755 -p $squash_dir @@ -1862,57 +1864,15 @@ # Move some files out side of the squash image, including: # - Files required to boot and mount the squashfs image # - Files need to be accessible without mounting the squash image - required_in_root() { - local file=$1 - local _sqsh_file=$squash_dir/$file - local _init_file=$initdir/$file - - if [[ -e $_init_file ]]; then - return - fi - - if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then - derror "$file is required to boot a squashed initramfs but it's not installed!" - return - fi - - if [[ ! -d $(dirname $_init_file) ]]; then - required_in_root $(dirname $file) - fi - - if [[ -L $_sqsh_file ]]; then - cp --preserve=all -P $_sqsh_file $_init_file - _sqsh_file=$(realpath $_sqsh_file 2>/dev/null) - if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then - # Relative symlink - required_in_root ${_sqsh_file#$squash_dir/} - return - fi - if [[ -e $squash_dir$_sqsh_file ]]; then - # Absolute symlink - required_in_root ${_sqsh_file#/} - return - fi - required_in_root ${module_spec#$squash_dir/} - else - if [[ -d $_sqsh_file ]]; then - mkdir $_init_file - else - mv $_sqsh_file $_init_file - fi - fi - } - - required_in_root etc/initrd-release - - for module_spec in $squash_dir/usr/lib/modules/*/modules.*; - do - required_in_root ${module_spec#$squash_dir/} - done - - for dracut_spec in $squash_dir/usr/lib/dracut/*; + # - Initramfs marker + for file in \ + $squash_dir/usr/lib/modules/*/modules.* \ + $squash_dir/usr/lib/dracut/* \ + $squash_dir/etc/initrd-release do - required_in_root ${dracut_spec#$squash_dir/} + [[ -d $file ]] && continue + DRACUT_RESOLVE_DEPS=1 dracutsysrootdir=$squash_dir inst ${file#$squash_dir} + rm $file done mv $initdir/init $initdir/init.stock @@ -1923,17 +1883,14 @@ # accessible before mounting the image. inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" hostonly="" instmods "loop" "squashfs" "overlay" - # Only keep systemctl outsite if we need switch root if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then inst "systemctl" fi + # Remove duplicated files for folder in "${squash_candidate[@]}"; do - # Remove duplicated files in squashfs image, save some more space - [[ ! -d $initdir/$folder/ ]] && continue - for file in $(find $initdir/$folder/ -not -type d); - do + for file in $(find $initdir/$folder/ -not -type d); do if [[ -e $squash_dir${file#$initdir} ]]; then mv $squash_dir${file#$initdir} $file fi @@ -1941,6 +1898,28 @@ done fi +if [[ $kernel_only != yes ]]; then + # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so + for _dir in $libdirs; do + for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do + [[ -e "$_f" ]] || continue + inst_libdir_file "libgcc_s.so*" + break 2 + done + done + + # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled + if [[ $DRACUT_FIPS_MODE ]]; then + for _dir in $libdirs; do + for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do + [[ -e "$_f" ]] || continue + inst_libdir_file -o "libssl.so*" + break 2 + done + done + fi +fi + if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then dinfo "*** Stripping files ***" find "$initdir" -type f \ @@ -2020,7 +1999,7 @@ if (( maxloglvl >= 5 )) && (( verbosity_mod_l >= 0 )); then if [[ $allowlocal ]]; then - "$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img"| ddebug + "$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img"| ddebug else lsinitrd "${DRACUT_TMPDIR}/initramfs.img"| ddebug fi @@ -2031,10 +2010,10 @@ if [[ $uefi = yes ]]; then if [[ $kernel_cmdline ]]; then echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt" - elif [[ $hostonly_cmdline = yes ]] && [ -d $initdir/etc/cmdline.d ];then - for conf in $initdir/etc/cmdline.d/*.conf ; do + elif [[ $hostonly_cmdline = yes ]] && [ -d "$initdir/etc/cmdline.d" ];then + for conf in "$initdir"/etc/cmdline.d/*.conf ; do [ -e "$conf" ] || continue - printf "%s " "$(< $conf)" >> "$uefi_outdir/cmdline.txt" + printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt" done else do_print_cmdline > "$uefi_outdir/cmdline.txt" @@ -2047,7 +2026,7 @@ [[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release" [[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release" [[ -s "${dracutsysrootdir}${uefi_splash_image}" ]] && \ - uefi_splash_image="${dracutsysroot}${uefi_splash_image}" || unset uefi_splash_image + uefi_splash_image="${dracutsysrootdir}${uefi_splash_image}" || unset uefi_splash_image if objcopy \ ${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \ @@ -2127,7 +2106,7 @@ # and there's no reason to sync, and *definitely* no reason to fsfreeze. # Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze # globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0 -if test -d $dracutsysrootdir/run/systemd/system; then +if [ -d "$dracutsysrootdir/run/systemd/system" ]; then if ! sync "$outfile" 2> /dev/null; then dinfo "dracut: sync operation on newly created initramfs $outfile failed" exit 1 @@ -2135,7 +2114,7 @@ # use fsfreeze only if we're not writing to / if [[ "$(stat -c %m -- "$outfile")" != "/" ]] && freeze_ok_for_fstype "$outfile"; then - if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then + if ! (fsfreeze -f "$(dirname "$outfile")" 2>/dev/null && fsfreeze -u "$(dirname "$outfile")" 2>/dev/null); then dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")" fi fi diff -Nru dracut-050+65/dracut.spec dracut-051/dracut.spec --- dracut-050+65/dracut.spec 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/dracut.spec 2020-12-14 17:54:26.000000000 +0000 @@ -203,11 +203,10 @@ %endif ${NULL} -make %{?_smp_mflags} +%make_build %install -make %{?_smp_mflags} install \ - DESTDIR=$RPM_BUILD_ROOT \ +%make_install %{?_smp_mflags} \ libdir=%{_prefix}/lib echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh @@ -279,11 +278,6 @@ echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf -%if 0%{?fedora} <= 30 || 0%{?rhel} <= 8 -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d -install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh -%endif - %files %if %{with doc} %doc README.md HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg @@ -348,7 +342,9 @@ %{dracutlibdir}/modules.d/03modsign %{dracutlibdir}/modules.d/03rescue %{dracutlibdir}/modules.d/04watchdog +%{dracutlibdir}/modules.d/04watchdog-modules %{dracutlibdir}/modules.d/05busybox +%{dracutlibdir}/modules.d/06dbus %{dracutlibdir}/modules.d/06rngd %{dracutlibdir}/modules.d/10i18n %{dracutlibdir}/modules.d/30convertfs @@ -366,7 +362,6 @@ %{dracutlibdir}/modules.d/90mdraid %{dracutlibdir}/modules.d/90multipath %{dracutlibdir}/modules.d/90nvdimm -%{dracutlibdir}/modules.d/90stratis %{dracutlibdir}/modules.d/90ppcmac %{dracutlibdir}/modules.d/90qemu %{dracutlibdir}/modules.d/91crypt-gpg @@ -434,6 +429,7 @@ %{dracutlibdir}/modules.d/02systemd-networkd %{dracutlibdir}/modules.d/35network-manager %{dracutlibdir}/modules.d/35network-legacy +%{dracutlibdir}/modules.d/35network-wicked %{dracutlibdir}/modules.d/40network %{dracutlibdir}/modules.d/45ifcfg %{dracutlibdir}/modules.d/90kernel-network-modules @@ -478,9 +474,5 @@ %files config-rescue %{dracutlibdir}/dracut.conf.d/02-rescue.conf %{_prefix}/lib/kernel/install.d/51-dracut-rescue.install -%if 0%{?fedora} <= 30 || 0%{?rhel} <= 8 -# FIXME: remove after F30 -%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh -%endif %changelog diff -Nru dracut-050+65/.github/CODE_OF_CONDUCT.md dracut-051/.github/CODE_OF_CONDUCT.md --- dracut-050+65/.github/CODE_OF_CONDUCT.md 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/CODE_OF_CONDUCT.md 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,56 @@ +# Dracut Code of Conduct + +This code of conduct outlines our expectations for participants within the Dracut community, as well as steps for reporting unacceptable behavior. +We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored. +Anyone who violates this code of conduct may be banned from the community. + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others’ private information, such as a physical or email address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer responsible for enforcement Harald Hoyer . +All complaints will be reviewed and investigated promptly and fairly and will result in a response that is deemed necessary and appropriate to the circumstances. +Project maintainers are obligated to respect the privacy and security of the reporter of any incident. +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. +Translations are available at https://www.contributor-covenant.org/translations. diff -Nru dracut-050+65/.github/ISSUE_TEMPLATE/bug_report.md dracut-051/.github/ISSUE_TEMPLATE/bug_report.md --- dracut-050+65/.github/ISSUE_TEMPLATE/bug_report.md 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/ISSUE_TEMPLATE/bug_report.md 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,26 @@ +--- +name: "\U0001F41B Bug report" +about: A report of an error in a recent Dracut version +labels: 'bug' +--- + +**Describe the bug** +A clear and concise description of what the error is. + +**Distribution used** +Which distribution was this behaviour seen in? + +**Dracut version** +Which dracut version was this behaviour seen in? + +**Init system** +Which init system is being used? + +**To Reproduce** +Steps or code to reproduce the behavior. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context you like about the problem here. diff -Nru dracut-050+65/.github/ISSUE_TEMPLATE/documentation.md dracut-051/.github/ISSUE_TEMPLATE/documentation.md --- dracut-050+65/.github/ISSUE_TEMPLATE/documentation.md 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/ISSUE_TEMPLATE/documentation.md 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,8 @@ +--- +name: "\U0001F4D6 Documentation" +about: Suggest an improvement for documentation in Dracut +labels: 'documents' +--- + +**Describe the documentation** +A clear and concise description of what should be better documented. diff -Nru dracut-050+65/.github/ISSUE_TEMPLATE/feature_request.md dracut-051/.github/ISSUE_TEMPLATE/feature_request.md --- dracut-050+65/.github/ISSUE_TEMPLATE/feature_request.md 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/ISSUE_TEMPLATE/feature_request.md 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,8 @@ +--- +name: "\U00002728 Feature Request" +about: A request for enhancement in Dracut +labels: 'enhancement' +--- + +**Describe the enhancement** +A clear and concise description of what the enhancement is that you would like to see. diff -Nru dracut-050+65/.github/labeler.yml dracut-051/.github/labeler.yml --- dracut-050+65/.github/labeler.yml 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/labeler.yml 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,296 @@ +needs review: + - "*" + +repository: + - ./* + +github: + - .github/* + - .github/**/* + +dracut-install: + - install/* + - install/**/* + +example: + - examples/* + - examples/**/* + - examples/**/**/* + +modules: + - modules.d/* + - modules.d/**/* + +bash: + - modules.d/00bash/* + +bootchart: + - modules.d/00bootchart/* + +dash: + - modules.d/00dash/* + +mksh: + - modules.d/00mksh/* + +systemd: + - modules.d/00systemd/* + +warpclock: + - modules.d/00warpclock/* + +fips: + - modules.d/01fips/* + +systemd-initrd: + - modules.d/01systemd-initrd/* + +caps: + - modules.d/02caps/* + +systemd-networkd: + - modules.d/02systemd-networkd/* + +modsign: + - modules.d/03modsign/* + +rescue: + - modules.d/03rescue/* + +watchdog: + - modules.d/04watchdog/* + +busybox: + - modules.d/05busybox/* + +rngd: + - modules.d/06rngd/* + +i18n: + - modules.d/10i18n/* + +convertfs: + - modules.d/30convertfs/* + +network-legacy: + - modules.d/35network-legacy/* + +network-manager: + - modules.d/35network-manager/* + +network: + - modules.d/40network/* + +ifcfg: + - modules.d/45ifcfg/* + +url-lib: + - modules.d/45url-lib/* + +drm: + - modules.d/50drm/* + +gensplash: + - modules.d/50gensplash/* + +plymouth: + - modules.d/50plymouth/* + +cms: + - modules.d/80cms/* + +lvmmerge: + - modules.d/80lvmmerge/* + +cio_ignore: + - modules.d/81cio_ignore/* + +btrfs: + - modules.d/90btrfs/* + +crypt: + - modules.d/90crypt/* + +dm: + - modules.d/90dm/* + +dmraid: + - modules.d/90dmraid/* + +dmsquash-live: + - modules.d/90dmsquash-live/* + +dmsquash-live-ntfs: + - modules.d/90dmsquash-live-ntfs/* + +kernel-modules: + - modules.d/90kernel-modules/* + +kernel-modules-extra: + - modules.d/90kernel-modules-extra/* + +kernel-network-modules: + - modules.d/90kernel-network-modules/* + +livenet: + - modules.d/90livenet/* + +lvm: + - modules.d/90lvm/* + +mdraid: + - modules.d/90mdraid/* + +multipath: + - modules.d/90multipath/* + +nvdimm: + - modules.d/90nvdimm/* + +ppcmac: + - modules.d/90ppcmac/* + +qemu: + - modules.d/90qemu/* + +qemu-net: + - modules.d/90qemu-net/* + +stratis: + - modules.d/90stratis/* + +crypt-gpg: + - modules.d/91crypt-gpg/* + +crypt-loop: + - modules.d/91crypt-loop/* + +zipl: + - modules.d/91zipl/* + +cifs: + - modules.d/95cifs/* + +dasd: + - modules.d/95dasd/* + +dasd_mod: + - modules.d/95dasd_mod/* + +dasd_rules: + - modules.d/95dasd_rules/* + +dcssblk: + - modules.d/95dcssblk/* + +debug: + - modules.d/95debug/* + +fcoe: + - modules.d/95fcoe/* + +fcoe-uefi: + - modules.d/95fcoe-uefi/* + +fstab-sys: + - modules.d/95fstab-sys/* + +iscsi: + - modules.d/95iscsi/* + +lunmask: + - modules.d/95lunmask/* + +nbd: + - modules.d/95nbd/* + +nfs: + - modules.d/95nfs/* + +nvmf: + - modules.d/95nvmf/* + +qeth_rules: + - modules.d/95qeth_rules/* + +resume: + - modules.d/95resume/* + +rootfs-block: + - modules.d/95rootfs-block/* + +ssh-client: + - modules.d/95ssh-client/* + +terminfo: + - modules.d/95terminfo/* + +udev-rules: + - modules.d/95udev-rules/* + +virtfs: + - modules.d/95virtfs/* + +zfcp: + - modules.d/95zfcp/* + +zfcp_rules: + - modules.d/95zfcp_rules/* + +znet: + - modules.d/95znet/* + +securityfs: + - modules.d/96securityfs/* + +biosdevname: + - modules.d/97biosdevname/* + +masterkey: +- modules.d/97masterkey/* + +dracut-systemd: + - modules.d/98dracut-systemd/* + +ecryptfs: + - modules.d/98ecryptfs/* + +integrity: + - modules.d/98integrity/* + +pollcdrom: + - modules.d/98pollcdrom/* + +selinux: + - modules.d/98selinux/* + +syslog: + - modules.d/98syslog/* + +usrmount: + - modules.d/98usrmount/* + +base: + - modules.d/99base/* + +fs-lib: + - modules.d/99fs-lib/* + +img-lib: + - modules.d/99img-lib/* + +memstrack: + - modules.d/99memstrack/* + +shutdown: + - modules.d/99shutdown/* + +squash: + - modules.d/99squash/* + +uefi-lib: + - modules.d/99uefi-lib/* + +test: + - test/* + - test/**/* diff -Nru dracut-050+65/.github/pull_request_template.md dracut-051/.github/pull_request_template.md --- dracut-050+65/.github/pull_request_template.md 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/pull_request_template.md 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,10 @@ +This pull request changes... + +## Changes + +## Checklist +- [ ] I have tested it locally +- [ ] I have reviewed and updated any documentation if relevant +- [ ] I am providing new code and test(s) for it + +Fixes # diff -Nru dracut-050+65/.github/SECURITY.md dracut-051/.github/SECURITY.md --- dracut-050+65/.github/SECURITY.md 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/SECURITY.md 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,3 @@ +Security is very important to us. If you discover any issue regarding security, we'd appreciate a non-public disclosure of +the information, so please disclose the information responsibly by sending an email to Harald Hoyer harald@redhat.com and not by creating a GitHub issue. +We will respond swiftly to fix verifiable security issues with the disclosure being coordinated with distributions and relevant security teams. diff -Nru dracut-050+65/.github/stale.yml dracut-051/.github/stale.yml --- dracut-050+65/.github/stale.yml 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/stale.yml 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,20 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - documents + - enhancement + - regression + - wiki +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue is being marked as stale because it has not had any recent activity. + It will be closed if no further activity occurs. + If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. + Thank you for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff -Nru dracut-050+65/.github/workflows/labels.yml dracut-051/.github/workflows/labels.yml --- dracut-050+65/.github/workflows/labels.yml 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/.github/workflows/labels.yml 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,15 @@ +name: Label the Pull Requests automatically via Cron + +on: + schedule: + - cron: '*/15 * * * *' + +jobs: + label: + runs-on: ubuntu-18.04 + steps: + - uses: paulfantom/periodic-labeler@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + LABEL_MAPPINGS_FILE: .github/labeler.yml diff -Nru dracut-050+65/install/dracut-install.c dracut-051/install/dracut-install.c --- dracut-050+65/install/dracut-install.c 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/install/dracut-install.c 2020-12-14 17:54:26.000000000 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -123,6 +124,7 @@ } #define _cleanup_fts_close_ _cleanup_(fts_closep) +#define _cleanup_globfree_ _cleanup_(globfree) static size_t dir_len(char const *file) @@ -569,6 +571,9 @@ if (strstr(buf, "cannot read header")) break; + if (strstr(buf, "cannot be preloaded")) + break; + if (strstr(buf, destrootdir)) break; @@ -807,123 +812,123 @@ log_debug("'%s' already exists", fulldstpath); /* dst does already exist */ - return ret; - } + } else { - /* check destination directory */ - fulldstdir = strdup(fulldstpath); - if (!fulldstdir) { - log_error("Out of memory!"); - return 1; - } - fulldstdir[dir_len(fulldstdir)] = '\0'; + /* check destination directory */ + fulldstdir = strdup(fulldstpath); + if (!fulldstdir) { + log_error("Out of memory!"); + return 1; + } + fulldstdir[dir_len(fulldstdir)] = '\0'; - ret = stat(fulldstdir, &db); + ret = stat(fulldstdir, &db); - if (ret < 0) { - _cleanup_free_ char *dname = NULL; + if (ret < 0) { + _cleanup_free_ char *dname = NULL; - if (errno != ENOENT) { - log_error("ERROR: stat '%s': %m", fulldstdir); - return 1; - } - /* create destination directory */ - log_debug("dest dir '%s' does not exist", fulldstdir); - dname = strdup(dst); - if (!dname) - return 1; + if (errno != ENOENT) { + log_error("ERROR: stat '%s': %m", fulldstdir); + return 1; + } + /* create destination directory */ + log_debug("dest dir '%s' does not exist", fulldstdir); + dname = strdup(dst); + if (!dname) + return 1; - dname[dir_len(dname)] = '\0'; - ret = dracut_install(dname, dname, true, false, true); + dname[dir_len(dname)] = '\0'; + ret = dracut_install(dname, dname, true, false, true); - if (ret != 0) { - log_error("ERROR: failed to create directory '%s'", fulldstdir); - return 1; + if (ret != 0) { + log_error("ERROR: failed to create directory '%s'", fulldstdir); + return 1; + } } - } - if (src_isdir) { - if (dst_exists) { - if (S_ISDIR(sb.st_mode)) { - log_debug("dest dir '%s' already exists", fulldstpath); - return 0; + if (src_isdir) { + if (dst_exists) { + if (S_ISDIR(sb.st_mode)) { + log_debug("dest dir '%s' already exists", fulldstpath); + return 0; + } + log_error("dest dir '%s' already exists but is not a directory", fulldstpath); + return 1; } - log_error("dest dir '%s' already exists but is not a directory", fulldstpath); - return 1; - } - log_info("mkdir '%s'", fulldstpath); - ret = dracut_mkdir(fulldstpath); - if (ret == 0) { - i = strdup(dst); - if (!i) - return -ENOMEM; + log_info("mkdir '%s'", fulldstpath); + ret = dracut_mkdir(fulldstpath); + if (ret == 0) { + i = strdup(dst); + if (!i) + return -ENOMEM; - hashmap_put(items, i, i); + hashmap_put(items, i, i); + } + return ret; } - return ret; - } - /* ready to install src */ + /* ready to install src */ - if (src_islink) { - _cleanup_free_ char *abspath = NULL; + if (src_islink) { + _cleanup_free_ char *abspath = NULL; - abspath = get_real_file(src, false); + abspath = get_real_file(src, false); - if (abspath == NULL) - return 1; + if (abspath == NULL) + return 1; - if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) { - log_debug("'%s' install error", abspath); - return 1; - } + if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) { + log_debug("'%s' install error", abspath); + return 1; + } - if (lstat(abspath, &sb) != 0) { - log_debug("lstat '%s': %m", abspath); - return 1; - } + if (lstat(abspath, &sb) != 0) { + log_debug("lstat '%s': %m", abspath); + return 1; + } - if (lstat(fulldstpath, &sb) != 0) { - _cleanup_free_ char *absdestpath = NULL; + if (lstat(fulldstpath, &sb) != 0) { + _cleanup_free_ char *absdestpath = NULL; - ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen); - if (ret < 0) { - log_error("Out of memory!"); - exit(EXIT_FAILURE); + ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen); + if (ret < 0) { + log_error("Out of memory!"); + exit(EXIT_FAILURE); + } + + ln_r(absdestpath, fulldstpath); } - ln_r(absdestpath, fulldstpath); - } + if (arg_hmac) { + /* copy .hmac files also */ + hmac_install(src, dst, NULL); + } - if (arg_hmac) { - /* copy .hmac files also */ - hmac_install(src, dst, NULL); + return 0; } - return 0; - } - - if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { - if (resolvedeps) - ret += resolve_deps(fullsrcpath + sysrootdirlen); - if (arg_hmac) { - /* copy .hmac files also */ - hmac_install(src, dst, NULL); + if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { + if (resolvedeps) + ret += resolve_deps(fullsrcpath + sysrootdirlen); + if (arg_hmac) { + /* copy .hmac files also */ + hmac_install(src, dst, NULL); + } } - } - log_debug("dracut_install ret = %d", ret); + log_debug("dracut_install ret = %d", ret); - if (arg_hostonly && !arg_module) - mark_hostonly(dst); + if (arg_hostonly && !arg_module) + mark_hostonly(dst); - if (isdir) { - log_info("mkdir '%s'", fulldstpath); - ret += dracut_mkdir(fulldstpath); - } else { - log_info("cp '%s' '%s'", fullsrcpath, fulldstpath); - ret += cp(fullsrcpath, fulldstpath); + if (isdir) { + log_info("mkdir '%s'", fulldstpath); + ret += dracut_mkdir(fulldstpath); + } else { + log_info("cp '%s' '%s'", fullsrcpath, fulldstpath); + ret += cp(fullsrcpath, fulldstpath); + } } if (ret == 0) { @@ -1325,8 +1330,33 @@ return r; } -static int install_firmware(struct kmod_module *mod) +static int install_firmware_fullpath(const char *fwpath) { + const char *fw; + _cleanup_free_ char *fwpath_xz = NULL; + fw = fwpath; + struct stat sb; + int ret, r; + if (stat(fwpath, &sb) != 0) { + r = asprintf(&fwpath_xz, "%s.xz", fwpath); + if (r < 0) { + log_error("Out of memory!"); + exit(EXIT_FAILURE); + } + if (stat(fwpath_xz, &sb) != 0) { + log_debug("stat(%s) != 0", fwpath); + return 1; + } + fw = fwpath_xz; + } + ret = dracut_install(fw, fw, false, false, true); + if (ret == 0) { + log_debug("dracut_install '%s' OK", fwpath); + } + return ret; +} + +static int install_firmware(struct kmod_module *mod) { struct kmod_list *l; _cleanup_kmod_module_info_free_list_ struct kmod_list *list = NULL; int ret; @@ -1351,8 +1381,6 @@ ret = -1; STRV_FOREACH(q, firmwaredirs) { _cleanup_free_ char *fwpath = NULL; - _cleanup_free_ char *fwpath_xz = NULL; - const char *fw; struct stat sb; int r; @@ -1362,27 +1390,22 @@ exit(EXIT_FAILURE); } - fw = fwpath; - if (stat(fwpath, &sb) != 0) { - r = asprintf(&fwpath_xz, "%s.xz", fwpath); - if (r < 0) { - log_error("Out of memory!"); - exit(EXIT_FAILURE); + if ((strstr(value, "*") != 0 || strstr(value, "?") != 0 || strstr(value, "[") != 0) && stat(fwpath, &sb) != 0) { + int i; + _cleanup_globfree_ glob_t globbuf; + glob(fwpath, 0, NULL, &globbuf); + for (i = 0; i < globbuf.gl_pathc; i++) { + install_firmware_fullpath(globbuf.gl_pathv[i]); + if (ret != 0) { + log_info("Possible missing firmware %s for kernel module %s", value, kmod_module_get_name(mod)); + } } - if (stat(fwpath_xz, &sb) != 0) { - log_debug("stat(%s) != 0", fwpath); - continue; + } else { + install_firmware_fullpath(fwpath); + if (ret != 0) { + log_info("Possible missing firmware %s for kernel module %s", value, kmod_module_get_name(mod)); } - fw = fwpath_xz; } - - ret = dracut_install(fw, fw, false, false, true); - if (ret == 0) - log_debug("dracut_install '%s' OK", fwpath); - } - - if (ret != 0) { - log_info("Possible missing firmware %s for kernel module %s", value, kmod_module_get_name(mod)); } } return 0; @@ -1482,9 +1505,13 @@ ret = install_dependent_modules(modlist); if (ret == 0) { ret = kmod_module_get_softdeps(mod, &modpre, &modpost); - if (ret == 0) - ret = install_dependent_modules(modpre); - } + if (ret == 0) { + int r; + ret = install_dependent_modules(modpre); + r = install_dependent_modules(modpost); + ret = ret ? : r; + } + } } else { log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]); } @@ -1545,8 +1572,12 @@ if (ret == 0) { ret = kmod_module_get_softdeps(mod, &modpre, &modpost); - if (ret == 0) - ret = install_dependent_modules(modpre); + if (ret == 0) { + int r; + ret = install_dependent_modules(modpre); + r = install_dependent_modules(modpost); + ret = ret ? : r; + } } return ret; diff -Nru dracut-050+65/.mailmap dracut-051/.mailmap --- dracut-050+65/.mailmap 2018-02-20 21:15:47.000000000 +0000 +++ dracut-051/.mailmap 2020-12-14 17:54:26.000000000 +0000 @@ -31,3 +31,6 @@ Nikoli Peter Robinson Xunlei Pang +Daniel Molkentin +Thomas Blume +Brian C. Lane diff -Nru dracut-050+65/mkinitrd-dracut.sh dracut-051/mkinitrd-dracut.sh --- dracut-050+65/mkinitrd-dracut.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/mkinitrd-dracut.sh 2020-12-14 17:54:26.000000000 +0000 @@ -57,10 +57,10 @@ s390|s390x) regex='image' ;; - ppc|ppc64) + ppc*) regex='vmlinux' ;; - i386|x86_64) + i?86|x86_64) regex='vmlinuz' ;; arm*) diff -Nru dracut-050+65/modules.d/00systemd/module-setup.sh dracut-051/modules.d/00systemd/module-setup.sh --- dracut-050+65/modules.d/00systemd/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/00systemd/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -65,6 +65,8 @@ $systemdutildir/system-generators/systemd-gpt-auto-generator \ \ $systemdsystemunitdir/cryptsetup.target \ + $systemdsystemunitdir/cryptsetup-pre.target \ + $systemdsystemunitdir/remote-cryptsetup.target \ $systemdsystemunitdir/emergency.target \ $systemdsystemunitdir/sysinit.target \ $systemdsystemunitdir/basic.target \ diff -Nru dracut-050+65/modules.d/01fips/fips.sh dracut-051/modules.d/01fips/fips.sh --- dracut-050+65/modules.d/01fips/fips.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/01fips/fips.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,5 +1,17 @@ #!/bin/sh +# systemd lets stdout go to journal only, but the system +# has to halt when the integrity check fails to satisfy FIPS. +if [ -z "$DRACUT_SYSTEMD" ]; then + fips_info() { + info "$*" + } +else + fips_info() { + echo "$*" >&2 + } +fi + mount_boot() { boot=$(getarg boot=) @@ -45,7 +57,7 @@ [ -e "$boot" ] || return 1 mkdir /boot - info "Mounting $boot as /boot" + fips_info "Mounting $boot as /boot" mount -oro "$boot" /boot || return 1 elif [ -d "$NEWROOT/boot" ]; then rm -fr -- /boot @@ -65,19 +77,27 @@ warn "HMAC sum mismatch" return 1 fi - info "rhevh_check OK" + fips_info "rhevh_check OK" return 0 } +nonfatal_modprobe() +{ + modprobe $1 2>&1 > /dev/stdout | + while read -r line || [ -n "$line" ]; do + echo "${line#modprobe: FATAL: }" >&2 + done +} + fips_load_crypto() { FIPSMODULES=$(cat /etc/fipsmodules) - info "Loading and integrity checking all crypto modules" + fips_info "Loading and integrity checking all crypto modules" mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak for _module in $FIPSMODULES; do if [ "$_module" != "tcrypt" ]; then - if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then + if ! nonfatal_modprobe "${_module}" 2>/tmp/fips.modprobe_err; then # check if kernel provides generic algo _found=0 while read _k _s _v || [ -n "$_k" ]; do @@ -92,7 +112,7 @@ done mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf - info "Self testing crypto algorithms" + fips_info "Self testing crypto algorithms" modprobe tcrypt || return 1 rmmod tcrypt } @@ -106,7 +126,7 @@ KERNEL=$(uname -r) - info "Checking integrity of kernel" + fips_info "Checking integrity of kernel" if [ -e "/run/initramfs/live/vmlinuz0" ]; then do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1 elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then @@ -145,7 +165,7 @@ (cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1 fi - info "All initrd crypto checks done" + fips_info "All initrd crypto checks done" > /tmp/fipsdone diff -Nru dracut-050+65/modules.d/04watchdog/module-setup.sh dracut-051/modules.d/04watchdog/module-setup.sh --- dracut-050+65/modules.d/04watchdog/module-setup.sh 2016-06-25 09:43:01.000000000 +0000 +++ dracut-051/modules.d/04watchdog/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -7,7 +7,7 @@ # called by dracut depends() { - return 0 + return "watchdog-modules" } # called by dracut @@ -27,53 +27,7 @@ inst_hook cleanup 00 "$moddir/watchdog.sh" inst_hook cleanup 99 "$moddir/watchdog.sh" fi + inst_hook emergency 02 "$moddir/watchdog-stop.sh" inst_multiple -o wdctl } - -installkernel() { - local -A _drivers - local _alldrivers _active _wdtdrv _wdtppath _dir - [[ -d /sys/class/watchdog/ ]] || return - for _dir in /sys/class/watchdog/*; do - [[ -d "$_dir" ]] || continue - [[ -f "$_dir/state" ]] || continue - _active=$(< "$_dir/state") - ! [[ $hostonly ]] || [[ "$_active" = "active" ]] || continue - # device/modalias will return driver of this device - _wdtdrv=$(< "$_dir/device/modalias") - # There can be more than one module represented by same - # modalias. Currently load all of them. - # TODO: Need to find a way to avoid any unwanted module - # represented by modalias - _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null) - if [[ $_wdtdrv ]]; then - instmods $_wdtdrv - for i in $_wdtdrv; do - _drivers[$i]=1 - done - fi - # however in some cases, we also need to check that if there is - # a specific driver for the parent bus/device. In such cases - # we also need to enable driver for parent bus/device. - _wdtppath=$(readlink -f "$_dir/device") - while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do - _wdtppath=$(readlink -f "$_wdtppath/..") - [[ -f "$_wdtppath/modalias" ]] || continue - - _wdtdrv=$(< "$_wdtppath/modalias") - _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null) - if [[ $_wdtdrv ]]; then - instmods $_wdtdrv - for i in $_wdtdrv; do - _drivers[$i]=1 - done - fi - done - done - # ensure that watchdog module is loaded as early as possible - _alldrivers="${!_drivers[*]}" - [[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf - - return 0 -} diff -Nru dracut-050+65/modules.d/04watchdog-modules/module-setup.sh dracut-051/modules.d/04watchdog-modules/module-setup.sh --- dracut-050+65/modules.d/04watchdog-modules/module-setup.sh 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/04watchdog-modules/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,38 @@ +#!/bin/bash + +# called by dracut +check() { + return 255 +} + +# called by dracut +depends() { + return 0 +} + +# called by dracut +install() { + return 0 +} + +installkernel() { + local -A _drivers + local _alldrivers _wdtdrv _wdtppath _dir + + for _wd in /sys/class/watchdog/*; do + ! [ -e $_wd ] && continue + _wdtdrv=$(get_dev_module $_wd) + if [[ $_wdtdrv ]]; then + instmods $_wdtdrv + for i in $_wdtdrv; do + _drivers[$i]=1 + done + fi + done + + # ensure that watchdog module is loaded as early as possible + _alldrivers="${!_drivers[*]}" + [[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf + + return 0 +} diff -Nru dracut-050+65/modules.d/06dbus/module-setup.sh dracut-051/modules.d/06dbus/module-setup.sh --- dracut-050+65/modules.d/06dbus/module-setup.sh 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/06dbus/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,70 @@ +#!/bin/bash + +# called by dracut +check() { + require_binaries dbus-daemon || return 1 + + return 255 +} + +depends() { + echo systemd + return 0 +} + +adjust_dependencies() { + sed -i -e \ +'/^\[Unit\]/aDefaultDependencies=no\ +Conflicts=shutdown.target\ +Before=shutdown.target' \ + "$initdir"${1} + +} + +install() { + + inst_multiple \ + $systemdsystemunitdir/dbus.service \ + $systemdsystemunitdir/dbus.socket \ + /usr/bin/dbus-send \ + /usr/bin/busctl + adjust_dependencies $systemdsystemunitdir/dbus.service + + if [[ -e /usr/bin/dbus-daemon ]]; then + inst_multiple \ + /usr/bin/dbus-daemon + fi + + if [[ -e /usr/bin/dbus-broker ]]; then + inst_multiple \ + $systemdsystemunitdir/dbus-broker.service \ + /usr/bin/dbus-broker \ + /usr/bin/dbus-broker-launch + adjust_dependencies $systemdsystemunitdir/dbus-broker.service + fi + + inst_dir /etc/dbus-1/system.d + inst_dir /usr/share/dbus-1/services + inst_dir /usr/share/dbus-1/system-services + inst_multiple /etc/dbus-1/system.conf + inst_multiple /usr/share/dbus-1/system.conf \ + /usr/share/dbus-1/services/org.freedesktop.systemd1.service + inst_multiple $(find /var/lib/dbus) + + grep '^\(d\|message\)bus:' /etc/passwd >> "$initdir/etc/passwd" + grep '^\(d\|message\)bus:' /etc/group >> "$initdir/etc/group" + + sed -i -e \ +'/^\[Unit\]/aDefaultDependencies=no\ +Conflicts=shutdown.target\ +Before=shutdown.target +/^\[Socket\]/aRemoveOnStop=yes' \ + "$initdir"/usr/lib/systemd/system/dbus.socket + + #We need to make sure that systemd-tmpfiles-setup.service->dbus.socket will not wait local-fs.target to start, + #If swap is encrypted, this would make dbus wait the timeout for the swap before loading. This could delay sysinit + #services that are dependent on dbus.service. + sed -i -Ee \ + '/^After/s/(After[[:space:]]*=.*)(local-fs.target[[:space:]]*)(.*)/\1-\.mount \3/' \ + "$initdir"/usr/lib/systemd/system/systemd-tmpfiles-setup.service +} diff -Nru dracut-050+65/modules.d/06rngd/rngd.service dracut-051/modules.d/06rngd/rngd.service --- dracut-050+65/modules.d/06rngd/rngd.service 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/06rngd/rngd.service 2020-12-14 17:54:26.000000000 +0000 @@ -2,6 +2,7 @@ Description=Hardware RNG Entropy Gatherer Daemon DefaultDependencies=no Before=systemd-udevd.service +ConditionVirtualization=!container [Service] ExecStart=/usr/sbin/rngd -f diff -Nru dracut-050+65/modules.d/35network-legacy/ifup.sh dracut-051/modules.d/35network-legacy/ifup.sh --- dracut-050+65/modules.d/35network-legacy/ifup.sh 2020-02-27 15:56:22.000000000 +0000 +++ dracut-051/modules.d/35network-legacy/ifup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -376,23 +376,6 @@ fi -# No ip lines default to dhcp -ip=$(getarg ip) - -if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then - if [ "$netroot" = "dhcp6" ]; then - do_dhcp -6 - else - do_dhcp -4 - fi - - for s in $(getargs nameserver); do - [ -n "$s" ] || continue - echo nameserver $s >> /tmp/net.$netif.resolv.conf - done -fi - - # Specific configuration, spin through the kernel command line # looking for ip= lines for p in $(getargs ip=); do @@ -473,21 +456,39 @@ # no ip option directed at our interface? if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then + ret=1 if [ -e /tmp/net.bootdev ]; then BOOTDEV=$(cat /tmp/net.bootdev) if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then - load_ipv6 do_dhcp + ret=$? fi else - if getargs 'ip=dhcp6'; then + # No ip lines, no bootdev -> default to dhcp + ip=$(getarg ip) + + if getargs 'ip=dhcp6' || [ -z "$ip" -a "$netroot" = "dhcp6" ]; then load_ipv6 do_dhcp -6 + ret=$? fi - if getargs 'ip=dhcp'; then + if getargs 'ip=dhcp' || [ -z "$ip" -a "$netroot" != "dhcp6" ]; then do_dhcp -4 + ret=$? fi fi + + for s in $(getargs nameserver); do + [ -n "$s" ] || continue + echo nameserver $s >> /tmp/net.$netif.resolv.conf + done + + if [ "$ret" -eq 0 ] && [ -n "$(ls /tmp/leaseinfo.${netif}*)" ]; then + > /tmp/net.${netif}.did-setup + if [ -e /sys/class/net/${netif}/address ]; then + > /tmp/net.$(cat /sys/class/net/${netif}/address).did-setup + fi + fi fi exit 0 diff -Nru dracut-050+65/modules.d/35network-legacy/parse-team.sh dracut-051/modules.d/35network-legacy/parse-team.sh --- dracut-050+65/modules.d/35network-legacy/parse-team.sh 2019-11-21 19:59:03.000000000 +0000 +++ dracut-051/modules.d/35network-legacy/parse-team.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,9 +1,12 @@ #!/bin/sh # # Format: -# team=: +# team=:[:] # # teamslaves is a comma-separated list of physical (ethernet) interfaces +# teamrunner is the runner type to be used (see teamd.conf(5)); defaults to activebackup +# +# team without parameters assumes team=team0:eth0,eth1:activebackup # parseteam() { @@ -15,8 +18,11 @@ done case $# in - 2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;; - *) die "team= requires two parameters" ;; + 0) teammaster=team0; teamslaves="eth0 eth1"; teamrunner="activebackup" ;; + 1) teammaster=$1; teamslaves="eth0 eth1"; teamrunner="activebackup" ;; + 2) teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner="activebackup" ;; + 3) teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner=$3 ;; + *) die "team= requires zero to three parameters" ;; esac return 0 } @@ -26,16 +32,18 @@ unset teammaster unset teamslaves + unset teamrunner parseteam "$team" || continue echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info + echo "teamrunner=\"$teamrunner\"" >> /tmp/team.${teammaster}.info if ! [ -e /etc/teamd/${teammaster}.conf ]; then - warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup." + warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using $teamrunner." mkdir -p /etc/teamd - printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf" + printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf" fi done diff -Nru dracut-050+65/modules.d/35network-wicked/module-setup.sh dracut-051/modules.d/35network-wicked/module-setup.sh --- dracut-050+65/modules.d/35network-wicked/module-setup.sh 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/35network-wicked/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,66 @@ +#!/bin/bash + +# called by dracut +check() { + local _program + + require_binaries wicked || return 1 + + # do not add this module by default + return 255 +} + +# called by dracut +depends() { + echo systemd dbus + return 0 +} + +# called by dracut +installkernel() { + return 0 +} + +# called by dracut +install() { + inst_hook cmdline 99 "$moddir/wicked-config.sh" + + # Seems to not execute if in initqueue/settled + inst_hook pre-udev 99 "$moddir/wicked-run.sh" + + # even with wicked configuring the interface, ip is useful + inst_multiple ip + + inst_dir /etc/wicked/extensions + inst_dir /usr/share/wicked/schema + inst_dir /usr/lib/wicked/bin + inst_dir /var/lib/wicked + + inst_multiple /etc/wicked/*.xml + inst_multiple /etc/wicked/extensions/* + inst_multiple /etc/dbus-1/system.d/org.opensuse.Network* + inst_multiple /usr/share/wicked/schema/* + inst_multiple /usr/lib/wicked/bin/* + inst_multiple /usr/libexec/wicked/bin/* + inst_multiple /usr/sbin/wicked* + + wicked_units=" + $systemdsystemunitdir/wickedd.service \ + $systemdsystemunitdir/wickedd-auto4.service \ + $systemdsystemunitdir/wickedd-dhcp4.service \ + $systemdsystemunitdir/wickedd-dhcp6.service \ + $systemdsystemunitdir/wickedd-nanny.service" + + inst_multiple $wicked_units + + for unit in $wicked_units; do + sed -i 's/^After=.*/After=dbus.service/g' $initdir/$unit + sed -i 's/^Before=\(.*\)/Before=\1 dracut-pre-udev.service/g' $initdir/$unit + sed -i 's/^Wants=\(.*\)/Wants=\1 dbus.service/g' $initdir/$unit + sed -i -e \ + '/^\[Unit\]/aDefaultDependencies=no\ + Conflicts=shutdown.target\ + Before=shutdown.target' \ + "$initdir"$unit + done +} diff -Nru dracut-050+65/modules.d/35network-wicked/wicked-config.sh dracut-051/modules.d/35network-wicked/wicked-config.sh --- dracut-050+65/modules.d/35network-wicked/wicked-config.sh 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/35network-wicked/wicked-config.sh 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/sh + +getcmdline > /tmp/cmdline.$$.conf +wicked show-config --ifconfig dracut:cmdline:/tmp/cmdline.$$.conf > /tmp/dracut.xml +rm -f /tmp/cmdline.$$.conf diff -Nru dracut-050+65/modules.d/35network-wicked/wicked-run.sh dracut-051/modules.d/35network-wicked/wicked-run.sh --- dracut-050+65/modules.d/35network-wicked/wicked-run.sh 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/35network-wicked/wicked-run.sh 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,6 @@ +#!/bin/sh + +# ensure wickedd is running +systemctl start wickedd +# detection wrapper around ifup --ifconfig "final xml" all +wicked bootstrap --ifconfig /tmp/dracut.xml all diff -Nru dracut-050+65/modules.d/40network/module-setup.sh dracut-051/modules.d/40network/module-setup.sh --- dracut-050+65/modules.d/40network/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/40network/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -7,12 +7,25 @@ # called by dracut depends() { - echo -n "kernel-network-modules " - if ! dracut_module_included "network-legacy" && [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ] ; then - echo "network-manager" - else - echo "network-legacy" - fi + is_qemu_virtualized && echo -n "qemu-net " + + for module in network-wicked network-manager network-legacy ; do + if dracut_module_included "$module" ; then + network_handler="$module" + break + fi + done; + + if [ -z "$network_handler" ]; then + if require_binaries wicked; then + network_handler="network-wicked" + elif [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ]; then + network_handler="network-manager" + else + network_handler="network-legacy" + fi + fi + echo "kernel-network-modules $network_handler" return 0 } diff -Nru dracut-050+65/modules.d/40network/net-lib.sh dracut-051/modules.d/40network/net-lib.sh --- dracut-050+65/modules.d/40network/net-lib.sh 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/modules.d/40network/net-lib.sh 2020-12-14 17:54:26.000000000 +0000 @@ -570,6 +570,11 @@ # udev requires MAC addresses to be lower case ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/') ;; + 21) + ifname_if=$1 + # udev requires MAC addresses to be lower case + ifname_mac=$(echo $2:$3:$4:$5:$6:$7:$8:$9:${10}:${11}:${12}:${13}:${14}:${15}:${16}:${17}:${18}:${19}:${20}:${21} | sed 'y/ABCDEF/abcdef/') + ;; *) die "Invalid arguments for ifname=" ;; diff -Nru dracut-050+65/modules.d/50drm/module-setup.sh dracut-051/modules.d/50drm/module-setup.sh --- dracut-050+65/modules.d/50drm/module-setup.sh 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/modules.d/50drm/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -31,15 +31,15 @@ # as we could e.g. be in the installer; nokmsboot boot parameter will disable # loading of the driver if needed if [[ $hostonly ]]; then - for i in /sys/bus/{pci/devices,virtio/devices,soc/devices/soc?}/*/modalias; do + for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do [[ -e $i ]] || continue - if hostonly="" dracut_instmods --silent -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i); then - if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then + if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(<"$i"); then + if strstr "$(modinfo -F filename $(<"$i") 2>/dev/null)" radeon.ko; then hostonly='' instmods amdkfd fi fi done else - dracut_instmods -o -s "drm_crtc_init|drm_dev_register" "=drivers/gpu/drm" "=drivers/staging" + dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging" fi } diff -Nru dracut-050+65/modules.d/90crypt/cryptroot-ask.sh dracut-051/modules.d/90crypt/cryptroot-ask.sh --- dracut-050+65/modules.d/90crypt/cryptroot-ask.sh 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/modules.d/90crypt/cryptroot-ask.sh 2020-12-14 17:54:26.000000000 +0000 @@ -20,8 +20,11 @@ # default luksname - luks-UUID luksname=$2 +# is_keysource - ask for passphrase even if a rd.luks.key argument is set +is_keysource=${3:-0} + # number of tries -numtries=${3:-10} +numtries=${4:-10} # TODO: improve to support what cmdline does if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then @@ -134,9 +137,12 @@ ask_passphrase=1 if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then - if cryptsetup --key-file "$luksfile" $cryptsetupopts luksOpen "$device" "$luksname"; then + if readkey "$luksfile" / "$device" \ + | cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"; then ask_passphrase=0 fi +elif [ "$is_keysource" -ne 0 ]; then + info "Asking for passphrase because $device is a keysource." else while [ -n "$(getarg rd.luks.key)" ]; do if tmp=$(getkey /tmp/luks.keys $device); then @@ -151,7 +157,7 @@ info "No key found for $device. Will try $numtries time(s) more later." initqueue --unique --onetime --settled \ --name cryptroot-ask-$luksname \ - $(command -v cryptroot-ask) "$device" "$luksname" "$(($numtries-1))" + $(command -v cryptroot-ask) "$device" "$luksname" "$is_keysource" "$(($numtries-1))" exit 0 fi unset tmp @@ -178,6 +184,15 @@ unset _timeout fi +if [ "$is_keysource" -ne 0 -a ${luksname##luks-} != "$luksname" ]; then + luks_close="$(command -v cryptsetup) close" + { + printf -- '[ -e /dev/mapper/%s ] && ' "$luksname" + printf -- '%s "%s"\n' "$luks_close" "$luksname" + } >> "$hookdir/cleanup/31-crypt-keysource.sh" + unset luks_close +fi + unset device luksname luksfile # mark device as asked diff -Nru dracut-050+65/modules.d/90crypt/module-setup.sh dracut-051/modules.d/90crypt/module-setup.sh --- dracut-050+65/modules.d/90crypt/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/90crypt/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -144,6 +144,8 @@ inst_script "$moddir/crypt-run-generator.sh" "/sbin/crypt-run-generator" if dracut_module_included "systemd"; then + # the cryptsetup targets are already pulled in by 00systemd, but not + # the enablement symlinks inst_multiple -o \ $systemdutildir/system-generators/systemd-cryptsetup-generator \ $systemdutildir/systemd-cryptsetup \ @@ -151,6 +153,8 @@ $systemdsystemunitdir/systemd-ask-password-console.service \ $systemdsystemunitdir/cryptsetup.target \ $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \ + $systemdsystemunitdir/remote-cryptsetup.target \ + $systemdsystemunitdir/initrd-root-device.target.wants/remote-cryptsetup.target \ systemd-ask-password systemd-tty-ask-password-agent fi diff -Nru dracut-050+65/modules.d/90crypt/parse-crypt.sh dracut-051/modules.d/90crypt/parse-crypt.sh --- dracut-050+65/modules.d/90crypt/parse-crypt.sh 2018-08-10 20:28:40.000000000 +0000 +++ dracut-051/modules.d/90crypt/parse-crypt.sh 2020-12-14 17:54:26.000000000 +0000 @@ -49,6 +49,12 @@ if [ -n "$PARTUUID" ]; then for uuid in $PARTUUID; do + is_keysource=0 + _uuid=$uuid + uuid=${uuid#keysource:} + [ $uuid != $_uuid ] && is_keysource=1 + unset _uuid + uuid=${uuid##luks-} if luksname=$(_cryptgetargsname "rd.luks.name=$uuid="); then luksname="${luksname#$uuid=}" @@ -61,7 +67,7 @@ printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid" printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)" printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)" - printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout" + printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$is_keysource" "$tout" } >> /etc/udev/rules.d/70-luks.rules.new else luksname=$(dev_unit_name "$luksname") @@ -81,6 +87,12 @@ elif [ -n "$SERIAL" ]; then for serialid in $SERIAL; do + is_keysource=0 + _serialid=$serialid + serialid=${serialid#keysource:} + [ $serialid != $_serialid ] && is_keysource=1 + unset _serialid + serialid=${serialid##luks-} if luksname=$(_cryptgetargsname "rd.luks.name=$serialid="); then luksname="${luksname#$serialid=}" @@ -93,7 +105,7 @@ printf -- 'ENV{ID_SERIAL_SHORT}=="*%s*", ' "$serialid" printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)" printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)" - printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout" + printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$is_keysource" "$tout" } >> /etc/udev/rules.d/70-luks.rules.new else luksname=$(dev_unit_name "$luksname") @@ -113,6 +125,12 @@ elif [ -n "$LUKS" ]; then for luksid in $LUKS; do + is_keysource=0 + _luksid=$luksid + luksid=${luksid#keysource:} + [ $luksid != $_luksid ] && is_keysource=1 + unset _luksid + luksid=${luksid##luks-} if luksname=$(_cryptgetargsname "rd.luks.name=$luksid="); then luksname="${luksname#$luksid=}" @@ -126,7 +144,7 @@ printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid" printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)" printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)" - printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout" + printf -- '$env{DEVNAME} %s %s %s"\n' "$luksname" "$is_keysource" "$tout" } >> /etc/udev/rules.d/70-luks.rules.new else luksname=$(dev_unit_name "$luksname") @@ -143,15 +161,16 @@ fi fi - uuid=$luksid - while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done - printf -- '[ -e /dev/disk/by-id/dm-uuid-CRYPT-LUKS?-*%s*-* ] || exit 1\n' $uuid \ - >> "$hookdir/initqueue/finished/90-crypt.sh" - - { - printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid - printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid - } >> "$hookdir/emergency/90-crypt.sh" + if [ $is_keysource -eq 0 ]; then + uuid=$luksid + while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done + printf -- '[ -e /dev/disk/by-id/dm-uuid-CRYPT-LUKS?-*%s*-* ] || exit 1\n' $uuid \ + >> "$hookdir/initqueue/finished/90-crypt.sh" + { + printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid + printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid + } >> "$hookdir/emergency/90-crypt.sh" + fi done elif getargbool 0 rd.auto; then if [ -z "$DRACUT_SYSTEMD" ]; then diff -Nru dracut-050+65/modules.d/90dmsquash-live/dmsquash-live-root.sh dracut-051/modules.d/90dmsquash-live/dmsquash-live-root.sh --- dracut-050+65/modules.d/90dmsquash-live/dmsquash-live-root.sh 2019-11-21 19:59:03.000000000 +0000 +++ dracut-051/modules.d/90dmsquash-live/dmsquash-live-root.sh 2020-12-14 17:54:26.000000000 +0000 @@ -268,20 +268,6 @@ } # end do_live_overlay() -# we might have a genMinInstDelta delta file for anaconda to take advantage of -if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then - OSMINSQFS=/run/initramfs/live/${live_dir}/osmin.img - # decompress the delta data - dd if=$OSMINSQFS of=/run/initramfs/osmin.img 2> /dev/null - OSMIN_SQUASHED_LOOPDEV=$( losetup -f ) - losetup -r $OSMIN_SQUASHED_LOOPDEV /run/initramfs/osmin.img - mkdir -m 0755 -p /run/initramfs/squashfs.osmin - mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin - OSMIN_LOOPDEV=$( losetup -f ) - losetup -r $OSMIN_LOOPDEV /run/initramfs/squashfs.osmin/osmin - umount -l /run/initramfs/squashfs.osmin -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}" @@ -370,12 +356,6 @@ fi fi -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 - echo "0 $sz snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV P 8" | dmsetup create --readonly live-osimg-min -fi - if [ -n "$reloadsysrootmountunit" ]; then eval "$reloadsysrootmountunit" systemctl daemon-reload diff -Nru dracut-050+65/modules.d/90dmsquash-live/iso-scan.sh dracut-051/modules.d/90dmsquash-live/iso-scan.sh --- dracut-050+65/modules.d/90dmsquash-live/iso-scan.sh 2014-10-22 08:30:33.000000000 +0000 +++ dracut-051/modules.d/90dmsquash-live/iso-scan.sh 2020-12-14 17:54:26.000000000 +0000 @@ -22,6 +22,7 @@ mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue if [ -f "/run/initramfs/isoscan/$isofile" ]; then losetup -f "/run/initramfs/isoscan/$isofile" + ln -s $dev /run/initramfs/isoscandev rm -f -- "$job" exit 0 else diff -Nru dracut-050+65/modules.d/90kernel-modules/module-setup.sh dracut-051/modules.d/90kernel-modules/module-setup.sh --- dracut-050+65/modules.d/90kernel-modules/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/90kernel-modules/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -3,6 +3,7 @@ # called by dracut installkernel() { local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma' + local _hostonly_drvs find_kernel_modules_external () { local _OLDIFS @@ -19,17 +20,24 @@ IFS=$_OLDIFS } - is_block_dev() { - [ -e /sys/dev/block/$1 ] && return 0 + record_block_dev_drv() { + for _mod in $(get_dev_module /dev/block/$1); do + [[ " $_hostonly_drvs " != *$_mod* ]] && _hostonly_drvs+=" $_mod" + done + [[ "$_hostonly_drvs" ]] && return 0 return 1 } + install_block_modules_strict () { + hostonly='' instmods $_hostonly_drvs + } + install_block_modules () { - hostonly='' instmods sg sr_mod sd_mod scsi_dh ata_piix instmods \ scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ + =drivers/usb/storage \ =ide nvme vmd \ - virtio_blk + virtio_blk virtio_scsi dracut_instmods -o -s "${_blockfuncs}" "=drivers" } @@ -41,7 +49,6 @@ ohci-hcd ohci-pci \ uhci-hcd \ xhci-hcd xhci-pci xhci-plat-hcd \ - "=drivers/pinctrl" \ ${NULL} hostonly=$(optional_hostonly) instmods \ @@ -49,15 +56,15 @@ "=drivers/tty/serial" \ "=drivers/input/serio" \ "=drivers/input/keyboard" \ - "=drivers/usb/storage" \ "=drivers/pci/host" \ "=drivers/pci/controller" \ + "=drivers/pinctrl" \ ${NULL} instmods \ yenta_socket \ atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ - virtio virtio_ring virtio_pci virtio_scsi \ + virtio virtio_ring virtio_pci pci_hyperv \ "=drivers/pcmcia" if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then @@ -65,9 +72,11 @@ _blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register' instmods \ "=drivers/clk" \ + "=drivers/devfreq" \ "=drivers/dma" \ "=drivers/extcon" \ "=drivers/gpio" \ + "=drivers/hwmon" \ "=drivers/hwspinlock" \ "=drivers/i2c/busses" \ "=drivers/mfd" \ @@ -91,8 +100,18 @@ find_kernel_modules_external | instmods - if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then - install_block_modules + # if not on hostonly mode, or there are hostonly block device + # install block drivers + if ! [[ $hostonly ]] || \ + for_each_host_dev_and_slaves_all record_block_dev_drv; + then + hostonly='' instmods sg sr_mod sd_mod scsi_dh ata_piix + + if [[ "$hostonly_mode" == "strict" ]]; then + install_block_modules_strict + else + install_block_modules + fi fi # if not on hostonly mode, install all known filesystems, diff -Nru dracut-050+65/modules.d/90kernel-network-modules/module-setup.sh dracut-051/modules.d/90kernel-network-modules/module-setup.sh --- dracut-050+65/modules.d/90kernel-network-modules/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/90kernel-network-modules/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -14,22 +14,33 @@ installkernel() { # Include wired net drivers, excluding wireless local _arch=${DRACUT_ARCH:-$(uname -m)} - local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open' + local _net_symbols='eth_type_trans|register_virtio_device|usbnet_open' local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/' + local _net_drivers if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then - _s390drivers="=drivers/s390/net" + dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net" fi - dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_drivers" "=drivers/net" ${_s390drivers:+"$_s390drivers"} + if [[ $hostonly_mode == 'strict' ]] && [[ $hostonly_nics ]]; then + for _nic in $hostonly_nics; do + _net_drivers=$(get_dev_module /sys/class/net/$_nic) + if ! [[ $_net_drivers ]]; then + derror "--hostonly-nics contains invalid NIC '$_nic'" + continue + fi + hostonly="" instmods $_net_drivers + done + return 0 + fi + dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net" #instmods() will take care of hostonly instmods \ =drivers/net/phy \ =drivers/net/team \ =drivers/net/ethernet \ ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet - hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs } # called by dracut diff -Nru dracut-050+65/modules.d/90lvm/lvm_scan.sh dracut-051/modules.d/90lvm/lvm_scan.sh --- dracut-050+65/modules.d/90lvm/lvm_scan.sh 2018-01-14 19:55:09.000000000 +0000 +++ dracut-051/modules.d/90lvm/lvm_scan.sh 2020-12-14 17:54:26.000000000 +0000 @@ -91,7 +91,7 @@ if [ -n "$SNAPSHOT" ] ; then # HACK - this should probably be done elsewhere or turned into a function # Enable read-write LVM locking - sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' ${initdir}/etc/lvm/lvm.conf + sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' /etc/lvm/lvm.conf # Expected SNAPSHOT format ":" ORIG_LV=${SNAPSHOT%%:*} diff -Nru dracut-050+65/modules.d/90lvm/module-setup.sh dracut-051/modules.d/90lvm/module-setup.sh --- dracut-050+65/modules.d/90lvm/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/90lvm/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -36,7 +36,7 @@ eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null) [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1 if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then - printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} " + printf " rd.lvm.lv=%s " "${DM_VG_NAME}/${DM_LV_NAME} " _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1 fi done @@ -101,7 +101,7 @@ sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \ ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules - sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules + sed -i -e 's/^ENV{SYSTEMD_WANTS}+\?=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules else sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \ ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules diff -Nru dracut-050+65/modules.d/90multipath/module-setup.sh dracut-051/modules.d/90multipath/module-setup.sh --- dracut-050+65/modules.d/90multipath/module-setup.sh 2020-04-22 20:17:17.000000000 +0000 +++ dracut-051/modules.d/90multipath/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -125,6 +125,6 @@ inst_rules 40-multipath.rules 56-multipath.rules \ 62-multipath.rules 65-multipath.rules \ 66-kpartx.rules 67-kpartx-compat.rules \ - 11-dm-mpath.rules + 11-dm-mpath.rules 11-dm-parts.rules } diff -Nru dracut-050+65/modules.d/90multipath/multipathd.sh dracut-051/modules.d/90multipath/multipathd.sh --- dracut-050+65/modules.d/90multipath/multipathd.sh 2020-04-10 19:54:03.000000000 +0000 +++ dracut-051/modules.d/90multipath/multipathd.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,6 +1,6 @@ #!/bin/sh -if [ "$(getarg rd.multipath)x" == "default" ] && [ ! -e /etc/multipath.conf ]; then +if [ "$(getarg rd.multipath)" = "default" ] && [ ! -e /etc/multipath.conf ]; then mkdir -p /etc/multipath/multipath.conf.d mpathconf --enable fi diff -Nru dracut-050+65/modules.d/90multipath/multipath-shutdown.sh dracut-051/modules.d/90multipath/multipath-shutdown.sh --- dracut-050+65/modules.d/90multipath/multipath-shutdown.sh 2018-08-24 11:15:15.000000000 +0000 +++ dracut-051/modules.d/90multipath/multipath-shutdown.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh for i in $(multipath -l -v1); do if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then diff -Nru dracut-050+65/modules.d/90ppcmac/module-setup.sh dracut-051/modules.d/90ppcmac/module-setup.sh --- dracut-050+65/modules.d/90ppcmac/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/90ppcmac/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -17,9 +17,9 @@ # called by dracut check() { - local _arch="$(uname -m)" + local _arch=${DRACUT_ARCH:-$(uname -m)} # only for PowerPC Macs - [[ "$_arch" == ppc* && "$_arch" != ppc*le ]] || return 1 + [[ "$_arch" == ppc* && "$_arch" != ppc64le ]] || return 1 return 0 } @@ -36,7 +36,7 @@ } # only PowerMac3,6 has a module, special case - if [[ "$(uname -m)" == ppc ]]; then + if [[ "${DRACUT_ARCH:-$(uname -m)}" != ppc64* ]]; then if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then instmods therm_windtunnel fi diff -Nru dracut-050+65/modules.d/90qemu-net/module-setup.sh dracut-051/modules.d/90qemu-net/module-setup.sh --- dracut-050+65/modules.d/90qemu-net/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/90qemu-net/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -2,15 +2,20 @@ # called by dracut check() { - if [[ $hostonly ]] || [[ $mount_needs ]]; then + if [[ $hostonly ]]; then + return 255 + fi + + if [[ $mount_needs ]]; then is_qemu_virtualized && return 0 return 255 fi + return 0 } # called by dracut installkernel() { # qemu specific modules - hostonly='' instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci + hostonly=$(optional_hostonly) instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci } diff -Nru dracut-050+65/modules.d/90stratis/module-setup.sh dracut-051/modules.d/90stratis/module-setup.sh --- dracut-050+65/modules.d/90stratis/module-setup.sh 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/modules.d/90stratis/module-setup.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -#!/bin/bash - -# called by dracut -check() { - require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1 - return 255 -} - -# called by dracut -depends() { - echo dm - return 0 -} - -# called by dracut -installkernel() { - instmods xfs -} - -# called by dracut -install() { - - inst_multiple stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs - - if dracut_module_included "systemd"; then - inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service" - systemctl -q --root "$initdir" enable stratisd-init.service - else - inst_hook pre-mount 25 "$moddir/stratisd-start.sh" - inst_hook cleanup 25 "$moddir/stratisd-stop.sh" - fi -} - diff -Nru dracut-050+65/modules.d/90stratis/stratisd-init.service dracut-051/modules.d/90stratis/stratisd-init.service --- dracut-050+65/modules.d/90stratis/stratisd-init.service 2018-05-17 14:54:36.000000000 +0000 +++ dracut-051/modules.d/90stratis/stratisd-init.service 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -[Unit] -Description=A daemon that manages a pool of block devices to create flexible file systems -Documentation=man:stratisd(8) -Before=local-fs-pre.target -DefaultDependencies=no - -[Service] -Type=simple -ExecStart=/sbin/stratisd-init --debug -KillSignal=SIGINT -StandardOutput=syslog -StandardError=syslog - -[Install] -WantedBy=sysinit.target diff -Nru dracut-050+65/modules.d/90stratis/stratisd-start.sh dracut-051/modules.d/90stratis/stratisd-start.sh --- dracut-050+65/modules.d/90stratis/stratisd-start.sh 2018-05-17 14:54:36.000000000 +0000 +++ dracut-051/modules.d/90stratis/stratisd-start.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#!/bin/sh - -stratisd-init --debug > /dev/kmsg 2>&1 & \ No newline at end of file diff -Nru dracut-050+65/modules.d/90stratis/stratisd-stop.sh dracut-051/modules.d/90stratis/stratisd-stop.sh --- dracut-050+65/modules.d/90stratis/stratisd-stop.sh 2018-05-17 14:54:36.000000000 +0000 +++ dracut-051/modules.d/90stratis/stratisd-stop.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -#!/bin/sh - -[ -f /lib/dracut-lib.sh ] && . /lib/dracut-lib.sh - -pid=$(pidof stratisd-init) -[ -n "$pid" ] && kill ${pid} diff -Nru dracut-050+65/modules.d/91zipl/parse-zipl.sh dracut-051/modules.d/91zipl/parse-zipl.sh --- dracut-050+65/modules.d/91zipl/parse-zipl.sh 2018-01-14 19:55:09.000000000 +0000 +++ dracut-051/modules.d/91zipl/parse-zipl.sh 2020-12-14 17:54:26.000000000 +0000 @@ -31,7 +31,7 @@ esac if [ "$zipl_env" ] ; then { - printf 'ACTION=="add|change", SUBSYSTEM=="block", %s=="%s", RUN+="/sbin/initqueue --settled --onetime --unique --name install_zipl_cmdline /sbin/install_zipl_cmdline.sh %s"\n' \ + printf 'ACTION=="add|change", SUBSYSTEM=="block", %s=="%s", ENV{SYSTEMD_READY}!="0", RUN+="/sbin/initqueue --settled --onetime --unique --name install_zipl_cmdline /sbin/install_zipl_cmdline.sh %s"\n' \ ${zipl_env} ${zipl_val} ${zipl_arg} echo "[ -f /tmp/install.zipl.cmdline-done ]" >$hookdir/initqueue/finished/wait-zipl-conf.sh } >> /etc/udev/rules.d/99zipl-conf.rules diff -Nru dracut-050+65/modules.d/95cifs/cifs-lib.sh dracut-051/modules.d/95cifs/cifs-lib.sh --- dracut-050+65/modules.d/95cifs/cifs-lib.sh 2014-10-22 08:30:33.000000000 +0000 +++ dracut-051/modules.d/95cifs/cifs-lib.sh 2020-12-14 17:54:26.000000000 +0000 @@ -30,5 +30,5 @@ if [ ! "$cifsuser" -o ! "$cifspass" ]; then die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL." fi - options="user=$cifsuser,pass=$cifspass" + options="user=$cifsuser,pass=$cifspass,$(getarg rootflags=)" } diff -Nru dracut-050+65/modules.d/95cifs/cifsroot.sh dracut-051/modules.d/95cifs/cifsroot.sh --- dracut-050+65/modules.d/95cifs/cifsroot.sh 2014-10-22 08:30:33.000000000 +0000 +++ dracut-051/modules.d/95cifs/cifsroot.sh 2020-12-14 17:54:26.000000000 +0000 @@ -16,7 +16,7 @@ echo path: $path echo options: $options -mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || ln -s null /dev/root ; } +mount.cifs "//$server/$path" "$NEWROOT" -o "$options" && { [ -e /dev/root ] || ln -s null /dev/root ; } # inject new exit_if_exists echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -f -- "$job"' > $hookdir/initqueue/cifs.sh diff -Nru dracut-050+65/modules.d/95cifs/module-setup.sh dracut-051/modules.d/95cifs/module-setup.sh --- dracut-050+65/modules.d/95cifs/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/95cifs/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -25,11 +25,11 @@ installkernel() { instmods cifs ipv6 # hash algos - instmods md4 md5 sha256 + instmods md4 md5 sha256 sha512 # ciphers - instmods aes arc4 des ecb + instmods aes arc4 des ecb gcm aead2 # macs - instmods hmac cmac + instmods hmac cmac ccm } # called by dracut diff -Nru dracut-050+65/modules.d/95fcoe/module-setup.sh dracut-051/modules.d/95fcoe/module-setup.sh --- dracut-050+65/modules.d/95fcoe/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/95fcoe/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -2,13 +2,12 @@ # called by dracut check() { - local _fcoe_ctlr + is_fcoe() { + block_is_fcoe $1 || return 1 + } + [[ $hostonly ]] || [[ $mount_needs ]] && { - for c in /sys/bus/fcoe/devices/ctlr_* ; do - [ -L $c ] || continue - _fcoe_ctlr=$c - done - [ -z "$_fcoe_ctlr" ] && return 255 + for_each_host_dev_and_slaves is_fcoe || return 255 } require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1 @@ -23,7 +22,7 @@ # called by dracut installkernel() { - instmods fcoe 8021q edd + instmods fcoe libfcoe 8021q edd bnx2fc } get_vlan_parent() { diff -Nru dracut-050+65/modules.d/95fcoe-uefi/module-setup.sh dracut-051/modules.d/95fcoe-uefi/module-setup.sh --- dracut-050+65/modules.d/95fcoe-uefi/module-setup.sh 2018-01-14 19:55:09.000000000 +0000 +++ dracut-051/modules.d/95fcoe-uefi/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -2,22 +2,15 @@ # called by dracut check() { - local _fcoe_ctlr - [[ $hostonly ]] || [[ $mount_needs ]] && { - for c in /sys/bus/fcoe/devices/ctlr_* ; do - [ -L $c ] || continue - _fcoe_ctlr=$c - done - [ -z "$_fcoe_ctlr" ] && return 255 + is_fcoe() { + block_is_fcoe $1 || return 1 } + [[ $hostonly ]] || [[ $mount_needs ]] && { + for_each_host_dev_and_slaves is_fcoe || return 255 [ -d /sys/firmware/efi ] || return 255 - for c in /sys/bus/fcoe/devices/ctlr_* ; do - [ -L $c ] || continue - fcoe_ctlr=$c - done - [ -z "$fcoe_ctlr" ] && return 255 } + require_binaries dcbtool fipvlan lldpad ip readlink || return 1 return 0 } diff -Nru dracut-050+65/modules.d/95iscsi/iscsiroot.sh dracut-051/modules.d/95iscsi/iscsiroot.sh --- dracut-050+65/modules.d/95iscsi/iscsiroot.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/95iscsi/iscsiroot.sh 2020-12-14 17:54:26.000000000 +0000 @@ -213,6 +213,9 @@ echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh fi + if strglobin $iscsi_target_ip '*:*:*' && ! strglobin $iscsi_target_ip '['; then + iscsi_target_ip="[$iscsi_target_ip]" + fi targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/') [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1 diff -Nru dracut-050+65/modules.d/95iscsi/module-setup.sh dracut-051/modules.d/95iscsi/module-setup.sh --- dracut-050+65/modules.d/95iscsi/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/95iscsi/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -9,20 +9,9 @@ # If hostonly was requested, fail the check if we are not actually # booting from root. - is_iscsi() { - local _dev=$1 - - [[ -L "/sys/dev/block/$_dev" ]] || return - cd "$(readlink -f "/sys/dev/block/$_dev")" - until [[ -d sys || -d iscsi_session ]]; do - cd .. - done - [[ -d iscsi_session ]] - } - [[ $hostonly ]] || [[ $mount_needs ]] && { pushd . >/dev/null - for_each_host_dev_and_slaves is_iscsi + for_each_host_dev_and_slaves block_is_iscsi local _is_iscsi=$? popd >/dev/null [[ $_is_iscsi == 0 ]] || return 255 @@ -120,27 +109,7 @@ done [ -z "$iscsi_address" ] && return - local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p') - ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p') - - # follow ifcfg settings for boot protocol - for _path in \ - "/etc/sysconfig/network-scripts/ifcfg-$ifname" \ - "/etc/sysconfig/network/ifcfg-$ifname" \ - ; do - [ -f "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path") - done - - if [ $bootproto ]; then - printf 'ip=%s:%s ' ${ifname} ${bootproto} - else - printf 'ip=%s:static ' ${ifname} - fi - - if [ -e /sys/class/net/$ifname/address ] ; then - ifmac=$(cat /sys/class/net/$ifname/address) - printf 'ifname=%s:%s ' ${ifname} ${ifmac} - fi + ip_params_for_remote_addr "$iscsi_address" if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then @@ -243,6 +212,7 @@ inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh" inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh" inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot" + if ! dracut_module_included "systemd"; then inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh" else diff -Nru dracut-050+65/modules.d/95nbd/module-setup.sh dracut-051/modules.d/95nbd/module-setup.sh --- dracut-050+65/modules.d/95nbd/module-setup.sh 2016-03-20 18:51:52.000000000 +0000 +++ dracut-051/modules.d/95nbd/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -7,11 +7,9 @@ # if an nbd device is not somewhere in the chain of devices root is # mounted on, fail the hostonly check. [[ $hostonly ]] || [[ $mount_needs ]] && { - is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;} - _rootdev=$(find_root_block_device) [[ -b /dev/block/$_rootdev ]] || return 1 - check_block_and_slaves is_nbd "$_rootdev" || return 255 + check_block_and_slaves block_is_nbd "$_rootdev" || return 255 } require_binaries nbd-client || return 1 diff -Nru dracut-050+65/modules.d/95nfs/module-setup.sh dracut-051/modules.d/95nfs/module-setup.sh --- dracut-050+65/modules.d/95nfs/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/95nfs/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -38,7 +38,7 @@ # called by dracut installkernel() { - hostonly='' instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files + hostonly=$(optional_hostonly) instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files } cmdline() { @@ -47,7 +47,6 @@ local nfs_root local nfs_address local lookup - local ifname ### nfsroot= ### nfs_device=$(findmnt -t nfs4 -n -o SOURCE /) @@ -69,21 +68,9 @@ lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1) nfs_address=${lookup##* } fi - ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p') - if [ -d /sys/class/net/$ifname/bonding ]; then - dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline." - return - elif [ -e /sys/class/net/$ifname/address ] ; then - ifmac=$(cat /sys/class/net/$ifname/address) - printf 'ifname=%s:%s ' ${ifname} ${ifmac} - fi - bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname) - if [ $bootproto ]; then - printf 'ip=%s:%s ' ${ifname} ${bootproto} - else - printf 'ip=%s:static ' ${ifname} - fi + [[ $nfs_address ]] || return + ip_params_for_remote_addr "$nfs_address" } # called by dracut @@ -127,7 +114,8 @@ inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh" mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs" mkdir -m 0770 -p "$initdir/var/lib/rpcbind" - mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm" + [ -d "$initdir/var/lib/nfs/statd/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm" + [ -d "$initdir/var/lib/nfs/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm" # Rather than copy the passwd file in, just set a user for rpcbind # We'll save the state and restart the daemon from the root anyway diff -Nru dracut-050+65/modules.d/95nfs/nfs-lib.sh dracut-051/modules.d/95nfs/nfs-lib.sh --- dracut-050+65/modules.d/95nfs/nfs-lib.sh 2016-12-14 14:48:44.000000000 +0000 +++ dracut-051/modules.d/95nfs/nfs-lib.sh 2020-12-14 17:54:26.000000000 +0000 @@ -112,8 +112,8 @@ [ -n "$new_root_path" ] && nfsroot_to_var "$nfs:$new_root_path" [ -z "$path" ] && [ "$(getarg root=)" = "/dev/nfs" ] && path=/tftpboot/%s [ -z "$server" ] && server=$srv - [ -z "$server" ] && server=$new_dhcp_server_identifier [ -z "$server" ] && server=$new_next_server + [ -z "$server" ] && server=$new_dhcp_server_identifier [ -z "$server" ] && server=${new_root_path%%:*} } diff -Nru dracut-050+65/modules.d/95nvmf/95-nvmf-initqueue.rules dracut-051/modules.d/95nvmf/95-nvmf-initqueue.rules --- dracut-050+65/modules.d/95nvmf/95-nvmf-initqueue.rules 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/95nvmf/95-nvmf-initqueue.rules 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,10 @@ +# +# nvmf-initqueue.rules +# +# D-Bus doesn't run in the initrd, which means that we cannot use our +# usual trick of starting custom systemd services. +# So use a rule to create initqueue entries instead. + +ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \ + ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \ + RUN+="/sbin/initqueue --onetime --unique --name nvmf-connect-$env{NVMEFC_TRADDR}-$env{NVMEFC_HOST_TRADDR} /usr/sbin/nvme connect-all --transport=fc --traddr=$env{NVMEFC_TRADDR} --host-traddr=$env{NVMEFC_HOST_TRADDR}" diff -Nru dracut-050+65/modules.d/95nvmf/module-setup.sh dracut-051/modules.d/95nvmf/module-setup.sh --- dracut-050+65/modules.d/95nvmf/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/95nvmf/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -6,9 +6,9 @@ [ -f /etc/nvme/hostnqn ] || return 255 [ -f /etc/nvme/hostid ] || return 255 - is_nvme_fc() { + is_nvmf() { local _dev=$1 - local traddr + local trtype [[ -L "/sys/dev/block/$_dev" ]] || return 0 cd -P "/sys/dev/block/$_dev" || return 0 @@ -18,19 +18,19 @@ for d in device/nvme* ; do [ -L "$d" ] || continue if readlink "$d" | grep -q nvme-fabrics ; then - traddr=$(cat "$d"/address) - break - fi - done - [[ "${traddr#traddr=nn-}" != "$traddr" ]] + trtype=$(cat "$d"/transport) + break + fi + done + [[ "$trtype" == "fc" ]] || [[ "$trtype" == "tcp" ]] || [[ "$trtype" == "rdma" ]] } [[ $hostonly ]] || [[ $mount_needs ]] && { pushd . >/dev/null - for_each_host_dev_and_slaves is_nvme_fc - local _is_nvme_fc=$? + for_each_host_dev_and_slaves is_nvmf + local _is_nvmf=$? popd >/dev/null - [[ $_is_nvme_fc == 0 ]] || return 255 + [[ $_is_nvmf == 0 ]] || return 255 if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ] ; then if [ ! -f /etc/nvme/discovery.conf ] ; then echo "No discovery arguments present" @@ -43,19 +43,45 @@ # called by dracut depends() { - echo bash rootfs-block + echo bash rootfs-block network return 0 } # called by dracut installkernel() { instmods nvme_fc lpfc qla2xxx + hostonly="" instmods nvme_tcp nvme_fabrics } # called by dracut cmdline() { local _hostnqn local _hostid + + gen_nvmf_cmdline() { + local _dev=$1 + local trtype + + [[ -L "/sys/dev/block/$_dev" ]] || return 0 + cd -P "/sys/dev/block/$_dev" || return 0 + if [ -f partition ] ; then + cd .. + fi + for d in device/nvme* ; do + [ -L "$d" ] || continue + if readlink "$d" | grep -q nvme-fabrics ; then + trtype=$(cat "$d"/transport) + break + fi + done + + [ -z "$trtype" ] && return 0 + nvme list-subsys ${PWD##*/} | while read x dev trtype traddr host_traddr state ana; do + [ "$trtype" != "${trtype#NQN}" ] && continue + echo -n " nvmf.discover=$trtype,${traddr#traddr=},${host_traddr#host_traddr=}" + done + } + if [ -f /etc/nvme/hostnqn ] ; then _hostnqn=$(cat /etc/nvme/hostnqn) echo -n " nvmf.hostnqn=${_hostnqn}" @@ -64,7 +90,12 @@ _hostid=$(cat /etc/nvme/hostid) echo -n " nvmf.hostid=${_hostid}" fi - echo "" + + [[ $hostonly ]] || [[ $mount_needs ]] && { + pushd . >/dev/null + for_each_host_dev_and_slaves gen_nvmf_cmdline + popd >/dev/null + } } # called by dracut @@ -76,13 +107,14 @@ inst_simple "/etc/nvme/hostnqn" inst_simple "/etc/nvme/hostid" + inst_multiple ip sed + + inst_script "${moddir}/nvmf-autoconnect.sh" /sbin/nvmf-autoconnect.sh + inst_multiple nvme - inst_multiple -o \ - "$systemdsystemunitdir/nvm*-connect@.service" \ - "$systemdsystemunitdir/nvm*-connect.target" inst_hook cmdline 99 "$moddir/parse-nvmf-boot-connections.sh" inst_simple "/etc/nvme/discovery.conf" - inst_rules /usr/lib/udev/rules.d/70-nvm*-autoconnect.rules inst_rules /usr/lib/udev/rules.d/71-nvmf-iopolicy-netapp.rules + inst_rules "$moddir/95-nvmf-initqueue.rules" dracut_need_initqueue } diff -Nru dracut-050+65/modules.d/95nvmf/nvmf-autoconnect.sh dracut-051/modules.d/95nvmf/nvmf-autoconnect.sh --- dracut-050+65/modules.d/95nvmf/nvmf-autoconnect.sh 1970-01-01 00:00:00.000000000 +0000 +++ dracut-051/modules.d/95nvmf/nvmf-autoconnect.sh 2020-12-14 17:54:26.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1 +echo add > /sys/class/fc/fc_udev_device/nvme_discovery +exit 0 diff -Nru dracut-050+65/modules.d/95nvmf/parse-nvmf-boot-connections.sh dracut-051/modules.d/95nvmf/parse-nvmf-boot-connections.sh --- dracut-050+65/modules.d/95nvmf/parse-nvmf-boot-connections.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/95nvmf/parse-nvmf-boot-connections.sh 2020-12-14 17:54:26.000000000 +0000 @@ -3,74 +3,116 @@ # Supported formats: # nvmf.hostnqn= # nvmf.hostid= -# nvmf.discover=::: +# nvmf.discover=,,, # # Examples: # nvmf.hostnqn=nqn.2014-08.org.nvmexpress:uuid:37303738-3034-584d-5137-333230423843 -# nvmf.discover=rdma:192.168.1.3::4420 -# nvmf.discover=fc:auto +# nvmf.discover=rdma,192.168.1.3,,4420 +# nvmf.discover=tcp,192.168.1.3,,4420 +# nvmf.discover=tcp,192.168.1.3 +# nvmf.discover=fc,nn-0x200400a098d85236:pn-0x201400a098d85236,nn-0x200000109b7db455:pn-0x100000109b7db455 +# nvmf.discover=fc,auto # # Note: FC does autodiscovery, so typically there is no need to # specify any discover parameters for FC. # +type is_ip >/dev/null 2>&1 || . /lib/net-lib.sh + +if getargbool 0 rd.nonvmf ; then + warn "rd.nonvmf=0: skipping nvmf" + return 0 +fi + +initqueue --onetime modprobe --all -b -q nvme nvme_tcp nvme_core nvme_fabrics + +validate_ip_conn() { + if ! getargbool 0 rd.neednet ; then + warn "$trtype transport requires rd.neednet=1" + return 1 + fi + + local_address=$(ip -o route get to $traddr | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p') + + # confirm we got a local IP address + if ! is_ip "$local_address" ; then + warn "$traddr is an invalid address"; + return 1 + fi + + ifname=$(ip -o route get to $local_address | sed -n 's/.*dev \([^ ]*\).*/\1/p') + + if ip l show "$ifname" >/dev/null 2>&1 ; then + warn "invalid network interface $ifname" + return 1 + fi + + # confirm there's a route to destination + if ip route get "$traddr" >/dev/null 2>&1 ; then + warn "no route to $traddr" + return 1 + fi +} + parse_nvmf_discover() { - OLDIFS="$IFS" - IFS=: - trtype="none" traddr="none" + trtype="none" hosttraddr="none" trsvcid=4420 - + OLDIFS="$IFS" + IFS=, set $1 IFS="$OLDIFS" case $# in 2) - trtype=$1 - traddr=$2 + [ -n "$1" ] && trtype=$1 + [ -n "$2" ] && traddr=$2 ;; 3) - trtype=$1 - traddr=$2 - hosttraddr=$3 + [ -n "$1" ] && trtype=$1 + [ -n "$2" ] && traddr=$2 + [ -n "$3" ] && hosttraddr=$3 ;; 4) - trtype=$1 - traddr=$2 - hosttraddr=$3 - trsvcid=$4 + [ -n "$1" ] && trtype=$1 + [ -n "$2" ] && traddr=$2 + [ -n "$3" ] && hosttraddr=$3 + [ -n "$4" ] && trsvcid=$4 ;; *) warn "Invalid arguments for nvmf.discover=$1" - return 1 + return 0 ;; esac - if [ -z "$traddr" ] ; then + if [ "$traddr" = "none" ] ; then warn "traddr is mandatory for $trtype" - return 1; + return 0; fi - [ -z "$hosttraddr" ] && hosttraddr="none" - [ -z "$trsvcid" ] && trsvcid="none" if [ "$trtype" = "fc" ] ; then - if [ -z "$hosttraddr" ] ; then - warn "host traddr is mandatory for fc" + if [ "$traddr" = "auto" ] ; then + rm /etc/nvme/discovery.conf return 1 fi + if [ "$hosttraddr" = "none" ] ; then + warn "host traddr is mandatory for fc" + return 0 + fi elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ] ; then warn "unsupported transport $trtype" - return 1 - elif [ -z "$trsvcid" ] ; then - trsvcid=4420 + return 0 + fi + if [ "$trtype" = "tcp" ]; then + validate_ip_conn fi - echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf + if [ "$trtype" = "fc" ] ; then + echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr" >> /etc/nvme/discovery.conf + else + echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf + fi + return 0 } -if ! getargbool 0 rd.nonvmf ; then - info "rd.nonvmf=0: skipping nvmf" - return 0 -fi - nvmf_hostnqn=$(getarg nvmf.hostnqn=) if [ -n "$nvmf_hostnqn" ] ; then echo "$nvmf_hostnqn" > /etc/nvme/hostnqn @@ -81,7 +123,7 @@ fi for d in $(getargs nvmf.discover=); do - parse_nvmf_discover "$d" + parse_nvmf_discover "$d" || break done # Host NQN and host id are mandatory for NVMe-oF @@ -89,7 +131,13 @@ [ -f "/etc/nvme/hostid" ] || exit 0 if [ -f "/etc/nvme/discovery.conf" ] ; then - /sbin/initqueue --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all + /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all + if [ "$trtype" = "tcp" ] ; then + > /tmp/net.$ifname.did-setup + fi else - /sbin/initqueue --finished --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery + # No nvme command line arguments present, try autodiscovery + if [ "$trtype" = "fc" ] ; then + /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh + fi fi diff -Nru dracut-050+65/modules.d/95resume/module-setup.sh dracut-051/modules.d/95resume/module-setup.sh --- dracut-050+65/modules.d/95resume/module-setup.sh 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/modules.d/95resume/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -2,9 +2,18 @@ # called by dracut check() { + swap_on_netdevice() { + local _dev + for _dev in "${swap_devs[@]}"; do + block_is_netdevice $_dev && return 0 + done + return 1 + } + # Only support resume if hibernation is currently on + # and no swap is mounted on a net device [[ $hostonly ]] || [[ $mount_needs ]] && { - [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255 + swap_on_netdevice || [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255 } return 0 diff -Nru dracut-050+65/modules.d/95rootfs-block/module-setup.sh dracut-051/modules.d/95rootfs-block/module-setup.sh --- dracut-050+65/modules.d/95rootfs-block/module-setup.sh 2018-01-14 19:55:10.000000000 +0000 +++ dracut-051/modules.d/95rootfs-block/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -30,7 +30,8 @@ } cmdline_rootfs() { - local _dev=/dev/block/$(find_root_block_device) + local _block=$(find_root_block_device) + local _dev=/dev/block/$_block local _fstype _flags _subvol # "--no-hostonly-default-device" can result in empty root_devs @@ -38,17 +39,21 @@ return fi - if [ -e $_dev ]; then + if [ -n "$_block" -a -b $_dev ]; then printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")" - _fstype="$(find_mp_fstype /)" - _flags="$(find_mp_fsopts /)" + fi + _fstype="$(find_mp_fstype /)" + _flags="$(find_mp_fsopts /)" + if [ -n "$_fstype" ]; then printf " rootfstype=%s" "$_fstype" - if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then - _subvol=$(findmnt -e -v -n -o FSROOT --target /) \ - && _subvol=${_subvol#/} - _flags="$_flags,${_subvol:+subvol=$_subvol}" - fi - printf " rootflags=%s" "${_flags#,}" + fi + if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then + _subvol=$(findmnt -e -v -n -o FSROOT --target /) \ + && _subvol=${_subvol#/} + _flags="$_flags${_subvol:+,subvol=$_subvol}" + fi + if [ -n "$_flags" ]; then + printf " rootflags=%s" "$_flags" fi } diff -Nru dracut-050+65/modules.d/95rootfs-block/mount-root.sh dracut-051/modules.d/95rootfs-block/mount-root.sh --- dracut-050+65/modules.d/95rootfs-block/mount-root.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/95rootfs-block/mount-root.sh 2020-12-14 17:54:26.000000000 +0000 @@ -116,7 +116,7 @@ ran_fsck=1 fi - echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc/fstab + echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 ${rootfsck:-0}" >> /etc/fstab if ! ismounted "$NEWROOT"; then info "Mounting ${root#block:} with -o ${rflags}" diff -Nru dracut-050+65/modules.d/95zfcp/parse-zfcp.sh dracut-051/modules.d/95zfcp/parse-zfcp.sh --- dracut-050+65/modules.d/95zfcp/parse-zfcp.sh 2015-11-28 13:08:46.000000000 +0000 +++ dracut-051/modules.d/95zfcp/parse-zfcp.sh 2020-12-14 17:54:26.000000000 +0000 @@ -3,7 +3,7 @@ getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do - echo $zfcp_arg | grep '0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\},0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}' >/dev/null + echo $zfcp_arg | grep '^0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\}\(,0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}\)\?$' >/dev/null test $? -ne 0 && die "For argument 'rd.zfcp=$zfcp_arg'\nSorry, invalid format." ( IFS="," diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-cmdline-ask.sh dracut-051/modules.d/98dracut-systemd/dracut-cmdline-ask.sh --- dracut-050+65/modules.d/98dracut-systemd/dracut-cmdline-ask.sh 2016-03-20 18:51:52.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-cmdline-ask.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh @@ -15,8 +15,8 @@ echo echo "Enter additional kernel command line parameter (end with ctrl-d or .)" while read -e -p "> " line || [ -n "$line" ]; do - [[ "$line" == "." ]] && break - [[ "$line" ]] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf + [ "$line" = "." ] && break + [ -n "$line" ] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf done exit 0 diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-cmdline.service dracut-051/modules.d/98dracut-systemd/dracut-cmdline.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-cmdline.service 2017-08-07 18:38:31.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-cmdline.service 2020-12-14 17:54:26.000000000 +0000 @@ -23,8 +23,7 @@ Type=oneshot ExecStart=-/bin/dracut-cmdline StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-initqueue.service dracut-051/modules.d/98dracut-systemd/dracut-initqueue.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-initqueue.service 2017-08-07 18:38:31.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-initqueue.service 2020-12-14 17:54:26.000000000 +0000 @@ -21,8 +21,7 @@ Type=oneshot ExecStart=-/bin/dracut-initqueue StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-initqueue.sh dracut-051/modules.d/98dracut-systemd/dracut-initqueue.sh --- dracut-050+65/modules.d/98dracut-systemd/dracut-initqueue.sh 2015-11-28 13:08:46.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-initqueue.sh 2020-12-14 17:54:26.000000000 +0000 @@ -55,14 +55,20 @@ done if [ $main_loop -gt $((2*$RDRETRY/3)) ]; then - warn "dracut-initqueue timeout - starting timeout scripts" - for job in $hookdir/initqueue/timeout/*.sh; 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 - [ $main_loop -eq 0 ] && break + warn "dracut-initqueue: timeout, still waiting for following initqueue hooks:" + for _f in $hookdir/initqueue/finished/*.sh; do + warn "$_f: \"$(cat "$_f")\"" done + if [ "$(ls -A $hookdir/initqueue/finished)" ]; then + warn "dracut-initqueue: starting timeout scripts" + for job in $hookdir/initqueue/timeout/*.sh; 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 + [ $main_loop -eq 0 ] && break + done + fi fi main_loop=$(($main_loop+1)) diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-mount.service dracut-051/modules.d/98dracut-systemd/dracut-mount.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-mount.service 2017-08-07 18:38:31.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-mount.service 2020-12-14 17:54:26.000000000 +0000 @@ -19,8 +19,7 @@ Type=oneshot ExecStart=-/bin/dracut-mount StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-pre-mount.service dracut-051/modules.d/98dracut-systemd/dracut-pre-mount.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-pre-mount.service 2017-08-07 18:38:31.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-pre-mount.service 2020-12-14 17:54:26.000000000 +0000 @@ -19,8 +19,7 @@ Type=oneshot ExecStart=-/bin/dracut-pre-mount StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-pre-pivot.service dracut-051/modules.d/98dracut-systemd/dracut-pre-pivot.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-pre-pivot.service 2017-08-07 18:38:31.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-pre-pivot.service 2020-12-14 17:54:26.000000000 +0000 @@ -27,8 +27,7 @@ Type=oneshot ExecStart=-/bin/dracut-pre-pivot StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-pre-trigger.service dracut-051/modules.d/98dracut-systemd/dracut-pre-trigger.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-pre-trigger.service 2017-08-07 18:38:31.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-pre-trigger.service 2020-12-14 17:54:26.000000000 +0000 @@ -20,8 +20,7 @@ Type=oneshot ExecStart=-/bin/dracut-pre-trigger StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/dracut-pre-udev.service dracut-051/modules.d/98dracut-systemd/dracut-pre-udev.service --- dracut-050+65/modules.d/98dracut-systemd/dracut-pre-udev.service 2018-01-14 19:55:10.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/dracut-pre-udev.service 2020-12-14 17:54:26.000000000 +0000 @@ -24,8 +24,7 @@ Type=oneshot ExecStart=-/bin/dracut-pre-udev StandardInput=null -StandardOutput=syslog -StandardError=syslog+console +StandardError=journal+console KillMode=process RemainAfterExit=yes diff -Nru dracut-050+65/modules.d/98dracut-systemd/rootfs-generator.sh dracut-051/modules.d/98dracut-systemd/rootfs-generator.sh --- dracut-050+65/modules.d/98dracut-systemd/rootfs-generator.sh 2018-01-14 19:55:10.000000000 +0000 +++ dracut-051/modules.d/98dracut-systemd/rootfs-generator.sh 2020-12-14 17:54:26.000000000 +0000 @@ -13,8 +13,15 @@ if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then - printf '[ -e "%s" ]\n' $1 \ - >> "$hookdir/initqueue/finished/devexists-${_name}.sh" + # If a LUKS device needs unlocking via systemd in the initrd, assume + # it's for the root device. In that case, don't block on it if it's + # after remote-fs-pre.target since the initqueue is ordered before it so + # it will never actually show up (think Tang-pinned rootfs). + cat > "$hookdir/initqueue/finished/devexists-${_name}.sh" << EOF +if ! grep -q After=remote-fs-pre.target /run/systemd/generator/systemd-cryptsetup@*.service 2>/dev/null; then + [ -e "$1" ] +fi +EOF { printf '[ -e "%s" ] || ' $1 printf 'warn "\"%s\" does not exist"\n' $1 diff -Nru dracut-050+65/modules.d/99base/dracut-lib.sh dracut-051/modules.d/99base/dracut-lib.sh --- dracut-050+65/modules.d/99base/dracut-lib.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/99base/dracut-lib.sh 2020-12-14 17:54:26.000000000 +0000 @@ -6,13 +6,15 @@ [ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT fi -if ! [ -d /run/initramfs ]; then - mkdir -p -m 0755 /run/initramfs/log - ln -sfn /run/initramfs/log /var/log -fi +if [ -z "$PREFIX" ]; then + if ! [ -d /run/initramfs ]; then + mkdir -p -m 0755 /run/initramfs/log + ln -sfn /run/initramfs/log /var/log + fi -[ -d /run/lock ] || mkdir -p -m 0755 /run/lock -[ -d /run/log ] || mkdir -p -m 0755 /run/log + [ -d /run/lock ] || mkdir -p -m 0755 /run/lock + [ -d /run/log ] || mkdir -p -m 0755 /run/log +fi debug_off() { set +x diff -Nru dracut-050+65/modules.d/99memstrack/memstrack-report.sh dracut-051/modules.d/99memstrack/memstrack-report.sh --- dracut-050+65/modules.d/99memstrack/memstrack-report.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/99memstrack/memstrack-report.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash . /lib/dracut-lib.sh if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then diff -Nru dracut-050+65/modules.d/99memstrack/memstrack.service dracut-051/modules.d/99memstrack/memstrack.service --- dracut-050+65/modules.d/99memstrack/memstrack.service 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/99memstrack/memstrack.service 2020-12-14 17:54:26.000000000 +0000 @@ -3,11 +3,13 @@ DefaultDependencies=no Before=dracut-cmdline.service systemd-udevd.service local-fs-pre.target IgnoreOnIsolate=true +ConditionKernelCommandLine=|rd.memdebug=4 +ConditionKernelCommandLine=|rd.memdebug=5 [Service] Type=simple ExecStart=/bin/memstrack-start PIDFile=/run/memstrack.pid StandardInput=null -StandardOutput=syslog+console -StandardError=syslog+console +StandardOutput=journal+console +StandardError=journal+console diff -Nru dracut-050+65/modules.d/99memstrack/module-setup.sh dracut-051/modules.d/99memstrack/module-setup.sh --- dracut-050+65/modules.d/99memstrack/module-setup.sh 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/modules.d/99memstrack/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/bin/bash check() { if type -P memstrack >/dev/null; then diff -Nru dracut-050+65/modules.d/99squash/module-setup.sh dracut-051/modules.d/99squash/module-setup.sh --- dracut-050+65/modules.d/99squash/module-setup.sh 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/99squash/module-setup.sh 2020-12-14 17:54:26.000000000 +0000 @@ -1,24 +1,36 @@ #!/bin/bash check() { + if ! dracut_module_included "systemd-initrd"; then + derror "dracut-squash only supports systemd bases initramfs" + return 1 + fi + + if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then + derror "dracut-squash module requires squashfs-tools" + return 1 + fi + + for i in squashfs loop overlay; do + if ! check_kernel_module $i; then + derror "dracut-squash module requires kernel module $i" + return 1 + fi + done + return 255 } depends() { - echo "bash systemd systemd-initrd" + echo "bash systemd-initrd" return 0 } installkernel() { - hostonly="" instmods -c squashfs loop overlay + hostonly="" instmods squashfs loop overlay } install() { - if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then - derror "squash module requires squashfs-tools to be installed." - return 1 - fi - inst_multiple kmod modprobe mount mkdir ln echo inst $moddir/setup-squash.sh /squash/setup-squash.sh inst $moddir/clear-squash.sh /squash/clear-squash.sh diff -Nru dracut-050+65/modules.d/99squash/setup-squash.sh dracut-051/modules.d/99squash/setup-squash.sh --- dracut-050+65/modules.d/99squash/setup-squash.sh 2019-11-21 19:59:03.000000000 +0000 +++ dracut-051/modules.d/99squash/setup-squash.sh 2020-12-14 17:54:26.000000000 +0000 @@ -4,7 +4,6 @@ SQUASH_IMG=/squash/root.img SQUASH_MNT=/squash/root SQUASH_MNT_REC=/squash/mounts -SQUASHED_MNT="usr etc" echo $SQUASH_MNT > $SQUASH_MNT_REC @@ -45,7 +44,8 @@ echo "Unable to mount squashed initramfs image" fi -for file in $SQUASHED_MNT; do +for file in $SQUASH_MNT/*; do + file=${file#$SQUASH_MNT/} lowerdir=$SQUASH_MNT/$file workdir=/squash/overlay-work/$file upperdir=/$file diff -Nru dracut-050+65/modules.d/99squash/squash-mnt-clear.service dracut-051/modules.d/99squash/squash-mnt-clear.service --- dracut-050+65/modules.d/99squash/squash-mnt-clear.service 2020-01-30 15:32:19.000000000 +0000 +++ dracut-051/modules.d/99squash/squash-mnt-clear.service 2020-12-14 17:54:26.000000000 +0000 @@ -12,6 +12,6 @@ Type=oneshot RemainAfterExit=no StandardInput=null -StandardOutput=syslog+console -StandardError=syslog+console +StandardOutput=journal+console +StandardError=journal+console ExecStart=/squash/clear-squash.sh diff -Nru dracut-050+65/NEWS dracut-051/NEWS --- dracut-050+65/NEWS 2020-03-19 09:54:30.000000000 +0000 +++ dracut-051/NEWS 2020-12-14 17:54:26.000000000 +0000 @@ -1,3 +1,264 @@ +dracut-051 +========== + +dracut: +- allow running on a cross-compiled rootfs + + dracutsysrootdir is the root directory, file existence checks use it. + + DRACUT_LDCONFIG can override ldconfig with a different one that works + on the sysroot with foreign binaries. + + DRACUT_LDD can override ldd with a different one that works + with foreign binaries. + + DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot + may use symlinks that are valid only when running on the target + so a real file must be provided that exist in the sysroot. + + DRACUT_INSTALL now supports debugging dracut-install in itself + when run by dracut but without debugging the dracut scripts. + E.g. DRACUT_INSTALL="valgrind dracut-install or + DRACUT_INSTALL="dracut-install --debug". + + DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA, + DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ, + DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4, + DRACUT_COMPRESS_CAT: All of the compression utilities may be + overridden, to support the native binaries in non-standard places. + + DRACUT_ARCH overrides "uname -m". + + SYSTEMD_VERSION overrides "systemd --version". + + The dracut-install utility was overhauled to support sysroot via + a new option -r and fixes for clang-analyze. It supports + cross-compiler-ldd from + https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f + + DRACUT_INSTALL_PATH was introduced so dracut-install can work with + a different PATH. In a cross-compiled environment (e.g. Yocto), PATH + points to natively built binaries that are not in the host's /bin, + /usr/bin, etc. dracut-install still needs plain /bin and /usr/bin + that are relative to the cross-compiled sysroot. + + DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were + introduced so dracut-install can use different settings from + DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL. + +- don't call fsfreeze on subvol of root file system +- Use TMPDIR (typically /run/user/$UID) if available +- dracut.sh: add check for invalid configuration files + Emit a warning about possible misconfigured configuration files, where + the spaces around values are missing for +="" +- dracut-functions: fix find_binary() to return full path +- dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL +- dracut.sh: fix early microcode detection logic +- dracut.sh: fix ia32 detection for uefi executables +- dracut.sh: Add --version +- dracut.sh: Add --hostonly-nics option +- EFI Mode: only write kernel cmdline to UEFI binary +- Allow $DRACUT_INSTALL to be not an absolute path +- Don't print when a module is explicitly omitted (by default) +- Remove uses of bash (and bash specific syntax) in runtime scripts +- dracut-init.sh: Add a helper for detect device kernel modules +- dracut-functions.sh: Fix check_block_and_slaves_all +- dracut-functions.sh: add a helper to check if kernel module is available + +Documentation +- dracut.cmdline.7.asc: clarify usage of `rd.lvm.vg` and `rd.lvm.lv` +- dracut.conf.5.asc: document how to config --no-compress in the config +- fix CI badges in README.md and fix dracut description +- dracut.modules.7.asc: fix typos +- dracut.modules.7.asc: fix reference to insmodpost module +- Add --version to man page +- Adding code of conduct +- Document initqueue/online hook + + +dracut-install: +- install: also install post weak dependencies of kernel modules +- install: Globbing support for resolving "firmware:" + +mkinitrd: +- use vmlinux regex for ppc*, vmlinuz for i686 + +mkinitrd-suse: +- fix i586 platform detection + +modules: + +00systemd: +- skip dependency add for non-existent units +- add missing cryptsetup-related targets + +05busybox: +- simplify listing of supported utilities + +06rngd: +- install dependant libs too +- Do not start inside container + +10i18n: +- i18n: Always install /etc/vconsole.conf + +35network-legacy: +- dhclient-script: Fix typo in output of BOUND & BOUND6 cases +- simplify fallback dhcp setup + +35network-manager: +- ensure that nm-run.sh is executed when needed +- install libnss DNS and mDNS plugins +- always pull in machinery to read ifcfg files +- set kernel hostname from the command line +- move connection generation to a lib file + +40network: +- fix glob matching ipv6 addresses +- net-lib.sh: support infiniband network mac addresses + +45url-lib: +- drop NSS if it's not in curl --version + +80cms: +- regenerate NetworkManager connections + +90btrfs: +- force preload btrfs module +- Install crypto modules in 90kernel-modules + +90crypt: +- cryptroot-ask: no warn if /run/cryptsetup exist +- install crypto modules in 90kernel-modules +- try to catch kernel config changes +- fix force on multiple lines +- pull in remote-cryptsetup.target enablement +- cryptroot-ask: unify /etc/crypttab and rd.luks.key + +90dmsquash-live: +- iso-scan.sh: Provide an easy reference to iso-scan device + +90kernel-modules: +- remove nfit from static module list (see nvdimm module) +- install crypto modules in 90kernel-modules +- add sg kernel module +- add pci_hyperv +- install block drivers more strictly +- install less modules for hostonly mode +- arm: add drivers/hwmon for arm/arm64 + +90kernel-network-modules +- on't install iscsi related module (use 95iscsi) + +90lvm: +- remove unnecessary ${initdir} from lvm_scan.sh +- fix removal of pvscan from udev rules +- do not add newline to cmdline + +90multipath: +- add automatic configuration for multipath + (adds 'rd.multipath=default' to use the default config) +- install kpartx's 11-dm-parts.rules + +90nvdimm: +- new module for NVDIMM support + +90ppcmac: +- respect DRACUT_ARCH, don't exclude ppcle + +90qemu-net: +- in hostonly mode, only install if network is needed +- install less module for strict hostonly mode + +91zipl: +- parse-zipl.sh: honor SYSTEMD_READY + +95cifs: +- pass rootflags to mount +- install new softdeps (sha512, gcm, ccm, aead2) + +95dasd: +- only install /etc/dasd.conf if present + +95dcssblk: +- fix script permissions + +95fcoe: +- fix pre-trigger stage by replacing exit with return in lldpad.sh +- default rd.nofcoe to false +- don't install if there is no FCoE hostonly devices + +95iscsi: +- fix missing space when compiling cmdline args +- fix ipv6 target discovery + +95nfs: +- only install rpc services for NFS < 4 when hostonly is strict +- Change the order of NFS servers during the boot + (next-server option has higher priority than DHCP-server itself) +- install less module if hostonly mode is strict + +95nvmf: +- add module for NVMe-oF +- add NVMe over TCP support + +95resume: +- do not resume on iSCSI, FCoE or NBD + +95rootfs-block: +- mount-root.sh: fix writing fstab file with missing fsck flag +- only write root argument for block device + +95zfcp: +- match simplified rd.zfcp format too + +95zfcp_rules: +- parse-zfcp.sh: remove rule existence check + +95znet: +- add a rd.znet_ifname= option + +98dracut-systemd: +- remove memtrace-ko and rd.memdebug=4 support in dracut +- remove cleanup_trace_mem calls +- dracut-initqueue: Print more useful info in case of timeout +- as of v246 of systemd "syslog" and "syslog-console" switches have been deprecated +- don't wait for root device if remote cryptsetup active + +99base: +- dracut-lib.sh: quote variables in parameter expansion patterns +- remove memtrace-ko and rd.memdebug=4 support in dracut +- remove cleanup_trace_mem calls +- see new module 99memstrack +- prevent creating unexpected files on the host when running dracut + +99memstrack: +- memstrack is a new tool to track the overall memory usage and + allocation, which can help off load the improve the builtin module + memory tracing function in dracut. + +99squash: +- don't hardcode the squash sub directories +- improve pre-requirements check +- check require module earlier, and properly + +new modules: +- nvmf +- watchdog-modules +- dbus +- network-wicked + +removed modules: +- stratis + +test suite: +- use dd from /dev/zero, instead of creating files with a hole +- TEST-03-USR-MOUNT/test.sh: increase loglevel +- TEST-12-RAID-DEG/create-root.sh: more udevadm settle +- TEST-35-ISCSI-MULTI: bump disk space +- TEST-41-NBD-NM/Makefile: should be based on TEST-40-NBD not TEST-20-NFS +- TEST-99: exclude /etc/dnf/* from check + dracut-050 ========== @@ -54,6 +315,9 @@ - add support for compressed firmware files - dracut_mkdir(): create parent directories as needed. +configure: +- Find FTS library with --as-needed + test suite: - lots of cleanups - add github actions @@ -85,6 +349,7 @@ dmsquash-live: - Support a flattened squashfs.img +- Remove obsolete osmin.img processing dracut-systemd: - Start systemd-vconsole-setup before dracut-cmdline-ask @@ -274,6 +539,9 @@ fips: - fixed creating path to .hmac of kernel based on BOOT_IMAGE +- turn info calls into fips_info calls +- modprobe failures during manual module loading is not fatal + lunmask: - add module to handle LUN masking diff -Nru dracut-050+65/README.md dracut-051/README.md --- dracut-050+65/README.md 2020-06-29 07:47:33.000000000 +0000 +++ dracut-051/README.md 2020-12-14 17:54:26.000000000 +0000 @@ -3,6 +3,7 @@ dracut is an event driven initramfs infrastructure. +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](.github/CODE_OF_CONDUCT.md) [![Build Status](https://travis-ci.org/dracutdevs/dracut.svg?branch=master)](https://travis-ci.org/dracutdevs/dracut) [![Fedora-31](https://github.com/dracutdevs/dracut/workflows/Fedora-31/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-31) [![Fedora-32](https://github.com/dracutdevs/dracut/workflows/Fedora-32/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-32)