From 7ba020668f7fcceaffa937ce43819b5e7433ca86 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 8 Jan 2016 11:54:31 +0100 Subject: [PATCH] dracut-044-17.git20160108 - include more HID driver - include machine info file - fix network carrier detection - fix nbd - do not copy over lldpad state - restorecon the final initramfs image --- ...nclude-all-HID-driver-in-hostonly-mo.patch | 26 ++ 0007-systemd-include-machine-info.patch | 21 ++ ...etup.sh-only-include-systemd-generat.patch | 24 ++ 0009-network-fix-carrier-detection.patch | 167 ++++++++++ ...generator-and-use-nbd-export-names-i.patch | 287 ++++++++++++++++++ ...-DMSQUASH-do-not-use-with-ldconfig-r.patch | 22 ++ ...L-SYSTEMD-optionally-install-machine.patch | 29 ++ ...sh-dev_unit_name-guard-against-dev-b.patch | 29 ++ 0014-nbd-add-missing-generator.patch | 71 +++++ 0015-fcoe-no-need-to-copy-lldpad-state.patch | 28 ++ ...racut.sh-restorecon-final-image-file.patch | 48 +++ dracut.spec | 21 +- 12 files changed, 772 insertions(+), 1 deletion(-) create mode 100644 0006-kernel-modules-include-all-HID-driver-in-hostonly-mo.patch create mode 100644 0007-systemd-include-machine-info.patch create mode 100644 0008-livenet-module-setup.sh-only-include-systemd-generat.patch create mode 100644 0009-network-fix-carrier-detection.patch create mode 100644 0010-nbd-add-systemd-generator-and-use-nbd-export-names-i.patch create mode 100644 0011-TEST-16-DMSQUASH-do-not-use-with-ldconfig-r.patch create mode 100644 0012-test-TEST-04-FULL-SYSTEMD-optionally-install-machine.patch create mode 100644 0013-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch create mode 100644 0014-nbd-add-missing-generator.patch create mode 100644 0015-fcoe-no-need-to-copy-lldpad-state.patch create mode 100644 0016-dracut.sh-restorecon-final-image-file.patch diff --git a/0006-kernel-modules-include-all-HID-driver-in-hostonly-mo.patch b/0006-kernel-modules-include-all-HID-driver-in-hostonly-mo.patch new file mode 100644 index 0000000..a1668bc --- /dev/null +++ b/0006-kernel-modules-include-all-HID-driver-in-hostonly-mo.patch @@ -0,0 +1,26 @@ +From 8d26b5661ea2fd9fb41c83048b7590e44b1c95df Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 9 Dec 2015 14:14:46 +0100 +Subject: [PATCH] kernel-modules: include all HID driver in hostonly mode + +If a kernel is updated in the undocked state and later on docked, some +keyboard modules can be missing. + +Thus include all HID drivers. +--- + modules.d/90kernel-modules/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index 41bf37d..c5f2397 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -41,7 +41,7 @@ installkernel() { + uhci-hcd \ + xhci-hcd xhci-pci xhci-plat-hcd + +- instmods \ ++ hostonly='' instmods \ + "=drivers/hid" \ + "=drivers/input/serio" \ + "=drivers/input/keyboard" diff --git a/0007-systemd-include-machine-info.patch b/0007-systemd-include-machine-info.patch new file mode 100644 index 0000000..751d32f --- /dev/null +++ b/0007-systemd-include-machine-info.patch @@ -0,0 +1,21 @@ +From 4bcd41389cabe7a41c4bb3a17eaf668b12cc0668 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Dec 2015 11:16:12 +0100 +Subject: [PATCH] systemd: include machine-info + +--- + modules.d/00systemd/module-setup.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh +index 50b3b8c..ed59beb 100755 +--- a/modules.d/00systemd/module-setup.sh ++++ b/modules.d/00systemd/module-setup.sh +@@ -162,6 +162,7 @@ install() { + /etc/systemd/system.conf \ + /etc/hostname \ + /etc/machine-id \ ++ /etc/machine-info \ + /etc/vconsole.conf \ + /etc/locale.conf \ + /etc/modules-load.d/*.conf \ diff --git a/0008-livenet-module-setup.sh-only-include-systemd-generat.patch b/0008-livenet-module-setup.sh-only-include-systemd-generat.patch new file mode 100644 index 0000000..94d5a3d --- /dev/null +++ b/0008-livenet-module-setup.sh-only-include-systemd-generat.patch @@ -0,0 +1,24 @@ +From efd3a6db74ebcc453e216966a5914b63e2b29aff Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Dec 2015 11:16:42 +0100 +Subject: [PATCH] livenet/module-setup.sh: only include systemd generator if + systemd included + +--- + modules.d/90livenet/module-setup.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules.d/90livenet/module-setup.sh b/modules.d/90livenet/module-setup.sh +index 3a8d4ba..11738b8 100755 +--- a/modules.d/90livenet/module-setup.sh ++++ b/modules.d/90livenet/module-setup.sh +@@ -17,6 +17,8 @@ install() { + inst_hook cmdline 29 "$moddir/parse-livenet.sh" + inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh" + inst_script "$moddir/livenetroot.sh" "/sbin/livenetroot" +- inst_script "$moddir/livenet-generator.sh" $systemdutildir/system-generators/dracut-livenet-generator ++ if dracut_module_included "systemd-initrd"; then ++ inst_script "$moddir/livenet-generator.sh" $systemdutildir/system-generators/dracut-livenet-generator ++ fi + dracut_need_initqueue + } diff --git a/0009-network-fix-carrier-detection.patch b/0009-network-fix-carrier-detection.patch new file mode 100644 index 0000000..514d942 --- /dev/null +++ b/0009-network-fix-carrier-detection.patch @@ -0,0 +1,167 @@ +From df95b1003c8e7564da73de92403013763eb028fe Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Dec 2015 13:10:05 +0100 +Subject: [PATCH] network: fix carrier detection + +rename iface_has_link() to iface_has_carrier() to clarify usage + +Only assign static "wildcard interface" settings, if the interface has a +carrier. + +If the interface name was specified with a name, do not do carrier +checking for static configurations. +--- + modules.d/40network/ifup.sh | 42 ++++++++++++++++++++----------------- + modules.d/40network/net-lib.sh | 47 ++++++++++++++++++++++++++---------------- + 2 files changed, 52 insertions(+), 37 deletions(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 109fb4b..eca7478 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -100,7 +100,7 @@ do_dhcp() { + + [ -e /tmp/dhclient.$netif.pid ] && return 0 + +- if ! iface_has_link $netif; then ++ if ! iface_has_carrier $netif; then + warn "No carrier detected on interface $netif" + return 1 + fi +@@ -150,7 +150,10 @@ do_ipv6auto() { + do_static() { + strglobin $ip '*:*:*' && load_ipv6 + +- if ! linkup $netif; then ++ if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then ++ warn "No carrier detected on interface $netif" ++ return 1 ++ elif ! linkup "$netif"; then + warn "Could not bring interface $netif up!" + return 1 + fi +@@ -375,27 +378,28 @@ for p in $(getargs ip=); do + done + ret=$? + +- > /tmp/net.${netif}.up ++ if [ $ret -eq 0 ]; then ++ > /tmp/net.${netif}.up + +- if [ -e /sys/class/net/${netif}/address ]; then +- > /tmp/net.$(cat /sys/class/net/${netif}/address).up +- fi ++ if [ -e /sys/class/net/${netif}/address ]; then ++ > /tmp/net.$(cat /sys/class/net/${netif}/address).up ++ fi + +- case $autoconf in +- dhcp|on|any|dhcp6) ++ case $autoconf in ++ dhcp|on|any|dhcp6) + ;; +- *) +- if [ $ret -eq 0 ]; then +- setup_net $netif +- source_hook initqueue/online $netif +- if [ -z "$manualup" ]; then +- /sbin/netroot $netif ++ *) ++ if [ $ret -eq 0 ]; then ++ setup_net $netif ++ source_hook initqueue/online $netif ++ if [ -z "$manualup" ]; then ++ /sbin/netroot $netif ++ fi + fi +- fi +- ;; +- esac +- +- exit 0 ++ ;; ++ esac ++ exit $ret ++ fi + done + + # netif isn't the top stack? Then we should exit here. +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 135c378..256826e 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -537,22 +537,20 @@ wait_for_if_up() { + + while [ $cnt -lt $timeout ]; do + li=$(ip -o link show up dev $1) +- if ! strstr "$li" "NO-CARRIER"; then +- if [ -n "$li" ]; then +- case "$li" in +- *\*) +- return 0;; +- *\<*,UP,*\>*) +- return 0;; +- esac +- fi +- if strstr "$li" "LOWER_UP" \ +- && strstr "$li" "state UNKNOWN" \ +- && ! strstr "$li" "DORMANT"; then +- return 0 +- fi ++ if [ -n "$li" ]; then ++ case "$li" in ++ *\*) ++ return 0;; ++ *\<*,UP,*\>*) ++ return 0;; ++ esac ++ fi ++ if strstr "$li" "LOWER_UP" \ ++ && strstr "$li" "state UNKNOWN" \ ++ && ! strstr "$li" "DORMANT"; then ++ return 0 + fi + sleep 0.1 + cnt=$(($cnt+1)) +@@ -620,7 +618,7 @@ type hostname >/dev/null 2>&1 || \ + cat /proc/sys/kernel/hostname + } + +-iface_has_link() { ++iface_has_carrier() { + local cnt=0 + local interface="$1" flags="" + [ -n "$interface" ] || return 2 +@@ -631,14 +629,27 @@ iface_has_link() { + timeout=$(($timeout*10)) + + linkup "$1" ++ ++ li=$(ip -o link show up dev $1) ++ strstr "$li" "NO-CARRIER" && _no_carrier_flag=1 ++ + while [ $cnt -lt $timeout ]; do +- [ "$(cat $interface/carrier)" = 1 ] && return 0 ++ if [ -n "$_no_carrier_flag" ]; then ++ # NO-CARRIER flag was cleared ++ strstr "$li" "NO-CARRIER" || return 0 ++ fi ++ # double check the syscfs carrier flag ++ [ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) + done + return 1 + } + ++iface_has_link() { ++ iface_has_carrier "$@" ++} ++ + find_iface_with_link() { + local iface_path="" iface="" + for iface_path in /sys/class/net/*; do diff --git a/0010-nbd-add-systemd-generator-and-use-nbd-export-names-i.patch b/0010-nbd-add-systemd-generator-and-use-nbd-export-names-i.patch new file mode 100644 index 0000000..d263e42 --- /dev/null +++ b/0010-nbd-add-systemd-generator-and-use-nbd-export-names-i.patch @@ -0,0 +1,287 @@ +From b070c1d360e86db69a8049b2f040b8223bc484c9 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Dec 2015 13:10:33 +0100 +Subject: [PATCH] nbd: add systemd generator and use nbd export names instead + of port numbers + +Add a systemd generator for root=nbd:.. so that systemd has a correct +sysroot.mount unit. + +Use export names instead of port numbers, because port number based +exports are deprecated and were removed. +--- + dracut.cmdline.7.asc | 14 +++++++++++--- + modules.d/95nbd/module-setup.sh | 3 +++ + modules.d/95nbd/nbdroot.sh | 11 +++++------ + modules.d/95nbd/parse-nbdroot.sh | 10 ++++++++-- + test/TEST-40-NBD/dhcpd.conf | 10 +++++----- + test/TEST-40-NBD/server-init.sh | 3 +-- + test/TEST-40-NBD/test.sh | 41 ++++++++++++++++++++++++---------------- + 7 files changed, 58 insertions(+), 34 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index c34b45b..e160e3b 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -755,13 +755,21 @@ NOTE: letters in the MAC-address must be lowercase! + + NBD + ~~~ +-**root=**??? **netroot=**nbd:____:____[:____[:____[:____]]]:: +- mount nbd share from ++**root=**??? **netroot=**nbd:____:____[:____[:____[:____]]]:: ++ mount nbd share from . +++ ++NOTE: ++ If "exportname" instead of "port" is given the standard port is used. ++ Newer versions of nbd are only supported with "exportname". + +-**root=dhcp** with **dhcp** **root-path=**nbd:____:____[:____[:____[:____]]]:: ++**root=dhcp** with **dhcp** **root-path=**nbd:____:____[:____[:____[:____]]]:: + root=dhcp alone directs initrd to look at the DHCP root-path where NBD + options can be specified. This syntax is only usable in cases where you are + directly mounting the volume as the rootfs. +++ ++NOTE: ++ If "exportname" instead of "port" is given the standard port is used. ++ Newer versions of nbd are only supported with "exportname". + + DASD + ~~~~ +diff --git a/modules.d/95nbd/module-setup.sh b/modules.d/95nbd/module-setup.sh +index 3cb6f49..22f6a3b 100755 +--- a/modules.d/95nbd/module-setup.sh ++++ b/modules.d/95nbd/module-setup.sh +@@ -34,6 +34,9 @@ install() { + inst nbd-client + inst_hook cmdline 90 "$moddir/parse-nbdroot.sh" + inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot" ++ if dracut_module_included "systemd-initrd"; then ++ inst_script "$moddir/nbd-generator.sh" $systemdutildir/system-generators/dracut-nbd-generator ++ fi + dracut_need_initqueue + } + +diff --git a/modules.d/95nbd/nbdroot.sh b/modules.d/95nbd/nbdroot.sh +index dd2bb55..7057f23 100755 +--- a/modules.d/95nbd/nbdroot.sh ++++ b/modules.d/95nbd/nbdroot.sh +@@ -28,11 +28,6 @@ nbdfstype=${nroot%%:*}; nroot=${nroot#*:} + nbdflags=${nroot%%:*} + nbdopts=${nroot#*:} + +-# If nbdport not an integer, then assume name based import +-if [ ! -z $(echo "$nbdport" | sed 's/[0-9]//g') ]; then +- nbdport="-N $nbdport" +-fi +- + if [ "$nbdopts" = "$nbdflags" ]; then + unset nbdopts + fi +@@ -113,7 +108,11 @@ if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then + preopts="--systemd-mark $preopts" + fi + +-nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1 ++if [ "$nbdport" -gt 0 ] 2>/dev/null; then ++ nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1 ++else ++ nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1 ++fi + + # NBD doesn't emit uevents when it gets connected, so kick it + echo change > /sys/block/nbd0/uevent +diff --git a/modules.d/95nbd/parse-nbdroot.sh b/modules.d/95nbd/parse-nbdroot.sh +index 746fb14..902e9a9 100755 +--- a/modules.d/95nbd/parse-nbdroot.sh ++++ b/modules.d/95nbd/parse-nbdroot.sh +@@ -1,8 +1,8 @@ + #!/bin/sh + # + # Preferred format: +-# root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]] +-# [root=*] netroot=nbd:srv:port[:fstype[:rootflags[:nbdopts]]] ++# root=nbd:srv:port/exportname[:fstype[:rootflags[:nbdopts]]] ++# [root=*] netroot=nbd:srv:port/exportname[:fstype[:rootflags[:nbdopts]]] + # + # nbdopts is a comma separated list of options to give to nbd-client + # +@@ -45,6 +45,12 @@ fi + # If it's not nbd we don't continue + [ "${netroot%%:*}" = "nbd" ] || return + ++ ++if [ -n "${DRACUT_SYSTEMD}" ] && [ "$root" = "dhcp" ]; then ++ echo "root=$netroot" > /etc/cmdline.d/root.conf ++ systemctl --no-block daemon-reload ++fi ++ + # Check required arguments + netroot_to_var $netroot + [ -z "$server" ] && die "Argument server for nbdroot is missing" +diff --git a/test/TEST-40-NBD/dhcpd.conf b/test/TEST-40-NBD/dhcpd.conf +index 942bc6a..08461f9 100644 +--- a/test/TEST-40-NBD/dhcpd.conf ++++ b/test/TEST-40-NBD/dhcpd.conf +@@ -20,7 +20,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 { + + group { + host nbd-2 { +- option root-path "nbd:192.168.50.1:2000"; ++ option root-path "nbd:192.168.50.1:raw"; + + hardware ethernet 52:54:00:12:34:01; + fixed-address 192.168.50.101; +@@ -29,7 +29,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 { + + group { + host nbd-3 { +- option root-path "nbd:192.168.50.1:2000:ext2"; ++ option root-path "nbd:192.168.50.1:raw:ext2"; + + hardware ethernet 52:54:00:12:34:02; + fixed-address 192.168.50.101; +@@ -38,7 +38,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 { + + group { + host nbd-4 { +- option root-path "nbd:192.168.50.1:2000::errors=panic"; ++ option root-path "nbd:192.168.50.1:raw::errors=panic"; + + hardware ethernet 52:54:00:12:34:03; + fixed-address 192.168.50.101; +@@ -47,7 +47,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 { + + group { + host nbd-5 { +- option root-path "nbd:192.168.50.1:2000:ext2:errors=panic"; ++ option root-path "nbd:192.168.50.1:raw:ext2:errors=panic"; + + hardware ethernet 52:54:00:12:34:04; + fixed-address 192.168.50.101; +@@ -57,7 +57,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 { + group { + host nbd-6 { + # Use the encrypted image +- option root-path "nbd:192.168.50.1:2001:ext2:errors=panic"; ++ option root-path "nbd:192.168.50.1:encrypted:ext2:errors=panic"; + + hardware ethernet 52:54:00:12:34:05; + fixed-address 192.168.50.101; +diff --git a/test/TEST-40-NBD/server-init.sh b/test/TEST-40-NBD/server-init.sh +index 73c64d6..0039753 100755 +--- a/test/TEST-40-NBD/server-init.sh ++++ b/test/TEST-40-NBD/server-init.sh +@@ -13,8 +13,7 @@ ip link set dev eth0 name ens3 + ip addr add 192.168.50.1/24 dev ens3 + ip link set ens3 up + modprobe af_packet +-nbd-server 2000 /dev/sdb -C /dev/null +-nbd-server 2001 /dev/sdc -C /dev/null ++nbd-server + >/var/lib/dhcpd/dhcpd.leases + chmod 777 /var/lib/dhcpd/dhcpd.leases + dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases & +diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh +index 39966ac..28ba6aa 100755 +--- a/test/TEST-40-NBD/test.sh ++++ b/test/TEST-40-NBD/test.sh +@@ -5,8 +5,8 @@ TEST_DESCRIPTION="root filesystem on NBD" + KVERSION=${KVERSION-$(uname -r)} + + # Uncomment this to debug failures +-#DEBUGFAIL="rd.shell rd.break" +-#SERIAL="udp:127.0.0.1:9999" ++#DEBUGFAIL="rd.shell rd.break rd.debug" ++SERIAL="tcp:127.0.0.1:9999" + SERIAL="null" + + run_server() { +@@ -104,36 +104,36 @@ test_run() { + client_run() { + # The default is ext3,errors=continue so use that to determine + # if our options were parsed and used ++ client_test "NBD root=nbd:IP:port" 52:54:00:12:34:00 \ ++ "root=nbd:192.168.50.1:raw rd.luks=0" || return 1 ++ + client_test "NBD root=nbd:IP:port::fsopts" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000::errors=panic rd.luks=0" \ ++ "root=nbd:192.168.50.1:raw::errors=panic rd.luks=0" \ + ext3 errors=panic || return 1 + +- client_test "NBD root=nbd:IP:port" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000 rd.luks=0" || return 1 +- + client_test "NBD root=nbd:IP:port:fstype" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000:ext2 rd.luks=0" ext2 || return 1 ++ "root=nbd:192.168.50.1:raw:ext2 rd.luks=0" ext2 || return 1 + + client_test "NBD root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000:ext2:errors=panic rd.luks=0" \ ++ "root=nbd:192.168.50.1:raw:ext2:errors=panic rd.luks=0" \ + ext2 errors=panic || return 1 + + client_test "NBD Bridge root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000:ext2:errors=panic bridge rd.luks=0" \ ++ "root=nbd:192.168.50.1:raw:ext2:errors=panic bridge rd.luks=0" \ + ext2 errors=panic || return 1 + + # There doesn't seem to be a good way to validate the NBD options, so + # just check that we don't screw up the other options + + client_test "NBD root=nbd:IP:port:::NBD opts" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000:::bs=2048 rd.luks=0" || return 1 ++ "root=nbd:192.168.50.1:raw:::bs=2048 rd.luks=0" || return 1 + + client_test "NBD root=nbd:IP:port:fstype::NBD opts" 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000:ext2::bs=2048 rd.luks=0" ext2 || return 1 ++ "root=nbd:192.168.50.1:raw:ext2::bs=2048 rd.luks=0" ext2 || return 1 + + client_test "NBD root=nbd:IP:port:fstype:fsopts:NBD opts" \ + 52:54:00:12:34:00 \ +- "root=nbd:192.168.50.1:2000:ext2:errors=panic:bs=2048 rd.luks=0" \ ++ "root=nbd:192.168.50.1:raw:ext2:errors=panic:bs=2048 rd.luks=0" \ + ext2 errors=panic || return 1 + + # DHCP root-path parsing +@@ -156,7 +156,7 @@ client_run() { + # netroot handling + + client_test "NBD netroot=nbd:IP:port" 52:54:00:12:34:00 \ +- "netroot=nbd:192.168.50.1:2000 rd.luks=0" || return 1 ++ "netroot=nbd:192.168.50.1:raw rd.luks=0" || return 1 + + client_test "NBD netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \ + 52:54:00:12:34:04 "netroot=dhcp rd.luks=0" ext2 errors=panic || return 1 +@@ -167,7 +167,7 @@ client_run() { + + client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \ + 52:54:00:12:34:00 \ +- "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:2001" || return 1 ++ "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:encrypted" || return 1 + + # XXX This should be ext2,errors=panic but that doesn't currently + # XXX work when you have a real root= line in addition to netroot= +@@ -308,11 +308,20 @@ make_server_root() { + mkdir -p "$initdir" + ( + cd "$initdir"; +- mkdir -p dev sys proc etc var/run var/lib/dhcpd tmp ++ mkdir -p dev sys proc etc var/run var/lib/dhcpd tmp etc/nbd-server + ) ++ cat > "$initdir/etc/nbd-server/config" < +Date: Mon, 14 Dec 2015 13:59:33 +0100 +Subject: [PATCH] TEST-16-DMSQUASH: do not use "--" with ldconfig -r + +--- + test/TEST-16-DMSQUASH/test.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh +index f2b9963..53a45d6 100755 +--- a/test/TEST-16-DMSQUASH/test.sh ++++ b/test/TEST-16-DMSQUASH/test.sh +@@ -98,7 +98,7 @@ test_setup() { + inst "$VMLINUZ" "/boot/vmlinuz-${KVERSION}" + find_binary plymouth >/dev/null && inst_multiple plymouth + cp -a -- /etc/ld.so.conf* "$initdir"/etc +- sudo ldconfig -r -- "$initdir" ++ sudo ldconfig -r "$initdir" + ) + python create.py -d -c livecd-fedora-minimal.ks + return 0 diff --git a/0012-test-TEST-04-FULL-SYSTEMD-optionally-install-machine.patch b/0012-test-TEST-04-FULL-SYSTEMD-optionally-install-machine.patch new file mode 100644 index 0000000..06c5bea --- /dev/null +++ b/0012-test-TEST-04-FULL-SYSTEMD-optionally-install-machine.patch @@ -0,0 +1,29 @@ +From b8bccd398a4214376474c330ee4b756a4d0c1d19 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Dec 2015 15:12:24 +0100 +Subject: [PATCH] test/TEST-04-FULL-SYSTEMD: optionally install machine-info + and *-id + +--- + test/TEST-04-FULL-SYSTEMD/test.sh | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh +index 6ea9281..f5a9d48 100755 +--- a/test/TEST-04-FULL-SYSTEMD/test.sh ++++ b/test/TEST-04-FULL-SYSTEMD/test.sh +@@ -264,9 +264,13 @@ EOF + inst_hook emergency 000 ./hard-off.sh + inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules + ) ++ ++ [ -e /etc/machine-id ] && EXTRA_MACHINE="/etc/machine-id" ++ [ -e /etc/machine-info ] && EXTRA_MACHINE+=" /etc/machine-info" ++ + sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + -a "debug systemd i18n" \ +- -I "/etc/machine-id /etc/hostname" \ ++ ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \ + -o "dash network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules" \ + -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \ + --no-hostonly-cmdline -N \ diff --git a/0013-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch b/0013-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch new file mode 100644 index 0000000..5daa5d4 --- /dev/null +++ b/0013-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch @@ -0,0 +1,29 @@ +From c41df7e1db1adc51399ab2c22f251b15eb2065b1 Mon Sep 17 00:00:00 2001 +From: Alexander Tsoy +Date: Tue, 5 Jan 2016 22:11:57 +0300 +Subject: [PATCH] base/dracut-lib.sh:dev_unit_name() guard against $dev + beginning with "-" + +crypt/parse-crypt.sh generate initqueue job which always call +dev_unit_name() with an argument beginning with "-". This results +in the following error: + +dracut-initqueue[307]: + systemd-escape -p -cfb4aa43-2f02-4c6b-a313-60ea99288087 +dracut-initqueue[307]: systemd-escape: invalid option -- 'c' +--- + modules.d/99base/dracut-lib.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index ad03394..0a0b1b9 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -874,7 +874,7 @@ dev_unit_name() + local dev="$1" + + if command -v systemd-escape >/dev/null; then +- systemd-escape -p "$dev" ++ systemd-escape -p -- "$dev" + return + fi + diff --git a/0014-nbd-add-missing-generator.patch b/0014-nbd-add-missing-generator.patch new file mode 100644 index 0000000..d79f2dd --- /dev/null +++ b/0014-nbd-add-missing-generator.patch @@ -0,0 +1,71 @@ +From 07149fe6bea01026b3ae37afb51b0fa831e9f27a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 7 Jan 2016 09:56:36 +0100 +Subject: [PATCH] nbd: add missing generator + +--- + modules.d/95nbd/nbd-generator.sh | 55 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 55 insertions(+) + create mode 100755 modules.d/95nbd/nbd-generator.sh + +diff --git a/modules.d/95nbd/nbd-generator.sh b/modules.d/95nbd/nbd-generator.sh +new file mode 100755 +index 0000000..de52d11 +--- /dev/null ++++ b/modules.d/95nbd/nbd-generator.sh +@@ -0,0 +1,55 @@ ++#!/bin/sh ++ ++type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh ++ ++[ -z "$root" ] && root=$(getarg root=) ++ ++[ "${root%%:*}" = "nbd" ] || exit 0 ++ ++GENERATOR_DIR="$2" ++[ -z "$GENERATOR_DIR" ] && exit 1 ++ ++[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR" ++ ++ROOTFLAGS="$(getarg rootflags)" ++ ++nroot=${root#nbd:} ++nbdserver=${nroot%%:*}; nroot=${nroot#*:} ++nbdport=${nroot%%:*}; nroot=${nroot#*:} ++nbdfstype=${nroot%%:*}; nroot=${nroot#*:} ++nbdflags=${nroot%%:*} ++ ++if [ "$nbdflags" = "$nbdfstype" ]; then ++ unset nbdflags ++fi ++if [ "$nbdfstype" = "$nbdport" ]; then ++ unset nbdfstype ++fi ++ ++[ -n "$nbdflags" ] && ROOTFLAGS="$nbdflags" ++ ++if getarg "ro"; then ++ if [ -n "$ROOTFLAGS" ]; then ++ ROOTFLAGS="$ROOTFLAGS,ro" ++ else ++ ROOTFLAGS="ro" ++ fi ++fi ++ ++if [ -n "$nbdfstype" ]; then ++ ROOTFSTYPE="$nbdfstype" ++else ++ ROOTFSTYPE=$(getarg rootfstype=) || unset ROOTFSTYPE ++fi ++ ++{ ++ echo "[Unit]" ++ echo "Before=initrd-root-fs.target" ++ echo "[Mount]" ++ echo "Where=/sysroot" ++ echo "What=/dev/root" ++ [ -n "$ROOTFSTYPE" ] && echo "Type=${ROOTFSTYPE}" ++ [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}" ++} > "$GENERATOR_DIR"/sysroot.mount ++ ++exit 0 diff --git a/0015-fcoe-no-need-to-copy-lldpad-state.patch b/0015-fcoe-no-need-to-copy-lldpad-state.patch new file mode 100644 index 0000000..eef6e71 --- /dev/null +++ b/0015-fcoe-no-need-to-copy-lldpad-state.patch @@ -0,0 +1,28 @@ +From e93ff1cf9aac8f97131b3101a5da240ce5f45239 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 7 Jan 2016 10:44:31 +0100 +Subject: [PATCH] fcoe: no need to copy lldpad state + +/dev/shm should be available later on by the normal switch root bind mount. +--- + modules.d/95fcoe/cleanup-fcoe.sh | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/modules.d/95fcoe/cleanup-fcoe.sh b/modules.d/95fcoe/cleanup-fcoe.sh +index 5ff4d05..856e2d9 100644 +--- a/modules.d/95fcoe/cleanup-fcoe.sh ++++ b/modules.d/95fcoe/cleanup-fcoe.sh +@@ -2,9 +2,8 @@ + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + +-if [ -e /var/run/lldpad.pid ]; then +- lldpad -k +- mkdir -m 0755 -p /run/initramfs/state/dev/shm +- cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1 +- echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab ++if [ -z "$DRACUT_SYSTEMD" ]; then ++ if [ -e /var/run/lldpad.pid ]; then ++ lldpad -k ++ fi + fi diff --git a/0016-dracut.sh-restorecon-final-image-file.patch b/0016-dracut.sh-restorecon-final-image-file.patch new file mode 100644 index 0000000..c35028e --- /dev/null +++ b/0016-dracut.sh-restorecon-final-image-file.patch @@ -0,0 +1,48 @@ +From 60928f36b6c9a855077506444ea5edbe6be9ec4c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 8 Jan 2016 11:37:25 +0100 +Subject: [PATCH] dracut.sh: restorecon final image file + +Instead of "mv" use "cp --reflink=auto" and restorecon the final image +--- + dracut.sh | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index a2fc496..6dc9858 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1724,6 +1724,8 @@ if (( maxloglvl >= 5 )); then + fi + fi + ++umask 077 ++ + if [[ $uefi = yes ]]; then + if [[ $kernel_cmdline ]]; then + echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt" +@@ -1749,7 +1751,7 @@ if [[ $uefi = yes ]]; then + --add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \ + --add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \ + "$uefi_stub" "${uefi_outdir}/linux.efi" \ +- && mv "${uefi_outdir}/linux.efi" "$outfile"; then ++ && cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then + dinfo "*** Creating UEFI image file '$outfile' done ***" + else + rm -f -- "$outfile" +@@ -1757,7 +1759,7 @@ if [[ $uefi = yes ]]; then + exit 1 + fi + else +- if mv "${DRACUT_TMPDIR}/initramfs.img" "$outfile"; then ++ if cp --reflink=auto "${DRACUT_TMPDIR}/initramfs.img" "$outfile"; then + dinfo "*** Creating initramfs image file '$outfile' done ***" + else + rm -f -- "$outfile" +@@ -1766,5 +1768,6 @@ else + fi + fi + ++command -v restorecon &>/dev/null && restorecon -- "$outfile" + + exit 0 diff --git a/dracut.spec b/dracut.spec index 9e21587..dce2fab 100644 --- a/dracut.spec +++ b/dracut.spec @@ -16,7 +16,7 @@ Name: dracut Version: 044 -Release: 6.git20151201%{?dist} +Release: 17.git20160108%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -40,6 +40,17 @@ Patch2: 0002-dmraid-61-dmraid-imsm.rules-add-nowatch-option-for-u.patch Patch3: 0003-livenet-livenet-generator.sh-mode-0755.patch Patch4: 0004-shutdown-guard-against-read-only-run.patch Patch5: 0005-dmsquash-live-dmsquash-live-root.sh-SQUASHED-can-be-.patch +Patch6: 0006-kernel-modules-include-all-HID-driver-in-hostonly-mo.patch +Patch7: 0007-systemd-include-machine-info.patch +Patch8: 0008-livenet-module-setup.sh-only-include-systemd-generat.patch +Patch9: 0009-network-fix-carrier-detection.patch +Patch10: 0010-nbd-add-systemd-generator-and-use-nbd-export-names-i.patch +Patch11: 0011-TEST-16-DMSQUASH-do-not-use-with-ldconfig-r.patch +Patch12: 0012-test-TEST-04-FULL-SYSTEMD-optionally-install-machine.patch +Patch13: 0013-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch +Patch14: 0014-nbd-add-missing-generator.patch +Patch15: 0015-fcoe-no-need-to-copy-lldpad-state.patch +Patch16: 0016-dracut.sh-restorecon-final-image-file.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -500,6 +511,14 @@ rm -rf -- $RPM_BUILD_ROOT %endif %changelog +* Fri Jan 8 2016 Harald Hoyer - 044-17.git20160108 +- include more HID driver +- include machine info file +- fix network carrier detection +- fix nbd +- do not copy over lldpad state +- restorecon the final initramfs image + * Tue Dec 1 2015 Harald Hoyer - 044-6.git20151201 - fix for readonly /run on shutdown - fix for the dmsquash-live module