diff --git a/.travis.yml b/.travis.yml index 37002e9..f913db5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ env: - IMAGE=latest TESTS=50 - IMAGE=latest TESTS=30 - IMAGE=latest TESTS=31 - - IMAGE=latest TESTS=60 - IMAGE=latest TESTS=70 - IMAGE=latest TESTS=99 - IMAGE=latest TESTS=02 @@ -19,8 +18,8 @@ env: - IMAGE=latest TESTS=04 - IMAGE=latest TESTS=10 - IMAGE=latest TESTS=11 - - IMAGE=29 TESTS=13 - - IMAGE=29 TESTS=14 + - IMAGE=latest TESTS=13 + - IMAGE=latest TESTS=14 - IMAGE=latest TESTS=15 - IMAGE=latest TESTS=17 @@ -30,7 +29,7 @@ before_script: sudo modprobe kvm-intel nested=1 || : sudo modprobe kvm-amd nested=1 || : dmesg | tail || : - - git fetch --tags --unshallow + - git pull --depth=100 - | git describe --abbrev=0 --tags || : git describe --tags || : diff --git a/50-dracut.install b/50-dracut.install index b897db8..64e3549 100755 --- a/50-dracut.install +++ b/50-dracut.install @@ -25,7 +25,7 @@ case "$COMMAND" in if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then # we found an initrd at the same place as the kernel # use this and don't generate a new one - cp "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \ + cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \ && chown root:root "$BOOT_DIR_ABS/$INITRD" \ && chmod 0600 "$BOOT_DIR_ABS/$INITRD" \ && exit 0 @@ -35,7 +35,9 @@ case "$COMMAND" in read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline elif [[ -f /usr/lib/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline - else + fi + + if ! [[ ${BOOT_OPTIONS[*]} ]]; then read -r -d '' -a BOOT_OPTIONS < /proc/cmdline fi @@ -47,7 +49,7 @@ case "$COMMAND" in break fi done - dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" + dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" ret=$? ;; remove) diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh index 2315855..67f5b71 100755 --- a/51-dracut-rescue-postinst.sh +++ b/51-dracut-rescue-postinst.sh @@ -57,7 +57,7 @@ if [[ ! -f $INITRDFILE ]]; then fi if [[ ! -f $NEW_KERNEL_IMAGE ]]; then - cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE" + cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE" ((ret+=$?)) fi diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install index 47eb8e7..6ddafdb 100755 --- a/51-dracut-rescue.install +++ b/51-dracut-rescue.install @@ -47,7 +47,9 @@ if [[ -f /etc/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline elif [[ -f /usr/lib/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline -else +fi + +if ! [[ "${BOOT_OPTIONS[@]}" ]]; then read -r -d '' -a line < /proc/cmdline for i in "${line[@]}"; do [[ "${i#initrd=*}" != "$i" ]] && continue @@ -55,6 +57,12 @@ else done fi +if ! [[ ${BOOT_OPTIONS[*]} ]]; then + echo "Could not determine the kernel command line parameters." >&2 + echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2 + exit 1 +fi + if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then BOOT_DIR="/${MACHINE_ID}/0-rescue" BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR} @@ -85,12 +93,12 @@ case "$COMMAND" in [[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS" - if ! cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then + if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2 fi if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then - dracut -f --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" + dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" ((ret+=$?)) fi @@ -104,11 +112,7 @@ case "$COMMAND" in echo "initrd $BOOT_DIR/initrd" } > $LOADER_ENTRY else - if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then - cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" $LOADER_ENTRY - else - cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY - fi + cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY fi diff --git a/Makefile b/Makefile index 503d069..8062343 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ man8pages = dracut.8 \ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages) -.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh +.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio @@ -216,17 +216,6 @@ rpm: dracut-$(VERSION).tar.xz syncheck --define "_rpmdir $$PWD" -ba dracut.spec; ) && \ ( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm ) -srpm: dracut-$(VERSION).tar.xz syncheck - rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \ - cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \ - LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \ - (cd "$$rpmbuild"; \ - [ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \ - rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \ - --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \ - --define "_rpmdir $$PWD" -bs dracut.spec; ) && \ - ( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm ) - syncheck: @ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \ [ "$${i##*/}" = "module-setup.sh" ] && continue; \ diff --git a/README.md b/README.md index 530f1c1..36ae7e1 100644 --- a/README.md +++ b/README.md @@ -27,5 +27,4 @@ dracut is an initramfs infrastructure. - Test 31: [![Test 31](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/) - Test 40: [![Test 40](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/) - Test 50: [![Test 50](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/) -- Test 60: [![Test 60](https://ci.centos.org/job/dracut-matrix-master/TESTS=60,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=60,label=dracut-ci-slave01/) - Test 70: [![Test 70](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/) diff --git a/dracut-init.sh b/dracut-init.sh index 032c38c..50d23e2 100644 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -150,14 +150,6 @@ dracut_module_included() { [[ " $mods_to_load $modules_loaded " == *\ $*\ * ]] } -dracut_no_switch_root() { - >"$initdir/lib/dracut/no-switch-root" -} - -dracut_module_path() { - echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; } -} - if ! [[ $DRACUT_INSTALL ]]; then DRACUT_INSTALL=$(find_binary dracut-install) fi @@ -444,7 +436,7 @@ inst_rules_wildcard() { } prepare_udev_rules() { - [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) for f in "$@"; do f="${initdir}/etc/udev/rules.d/$f" diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc index bf74557..3cee5a0 100644 --- a/dracut.cmdline.7.asc +++ b/dracut.cmdline.7.asc @@ -187,9 +187,9 @@ It should be attached to any report about dracut problems. _/run/initramfs/init.log_. If "quiet" is set, it also logs to the console. -**rd.memdebug=[0-5]**:: - Print memory usage info at various points, set the verbose level from 0 to 5. -+ +**rd.memdebug=[0-4]**:: + Print memory usage info at various points, set the verbose level from 0 to 4. ++ Higher level means more debugging output: + ---- @@ -197,14 +197,10 @@ It should be attached to any report about dracut problems. 1 - partial /proc/meminfo 2 - /proc/meminfo 3 - /proc/meminfo + /proc/slabinfo - 4 - /proc/meminfo + /proc/slabinfo + memstrack summary - NOTE: memstrack is a memory tracing tool that tracks the total memory - consumption, and peak memory consumption of each kernel modules - and userspace progress during the whole initramfs runtime, report - is genereted and the end of initramsfs run. - 5 - /proc/meminfo + /proc/slabinfo + memstrack (with top memory stacktrace) - NOTE: memstrack (with top memory stacktrace) will print top memory - allocation stack traces during the whole initramfs runtime. + 4 - /proc/meminfo + /proc/slabinfo + tracekomem + NOTE: tracekomem is a shell script utilizing kernel trace to track + the rough total memory consumption of kernel modules during + loading. It may override other trace configurations. ---- **rd.break**:: @@ -406,9 +402,6 @@ MULTIPATH **rd.multipath=0**:: disable multipath detection -**rd.multipath=default**:: - use default multipath settings - FIPS ~~~~ **rd.fips**:: @@ -593,13 +586,9 @@ interface name. Better name it "bootnet" or "bluesocket". 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 @@ -656,7 +645,7 @@ NFS Wait until IPv6 automatic addresses are assigned. Default is 40 seconds. **rd.net.timeout.carrier=**____:: - Wait until carrier is recognized. Default is 10 seconds. + Wait until carrier is recognized. Default is 5 seconds. CIFS ~~~ @@ -768,9 +757,6 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30 **rd.iscsi.ibft** **rd.iscsi.ibft=1**: Turn on iBFT autoconfiguration for the interfaces -**rd.iscsi.mp** **rd.iscsi.mp=1**: - Configure all iBFT interfaces, not only used for booting (multipath) - **rd.iscsi.waitnet=0**: Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets. @@ -779,9 +765,6 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30 FCoE ~~~~ -**rd.nofcoe=0**:: - disable FCoE and lldpad - **fcoe=**____:__{dcb|nodcb}__:__{fabric|vn2vn}__:: Try to connect to a FCoE SAN through the NIC specified by __ or __ or EDD settings. The second argument specifies if DCB @@ -842,11 +825,6 @@ ZNET RHEL/Fedora with ccw_init, which is called from udev for certain devices on z-series. rd.znet can be specified multiple times on the kernel command line. - -**rd.znet_ifname=**____:____:: - Assign network device name (i.e. "bootnet") to the NIC - corresponds to the subchannels. This is useful when dracut's default - "ifname=" doesn't work due to device having a changing MAC address. + [listing] .Example diff --git a/dracut.sh b/dracut.sh index 01abe7a..e683a9b 100755 --- a/dracut.sh +++ b/dracut.sh @@ -173,8 +173,6 @@ Creates initial ramdisk images for preloading modules --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. @@ -184,8 +182,8 @@ Creates initial ramdisk images for preloading modules --mount "[DEV] [MP] [FSTYPE] [FSOPTS]" Mount device [DEV] on mountpoint [MP] with filesystem [FSTYPE] and options [FSOPTS] in the initramfs - --mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are - determined by looking at the current mounts. + --mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are + determined by looking at the current mounts. --add-device "[DEV]" Bring up [DEV] in initramfs -i, --include [SOURCE] [TARGET] Include the files in the SOURCE directory into the @@ -236,9 +234,7 @@ Creates initial ramdisk images for preloading modules --uefi Create an UEFI executable with the kernel cmdline and kernel combined --uefi-stub [FILE] Use the UEFI stub [FILE] to create an UEFI executable - --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 + --kernel-image [FILE] location of the kernel image If [LIST] has multiple arguments, then you have to put these in quotes. @@ -402,7 +398,6 @@ rearrange_params() --long kernel-image: \ --long no-hostonly-i18n \ --long hostonly-i18n \ - --long hostonly-nics: \ --long no-machineid \ -- "$@") @@ -564,8 +559,6 @@ while :; do 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) @@ -725,7 +718,6 @@ unset NPATH (( ${#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[@]}" @@ -1381,7 +1373,7 @@ do_print_cmdline() for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do _d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]} [[ ${_mods_to_print[$_d_mod]} ]] || continue - module_cmdline "$_d_mod" "$moddir" + module_cmdline "$_d_mod" done unset moddir } @@ -1462,14 +1454,14 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do dinfo "*** Including module: $_d_mod ***" fi if [[ $kernel_only == yes ]]; then - module_installkernel "$_d_mod" "$moddir" || { + module_installkernel "$_d_mod" || { dfatal "installkernel failed in module $_d_mod" exit 1 } else - module_install "$_d_mod" "$moddir" + module_install "$_d_mod" if [[ $no_kernel != yes ]]; then - module_installkernel "$_d_mod" "$moddir" || { + module_installkernel "$_d_mod" || { dfatal "installkernel failed in module $_d_mod" exit 1 } @@ -1586,6 +1578,15 @@ if [[ $kernel_only != yes ]]; then # 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 "$_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 @@ -1658,6 +1659,21 @@ for d in $(ldconfig_paths); do rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1 done +if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then + dinfo "*** Stripping files ***" + find "$initdir" -type f \ + -executable -not -path '*/lib/modules/*.ko' -print0 \ + | xargs -r -0 $strip_cmd -g 2>/dev/null + + # strip kernel modules, but do not touch signed modules + find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \ + | while read -r -d $'\0' f || [ -n "$f" ]; do + SIG=$(tail -c 28 "$f" | tr -d '\000') + [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; } + done | xargs -r -0 $strip_cmd -g + + dinfo "*** Stripping files done ***" +fi if [[ $early_microcode = yes ]]; then dinfo "*** Generating early-microcode cpio image ***" ucode_dir=(amd-ucode intel-ucode) @@ -1729,8 +1745,9 @@ if [[ $hostonly_cmdline == "yes" ]] ; then fi fi +dinfo "*** Creating image file '$outfile' ***" + 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 @@ -1744,7 +1761,7 @@ if dracut_module_included "squash"; then exit 1 fi - readonly squash_dir="$initdir/squash/root" + readonly squash_dir="${DRACUT_TMPDIR}/squashfs" readonly squash_img=$initdir/squash/root.img # Currently only move "usr" "etc" to squashdir @@ -1755,6 +1772,22 @@ if dracut_module_included "squash"; then mv $initdir/$folder $squash_dir/$folder done + # Reinstall required files, because we have moved some important folders to $squash_dir + inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \ + "systemctl" "udevadm" "$systemdutildir/systemd" + hostonly="" instmods "loop" "squashfs" "overlay" + + 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 + if [[ -e $squash_dir${file#$initdir} ]]; then + mv $squash_dir${file#$initdir} $file + fi + done + done + # Move some files out side of the squash image, including: # - Files required to boot and mount the squashfs image # - Files need to be accessable without mounting the squash image @@ -1776,26 +1809,30 @@ if dracut_module_included "squash"; 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/} + if [[ -d $_sqsh_file ]]; then + if [[ -L $_sqsh_file ]]; then + cp --preserve=all -P $_sqsh_file $_init_file + else + mkdir $_init_file + fi else - if [[ -d $_sqsh_file ]]; then - mkdir $_init_file - else - mv $_sqsh_file $_init_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 + mv $_sqsh_file $_init_file + fi fi } @@ -1816,81 +1853,14 @@ if dracut_module_included "squash"; then ln -s squash/init.sh $initdir/init ln -s squash/shutdown.sh $initdir/shutdown - # Reinstall required files for the squash image setup script. - # We have moved them inside the squashed image, but they need to be - # 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 - - 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 - if [[ -e $squash_dir${file#$initdir} ]]; then - mv $squash_dir${file#$initdir} $file - fi - done - 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 \ - -executable -not -path '*/lib/modules/*.ko' -print0 \ - | xargs -r -0 $strip_cmd -g -p 2>/dev/null - - # strip kernel modules, but do not touch signed modules - find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \ - | while read -r -d $'\0' f || [ -n "$f" ]; do - SIG=$(tail -c 28 "$f" | tr -d '\000') - [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; } - done | xargs -r -0 $strip_cmd -g -p - dinfo "*** Stripping files done ***" -fi - -if dracut_module_included "squash"; then - dinfo "*** Squashing the files inside the initramfs ***" - mksquashfs $squash_dir $squash_img -no-xattrs -no-exports -noappend -always-use-fragments -comp xz -Xdict-size 100% -no-progress 1> /dev/null + mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null if [[ $? != 0 ]]; then dfatal "dracut: Failed making squash image" exit 1 fi - - rm -rf $squash_dir - dinfo "*** Squashing the files inside the initramfs done ***" fi -dinfo "*** Creating image file '$outfile' ***" - if [[ $uefi = yes ]]; then readonly uefi_outdir="$DRACUT_TMPDIR/uefi" mkdir "$uefi_outdir" diff --git a/dracut.spec b/dracut.spec index b371118..155868c 100644 --- a/dracut.spec +++ b/dracut.spec @@ -65,13 +65,6 @@ Provides: dracut-fips = %{version}-%{release} Obsoletes: dracut-fips-aesni <= 047 Provides: dracut-fips-aesni = %{version}-%{release} -Obsoletes: dracut-kernel < 005 -Provides: dracut-kernel = %{version}-%{release} - -Obsoletes: dracut < 030 -Obsoletes: dracut-norescue < 030 -Provides: dracut-norescue = %{version}-%{release} - Requires: bash >= 4 Requires: coreutils Requires: cpio @@ -84,12 +77,11 @@ Requires: xz Requires: gzip %if 0%{?fedora} || 0%{?rhel} -Recommends: memstrack Recommends: hardlink Recommends: pigz Recommends: kpartx Requires: util-linux >= 2.21 -Requires: systemd >= 239-23 +Requires: systemd >= 219 Requires: systemd-udev >= 219 Requires: procps-ng %else @@ -189,7 +181,7 @@ This package contains tools to assemble the local initrd and host configuration. %package squash Summary: dracut module to build an initramfs with most files in a squashfs image Requires: %{name} = %{version}-%{release} -Requires: squashfs-tools +Requires: squash-tools %description squash This package provides a dracut module to build an initramfs, but store most files @@ -346,9 +338,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %{dracutlibdir}/modules.d/03modsign %{dracutlibdir}/modules.d/03rescue %{dracutlibdir}/modules.d/04watchdog -%{dracutlibdir}/modules.d/04watchdog-modules %{dracutlibdir}/modules.d/05busybox -%{dracutlibdir}/modules.d/06rngd %{dracutlibdir}/modules.d/10i18n %{dracutlibdir}/modules.d/30convertfs %{dracutlibdir}/modules.d/45url-lib @@ -371,7 +361,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %{dracutlibdir}/modules.d/95debug %{dracutlibdir}/modules.d/95fstab-sys %{dracutlibdir}/modules.d/95lunmask -%{dracutlibdir}/modules.d/95nvmf %{dracutlibdir}/modules.d/95resume %{dracutlibdir}/modules.d/95rootfs-block %{dracutlibdir}/modules.d/95terminfo @@ -402,7 +391,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %{dracutlibdir}/modules.d/98syslog %{dracutlibdir}/modules.d/98usrmount %{dracutlibdir}/modules.d/99base -%{dracutlibdir}/modules.d/99memstrack %{dracutlibdir}/modules.d/99fs-lib %{dracutlibdir}/modules.d/99shutdown %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log @@ -464,14 +452,14 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %doc %{_mandir}/man8/dracut-catimages.8* %endif +%files squash +%{dracutlibdir}/modules.d/99squash + %{_bindir}/dracut-catimages %dir /boot/dracut %dir /var/lib/dracut %dir /var/lib/dracut/overlay -%files squash -%{dracutlibdir}/modules.d/99squash - %files config-generic %{dracutlibdir}/dracut.conf.d/02-generic-image.conf @@ -483,9 +471,4 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh %endif -%triggerin network -- dracut-network < 049-83.git20200525 -echo '# Since rhel-8.3 dracut moved to use NetworkManager -# On existing installations we want to preserve the old scripts -add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf - %changelog diff --git a/git2spec.pl b/git2spec.pl index 9ddc380..7853791 100755 --- a/git2spec.pl +++ b/git2spec.pl @@ -37,7 +37,7 @@ $tag=`git describe --abbrev=0 --tags` if not defined $tag; chomp($tag); my @patches=&create_patches($tag, $pdir); my $num=$#patches + 2; -$tag=~s/[^0-9]+?([0-9]+)/$1/ if $tag !~ /\b[0-9a-f]{5,40}\b/; +$tag=~s/[^0-9]+?([0-9]+)/$1/; my $release="$num.git$datestr"; $release="1" if $num == 1; diff --git a/install/dracut-install.c b/install/dracut-install.c index baf6dcf..88bca1d 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -84,11 +84,6 @@ static bool arg_mod_filter_noname = false; static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst); -static inline void kmod_module_unrefp(struct kmod_module **p) { - if (*p) - kmod_module_unref(*p); -} -#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp) static inline void kmod_module_unref_listp(struct kmod_list **p) { if (*p) @@ -481,9 +476,6 @@ static int resolve_deps(const char *src) if (strstr(buf, "cannot read header")) break; - if (strstr(buf, "cannot be preloaded")) - break; - if (strstr(buf, destrootdir)) break; @@ -1242,52 +1234,28 @@ static bool check_module_path(const char *path) static int install_dependent_modules(struct kmod_list *modlist) { struct kmod_list *itr; + struct kmod_module *mod; const char *path = NULL; const char *name = NULL; int ret = 0; kmod_list_foreach(itr, modlist) { - _cleanup_kmod_module_unref_ struct kmod_module *mod = NULL; mod = kmod_module_get_module(itr); path = kmod_module_get_path(mod); - if (path == NULL) - continue; - - if (check_hashmap(items_failed, path)) - return -1; - - if (check_hashmap(items, path)) { - continue; - } - name = kmod_module_get_name(mod); - - if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) { + if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) { + kmod_module_unref(mod); continue; } - ret = dracut_install(path, &path[kerneldirlen], false, false, true); if (ret == 0) { - _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; - _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL; - _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL; log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]); install_firmware(mod); - modlist = kmod_module_get_dependencies(mod); - ret = install_dependent_modules(modlist); - if (ret == 0) { - ret = kmod_module_get_softdeps(mod, &modpre, &modpost); - 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]); } + kmod_module_unref(mod); } return ret; @@ -1345,12 +1313,8 @@ static int install_module(struct kmod_module *mod) if (ret == 0) { ret = kmod_module_get_softdeps(mod, &modpre, &modpost); - if (ret == 0) { - int r; - ret = install_dependent_modules(modpre); - r = install_dependent_modules(modpost); - ret = ret ? : r; - } + if (ret == 0) + ret = install_dependent_modules(modpre); } return ret; diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh index 1f0b5da..1ed4b34 100755 --- a/modules.d/00systemd/module-setup.sh +++ b/modules.d/00systemd/module-setup.sh @@ -18,7 +18,7 @@ depends() { } installkernel() { - hostonly='' instmods autofs4 ipv6 algif_hash hmac sha256 sg + hostonly='' instmods autofs4 ipv6 algif_hash hmac sha256 instmods -s efivarfs } @@ -32,10 +32,6 @@ install() { fi inst_multiple -o \ - $systemdutildir/system-generators/systemd-debug-generator \ - $systemdsystemunitdir/debug-shell.service - - inst_multiple -o \ $systemdutildir/systemd \ $systemdutildir/systemd-coredump \ $systemdutildir/systemd-cgroups-agent \ @@ -225,7 +221,9 @@ install() { systemd-ask-password-console.service \ systemd-ask-password-plymouth.service \ ; do - systemctl -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service 2>/dev/null + mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants" + ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \ + "${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service" done mkdir -p "$initdir/etc/systemd" @@ -237,6 +235,6 @@ install() { echo "RateLimitBurst=0" } >> "$initdir/etc/systemd/journald.conf" - systemctl -q --root "$initdir" set-default multi-user.target + ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target" } diff --git a/modules.d/01fips/fips-load-crypto.sh b/modules.d/01fips/fips-load-crypto.sh deleted file mode 100644 index 82cbeee..0000000 --- a/modules.d/01fips/fips-load-crypto.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then - rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1 -else - . /sbin/fips.sh - fips_load_crypto || die "FIPS integrity test failed" -fi diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh index 03da686..9bc089f 100755 --- a/modules.d/01fips/fips.sh +++ b/modules.d/01fips/fips.sh @@ -27,7 +27,7 @@ mount_boot() if ! [ -e "$boot" ]; then udevadm trigger --action=add >/dev/null 2>&1 - [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version) i=0 while ! [ -e $boot ]; do if [ $UDEVVERSION -ge 143 ]; then @@ -69,8 +69,15 @@ do_rhevh_check() return 0 } -fips_load_crypto() +do_fips() { + local _v + local _s + local _v + local _module + + KERNEL=$(uname -r) + FIPSMODULES=$(cat /etc/fipsmodules) info "Loading and integrity checking all crypto modules" @@ -95,16 +102,6 @@ fips_load_crypto() info "Self testing crypto algorithms" modprobe tcrypt || return 1 rmmod tcrypt -} - -do_fips() -{ - local _v - local _s - local _v - local _module - - KERNEL=$(uname -r) info "Checking integrity of kernel" if [ -e "/run/initramfs/live/vmlinuz0" ]; then @@ -113,16 +110,12 @@ do_fips() do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1 else BOOT_IMAGE="$(getarg BOOT_IMAGE)" - - # Trim off any leading GRUB boot device (e.g. ($root) ) - BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')" - BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}" BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}" if [ -z "$BOOT_IMAGE_NAME" ]; then BOOT_IMAGE_NAME="vmlinuz-${KERNEL}" - elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then + elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then #if /boot is not a separate partition BOOT_IMAGE might start with /boot BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"} #on some achitectures BOOT_IMAGE does not contain path to kernel @@ -133,13 +126,13 @@ do_fips() fi fi - BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac" + BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac" if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then warn "${BOOT_IMAGE_HMAC} does not exist" return 1 fi - (cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1 + sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1 fi info "All initrd crypto checks done" diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh index f011f15..f3af4d9 100755 --- a/modules.d/01fips/module-setup.sh +++ b/modules.d/01fips/module-setup.sh @@ -12,7 +12,7 @@ depends() { # called by dracut installkernel() { - local _fipsmodules _mod _bootfstype + local _fipsmodules _mod if [[ -f "${srcmods}/modules.fips" ]]; then _fipsmodules="$(cat "${srcmods}/modules.fips")" else @@ -24,7 +24,7 @@ installkernel() { _fipsmodules+="crc32c crct10dif ghash " # Ciphers: - _fipsmodules+="cipher_null des3_ede aes cfb " + _fipsmodules+="cipher_null des3_ede aes " # Modes/templates: _fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac " @@ -47,16 +47,6 @@ installkernel() { echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf" fi done - - # with hostonly_default_device fs module for /boot is not installed by default - if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then - _bootfstype=$(find_mp_fstype /boot) - if [[ -n "$_bootfstype" ]]; then - hostonly='' instmods $_bootfstype - else - dwarning "Can't determine fs type for /boot, FIPS check may fail." - fi - fi } # called by dracut @@ -64,7 +54,6 @@ install() { local _dir inst_hook pre-trigger 01 "$moddir/fips-boot.sh" inst_hook pre-pivot 01 "$moddir/fips-noboot.sh" - inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh" inst_script "$moddir/fips.sh" /sbin/fips.sh inst_multiple sha512hmac rmmod insmod mount uname umount diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh index a42e220..cb8a8fa 100755 --- a/modules.d/01systemd-initrd/module-setup.sh +++ b/modules.d/01systemd-initrd/module-setup.sh @@ -36,7 +36,7 @@ install() { $systemdsystemunitdir/initrd-udevadm-cleanup-db.service \ $systemdsystemunitdir/initrd-parse-etc.service - systemctl -q --root "$initdir" set-default initrd.target + ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target" local VERSION="" local PRETTY_NAME="" diff --git a/modules.d/02systemd-networkd/module-setup.sh b/modules.d/02systemd-networkd/module-setup.sh index 8b87923..b86751e 100755 --- a/modules.d/02systemd-networkd/module-setup.sh +++ b/modules.d/02systemd-networkd/module-setup.sh @@ -61,11 +61,11 @@ install() { for i in \ systemd-networkd-wait-online.service \ - systemd-networkd.service \ - systemd-networkd.socket -# systemd-timesyncd.service + systemd-networkd.service \ + systemd-networkd.socket +# systemd-timesyncd.service do - systemctl -q --root "$initdir" enable "$i" + systemctl --root "$initdir" enable "$i" done } diff --git a/modules.d/04watchdog-modules/module-setup.sh b/modules.d/04watchdog-modules/module-setup.sh deleted file mode 100755 index 5fbd769..0000000 --- a/modules.d/04watchdog-modules/module-setup.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/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 - [[ -d /sys/class/watchdog/ ]] || return - for _dir in /sys/class/watchdog/*; do - [[ -d "$_dir" ]] || continue - [[ -f "$_dir/state" ]] || 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 --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh index 15bcd89..7566d65 100755 --- a/modules.d/04watchdog/module-setup.sh +++ b/modules.d/04watchdog/module-setup.sh @@ -7,7 +7,7 @@ check() { # called by dracut depends() { - return "watchdog-modules" + return 0 } # called by dracut @@ -27,7 +27,53 @@ install() { 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 --git a/modules.d/06rngd/module-setup.sh b/modules.d/06rngd/module-setup.sh deleted file mode 100644 index 354bd0b..0000000 --- a/modules.d/06rngd/module-setup.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80: -# -# Copyright (c) 2019 Red Hat, Inc. -# Author: Renaud Métrich -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -depends() { - echo systemd - return 0 -} - -check() { - # if there's no rngd binary, no go. - require_binaries rngd || return 1 - - return 0 -} - -install() { - inst rngd - inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service" - - systemctl -q --root "$initdir" add-wants sysinit.target rngd.service -} diff --git a/modules.d/06rngd/rngd.service b/modules.d/06rngd/rngd.service deleted file mode 100644 index 570fbed..0000000 --- a/modules.d/06rngd/rngd.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Hardware RNG Entropy Gatherer Daemon -DefaultDependencies=no -Before=systemd-udevd.service - -[Service] -ExecStart=/usr/sbin/rngd -f diff --git a/modules.d/35network-legacy/dhclient-script.sh b/modules.d/35network-legacy/dhclient-script.sh index 44633b3..fc6ed0a 100755 --- a/modules.d/35network-legacy/dhclient-script.sh +++ b/modules.d/35network-legacy/dhclient-script.sh @@ -75,8 +75,8 @@ setup_interface() { setup_interface6() { domain=$new_domain_name - search=$(printf -- "$new_dhcp6_domain_search") - namesrv=$new_dhcp6_name_servers + search=$(printf -- "$new_domain_search") + namesrv=$new_domain_name_servers hostname=$new_host_name [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time [ -n "$new_max_life" ] && lease_time=$new_max_life @@ -126,11 +126,9 @@ parse_option_121() { elif [ $mask -gt 8 ]; then destination="$1.$2.0.0/$mask" shift; shift - elif [ $mask -gt 0 ]; then + else destination="$1.0.0.0/$mask" shift - else - destination="0.0.0.0/$mask" fi # Read the gateway @@ -140,7 +138,7 @@ parse_option_121() { # Multicast routing on Linux # - If you set a next-hop address for a multicast group, this breaks with Cisco switches # - If you simply leave it link-local and attach it to an interface, it works fine. - if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then + if [ $multicast -eq 1 ]; then temp_result="$destination dev $interface" else temp_result="$destination via $gateway dev $interface" diff --git a/modules.d/35network-legacy/dhcp-root.sh b/modules.d/35network-legacy/dhcp-root.sh new file mode 100755 index 0000000..06c5099 --- /dev/null +++ b/modules.d/35network-legacy/dhcp-root.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# This script is sourced, so root should be set. But let's be paranoid +[ -z "$root" ] && root=$(getarg root=) + +if [ -z "$netroot" ]; then + for netroot in $(getargs netroot=); do + [ "$netroot" = "dhcp" ] && break + [ "$netroot" = "dhcp6" ] && break + done + [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot +fi + +if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then + # Tell ip= checker that we need dhcp + NEEDDHCP="1" + + # Done, all good! + rootok=1 + if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then + netroot=$root + fi + + # Shut up init error check + [ -z "$root" ] && root="dhcp" + echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh +fi diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh index 6183874..ea2a67f 100755 --- a/modules.d/35network-legacy/ifup.sh +++ b/modules.d/35network-legacy/ifup.sh @@ -50,9 +50,8 @@ do_dhcp() { while [ $_COUNT -lt $_DHCPRETRY ]; do info "Starting dhcp for interface $netif" dhclient "$@" \ - ${_timeout:+--timeout $_timeout} \ + ${_timeout:+-timeout $_timeout} \ -q \ - -1 \ -cf /etc/dhclient.conf \ -pf /tmp/dhclient.$netif.pid \ -lf /tmp/dhclient.$netif.lease \ @@ -62,9 +61,6 @@ do_dhcp() { [ $_COUNT -lt $_DHCPRETRY ] && sleep 1 done warn "dhcp for interface $netif failed" - # nuke those files since we failed; we might retry dhcp again if it's e.g. - # `ip=dhcp,dhcp6` and we check for the PID file at the top - rm -f /tmp/dhclient.$netif.{pid,lease} return 1 } @@ -412,11 +408,7 @@ for p in $(getargs ip=); do esac # If this option isn't directed at our interface, skip it - if [ -n "$dev" ]; then - [ "$dev" != "$netif" ] && continue - else - iface_is_enslaved "$netif" && continue - fi + [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue # Store config for later use for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do @@ -453,16 +445,19 @@ for p in $(getargs ip=); do > /tmp/net.$(cat /sys/class/net/${netif}/address).up fi - # and finally, finish interface set up if there isn't already a script - # to do so (which is the case in the dhcp path) - if [ ! -e $hookdir/initqueue/setup_net_$netif.sh ]; then - setup_net $netif - source_hook initqueue/online $netif - if [ -z "$manualup" ]; then - /sbin/netroot $netif + 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 + fi fi - fi - + ;; + esac exit $ret fi done diff --git a/modules.d/35network-legacy/module-setup.sh b/modules.d/35network-legacy/module-setup.sh index 5a82e99..71abda3 100755 --- a/modules.d/35network-legacy/module-setup.sh +++ b/modules.d/35network-legacy/module-setup.sh @@ -36,6 +36,7 @@ install() { inst_simple -H "/etc/dhclient.conf" cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf" inst_hook pre-udev 60 "$moddir/net-genrules.sh" + inst_hook cmdline 91 "$moddir/dhcp-root.sh" inst_hook cmdline 92 "$moddir/parse-ibft.sh" inst_hook cmdline 95 "$moddir/parse-vlan.sh" inst_hook cmdline 96 "$moddir/parse-bond.sh" diff --git a/modules.d/35network-legacy/parse-team.sh b/modules.d/35network-legacy/parse-team.sh index 03fbcf2..a6eef18 100755 --- a/modules.d/35network-legacy/parse-team.sh +++ b/modules.d/35network-legacy/parse-team.sh @@ -1,12 +1,9 @@ #!/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() { @@ -18,11 +15,8 @@ parseteam() { done case $# in - 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" ;; + 2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;; + *) die "team= requires two parameters" ;; esac return 0 } @@ -32,18 +26,16 @@ for team in $(getargs team); do 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 $teamrunner." + warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup." mkdir -p /etc/teamd - printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf" + printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf" fi done diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh index ed2f399..62aba3c 100755 --- a/modules.d/35network-manager/module-setup.sh +++ b/modules.d/35network-manager/module-setup.sh @@ -26,9 +26,7 @@ install() { _nm_version=$(NetworkManager --version) - # We don't need `ip` but having it is *really* useful for people debugging - # in an emergency shell. - inst_multiple ip sed grep + inst_multiple sed grep inst NetworkManager inst /usr/libexec/nm-initrd-generator @@ -37,7 +35,6 @@ install() { inst_hook initqueue/settled 99 "$moddir/nm-run.sh" inst_rules 85-nm-unmanaged.rules inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so" - inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh" if [[ -x "$initdir/usr/sbin/dhclient" ]]; then inst /usr/libexec/nm-dhcp-helper @@ -48,11 +45,8 @@ install() { fi # We don't install the ifcfg files from the host automatically. - # But the user might choose to include them, so we pull in the machinery to read them. - inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so" - - _arch=${DRACUT_ARCH:-$(uname -m)} - - inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \ - {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" + # But if the user chooses to include them, we pull in the machinery to read them. + if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then + inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so" + fi } diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh index 2b9df02..1339ebe 100755 --- a/modules.d/35network-manager/nm-config.sh +++ b/modules.d/35network-manager/nm-config.sh @@ -1,9 +1,3 @@ #!/bin/sh -type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh - -if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then - echo rd.neednet >> /etc/cmdline.d/35-neednet.conf -fi - -nm_generate_connections +/usr/libexec/nm-initrd-generator -- $(getcmdline) diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh deleted file mode 100644 index fe053cf..0000000 --- a/modules.d/35network-manager/nm-lib.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -type getcmdline >/dev/null 2>&1 || . /lib/dracut-lib.sh - -nm_generate_connections() -{ - rm -f /run/NetworkManager/system-connections/* - /usr/libexec/nm-initrd-generator -- $(getcmdline) - - if getargbool 0 rd.neednet; then - for i in /usr/lib/NetworkManager/system-connections/* \ - /run/NetworkManager/system-connections/* \ - /etc/NetworkManager/system-connections/* \ - /etc/sysconfig/network-scripts/ifcfg-*; do - [ -f "$i" ] || continue - echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh - break - done - fi -} diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh index 6175238..f6defa9 100755 --- a/modules.d/35network-manager/nm-run.sh +++ b/modules.d/35network-manager/nm-run.sh @@ -1,30 +1,16 @@ #!/bin/sh -for i in /usr/lib/NetworkManager/system-connections/* \ - /run/NetworkManager/system-connections/* \ - /etc/NetworkManager/system-connections/* \ - /etc/sysconfig/network-scripts/ifcfg-*; do - [ -f "$i" ] || continue - if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then - /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace - else - /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon - fi +if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then + /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace +else + /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon +fi - if [ -s /run/NetworkManager/initrd/hostname ]; then - cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname - fi - break -done - -for _i in /sys/class/net/* +for _i in /sys/class/net/*/ do state=/run/NetworkManager/devices/$(cat $_i/ifindex) - grep -q connection-uuid= $state 2>/dev/null || continue - ifname=${_i##*/} - sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' <$state >/tmp/dhclient.$ifname.dhcpopts - source_hook initqueue/online $ifname + grep -q managed=true $state 2>/dev/null || continue + ifname=$(basename $_i) + sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts /sbin/netroot $ifname done - -> /tmp/nm.done diff --git a/modules.d/40network/dhcp-root.sh b/modules.d/40network/dhcp-root.sh deleted file mode 100755 index 06c5099..0000000 --- a/modules.d/40network/dhcp-root.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# This script is sourced, so root should be set. But let's be paranoid -[ -z "$root" ] && root=$(getarg root=) - -if [ -z "$netroot" ]; then - for netroot in $(getargs netroot=); do - [ "$netroot" = "dhcp" ] && break - [ "$netroot" = "dhcp6" ] && break - done - [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot -fi - -if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then - # Tell ip= checker that we need dhcp - NEEDDHCP="1" - - # Done, all good! - rootok=1 - if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then - netroot=$root - fi - - # Shut up init error check - [ -z "$root" ] && root="dhcp" - echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh -fi diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh index 8e2a74a..57c0a45 100755 --- a/modules.d/40network/module-setup.sh +++ b/modules.d/40network/module-setup.sh @@ -1,11 +1,6 @@ #!/bin/bash # called by dracut -check() { - return 255 -} - -# called by dracut depends() { echo -n "kernel-network-modules " if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then @@ -28,7 +23,6 @@ install() { inst_script "$moddir/netroot.sh" "/sbin/netroot" inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh" inst_hook pre-udev 50 "$moddir/ifname-genrules.sh" - inst_hook cmdline 91 "$moddir/dhcp-root.sh" dracut_need_initqueue } diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh index f0c1c04..1e7f1b3 100755 --- a/modules.d/40network/net-lib.sh +++ b/modules.d/40network/net-lib.sh @@ -251,10 +251,8 @@ ibft_to_cmdline() { [ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a) # Skip invalid interfaces (( $flags & 1 )) || continue - # Skip interfaces not used for booting unless using multipath - if ! getargbool 0 rd.iscsi.mp ; then - (( $flags & 2 )) || continue - fi + # Skip interfaces not used for booting + (( $flags & 2 )) || continue [ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a) [ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a) [ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a) @@ -465,7 +463,7 @@ ip_to_var() { # ip= means anaconda-style static config argument cluster autoconf="$1" - if strglob "$autoconf" "*.*.*.*"; then + if strstr "$autoconf" "*.*.*.*"; then # ip= means anaconda-style static config argument cluster: # ip= gateway= netmask= hostname= mtu= # ksdevice={link|bootif|ibft||} @@ -510,7 +508,7 @@ ip_to_var() { [ -n "$6" ] && dev=$6 [ -n "$7" ] && autoconf=$7 case "$8" in - [0-9a-fA-F]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*) + [0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*) dns1="$8" [ -n "$9" ] && dns2="$9" ;; @@ -655,8 +653,8 @@ wait_for_ipv6_dad_link() { timeout=$(($timeout*10)) while [ $cnt -lt $timeout ]; do - [ -n "$(ip -6 addr show dev "$1" scope link)" ] \ - && [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \ + [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \ + && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \ && return 0 [ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \ && return 1 @@ -673,8 +671,7 @@ wait_for_ipv6_dad() { timeout=$(($timeout*10)) while [ $cnt -lt $timeout ]; do - [ -n "$(ip -6 addr show dev "$1")" ] \ - && [ -z "$(ip -6 addr show dev "$1" tentative)" ] \ + [ -z "$(ip -6 addr show dev "$1" tentative)" ] \ && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \ && return 0 [ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \ @@ -719,7 +716,7 @@ iface_has_carrier() { interface="/sys/class/net/$interface" [ -d "$interface" ] || return 2 local timeout="$(getargs rd.net.timeout.carrier=)" - timeout=${timeout:-10} + timeout=${timeout:-5} timeout=$(($timeout*10)) linkup "$1" @@ -748,13 +745,6 @@ iface_has_link() { iface_has_carrier "$@" } -iface_is_enslaved() { - local _li - _li=$(ip -o link show dev $1) - strstr "$_li" " master " || return 1 - return 0 -} - find_iface_with_link() { local iface_path="" iface="" for iface_path in /sys/class/net/*; do diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh index abd111f..3bf847a 100755 --- a/modules.d/45ifcfg/write-ifcfg.sh +++ b/modules.d/45ifcfg/write-ifcfg.sh @@ -270,7 +270,7 @@ for netup in /tmp/net.*.did-setup ; do done fi i=1 - for ns in $(getargs nameserver) $dns1 $dns2; do + for ns in $(getargs nameserver); do echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif i=$((i+1)) done diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh index b4ead7f..23545e3 100755 --- a/modules.d/50drm/module-setup.sh +++ b/modules.d/50drm/module-setup.sh @@ -33,13 +33,13 @@ installkernel() { if [[ $hostonly ]]; then for i in /sys/bus/{pci/devices,virtio/devices,soc/devices/soc?}/*/modalias; do [[ -e $i ]] || continue - if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register" -S "iw_handler_get_spy" $(<$i); then + 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 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" "=drivers/gpu/drm" "=drivers/staging" fi } diff --git a/modules.d/80cms/cmsifup.sh b/modules.d/80cms/cmsifup.sh index 77c1845..902df8d 100755 --- a/modules.d/80cms/cmsifup.sh +++ b/modules.d/80cms/cmsifup.sh @@ -35,9 +35,4 @@ fi IFACES="$IFACES $DEVICE" echo "$IFACES" >> /tmp/net.ifaces -if [ -x /usr/libexec/nm-initrd-generator ]; then - type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh - nm_generate_connections -else - exec ifup "$DEVICE" -fi +exec ifup "$DEVICE" diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh index a26b6df..1ec5909 100755 --- a/modules.d/90crypt/module-setup.sh +++ b/modules.d/90crypt/module-setup.sh @@ -120,8 +120,6 @@ install() { inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh" 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 \ @@ -129,8 +127,6 @@ install() { $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 inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator fi diff --git a/modules.d/90dm/59-persistent-storage-dm.rules b/modules.d/90dm/59-persistent-storage-dm.rules index 2be1122..73b0937 100644 --- a/modules.d/90dm/59-persistent-storage-dm.rules +++ b/modules.d/90dm/59-persistent-storage-dm.rules @@ -1,7 +1,7 @@ SUBSYSTEM!="block", GOTO="dm_end" ACTION!="add|change", GOTO="dm_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end" KERNEL!="dm-[0-9]*", GOTO="dm_end" ACTION=="add", GOTO="dm_end" diff --git a/modules.d/90dmraid/61-dmraid-imsm.rules b/modules.d/90dmraid/61-dmraid-imsm.rules index 8a6b215..72267d3 100644 --- a/modules.d/90dmraid/61-dmraid-imsm.rules +++ b/modules.d/90dmraid/61-dmraid-imsm.rules @@ -5,7 +5,7 @@ SUBSYSTEM!="block", GOTO="dm_end" ACTION!="add|change", GOTO="dm_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end" ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end" diff --git a/modules.d/90kernel-modules-extra/module-setup.sh b/modules.d/90kernel-modules-extra/module-setup.sh index 1706c82..c0a2b7f 100755 --- a/modules.d/90kernel-modules-extra/module-setup.sh +++ b/modules.d/90kernel-modules-extra/module-setup.sh @@ -187,7 +187,7 @@ installkernel() printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \ | (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \ | tr -d ':' \ - | (cd "$depmod_module_dir" || exit; xargs -r realpath -se --) \ + | (cd "$depmod_module_dir" || exit; xargs -r realpath -e --) \ | instmods || return 1 return 0 diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh index 8685203..3dfceff 100755 --- a/modules.d/90kernel-modules/module-setup.sh +++ b/modules.d/90kernel-modules/module-setup.sh @@ -2,8 +2,6 @@ # 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' - find_kernel_modules_external () { local _OLDIFS local external_pattern="^/" @@ -18,25 +16,11 @@ installkernel() { done < "$srcmods/modules.dep" IFS=$_OLDIFS } - - is_block_dev() { - [ -e /sys/dev/block/$1 ] && return 0 - return 1 - } - - install_block_modules () { - hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix - instmods \ - scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ - =ide nvme vmd nfit \ - virtio_blk - - dracut_instmods -o -s "${_blockfuncs}" "=drivers" - } + 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' if [[ -z $drivers ]]; then hostonly='' instmods \ - hid_generic unix \ + sr_mod sd_mod scsi_dh ata_piix hid_generic unix \ ehci-hcd ehci-pci ehci-platform \ ohci-hcd ohci-pci \ uhci-hcd \ @@ -54,10 +38,10 @@ installkernel() { ${NULL} instmods \ - yenta_socket \ + yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ - virtio virtio_ring virtio_pci virtio_scsi pci_hyperv \ - "=drivers/pcmcia" + virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ + "=drivers/pcmcia" =ide nvme vmd nfit if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then # arm/aarch64 specific modules @@ -88,11 +72,9 @@ installkernel() { ${NULL} fi - find_kernel_modules_external | instmods + dracut_instmods -o -s "${_blockfuncs}" "=drivers" - if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then - install_block_modules - fi + find_kernel_modules_external | instmods # if not on hostonly mode, install all known filesystems, # if the required list is not set via the filesystems variable diff --git a/modules.d/90kernel-network-modules/module-setup.sh b/modules.d/90kernel-network-modules/module-setup.sh index f36d31f..600ef11 100755 --- a/modules.d/90kernel-network-modules/module-setup.sh +++ b/modules.d/90kernel-network-modules/module-setup.sh @@ -14,27 +14,15 @@ depends() { installkernel() { # Include wired net drivers, excluding wireless local _arch=$(uname -m) - local _net_symbols='eth_type_trans|register_virtio_device|usbnet_open' + local _net_drivers='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 - dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net" + _s390drivers="=drivers/s390/net" fi - 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_drivers" "=drivers/net" ${_s390drivers:+"$_s390drivers"} - dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net" #instmods() will take care of hostonly instmods \ =drivers/net/phy \ diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules index 65f6524..3ce0c1f 100644 --- a/modules.d/90lvm/64-lvm.rules +++ b/modules.d/90lvm/64-lvm.rules @@ -7,7 +7,7 @@ SUBSYSTEM!="block", GOTO="lvm_end" ACTION!="add|change", GOTO="lvm_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="lvm_end" KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end" ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end" diff --git a/modules.d/90mdraid/59-persistent-storage-md.rules b/modules.d/90mdraid/59-persistent-storage-md.rules index 96b1010..6ef858a 100644 --- a/modules.d/90mdraid/59-persistent-storage-md.rules +++ b/modules.d/90mdraid/59-persistent-storage-md.rules @@ -1,7 +1,7 @@ SUBSYSTEM!="block", GOTO="md_end" ACTION!="add|change", GOTO="md_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end" KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end" diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules index 52f5b19..d66dd01 100644 --- a/modules.d/90mdraid/65-md-incremental-imsm.rules +++ b/modules.d/90mdraid/65-md-incremental-imsm.rules @@ -9,7 +9,7 @@ KERNEL=="md*", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end" KERNEL=="md*", ACTION!="change", GOTO="md_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end" ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try" GOTO="md_end" diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh index 1844a03..f825c00 100755 --- a/modules.d/90multipath/module-setup.sh +++ b/modules.d/90multipath/module-setup.sh @@ -29,7 +29,6 @@ check() { # if there's no multipath binary, no go. require_binaries multipath || return 1 - require_binaries kpartx || return 1 return 0 } @@ -83,12 +82,11 @@ install() { dmsetup \ kpartx \ mpath_wait \ - mpathconf \ - mpathpersist \ multipath \ multipathd \ - xdrgetprio \ + mpathpersist \ xdrgetuid \ + xdrgetprio \ /etc/xdrdevices.conf \ /etc/multipath.conf \ /etc/multipath/* \ @@ -110,10 +108,9 @@ install() { fi if dracut_module_included "systemd"; then - inst_simple "${moddir}/multipathd-configure.service" "${systemdsystemunitdir}/multipathd-configure.service" inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service" - systemctl -q --root "$initdir" enable multipathd-configure.service - systemctl -q --root "$initdir" enable multipathd.service + mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants" + ln -rfs "${initdir}${systemdsystemunitdir}/multipathd.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/multipathd.service" else inst_hook pre-trigger 02 "$moddir/multipathd.sh" inst_hook cleanup 02 "$moddir/multipathd-stop.sh" @@ -125,6 +122,6 @@ install() { 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-parts.rules + 11-dm-mpath.rules } diff --git a/modules.d/90multipath/multipathd-configure.service b/modules.d/90multipath/multipathd-configure.service deleted file mode 100644 index de69061..0000000 --- a/modules.d/90multipath/multipathd-configure.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=Device-Mapper Multipath Default Configuration -Before=iscsi.service iscsid.service lvm2-activation-early.service -Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target -After=systemd-udev-trigger.service systemd-udev-settle.service -Before=local-fs-pre.target multipathd.service -DefaultDependencies=no -Conflicts=shutdown.target - -ConditionKernelCommandLine=rd.multipath=default -ConditionPathExists=!/etc/multipath.conf - -[Service] -Type=oneshot -ExecStartPre=-/usr/bin/mkdir -p /etc/multipath/multipath.conf.d -ExecStart=/usr/sbin/mpathconf --enable - -[Install] -WantedBy=sysinit.target diff --git a/modules.d/90multipath/multipathd.sh b/modules.d/90multipath/multipathd.sh index b0183ff..2c2dcc8 100755 --- a/modules.d/90multipath/multipathd.sh +++ b/modules.d/90multipath/multipathd.sh @@ -1,10 +1,5 @@ #!/bin/sh -if [ "$(getarg rd.multipath)" = "default" ] && [ ! -e /etc/multipath.conf ]; then - mkdir -p /etc/multipath/multipath.conf.d - mpathconf --enable -fi - if getargbool 1 rd.multipath -d -n rd_NO_MULTIPATH && [ -e /etc/multipath.conf ]; then modprobe dm-multipath multipathd -B || multipathd diff --git a/modules.d/90stratis/module-setup.sh b/modules.d/90stratis/module-setup.sh index 943f572..29f0765 100755 --- a/modules.d/90stratis/module-setup.sh +++ b/modules.d/90stratis/module-setup.sh @@ -24,7 +24,8 @@ install() { if dracut_module_included "systemd"; then inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service" - systemctl -q --root "$initdir" enable stratisd-init.service + mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants" + ln -rfs "${initdir}${systemdsystemunitdir}/stratisd-init.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/stratisd-init.service" else inst_hook cmdline 25 "$moddir/stratisd-start.sh" inst_hook cleanup 25 "$moddir/stratisd-stop.sh" diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh index ec33a9e..0da6130 100755 --- a/modules.d/95dasd/module-setup.sh +++ b/modules.d/95dasd/module-setup.sh @@ -18,9 +18,8 @@ depends() { install() { inst_hook cmdline 30 "$moddir/parse-dasd.sh" inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg - conf=/etc/dasd.conf - if [[ $hostonly && -f $conf ]] ; then - inst -H $conf + if [[ $hostonly ]]; then + inst -H /etc/dasd.conf fi inst_rules 56-dasd.rules inst_rules 59-dasd.rules diff --git a/modules.d/95fcoe/lldpad.sh b/modules.d/95fcoe/lldpad.sh index 444c943..d06a3bd 100755 --- a/modules.d/95fcoe/lldpad.sh +++ b/modules.d/95fcoe/lldpad.sh @@ -1,10 +1,5 @@ #!/bin/bash -if ! getargbool 0 rd.nofcoe ; then - info "rd.nofcoe=0: skipping lldpad activation" - return 0 -fi - # Note lldpad will stay running after switchroot, the system initscripts # are to kill it and start a new lldpad to take over. Data is transfered # between the 2 using a shm segment diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh index c2224ec..63f45b5 100755 --- a/modules.d/95fcoe/module-setup.sh +++ b/modules.d/95fcoe/module-setup.sh @@ -23,7 +23,7 @@ depends() { # called by dracut installkernel() { - instmods fcoe libfcoe 8021q edd bnx2fc + instmods fcoe 8021q edd } get_vlan_parent() { diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh index 8bb55c6..75cca9a 100755 --- a/modules.d/95fcoe/parse-fcoe.sh +++ b/modules.d/95fcoe/parse-fcoe.sh @@ -13,17 +13,12 @@ # fcoe=eth0:nodcb:vn2vn # fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric -if ! getargbool 0 rd.nofcoe ; then - info "rd.nofcoe=0: skipping fcoe" - return 0 -fi - [ -z "$fcoe" ] && fcoe=$(getarg fcoe=) # If it's not set we don't continue [ -z "$fcoe" ] && return -[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || modprobe -b -a libfcoe || die "FCoE requested but kernel/initrd does not support FCoE" +[ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE" initqueue --onetime modprobe -b -q bnx2fc diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh index 618d1dc..5c2073b 100755 --- a/modules.d/95iscsi/module-setup.sh +++ b/modules.d/95iscsi/module-setup.sh @@ -4,7 +4,7 @@ check() { local _rootdev # If our prerequisites are not met, fail anyways. - require_binaries iscsi-iname iscsiadm iscsid || return 1 + require_binaries hostname iscsi-iname iscsiadm iscsid || return 1 # If hostonly was requested, fail the check if we are not actually # booting from root. @@ -86,8 +86,6 @@ install_iscsiroot() { iscsi_host=${host##*/} for flash in ${host}/flashnode_sess-* ; do - [ -f "$flash" ] || continue - [ ! -e "$flash/is_boot_target" ] && continue is_boot=$(cat $flash/is_boot_target) if [ $is_boot -eq 1 ] ; then # qla4xxx flashnode session; skip iBFT discovery @@ -208,7 +206,7 @@ cmdline() { install() { inst_multiple -o iscsiuio inst_libdir_file 'libgcc_s.so*' - inst_multiple umount iscsi-iname iscsiadm iscsid + inst_multiple umount hostname iscsi-iname iscsiadm iscsid inst_multiple -o \ $systemdsystemunitdir/iscsid.socket \ @@ -244,18 +242,20 @@ install() { $systemdsystemunitdir/iscsiuio.socket \ iscsiadm iscsid + mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants" for i in \ iscsid.socket \ iscsiuio.socket \ ; do - systemctl -q --root "$initdir" enable "$i" + ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}" done - + + mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants" for i in \ iscsid.service \ iscsiuio.service \ ; do - systemctl -q --root "$initdir" add-wants basic.target "$i" + ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}" done # Make sure iscsid is started after dracut-cmdline and ready for the initqueue @@ -265,23 +265,6 @@ install() { echo "After=dracut-cmdline.service" echo "Before=dracut-initqueue.service" ) > "${initdir}/$systemdsystemunitdir/iscsid.service.d/dracut.conf" - - # The iscsi deamon does not need to wait for any storage inside initrd - mkdir -p "${initdir}/$systemdsystemunitdir/iscsid.socket.d" - ( - echo "[Unit]" - echo "DefaultDependencies=no" - echo "Conflicts=shutdown.target" - echo "Before=shutdown.target sockets.target" - ) > "${initdir}/$systemdsystemunitdir/iscsid.socket.d/dracut.conf" - mkdir -p "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d" - ( - echo "[Unit]" - echo "DefaultDependencies=no" - echo "Conflicts=shutdown.target" - echo "Before=shutdown.target sockets.target" - ) > "${initdir}/$systemdsystemunitdir/iscsiuio.socket.d/dracut.conf" - fi inst_dir /var/lib/iscsi dracut_need_initqueue diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh index f00a83b..7a64d88 100755 --- a/modules.d/95iscsi/parse-iscsiroot.sh +++ b/modules.d/95iscsi/parse-iscsiroot.sh @@ -107,13 +107,14 @@ if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ iscsi_initiator=$arg echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi - rm -f /etc/iscsi/initiatorname.iscsi - mkdir -p /etc/iscsi - ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi - if [ -n "$DRACUT_SYSTEMD" ]; then - systemctl try-restart iscsid - # FIXME: iscsid is not yet ready, when the service is :-/ - sleep 1 + if ! [ -e /etc/iscsi/initiatorname.iscsi ]; then + mkdir -p /etc/iscsi + ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi + if [ -n "$DRACUT_SYSTEMD" ]; then + systemctl try-restart iscsid + # FIXME: iscsid is not yet ready, when the service is :-/ + sleep 1 + fi fi fi diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh index 95844f5..1ba4f5f 100755 --- a/modules.d/95nfs/nfs-lib.sh +++ b/modules.d/95nfs/nfs-lib.sh @@ -112,8 +112,8 @@ nfsroot_from_dhcp() { [ -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_next_server [ -z "$server" ] && server=$new_dhcp_server_identifier + [ -z "$server" ] && server=$new_next_server [ -z "$server" ] && server=${new_root_path%%:*} } diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh deleted file mode 100755 index 418b5e0..0000000 --- a/modules.d/95nvmf/module-setup.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -# called by dracut -check() { - require_binaries nvme || return 1 - [ -f /etc/nvme/hostnqn ] || return 255 - [ -f /etc/nvme/hostid ] || return 255 - - is_nvmf() { - 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 - [[ "$trtype" == "fc" ]] || [[ "$trtype" == "tcp" ]] || [[ "$trtype" == "rdma" ]] - } - - [[ $hostonly ]] || [[ $mount_needs ]] && { - pushd . >/dev/null - for_each_host_dev_and_slaves is_nvmf - local _is_nvmf=$? - popd >/dev/null - [[ $_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" - return 255 - fi - fi - } - return 0 -} - -# called by dracut -depends() { - 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 - if [ -f /etc/nvme/hostnqn ] ; then - _hostnqn=$(cat /etc/nvme/hostnqn) - echo -n " nvmf.hostnqn=${_hostnqn}" - fi - if [ -f /etc/nvme/hostid ] ; then - _hostid=$(cat /etc/nvme/hostid) - echo -n " nvmf.hostid=${_hostid}" - fi - echo "" -} - -# called by dracut -install() { - if [[ $hostonly_cmdline == "yes" ]]; then - local _nvmf_args=$(cmdline) - [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf" - fi - inst_simple "/etc/nvme/hostnqn" - inst_simple "/etc/nvme/hostid" - - inst_multiple ip sed - - 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 - dracut_need_initqueue -} diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh deleted file mode 100755 index 61c6dec..0000000 --- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/sh -# -# Supported formats: -# nvmf.hostnqn= -# nvmf.hostid= -# nvmf.discover=::: -# -# Examples: -# nvmf.hostnqn=nqn.2014-08.org.nvmexpress:uuid:37303738-3034-584d-5137-333230423843 -# nvmf.discover=rdma:192.168.1.3::4420 -# nvme.discover=tcp:192.168.1.3::4420 -# nvme.discover=tcp:192.168.1.3 -# 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 - -traddr="none" -trtype="none" -hosttraddr="none" -trsvcid=4420 - -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=: - set $1 - IFS="$OLDIFS" - - case $# in - 2) - [ -n "$1" ] && trtype=$1 - [ -n "$2" ] && traddr=$2 - ;; - 3) - [ -n "$1" ] && trtype=$1 - [ -n "$2" ] && traddr=$2 - [ -n "$3" ] && hosttraddr=$3 - ;; - 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 - ;; - esac - if [ "$traddr" = "none" ] ; then - warn "traddr is mandatory for $trtype" - return 1; - fi - if [ "$trtype" = "fc" ] ; then - if [ "$hosttraddr" = "none" ] ; then - warn "host traddr is mandatory for fc" - return 1 - fi - elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ] ; then - warn "unsupported transport $trtype" - return 1 - fi - if [ "$trtype" = "tcp" ]; then - validate_ip_conn - fi - echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf -} - -nvmf_hostnqn=$(getarg nvmf.hostnqn=) -if [ -n "$nvmf_hostnqn" ] ; then - echo "$nvmf_hostnqn" > /etc/nvme/hostnqn -fi -nvmf_hostid=$(getarg nvmf.hostid=) -if [ -n "$nvmf_hostid" ] ; then - echo "$nvmf_hostid" > /etc/nvme/hostid -fi - -for d in $(getargs nvmf.discover=); do - parse_nvmf_discover "$d" -done - -# Host NQN and host id are mandatory for NVMe-oF -[ -f "/etc/nvme/hostnqn" ] || exit 0 -[ -f "/etc/nvme/hostid" ] || exit 0 - -if [ -f "/etc/nvme/discovery.conf" ] ; then - if [ "$trtype" = "tcp" ] ; then - /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all - > /tmp/net.$ifname.did-setup - else - /sbin/initqueue --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all - fi -else - if [ "$trtype" = "tcp" ] ; then - /sbin/initqueue --settled --onetime --unique /usr/sbin/nvme connect-all -t tcp -a $traddr -s $trsvcid - > /tmp/net.$ifname.did-setup - else - /sbin/initqueue --finished --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery - fi -fi diff --git a/modules.d/95udev-rules/59-persistent-storage.rules b/modules.d/95udev-rules/59-persistent-storage.rules index 8d8650f..47ff6ed 100644 --- a/modules.d/95udev-rules/59-persistent-storage.rules +++ b/modules.d/95udev-rules/59-persistent-storage.rules @@ -1,7 +1,7 @@ SUBSYSTEM!="block", GOTO="ps_end" ACTION!="add|change", GOTO="ps_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="ps_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end" KERNEL=="cciss[0-9]*", IMPORT BLKID KERNEL=="nbd[0-9]*", IMPORT BLKID diff --git a/modules.d/95udev-rules/61-persistent-storage.rules b/modules.d/95udev-rules/61-persistent-storage.rules index 895eceb..37148b0 100644 --- a/modules.d/95udev-rules/61-persistent-storage.rules +++ b/modules.d/95udev-rules/61-persistent-storage.rules @@ -1,7 +1,7 @@ SUBSYSTEM!="block", GOTO="pss_end" ACTION!="add|change", GOTO="pss_end" # Also don't process disks that are slated to be a multipath device -ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="pss_end" +ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="pss_end" ACTION=="change", KERNEL=="dm-[0-9]*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="do_pss" KERNEL=="cciss[0-9]*", GOTO="do_pss" diff --git a/modules.d/95zfcp/parse-zfcp.sh b/modules.d/95zfcp/parse-zfcp.sh index 5aa6add..6e1514f 100755 --- a/modules.d/95zfcp/parse-zfcp.sh +++ b/modules.d/95zfcp/parse-zfcp.sh @@ -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 --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh index 59b588f..7d40a1a 100755 --- a/modules.d/95znet/parse-ccw.sh +++ b/modules.d/95znet/parse-ccw.sh @@ -4,22 +4,4 @@ for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); echo $ccw_arg >> /etc/ccw.conf done -for ifname in $(getargs rd.znet_ifname); do - IFS=: read ifname_if ifname_subchannels _rest <<< "$ifname" - if [ -z "$ifname_if" ] || [ -z "$ifname_subchannels" ] || [ -n "$_rest" ]; then - warn "Invalid arguments for rd.znet_ifname=" - else - { - ifname_subchannels=${ifname_subchannels//,/|} - - echo 'ACTION!="add|change", GOTO="ccw_ifname_end"' - echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"' - echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"' - echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\"" - echo 'LABEL="ccw_ifname_end"' - - } > /etc/udev/rules.d/81-ccw-ifname.rules - fi -done - znet_cio_free diff --git a/modules.d/98dracut-systemd/dracut-cmdline.sh b/modules.d/98dracut-systemd/dracut-cmdline.sh index 6c6ee02..bff9435 100755 --- a/modules.d/98dracut-systemd/dracut-cmdline.sh +++ b/modules.d/98dracut-systemd/dracut-cmdline.sh @@ -42,7 +42,7 @@ export root export rflags export fstype -make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' +make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem' # run scriptlets to parse the command line getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" source_hook cmdline diff --git a/modules.d/98dracut-systemd/dracut-pre-mount.sh b/modules.d/98dracut-systemd/dracut-pre-mount.sh index ae51128..a3b9d29 100755 --- a/modules.d/98dracut-systemd/dracut-pre-mount.sh +++ b/modules.d/98dracut-systemd/dracut-pre-mount.sh @@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh source_conf /etc/conf.d -make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' +make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount" diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh index cc70e3c..dc9a250 100755 --- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh +++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh @@ -8,12 +8,13 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh source_conf /etc/conf.d -make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' +make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot" source_hook pre-pivot +cleanup_trace_mem # pre pivot cleanup scripts are sourced just before we switch over to the new root. getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" source_hook cleanup diff --git a/modules.d/98dracut-systemd/dracut-pre-trigger.sh b/modules.d/98dracut-systemd/dracut-pre-trigger.sh index a1a3396..7cd821e 100755 --- a/modules.d/98dracut-systemd/dracut-pre-trigger.sh +++ b/modules.d/98dracut-systemd/dracut-pre-trigger.sh @@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh source_conf /etc/conf.d -make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' +make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' source_hook pre-trigger diff --git a/modules.d/98dracut-systemd/module-setup.sh b/modules.d/98dracut-systemd/module-setup.sh index 9a0f476..900162c 100755 --- a/modules.d/98dracut-systemd/module-setup.sh +++ b/modules.d/98dracut-systemd/module-setup.sh @@ -55,7 +55,7 @@ install() { dracut-pre-udev.service \ ; do inst_simple "$moddir/${i}" "$systemdsystemunitdir/${i}" - systemctl -q --root "$initdir" add-wants initrd.target "$i" + ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/initrd.target.wants/${i}" done inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf" diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh index bb376c0..4ae693b 100755 --- a/modules.d/98dracut-systemd/rootfs-generator.sh +++ b/modules.d/98dracut-systemd/rootfs-generator.sh @@ -13,15 +13,8 @@ generator_wait_for_dev() if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then - # 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" ]\n' $1 \ + >> "$hookdir/initqueue/finished/devexists-${_name}.sh" { printf '[ -e "%s" ] || ' $1 printf 'warn "\"%s\" does not exist"\n' $1 diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 96dd55a..f71e757 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -531,7 +531,7 @@ incol2() { } udevsettle() { - [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) if [ $UDEVVERSION -ge 143 ]; then udevadm settle --exit-if-exists=$hookdir/initqueue/work $settle_exit_if_exists @@ -541,7 +541,7 @@ udevsettle() { } udevproperty() { - [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) + [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) if [ $UDEVVERSION -ge 143 ]; then for i in "$@"; do udevadm control --property=$i; done @@ -1220,25 +1220,50 @@ are_lists_eq() { setmemdebug() { if [ -z "$DEBUG_MEM_LEVEL" ]; then - export DEBUG_MEM_LEVEL=$(getargnum 0 0 5 rd.memdebug) + export DEBUG_MEM_LEVEL=$(getargnum 0 0 4 rd.memdebug) fi } setmemdebug -# parameters: func log_level prefix msg [trace_level:trace]... +cleanup_trace_mem() +{ + # tracekomem based on kernel trace needs cleanup after use. + if [ "$DEBUG_MEM_LEVEL" -eq 4 ]; then + tracekomem --cleanup + fi +} + +# parameters: msg [trace_level:trace]... make_trace_mem() { - local log_level prefix msg msg_printed + local msg + msg="$1" + shift + if [ -n "$DEBUG_MEM_LEVEL" ] && [ "$DEBUG_MEM_LEVEL" -gt 0 ]; then + make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@" >&2 + fi +} + +# parameters: func log_level prefix msg [trace_level:trace]... +make_trace() +{ + local func log_level prefix msg msg_printed local trace trace_level trace_in_higher_levels insert_trace - msg=$1 + func=$1 shift - prefix='[debug_mem]' - log_level=$DEBUG_MEM_LEVEL + log_level=$1 + shift + + prefix=$1 + shift - if [ -z "$log_level" ] || [ "$log_level" -le 0 ]; then + msg=$1 + shift + + if [ -z "$log_level" ]; then return fi @@ -1271,7 +1296,7 @@ make_trace_mem() echo "$prefix $msg" msg_printed=1 fi - show_memstats $trace + $func $trace fi shift done @@ -1293,6 +1318,9 @@ show_memstats() iomem) cat /proc/iomem ;; + komem) + tracekomem + ;; esac } diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index 732a7f4..e4f7cff 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -92,7 +92,7 @@ fi trap "emergency_shell Signal caught!" 0 -export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; }) +export UDEVVERSION=$(udevadm --version) if [ $UDEVVERSION -gt 166 ]; then # newer versions of udev use /run/udev/rules.d export UDEVRULESD=/run/udev/rules.d @@ -131,7 +131,7 @@ if ! getargbool 1 'rd.hostonly'; then fi # run scriptlets to parse the command line -make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' +make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem' getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" source_hook cmdline @@ -160,7 +160,7 @@ fi udevproperty "hookdir=$hookdir" -make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' +make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" source_hook pre-trigger @@ -230,7 +230,7 @@ unset RDRETRY # pre-mount happens before we try to mount the root filesystem, # and happens once. -make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' +make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount" source_hook pre-mount @@ -266,11 +266,12 @@ done # pre pivot scripts are sourced just before we doing cleanup and switch over # to the new root. -make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' +make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot" source_hook pre-pivot make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab' +cleanup_trace_mem # pre pivot cleanup scripts are sourced just before we switch over to the new root. getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" source_hook cleanup diff --git a/modules.d/99base/memtrace-ko.sh b/modules.d/99base/memtrace-ko.sh new file mode 100755 index 0000000..ee035e1 --- /dev/null +++ b/modules.d/99base/memtrace-ko.sh @@ -0,0 +1,191 @@ +#!/bin/sh + +# Try to find out kernel modules with large total memory allocation during loading. +# For large slab allocation, it will fall into buddy, also not trace "mm_page_free" +# considering large free is quite rare for module_init, thus saving tons of events +# to avoid trace data overwritten. +# +# Therefore, tracing "mm_page_alloc"alone should be enough for the purpose. + +# "sys/kernel/tracing" has the priority if exists. +get_trace_base() { + # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available. + if [ -d "/sys/kernel/tracing" ]; then + echo "/sys/kernel" + else + echo "/sys/kernel/debug" + fi +} + +# We want to enable these trace events. +get_want_events() { + echo "module:module_put module:module_load kmem:mm_page_alloc" +} + +get_event_filter() { + echo "comm == systemd-udevd || comm == modprobe || comm == insmod" +} + +is_trace_ready() { + local trace_base want_events current_events + + trace_base=$(get_trace_base) + ! [ -f "$trace_base/tracing/trace" ] && return 1 + + [ "$(cat $trace_base/tracing/tracing_on)" -eq 0 ] && return 1 + + # Also check if trace events were properly setup. + want_events=$(get_want_events) + current_events=$(echo $(cat $trace_base/tracing/set_event)) + [ "$current_events" != "$want_events" ] && return 1 + + return 0 +} + +prepare_trace() { + local trace_base + + trace_base=$(get_trace_base) + # old debugfs interface case. + if ! [ -d "$trace_base/tracing" ]; then + mount none -t debugfs $trace_base + # new tracefs interface case. + elif ! [ -f "$trace_base/tracing/trace" ]; then + mount none -t tracefs "$trace_base/tracing" + fi + + if ! [ -f "$trace_base/tracing/trace" ]; then + echo "WARN: Mount trace failed for kernel module memory analyzing." + return 1 + fi + + # Active all the wanted trace events. + echo "$(get_want_events)" > $trace_base/tracing/set_event + + # There are three kinds of known applications for module loading: + # "systemd-udevd", "modprobe" and "insmod". + # Set them as the global events filter. + # NOTE: Some kernel may not support this format of filter, anyway + # the operation will fail and it doesn't matter. + echo "$(get_event_filter)" > $trace_base/tracing/events/kmem/filter 2>&1 + echo "$(get_event_filter)" > $trace_base/tracing/events/module/filter 2>&1 + + # Set the number of comm-pid if supported. + if [ -f "$trace_base/tracing/saved_cmdlines_size" ]; then + # Thanks to filters, 4096 is big enough(also well supported). + echo 4096 > $trace_base/tracing/saved_cmdlines_size + fi + + # Enable and clear trace data for the first time. + echo 1 > $trace_base/tracing/tracing_on + echo > $trace_base/tracing/trace + echo "Prepare trace success." + return 0 +} + +order_to_pages() +{ + local pages=1 + local order=$1 + + while [ "$order" != 0 ]; do + order=$((order-1)) + pages=$(($pages*2)) + done + + echo $pages +} + +parse_trace_data() { + local module_name tmp_eval pages + + cat "$(get_trace_base)/tracing/trace" | while read pid cpu flags ts function args + do + # Skip comment lines + if [ "$pid" = "#" ]; then + continue + fi + + pid=${pid##*-} + function=${function%:} + if [ "$function" = "module_load" ]; then + # One module is being loaded, save the task pid for tracking. + # Remove the trailing after whitespace, there may be the module flags. + module_name=${args%% *} + # Mark current_module to track the task. + eval current_module_$pid="$module_name" + tmp_eval=$(eval echo '${module_loaded_'${module_name}'}') + if [ -n "$tmp_eval" ]; then + echo "WARN: \"$module_name\" was loaded multiple times!" + fi + eval unset module_loaded_$module_name + eval nr_alloc_pages_$module_name=0 + continue + fi + + module_name=$(eval echo '${current_module_'${pid}'}') + if [ -z "$module_name" ]; then + continue + fi + + # Once we get here, the task is being tracked(is loading a module). + if [ "$function" = "module_put" ]; then + # Mark the module as loaded when the first module_put event happens after module_load. + tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}') + echo "$tmp_eval pages consumed by \"$module_name\"" + eval module_loaded_$module_name=1 + # Module loading finished, so untrack the task. + eval unset current_module_$pid + eval unset nr_alloc_pages_$module_name + continue + fi + + if [ "$function" = "mm_page_alloc" ]; then + # Get order first, then convert to actual pages. + pages=$(echo $args | sed -e 's/.*order=\([0-9]*\) .*/\1/') + pages=$(order_to_pages "$pages") + tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}') + eval nr_alloc_pages_$module_name="$(($tmp_eval+$pages))" + fi + done +} + +cleanup_trace() { + local trace_base + + if is_trace_ready; then + trace_base=$(get_trace_base) + echo 0 > $trace_base/tracing/tracing_on + echo > $trace_base/tracing/trace + echo > $trace_base/tracing/set_event + echo 0 > $trace_base/tracing/events/kmem/filter + echo 0 > $trace_base/tracing/events/module/filter + fi +} + +show_usage() { + echo "Find out kernel modules with large memory consumption during loading based on trace." + echo "Usage:" + echo "1) run it first to setup trace." + echo "2) run again to parse the trace data if any." + echo "3) run with \"--cleanup\" option to cleanup trace after use." +} + +if [ "$1" = "--help" ]; then + show_usage + exit 0 +fi + +if [ "$1" = "--cleanup" ]; then + cleanup_trace + exit 0 +fi + +if is_trace_ready ; then + echo "tracekomem - Rough memory consumption by loading kernel modules (larger value with better accuracy)" + parse_trace_data +else + prepare_trace +fi + +exit $? diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh index d10aa6a..21523fc 100755 --- a/modules.d/99base/module-setup.sh +++ b/modules.d/99base/module-setup.sh @@ -35,6 +35,7 @@ install() { inst_script "$moddir/initqueue.sh" "/sbin/initqueue" inst_script "$moddir/loginit.sh" "/sbin/loginit" inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport" + inst_script "$moddir/memtrace-ko.sh" "/sbin/tracekomem" [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib mkdir -m 0755 -p ${initdir}/lib/dracut @@ -74,7 +75,7 @@ install() { VERSION+="dracut-$DRACUT_VERSION" PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)" VERSION_ID=$DRACUT_VERSION - ANSI_COLOR="0;31" + ANSI_COLOR="0;34" [ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p ${initdir}/usr/lib { @@ -92,7 +93,7 @@ install() { ## save host_devs which we need bring up if [[ $hostonly_cmdline == "yes" ]]; then - if [[ -n "${host_devs[@]}" ]]; then + if [[ -n $add_device ]]; then dracut_need_initqueue fi if [[ -f "$initdir/lib/dracut/need-initqueue" ]] || ! dracut_module_included "systemd"; then diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh index 11e795d..d39ca1b 100755 --- a/modules.d/99fs-lib/fs-lib.sh +++ b/modules.d/99fs-lib/fs-lib.sh @@ -44,22 +44,22 @@ fsck_able() { ;; ext?) type e2fsck >/dev/null 2>&1 && - _drv="fsck_drv_com e2fsck" && + _drv="_drv=e2fsck fsck_drv_com" && return 0 ;; f2fs) type fsck.f2fs >/dev/null 2>&1 && - _drv="fsck_drv_com fsck.f2fs" && + _drv="_drv=fsck.f2fs fsck_drv_com" && return 0 ;; jfs) type jfs_fsck >/dev/null 2>&1 && - _drv="fsck_drv_com jfs_fsck" && + _drv="_drv=jfs_fsck fsck_drv_com" && return 0 ;; reiserfs) type reiserfsck >/dev/null 2>&1 && - _drv="fsck_drv_com reiserfsck" && + _drv="_drv=reiserfsck fsck_drv_com" && return 0 ;; btrfs) @@ -70,12 +70,12 @@ fsck_able() { ;; nfs*) # nfs can be a nop, returning success - _drv=":" && + _drv="_drv=none :" && return 0 ;; *) type fsck >/dev/null 2>&1 && - _drv="fsck_drv_std fsck" && + _drv="_drv=fsck fsck_drv_std" && return 0 ;; esac @@ -97,7 +97,6 @@ fsck_drv_btrfs() { # common code for checkers that follow usual subset of options and return codes fsck_drv_com() { - local _drv="$1" local _ret local _out diff --git a/modules.d/99memstrack/memstrack-report.sh b/modules.d/99memstrack/memstrack-report.sh deleted file mode 100755 index 3de55bd..0000000 --- a/modules.d/99memstrack/memstrack-report.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -. /lib/dracut-lib.sh - -if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then - return 0 -fi - -if type -P systemctl >/dev/null; then - systemctl stop memstrack.service -else - get_pid_of_tracer () { - local _user _pid _rest - read _user _pid _rest <<< $(ps aux | grep [m]emstrack | head -1) - echo $_pid - } - - kill -s INT $(get_pid_of_tracer) - while [[ -n $(get_pid_of_tracer) ]]; do - sleep 1 - done -fi - -cat /.memstrack diff --git a/modules.d/99memstrack/memstrack-start.sh b/modules.d/99memstrack/memstrack-start.sh deleted file mode 100755 index 5aa73ef..0000000 --- a/modules.d/99memstrack/memstrack-start.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# Mount kernel debug fs so debug tools can work. -# memdebug=4 and memdebug=5 requires debug fs to be mounted. -# And there is no need to umount it. - -type getargnum >/dev/null 2>&1 || . /lib/dracut-lib.sh - -# "sys/kernel/tracing" has the priority if exists. -get_trace_base() { - # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available. - if [ -d "/sys/kernel/tracing" ]; then - echo "/sys/kernel" - else - echo "/sys/kernel/debug" - fi -} - -is_debugfs_ready() { - [ -f "$(get_trace_base)/tracing/trace" ] -} - -prepare_debugfs() { - local trace_base - - trace_base=$(get_trace_base) - # old debugfs interface case. - if ! [ -d "$trace_base/tracing" ]; then - mount none -t debugfs $trace_base - # new tracefs interface case. - elif ! [ -f "$trace_base/tracing/trace" ]; then - mount none -t tracefs "$trace_base/tracing" - fi - - if ! [ -f "$trace_base/tracing/trace" ]; then - echo "WARN: failed to mount debugfs" - return 1 - fi -} - -if ! is_debugfs_ready ; then - prepare_debugfs -fi - -if [ -n "$DEBUG_MEM_LEVEL" ]; then - if [ "$DEBUG_MEM_LEVEL" -ge 5 ]; then - echo "memstrack - will report kernel module memory usage summary and top allocation stack" - memstrack --report module_summary,module_top --notui --throttle 80 -o /.memstrack & - elif [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then - echo "memstrack - will report memory usage summary" - memstrack --report module_summary --notui --throttle 80 -o /.memstrack & - else - exit 0; - fi -fi - -PID=$! -RET=$? - -if [ $RET -ne 0 ]; then - echo "Failed to start memstrack, exit status: $RET" - exit $RET -fi - -# Wait a second for memstrack to setup everything, avoid missing any event -sleep 1 - -echo $PID > /run/memstrack.pid -disown diff --git a/modules.d/99memstrack/memstrack.service b/modules.d/99memstrack/memstrack.service deleted file mode 100644 index 6b47ade..0000000 --- a/modules.d/99memstrack/memstrack.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Memstrack Anylazing Service -DefaultDependencies=no -Before=dracut-cmdline.service systemd-udevd.service local-fs-pre.target -IgnoreOnIsolate=true - -[Service] -Type=simple -ExecStart=/bin/memstrack-start -PIDFile=/run/memstrack.pid -StandardInput=null -StandardOutput=syslog+console -StandardError=syslog+console diff --git a/modules.d/99memstrack/module-setup.sh b/modules.d/99memstrack/module-setup.sh deleted file mode 100755 index d5bacb4..0000000 --- a/modules.d/99memstrack/module-setup.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/bash - -check() { - if type -P memstrack >/dev/null; then - dinfo "memstrack is available" - return 0 - fi - - dinfo "memstrack is not available" - dinfo "If you need to use rd.memdebug>=4, please install memstrack" - - return 1 -} - -depends() { - return 0 -} - -install() { - inst "/bin/memstrack" "/bin/memstrack" - - inst "$moddir/memstrack-start.sh" "/bin/memstrack-start" - inst_hook cleanup 99 "$moddir/memstrack-report.sh" - - inst "$moddir/memstrack.service" "$systemdsystemunitdir/memstrack.service" - systemctl -q --root "$initdir" add-wants initrd.target memstrack.service -} diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh index 7aa0b44..935fd72 100644 --- a/modules.d/99squash/module-setup.sh +++ b/modules.d/99squash/module-setup.sh @@ -25,5 +25,5 @@ install() { inst $moddir/init.sh /squash/init.sh inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service" - systemctl -q --root "$initdir" add-wants initrd-switch-root.target squash-mnt-clear.service + ln_r "$systemdsystemunitdir/squash-mnt-clear.service" "$systemdsystemunitdir/initrd.target.wants/squash-mnt-clear.service" } diff --git a/modules.d/99squash/squash-mnt-clear.service b/modules.d/99squash/squash-mnt-clear.service index 84441f6..8dd1781 100644 --- a/modules.d/99squash/squash-mnt-clear.service +++ b/modules.d/99squash/squash-mnt-clear.service @@ -4,14 +4,16 @@ [Unit] Description=Cleanup squashfs mounts when switch root DefaultDependencies=no -Before=initrd-switch-root.service -After=initrd-switch-root.target +After=initrd.target +After=dracut-initqueue.service dracut-pre-pivot.service +Before=initrd-cleanup.service ConditionPathExists=/squash/root +Conflicts=initrd-switch-root.target [Service] Type=oneshot -RemainAfterExit=no +RemainAfterExit=yes StandardInput=null StandardOutput=syslog+console StandardError=syslog+console -ExecStart=/squash/clear-squash.sh +ExecStop=/squash/clear-squash.sh diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index ca4a828..ed2ae5d 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -15,7 +15,7 @@ test_run() { -net none \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=LABEL=dracut rw systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.debug console=ttyS0,115200n81 rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing || return 1 grep -F -m 1 -q dracut-root-block-success $TESTDIR/result || return 1 } diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh index 848021e..8c5eb16 100755 --- a/test/TEST-02-SYSTEMD/test.sh +++ b/test/TEST-02-SYSTEMD/test.sh @@ -11,7 +11,7 @@ test_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1 } diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh index 5d5ec8f..42c0da6 100755 --- a/test/TEST-03-USR-MOUNT/test.sh +++ b/test/TEST-03-USR-MOUNT/test.sh @@ -22,7 +22,7 @@ client_run() { -net none \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=LABEL=dracut $client_opts quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing if (($? != 0)); then diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh index f65f30f..97528e4 100755 --- a/test/TEST-04-FULL-SYSTEMD/test.sh +++ b/test/TEST-04-FULL-SYSTEMD/test.sh @@ -23,7 +23,7 @@ client_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing if (($? != 0)); then diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh index af4cac0..7b5f2a7 100755 --- a/test/TEST-10-RAID/create-root.sh +++ b/test/TEST-10-RAID/create-root.sh @@ -8,9 +8,9 @@ udevadm control --reload # save a partition at the beginning for future flagging purposes sfdisk /dev/sda <keyfile diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh index 9ffe24b..76ec36b 100755 --- a/test/TEST-13-ENC-RAID-LVM/test.sh +++ b/test/TEST-13-ENC-RAID-LVM/test.sh @@ -20,7 +20,7 @@ test_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img || return 1 echo "CLIENT TEST END: [OK]" @@ -34,7 +34,7 @@ test_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ + -append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img || return 1 echo "CLIENT TEST END: [OK]" @@ -48,7 +48,7 @@ test_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \ + -append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \ -initrd $TESTDIR/initramfs.testing grep -F -m 1 -q dracut-root-block-success $TESTDIR/check-success.img && return 1 echo "CLIENT TEST END: [OK]" @@ -59,7 +59,7 @@ test_run() { test_setup() { # Create the blank file to use as a root filesystem rm -f -- $TESTDIR/root.ext2 - dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=134 + dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80 kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay diff --git a/test/TEST-14-IMSM/create-root.sh b/test/TEST-14-IMSM/create-root.sh index 0d10945..f637ec8 100755 --- a/test/TEST-14-IMSM/create-root.sh +++ b/test/TEST-14-IMSM/create-root.sh @@ -1,7 +1,4 @@ #!/bin/sh - -trap 'poweroff -f' EXIT - # don't let udev and this script step on eachother's toes for x in 61-dmraid-imsm.rules 64-md-raid.rules 65-md-incremental-imsm.rules 65-md-incremental.rules 64-lvm.rules 70-mdadm.rules 99-mount-rules; do rm -f -- "/etc/udev/rules.d/$x" @@ -32,9 +29,9 @@ sfdisk -g /dev/mapper/isw*Test0 # save a partition at the beginning for future flagging purposes sfdisk --no-reread /dev/mapper/isw*Test0 < /tmp/mduuid . /tmp/mduuid echo "MD_UUID=$MD_UUID" { echo "dracut-root-block-created"; echo MD_UUID=$MD_UUID;} > /dev/sda mdadm --wait-clean /dev/md0 +poweroff -f diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh index a3e52b5..8ebc285 100755 --- a/test/TEST-14-IMSM/test.sh +++ b/test/TEST-14-IMSM/test.sh @@ -16,7 +16,7 @@ client_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then echo "CLIENT TEST END: $@ [FAIL]" @@ -53,8 +53,8 @@ test_setup() { rm -f -- $TESTDIR/disk1 rm -f -- $TESTDIR/disk2 dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=1 - dd if=/dev/null of=$TESTDIR/disk1 bs=1M seek=104 - dd if=/dev/null of=$TESTDIR/disk2 bs=1M seek=104 + dd if=/dev/null of=$TESTDIR/disk1 bs=1M seek=80 + dd if=/dev/null of=$TESTDIR/disk2 bs=1M seek=80 kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh index dda7667..02cb497 100755 --- a/test/TEST-15-BTRFSRAID/test.sh +++ b/test/TEST-15-BTRFSRAID/test.sh @@ -15,7 +15,7 @@ test_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing grep -F -m 1 -q dracut-root-block-success $MARKER_DISKIMAGE || return 1 } diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh index 65d5bdb..45d8c4c 100755 --- a/test/TEST-16-DMSQUASH/test.sh +++ b/test/TEST-16-DMSQUASH/test.sh @@ -23,7 +23,7 @@ test_run() { -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \ -initrd "$TESTDIR"/initramfs.testing # mediacheck test with qemu GUI diff --git a/test/TEST-17-LVM-THIN/create-root.sh b/test/TEST-17-LVM-THIN/create-root.sh index 6e09012..117d134 100755 --- a/test/TEST-17-LVM-THIN/create-root.sh +++ b/test/TEST-17-LVM-THIN/create-root.sh @@ -8,16 +8,16 @@ udevadm control --reload # save a partition at the beginning for future flagging purposes sfdisk /dev/sda </dev/sda1 +sleep 1 && \ +echo "dracut-root-block-created" >/dev/sda1 poweroff -f diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh index c7247c9..af34924 100755 --- a/test/TEST-17-LVM-THIN/test.sh +++ b/test/TEST-17-LVM-THIN/test.sh @@ -12,14 +12,14 @@ test_run() { -m 512M -smp 2 -nographic \ -net none \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ + -append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \ -initrd $TESTDIR/initramfs.testing grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2 || return 1 } test_setup() { # Create the blank file to use as a root filesystem - dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=92 + dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80 kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay @@ -56,7 +56,7 @@ test_setup() { ( export initdir=$TESTDIR/overlay . $basedir/dracut-init.sh - inst_multiple sfdisk mke2fs poweroff cp umount grep dmsetup + inst_multiple sfdisk mke2fs poweroff cp umount inst_hook initqueue 01 ./create-root.sh inst_hook initqueue/finished 01 ./finished-false.sh inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh index 4ad7fd7..e942745 100755 --- a/test/TEST-20-NFS/test.sh +++ b/test/TEST-20-NFS/test.sh @@ -22,7 +22,7 @@ run_server() { ${SERIAL:--serial file:"$TESTDIR"/server.log} \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot rd.debug loglevel=77 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \ + -append "panic=1 rd.debug loglevel=77 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \ -initrd $TESTDIR/initramfs.server \ -pidfile $TESTDIR/server.pid -daemonize || return 1 sudo chmod 644 $TESTDIR/server.pid || return 1 @@ -57,7 +57,7 @@ client_test() { -net socket,connect=127.0.0.1:12320 \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet ro console=ttyS0,115200n81 selinux=0" \ + -append "panic=1 rd.shell=0 $cmdline $DEBUGFAIL rd.debug rd.retry=10 rd.info quiet ro console=ttyS0,115200n81 selinux=0" \ -initrd $TESTDIR/initramfs.testing if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nfs-OK $TESTDIR/client.img; then diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh index c126e3d..f6cc56d 100755 --- a/test/TEST-30-ISCSI/test.sh +++ b/test/TEST-30-ISCSI/test.sh @@ -26,7 +26,7 @@ run_server() { -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ -net socket,listen=127.0.0.1:12330 \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd $TESTDIR/initramfs.server \ -pidfile $TESTDIR/server.pid -daemonize || return 1 sudo chmod 644 $TESTDIR/server.pid || return 1 @@ -51,7 +51,7 @@ run_client() { -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ -net socket,connect=127.0.0.1:12330 \ -no-reboot \ - -append "panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ + -append "panic=1 rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ -initrd $TESTDIR/initramfs.testing if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" @@ -109,9 +109,9 @@ test_setup() { fi # Create the blank file to use as a root filesystem - dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=45 - dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=45 - dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=45 + dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=40 + dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=40 + dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=40 kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay diff --git a/test/TEST-31-ISCSI-MULTI/test.sh b/test/TEST-31-ISCSI-MULTI/test.sh index 122c69e..5c38249 100755 --- a/test/TEST-31-ISCSI-MULTI/test.sh +++ b/test/TEST-31-ISCSI-MULTI/test.sh @@ -26,7 +26,7 @@ run_server() { -net nic,macaddr=52:54:00:12:34:57,model=e1000 \ -net socket,listen=127.0.0.1:12331 \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ + -append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \ -initrd $TESTDIR/initramfs.server \ -pidfile $TESTDIR/server.pid -daemonize || return 1 sudo chmod 644 $TESTDIR/server.pid || return 1 @@ -51,7 +51,7 @@ run_client() { -net nic,macaddr=52:54:00:12:34:01,model=e1000 \ -net socket,connect=127.0.0.1:12331 \ -no-reboot \ - -append "panic=1 systemd.crash_reboot rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ + -append "panic=1 rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \ -initrd $TESTDIR/initramfs.testing if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" @@ -131,9 +131,9 @@ test_setup() { fi # Create the blank file to use as a root filesystem - dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=45 - dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=45 - dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=45 + dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=40 + dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=40 + dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=40 kernel=$KVERSION # Create what will eventually be our root filesystem onto an overlay diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh index 19ec5b0..12736a1 100755 --- a/test/TEST-40-NBD/test.sh +++ b/test/TEST-40-NBD/test.sh @@ -28,7 +28,7 @@ run_server() { ${SERIAL:+-serial "$SERIAL"} \ ${SERIAL:--serial file:"$TESTDIR"/server.log} \ -no-reboot \ - -append "panic=1 systemd.crash_reboot root=/dev/sda rootfstype=ext2 rw quiet console=ttyS0,115200n81 selinux=0" \ + -append "panic=1 root=/dev/sda rootfstype=ext2 rw quiet console=ttyS0,115200n81 selinux=0" \ -initrd $TESTDIR/initramfs.server -pidfile $TESTDIR/server.pid -daemonize || return 1 sudo chmod 644 $TESTDIR/server.pid || return 1 @@ -65,7 +65,7 @@ client_test() { -net nic,macaddr=$mac,model=e1000 \ -net socket,connect=127.0.0.1:12340 \ -no-reboot \ - -append "panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \ + -append "panic=1 rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \ -initrd $TESTDIR/initramfs.testing if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nbd-OK $TESTDIR/flag.img; then diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh index 7099dcf..529379f 100755 --- a/test/TEST-50-MULTINIC/client-init.sh +++ b/test/TEST-50-MULTINIC/client-init.sh @@ -105,17 +105,7 @@ export TERM=linux export PS1='initramfs-test:\w\$ ' stty sane echo "made it to the rootfs! Powering down." -for i in /sys/class/net/*/ -do - # booting with network-manager module - state=/run/NetworkManager/devices/$(cat $i/ifindex) - grep -q connection-uuid= $state 2>/dev/null || continue - i=${i##*/} - ip link show $i |grep -q master && continue - IFACES+="$i " -done for i in /run/initramfs/net.*.did-setup; do - # booting with network-legacy module [ -f "$i" ] || continue strglobin "$i" ":*:*:*:*:" && continue i=${i%.did-setup} diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh index ff2961d..495a66f 100755 --- a/test/TEST-50-MULTINIC/test.sh +++ b/test/TEST-50-MULTINIC/test.sh @@ -23,7 +23,7 @@ run_server() { ${SERIAL:--serial file:"$TESTDIR"/server.log} \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \ + -append "panic=1 loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 @@ -63,7 +63,7 @@ client_test() { -device e1000,netdev=n2,mac=52:54:00:12:34:99 \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \ + -append "panic=1 rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \ -initrd "$TESTDIR"/initramfs.testing { read OK; read IFACES; } < "$TESTDIR"/client.img diff --git a/test/TEST-60-IFCFG/99-idesymlinks.rules b/test/TEST-60-IFCFG/99-idesymlinks.rules deleted file mode 100644 index d557790..0000000 --- a/test/TEST-60-IFCFG/99-idesymlinks.rules +++ /dev/null @@ -1,8 +0,0 @@ -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd" -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}" diff --git a/test/TEST-60-IFCFG/Makefile b/test/TEST-60-IFCFG/Makefile deleted file mode 100644 index aad2705..0000000 --- a/test/TEST-60-IFCFG/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -all: - @$(MAKE) -s --no-print-directory -C ../.. all - @V=$(V) basedir=../.. testdir=../ ./test.sh --all -setup: - @$(MAKE) --no-print-directory -C ../.. all - @basedir=../.. testdir=../ ./test.sh --setup -clean: - @basedir=../.. testdir=../ ./test.sh --clean -run: - @basedir=../.. testdir=../ ./test.sh --run diff --git a/test/TEST-60-IFCFG/client-init.sh b/test/TEST-60-IFCFG/client-init.sh deleted file mode 100755 index 8c33ff0..0000000 --- a/test/TEST-60-IFCFG/client-init.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -exec >/dev/console 2>&1 -export PATH=/sbin:/bin:/usr/sbin:/usr/bin -strstr() { [ "${1#*$2*}" != "$1" ]; } -CMDLINE=$(while read line; do echo $line;done < /proc/cmdline) -export TERM=linux -export PS1='initramfs-test:\w\$ ' -stty sane -echo "made it to the rootfs! Powering down." - -( - echo OK - ip -o -4 address show scope global | while read n if rest; do echo $if;done | sort - for i in /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-*; do - echo $i - grep -v 'UUID=' $i - done - echo EOF -) > /dev/sda - -strstr "$CMDLINE" "rd.shell" && sh -i -poweroff -f diff --git a/test/TEST-60-IFCFG/dhcpd.conf b/test/TEST-60-IFCFG/dhcpd.conf deleted file mode 100644 index e26bd60..0000000 --- a/test/TEST-60-IFCFG/dhcpd.conf +++ /dev/null @@ -1,27 +0,0 @@ -ddns-update-style none; - -use-host-decl-names true; - -subnet 192.168.50.0 netmask 255.255.255.0 { - option subnet-mask 255.255.255.0; - option routers 192.168.50.1; - next-server 192.168.50.1; - server-identifier 192.168.50.1; - option domain-name-servers 192.168.50.1; - option domain-search "example.com"; - option domain-name "other.com"; - option root-path "nfs:192.168.50.1:/nfs/client"; - range 192.168.50.10 192.168.50.100; -} - -subnet 192.168.51.0 netmask 255.255.255.0 { - option subnet-mask 255.255.255.0; - option routers 192.168.51.1; - next-server 192.168.51.1; - server-identifier 192.168.51.1; - option domain-name-servers 192.168.51.1; - option domain-search "example.com"; - option domain-name "other.com"; - option root-path "nfs:192.168.51.1:/nfs/client"; - range 192.168.51.10 192.168.51.100; -} diff --git a/test/TEST-60-IFCFG/exports b/test/TEST-60-IFCFG/exports deleted file mode 100644 index ff5f29b..0000000 --- a/test/TEST-60-IFCFG/exports +++ /dev/null @@ -1 +0,0 @@ -/nfs/client 192.168.50.0/24(rw,insecure,no_subtree_check,no_root_squash) diff --git a/test/TEST-60-IFCFG/finished-false.sh b/test/TEST-60-IFCFG/finished-false.sh deleted file mode 100755 index ecdbef9..0000000 --- a/test/TEST-60-IFCFG/finished-false.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exit 1 diff --git a/test/TEST-60-IFCFG/hard-off.sh b/test/TEST-60-IFCFG/hard-off.sh deleted file mode 100755 index 12c3d5a..0000000 --- a/test/TEST-60-IFCFG/hard-off.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -getarg rd.shell || poweroff -f -getarg failme && poweroff -f diff --git a/test/TEST-60-IFCFG/hosts b/test/TEST-60-IFCFG/hosts deleted file mode 100644 index d02a4e9..0000000 --- a/test/TEST-60-IFCFG/hosts +++ /dev/null @@ -1,5 +0,0 @@ -127.0.0.1 localhost -192.168.50.1 server -192.168.50.100 client-if1 -192.168.50.101 client-if2 -192.168.50.102 client-if3 diff --git a/test/TEST-60-IFCFG/server-init.sh b/test/TEST-60-IFCFG/server-init.sh deleted file mode 100755 index b9f01c9..0000000 --- a/test/TEST-60-IFCFG/server-init.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -exec /dev/console 2>&1 -set -x -export PATH=/sbin:/bin:/usr/sbin:/usr/bin -export TERM=linux -export PS1='nfstest-server:\w\$ ' -stty sane -echo "made it to the rootfs!" -echo server > /proc/sys/kernel/hostname - -wait_for_if_link() { - local cnt=0 - local li - while [ $cnt -lt 600 ]; do - li=$(ip -o link show dev $1 2>/dev/null) - [ -n "$li" ] && return 0 - sleep 0.1 - cnt=$(($cnt+1)) - done - return 1 -} - -wait_for_if_up() { - local cnt=0 - local li - while [ $cnt -lt 200 ]; do - li=$(ip -o link show up dev $1) - [ -n "$li" ] && return 0 - sleep 0.1 - cnt=$(($cnt+1)) - done - return 1 -} - -wait_for_route_ok() { - local cnt=0 - while [ $cnt -lt 200 ]; do - li=$(ip route show) - [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0 - sleep 0.1 - cnt=$(($cnt+1)) - done - return 1 -} - -linkup() { - wait_for_if_link $1 2>/dev/null\ - && ip link set $1 up 2>/dev/null\ - && wait_for_if_up $1 2>/dev/null -} - -modprobe --all -b -q 8021q ipvlan macvlan ->/dev/watchdog -ip addr add 127.0.0.1/8 dev lo -linkup lo -ip link set dev eth0 name ens3 -ip addr add 192.168.50.1/24 dev ens3 -linkup ens3 ->/dev/watchdog -ip link set dev eth1 name ens4 -ip link add dev ens4.1 link ens4 type vlan id 1 -ip link add dev ens4.2 link ens4 type vlan id 2 -ip link add dev ens4.3 link ens4 type vlan id 3 -ip link add dev ens4.4 link ens4 type vlan id 4 -ip addr add 192.168.54.1/24 dev ens4.1 -ip addr add 192.168.55.1/24 dev ens4.2 -ip addr add 192.168.56.1/24 dev ens4.3 -ip addr add 192.168.57.1/24 dev ens4.4 -linkup ens4 -ip link set dev ens4.1 up -ip link set dev ens4.2 up -ip link set dev ens4.3 up -ip link set dev ens4.4 up -ip link set dev eth2 name ens5 -ip addr add 192.168.51.1/24 dev ens5 -linkup ens5 -ip link set dev eth3 name ens6 -linkup ens6 ->/dev/watchdog -modprobe af_packet -> /dev/watchdog -modprobe sunrpc ->/dev/watchdog -mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs ->/dev/watchdog -[ -x /sbin/portmap ] && portmap ->/dev/watchdog -mkdir -p /run/rpcbind -[ -x /sbin/rpcbind ] && rpcbind ->/dev/watchdog -modprobe nfsd ->/dev/watchdog -mount -t nfsd nfsd /proc/fs/nfsd ->/dev/watchdog -exportfs -r ->/dev/watchdog -rpc.nfsd ->/dev/watchdog -rpc.mountd ->/dev/watchdog -rpc.idmapd ->/dev/watchdog -exportfs -r ->/dev/watchdog ->/var/lib/dhcpd/dhcpd.leases ->/dev/watchdog -chmod 777 /var/lib/dhcpd/dhcpd.leases ->/dev/watchdog -dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases ens3 ens5 -#echo -n 'V' > /dev/watchdog -#sh -i -#tcpdump -i ens3 -# Wait forever for the VM to die -echo "Serving NFS mounts" -while :; do - sleep 10 - >/dev/watchdog -done -mount -n -o remount,ro / -poweroff -f diff --git a/test/TEST-60-IFCFG/test.sh b/test/TEST-60-IFCFG/test.sh deleted file mode 100755 index 8e8bd98..0000000 --- a/test/TEST-60-IFCFG/test.sh +++ /dev/null @@ -1,336 +0,0 @@ -#!/bin/bash -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh -TEST_DESCRIPTION="root filesystem on NFS with bridging/bonding/vlan" -KVERSION=${KVERSION-$(uname -r)} - -# Uncomment this to debug failures -#DEBUGFAIL="rd.shell rd.break" -#DEBUGFAIL="rd.shell rd.break rd.debug" -#SERIAL="tcp:127.0.0.1:9999" - -run_server() { - # Start server first - echo "MULTINIC TEST SETUP: Starting DHCP/NFS server" - - fsck -a "$TESTDIR"/server.ext3 || return 1 - - $testdir/run-qemu \ - -hda "$TESTDIR"/server.ext3 \ - -m 512M -smp 2 \ - -display none \ - -netdev socket,id=n0,listen=127.0.0.1:12370 \ - -netdev socket,id=n1,listen=127.0.0.1:12371 \ - -netdev socket,id=n2,listen=127.0.0.1:12372 \ - -netdev socket,id=n3,listen=127.0.0.1:12373 \ - -device e1000,netdev=n0,mac=52:54:01:12:34:56 \ - -device e1000,netdev=n1,mac=52:54:01:12:34:57 \ - -device e1000,netdev=n2,mac=52:54:01:12:34:58 \ - -device e1000,netdev=n3,mac=52:54:01:12:34:59 \ - ${SERIAL:+-serial "$SERIAL"} \ - ${SERIAL:--serial file:"$TESTDIR"/server.log} \ - -watchdog i6300esb -watchdog-action poweroff \ - -no-reboot \ - -append "panic=1 loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 rd.debug" \ - -initrd "$TESTDIR"/initramfs.server \ - -pidfile "$TESTDIR"/server.pid -daemonize || return 1 - chmod 644 -- "$TESTDIR"/server.pid || return 1 - - # Cleanup the terminal if we have one - tty -s && stty sane - - echo Sleeping 10 seconds to give the server a head start - sleep 10 -} - -client_test() { - local test_name="$1" - local do_vlan13="$2" - local cmdline="$3" - local check="$4" - local CONF - - echo "CLIENT TEST START: $test_name" - - [ "$do_vlan13" != "yes" ] && unset do_vlan13 - - # Need this so kvm-qemu will boot (needs non-/dev/zero local disk) - if ! dd if=/dev/zero of="$TESTDIR"/client.img bs=1M count=1; then - echo "Unable to make client sda image" 1>&2 - return 1 - fi - if [[ $do_vlan13 ]]; then - nic1=" -netdev socket,connect=127.0.0.1:12371,id=n1" - nic3=" -netdev socket,connect=127.0.0.1:12373,id=n3" - else - nic1=" -netdev hubport,id=n1,hubid=2" - nic3=" -netdev hubport,id=n3,hubid=3" - fi - - if $testdir/run-qemu --help | grep -qF -m1 'netdev hubport,id=str,hubid=n[,netdev=nd]' && echo OK; then - $testdir/run-qemu \ - -hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \ - -netdev socket,connect=127.0.0.1:12370,id=s1 \ - -netdev hubport,hubid=1,id=h1,netdev=s1 \ - -netdev hubport,hubid=1,id=h2 -device e1000,mac=52:54:00:12:34:01,netdev=h2 \ - -netdev hubport,hubid=1,id=h3 -device e1000,mac=52:54:00:12:34:02,netdev=h3 \ - $nic1 -device e1000,mac=52:54:00:12:34:03,netdev=n1 \ - -netdev socket,connect=127.0.0.1:12372,id=n2 -device e1000,mac=52:54:00:12:34:04,netdev=n2 \ - $nic3 -device e1000,mac=52:54:00:12:34:05,netdev=n3 \ - -watchdog i6300esb -watchdog-action poweroff \ - -no-reboot \ - -append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ - -initrd "$TESTDIR"/initramfs.testing - else - $testdir/run-qemu \ - -hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \ - -net socket,vlan=0,connect=127.0.0.1:12370 \ - ${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12371} \ - -net socket,vlan=2,connect=127.0.0.1:12372 \ - ${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12373} \ - -net nic,vlan=0,macaddr=52:54:00:12:34:01,model=e1000 \ - -net nic,vlan=0,macaddr=52:54:00:12:34:02,model=e1000 \ - -net nic,vlan=1,macaddr=52:54:00:12:34:03,model=e1000 \ - -net nic,vlan=2,macaddr=52:54:00:12:34:04,model=e1000 \ - -net nic,vlan=3,macaddr=52:54:00:12:34:05,model=e1000 \ - -watchdog i6300esb -watchdog-action poweroff \ - -no-reboot \ - -append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ - -initrd "$TESTDIR"/initramfs.testing - fi - - { - read OK - if [[ "$OK" != "OK" ]]; then - echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" - return 1 - fi - - while read line; do - [[ $line == END ]] && break - CONF+="$line " - done - } < "$TESTDIR"/client.img || return 1 - - if [[ "$check" != "$CONF" ]]; then - echo "Expected: '$check'" - echo - echo - echo "Got: '$CONF'" - echo "CLIENT TEST END: $test_name [FAILED - BAD CONF]" - return 1 - fi - - echo "CLIENT TEST END: $test_name [OK]" - return 0 -} - - -test_run() { - if ! run_server; then - echo "Failed to start server" 1>&2 - return 1 - fi - test_client || { kill_server; return 1; } -} - -test_client() { - client_test "Multiple VLAN" \ - "yes" \ - " -vlan=vlan0001:ens5 -vlan=vlan2:ens5 -vlan=ens5.3:ens5 -vlan=ens5.0004:ens5 -ip=ens3:dhcp -ip=192.168.54.101::192.168.54.1:24:test:vlan0001:none -ip=192.168.55.102::192.168.55.1:24:test:vlan2:none -ip=192.168.56.103::192.168.56.1:24:test:ens5.3:none -ip=192.168.57.104::192.168.57.1:24:test:ens5.0004:none -rd.neednet=1 -root=nfs:192.168.50.1:/nfs/client bootdev=ens3 -" \ - 'ens3 ens5.0004 ens5.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens3 # Generated by dracut initrd NAME="ens3" DEVICE="ens3" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.0004 # Generated by dracut initrd NAME="ens5.0004" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.57.104" PREFIX="24" GATEWAY="192.168.57.1" TYPE=Vlan DEVICE="ens5.0004" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.3 # Generated by dracut initrd NAME="ens5.3" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.56.103" PREFIX="24" GATEWAY="192.168.56.1" TYPE=Vlan DEVICE="ens5.3" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan0001 # Generated by dracut initrd NAME="vlan0001" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.54.101" PREFIX="24" GATEWAY="192.168.54.1" TYPE=Vlan DEVICE="vlan0001" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan2 # Generated by dracut initrd NAME="vlan2" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.55.102" PREFIX="24" GATEWAY="192.168.55.1" TYPE=Vlan DEVICE="vlan2" VLAN=yes PHYSDEV="ens5" EOF ' \ - || return 1 - - client_test "Multiple Bonds" \ - "yes" \ - " -bond=bond0:ens4,ens5 -bond=bond1:ens6,ens7 -ip=bond0:dhcp -ip=bond1:dhcp -rd.neednet=1 -root=nfs:192.168.50.1:/nfs/client bootdev=bond0 -" \ - 'bond0 bond1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond0 # Generated by dracut initrd NAME="bond0" DEVICE="bond0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond0" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond1 # Generated by dracut initrd NAME="bond1" DEVICE="bond1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond1" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4 # Generated by dracut initrd NAME="ens4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5 # Generated by dracut initrd NAME="ens5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens6 # Generated by dracut initrd NAME="ens6" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="ens6" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens7 # Generated by dracut initrd NAME="ens7" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="ens7" EOF ' \ - || return 1 - - client_test "Multiple Bridges" \ - "no" \ - " -bridge=br0:ens4,ens5 -bridge=br1:ens6,ens7 -ip=br0:dhcp -ip=br1:dhcp -rd.neednet=1 -root=nfs:192.168.50.1:/nfs/client bootdev=br0 -" \ - 'br0 br1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br0 # Generated by dracut initrd NAME="br0" DEVICE="br0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br0" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br1 # Generated by dracut initrd NAME="br1" DEVICE="br1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br1" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4 # Generated by dracut initrd NAME="ens4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5 # Generated by dracut initrd NAME="ens5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens6 # Generated by dracut initrd NAME="ens6" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="ens6" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens7 # Generated by dracut initrd NAME="ens7" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="ens7" EOF ' \ - || return 1 - - kill_server - return 0 -} - -test_setup() { - # Make server root - dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120 - mke2fs -j -F -- "$TESTDIR"/server.ext3 - mkdir -- "$TESTDIR"/mnt - mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt - kernel=$KVERSION - ( - export initdir="$TESTDIR"/mnt - . "$basedir"/dracut-init.sh - - ( - cd "$initdir"; - mkdir -p -- dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind} - mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs} - chmod 777 -- var/lib/rpcbind var/lib/nfs - ) - - for _f in modules.builtin.bin modules.builtin; do - [[ $srcmods/$_f ]] && break - done || { - dfatal "No modules.builtin.bin and modules.builtin found!" - return 1 - } - - for _f in modules.builtin.bin modules.builtin modules.order; do - [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" - done - - inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ - dmesg mkdir cp ping exportfs \ - modprobe rpc.nfsd rpc.mountd showmount tcpdump \ - /etc/services sleep mount chmod - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [ -f "${_terminfodir}"/l/linux ] && break - done - inst_multiple -o "${_terminfodir}"/l/linux - type -P portmap >/dev/null && inst_multiple portmap - type -P rpcbind >/dev/null && inst_multiple rpcbind - [ -f /etc/netconfig ] && inst_multiple /etc/netconfig - type -P dhcpd >/dev/null && inst_multiple dhcpd - [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd - instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan - inst_simple /etc/os-release - inst ./server-init.sh /sbin/init - inst ./hosts /etc/hosts - inst ./exports /etc/exports - inst ./dhcpd.conf /etc/dhcpd.conf - inst_multiple /etc/nsswitch.conf /etc/rpc /etc/protocols - - inst_multiple rpc.idmapd /etc/idmapd.conf - - inst_libdir_file 'libnfsidmap_nsswitch.so*' - inst_libdir_file 'libnfsidmap/*.so*' - inst_libdir_file 'libnfsidmap*.so*' - - _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|') - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - inst /etc/nsswitch.conf /etc/nsswitch.conf - inst /etc/passwd /etc/passwd - inst /etc/group /etc/group - - cp -a -- /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - dracut_kernel_post - ) - - # Make client root inside server root - ( - export initdir="$TESTDIR"/mnt/nfs/client - . "$basedir"/dracut-init.sh - inst_multiple sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep ls sort - for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do - [[ -f ${_terminfodir}/l/linux ]] && break - done - inst_multiple -o "${_terminfodir}"/l/linux - inst_simple /etc/os-release - inst ./client-init.sh /sbin/init - ( - cd "$initdir" - mkdir -p -- dev sys proc etc run - mkdir -p -- var/lib/nfs/rpc_pipefs - ) - inst /etc/nsswitch.conf /etc/nsswitch.conf - inst /etc/passwd /etc/passwd - inst /etc/group /etc/group - - inst_multiple rpc.idmapd /etc/idmapd.conf - inst_libdir_file 'libnfsidmap_nsswitch.so*' - inst_libdir_file 'libnfsidmap/*.so*' - inst_libdir_file 'libnfsidmap*.so*' - - _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' -- /etc/nsswitch.conf \ - | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|') - _nsslibs=${_nsslibs#|} - _nsslibs=${_nsslibs%|} - - inst_libdir_file -n "$_nsslibs" 'libnss_*.so*' - - cp -a -- /etc/ld.so.conf* "$initdir"/etc - ldconfig -r "$initdir" - ) - - umount "$TESTDIR"/mnt - rm -fr -- "$TESTDIR"/mnt - - # Make an overlay with needed tools for the test harness - ( - export initdir="$TESTDIR"/overlay - . "$basedir"/dracut-init.sh - inst_multiple poweroff shutdown - inst_hook emergency 000 ./hard-off.sh - inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules - ) - - # Make server's dracut image - $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \ - --no-early-microcode \ - -m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog" \ - -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1 - - # Make client's dracut image - $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \ - --no-early-microcode \ - -o "plymouth" \ - -a "debug network-legacy" \ - -d "ipvlan macvlan af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \ - --no-hostonly-cmdline -N \ - -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1 -} - -kill_server() { - if [[ -s "$TESTDIR"/server.pid ]]; then - kill -TERM -- $(cat "$TESTDIR"/server.pid) - rm -f -- "$TESTDIR"/server.pid - fi -} - -test_cleanup() { - kill_server -} - -. "$testdir"/test-functions diff --git a/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh b/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh index 083e0f5..8c33ff0 100755 --- a/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh +++ b/test/TEST-70-BONDBRIDGETEAMVLAN/client-init.sh @@ -10,7 +10,11 @@ echo "made it to the rootfs! Powering down." ( echo OK - ip -o -4 address show scope global |sed -n 's/^[^:]*: \([^ ]*\) *\(.*\) scope.*/\1 \2/p' |sort + ip -o -4 address show scope global | while read n if rest; do echo $if;done | sort + for i in /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-*; do + echo $i + grep -v 'UUID=' $i + done echo EOF ) > /dev/sda diff --git a/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh b/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh index b6dd080..8c11a7d 100755 --- a/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh +++ b/test/TEST-70-BONDBRIDGETEAMVLAN/test.sh @@ -31,7 +31,7 @@ run_server() { ${SERIAL:--serial file:"$TESTDIR"/server.log} \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 rd.debug" \ + -append "panic=1 loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 rd.debug" \ -initrd "$TESTDIR"/initramfs.server \ -pidfile "$TESTDIR"/server.pid -daemonize || return 1 chmod 644 -- "$TESTDIR"/server.pid || return 1 @@ -79,7 +79,7 @@ client_test() { $nic3 -device e1000,mac=52:54:00:12:34:05,netdev=n3 \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ + -append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ -initrd "$TESTDIR"/initramfs.testing else $testdir/run-qemu \ @@ -95,7 +95,7 @@ client_test() { -net nic,vlan=3,macaddr=52:54:00:12:34:05,model=e1000 \ -watchdog i6300esb -watchdog-action poweroff \ -no-reboot \ - -append "panic=1 systemd.crash_reboot $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ + -append "panic=1 $cmdline rd.debug $DEBUGFAIL rd.retry=5 rw console=ttyS0,115200n81 selinux=0 init=/sbin/init" \ -initrd "$TESTDIR"/initramfs.testing fi @@ -112,8 +112,8 @@ client_test() { done } < "$TESTDIR"/client.img || return 1 - if [[ ! "$CONF" =~ ^$check$ ]]; then - echo "Expected: /^$check\$/" + if [[ "$check" != "$CONF" ]]; then + echo "Expected: '$check'" echo echo echo "Got: '$CONF'" @@ -150,7 +150,7 @@ ip=192.168.57.104::192.168.57.1:24:test:ens5.0004:none rd.neednet=1 root=nfs:192.168.50.1:/nfs/client bootdev=ens3 " \ - 'ens3 inet 192\.168\.50\.[0-9]*/24 brd 192\.168\.50\.255 ens5\.0004 inet 192\.168\.57\.104/24 brd 192\.168\.57\.255 ens5\.3 inet 192\.168\.56\.103/24 brd 192\.168\.56\.255 vlan0001 inet 192\.168\.54\.101/24 brd 192\.168\.54\.255 vlan2 inet 192\.168\.55\.102/24 brd 192\.168\.55\.255 EOF ' \ + 'ens3 ens5.0004 ens5.3 vlan0001 vlan2 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens3 # Generated by dracut initrd NAME="ens3" DEVICE="ens3" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.0004 # Generated by dracut initrd NAME="ens5.0004" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.57.104" PREFIX="24" GATEWAY="192.168.57.1" TYPE=Vlan DEVICE="ens5.0004" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5.3 # Generated by dracut initrd NAME="ens5.3" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.56.103" PREFIX="24" GATEWAY="192.168.56.1" TYPE=Vlan DEVICE="ens5.3" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan0001 # Generated by dracut initrd NAME="vlan0001" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.54.101" PREFIX="24" GATEWAY="192.168.54.1" TYPE=Vlan DEVICE="vlan0001" VLAN=yes PHYSDEV="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-vlan2 # Generated by dracut initrd NAME="vlan2" ONBOOT=yes NETBOOT=yes BOOTPROTO=none IPADDR="192.168.55.102" PREFIX="24" GATEWAY="192.168.55.1" TYPE=Vlan DEVICE="vlan2" VLAN=yes PHYSDEV="ens5" EOF ' \ || return 1 client_test "Multiple Bonds" \ @@ -163,7 +163,7 @@ ip=bond1:dhcp rd.neednet=1 root=nfs:192.168.50.1:/nfs/client bootdev=bond0 " \ - 'bond0 inet 192\.168\.50\.[0-9]*/24 brd 192\.168\.50\.255 bond1 inet 192\.168\.51\.[0-9]*/24 brd 192\.168\.51\.255 EOF ' \ + 'bond0 bond1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond0 # Generated by dracut initrd NAME="bond0" DEVICE="bond0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond0" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-bond1 # Generated by dracut initrd NAME="bond1" DEVICE="bond1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp BONDING_OPTS="" NAME="bond1" TYPE=Bond /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4 # Generated by dracut initrd NAME="ens4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5 # Generated by dracut initrd NAME="ens5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond0" DEVICE="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens6 # Generated by dracut initrd NAME="ens6" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="ens6" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens7 # Generated by dracut initrd NAME="ens7" TYPE=Ethernet ONBOOT=yes NETBOOT=yes SLAVE=yes MASTER="bond1" DEVICE="ens7" EOF ' \ || return 1 client_test "Multiple Bridges" \ @@ -176,7 +176,7 @@ ip=br1:dhcp rd.neednet=1 root=nfs:192.168.50.1:/nfs/client bootdev=br0 " \ - 'br0 inet 192\.168\.50\.[0-9]*/24 brd 192\.168\.50\.255 br1 inet 192\.168\.51\.[0-9]*/24 brd 192\.168\.51\.255 EOF ' \ + 'br0 br1 /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br0 # Generated by dracut initrd NAME="br0" DEVICE="br0" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br0" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-br1 # Generated by dracut initrd NAME="br1" DEVICE="br1" ONBOOT=yes NETBOOT=yes IPV6INIT=yes BOOTPROTO=dhcp TYPE=Bridge NAME="br1" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens4 # Generated by dracut initrd NAME="ens4" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="ens4" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens5 # Generated by dracut initrd NAME="ens5" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br0" DEVICE="ens5" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens6 # Generated by dracut initrd NAME="ens6" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="ens6" /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-ens7 # Generated by dracut initrd NAME="ens7" TYPE=Ethernet ONBOOT=yes NETBOOT=yes BRIDGE="br1" DEVICE="ens7" EOF ' \ || return 1 kill_server @@ -260,7 +260,7 @@ test_setup() { export initdir="$TESTDIR"/mnt/nfs/client . "$basedir"/dracut-init.sh inst_multiple sh shutdown poweroff stty cat ps ln ip \ - mount dmesg mkdir cp ping grep ls sort sed + mount dmesg mkdir cp ping grep ls sort for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do [[ -f ${_terminfodir}/l/linux ]] && break done diff --git a/test/test-functions b/test/test-functions index 51b3df8..a6254ec 100644 --- a/test/test-functions +++ b/test/test-functions @@ -80,7 +80,7 @@ while (($# > 0)); do ret=$? test_cleanup if ((ret!=0)) && [[ -f "$TESTDIR"/server.log ]]; then - mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log + mv [[ -f "$TESTDIR"/server.log ]] ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log fi rm -fr -- "$TESTDIR" rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID} diff --git a/test/test-rpms.txt b/test/test-rpms.txt deleted file mode 100644 index 02577c8..0000000 --- a/test/test-rpms.txt +++ /dev/null @@ -1,29 +0,0 @@ -dash -bridge-utils -asciidoc -mdadm -lvm2 -dmraid -cryptsetup -nfs-utils -nbd -dhcp-server -dhcp -scsi-target-utils -iscsi-initiator-utils -net-tools -strace -syslinux -python-imgcreate -genisoimage -btrfs-progs -bridge-utils -kmod-devel -gcc -gzip -bzip2 -xz -tar -wget -rpm-build -util-linux