]> git.ipfire.org Git - thirdparty/dracut.git/log
thirdparty/dracut.git
4 years agodracut.sh: check kmoddir is properly formed
Daniel Cordero [Fri, 24 Jan 2020 16:14:25 +0000 (16:14 +0000)] 
dracut.sh: check kmoddir is properly formed

Due to the way dracut-install handles modules from custom kmoddirs, add
a test that ensures the kmoddir argument seems sane.

In addition to erroring out, provide some guidance on how to proceed, as
well as a method of skipping the test via environment variable.

4 years agodracut-install: fetch kernel modules from kmoddir
Daniel Cordero [Tue, 21 Jan 2020 18:43:59 +0000 (18:43 +0000)] 
dracut-install: fetch kernel modules from kmoddir

dracut, when passing --kmoddir, would only install modules that exist at
the same location as it will appear in the initramfs.

For most (possibly all) outputs, the output path would be /lib/modules,
so previously all kernel modules must be copied there or the module
installation silently fails.

Now use the original path variable, and install to the shortened path
variable (as calculated by kerneldirlen).

Note: This means that the argument to --kmoddir (and the modules filetree)
should be a directory that ends in 'lib/modules/$kernelversion'.

4 years agouefi-lib/uefi-lib.sh: fixed script for bash version 5
Harald Hoyer [Fri, 24 Jan 2020 12:40:15 +0000 (13:40 +0100)] 
uefi-lib/uefi-lib.sh: fixed script for bash version 5

bash 5 `read` behaves differently and returns != 0 for 0 bytes read

fix it with the best effort

4 years agoucode: use microcode found in packed cpio images
Jonas Witschel [Tue, 24 Dec 2019 14:48:19 +0000 (15:48 +0100)] 
ucode: use microcode found in packed cpio images

Some distributions (Arch, Gentoo) ship prepacked microcode images. These
are cpio images that follow the structure specified in the Linux kernel
documentation (x86/microcode.rst, "Early load microcode"), the same
structure dracut uses for its early microcode images.

In case of Arch Linux, the microcode for Intel CPUs is currently only
available in this packed form, /usr/lib/firmware/intel-ucode does not
exist. This commit adds a way to make use of these images on such
systems by unpacking them to the early cpio directory. (Note that the
packed image cannot be used directly since dracut might need to add ACPI
tables to the early initramfs.)

This approach has the drawback that it is not possible to control the
selection of CPUs to be included in the microcode file in host-only
mode, so we only try it as a last ressort if no unpacked microcode could
be found in fw_dir.

The list of possible file names for the packed microcode image is taken
from GRUB (cf. GRUB_EARLY_INITRD_LINUX_STOCK), but can be adapted by
setting "early_microcode_image_name" (and "early_microcode_image_dir")
in a dracut configuration file.

4 years agoadd missing crypto modules for aarch64
Harald Hoyer [Thu, 23 Jan 2020 12:47:53 +0000 (13:47 +0100)] 
add missing crypto modules for aarch64

Fixes https://github.com/dracutdevs/dracut/issues/711

4 years agonetwork-legacy/ifup: nuke pid and lease files if dhclient failed
Jonathan Lebon [Tue, 21 Jan 2020 22:57:31 +0000 (17:57 -0500)] 
network-legacy/ifup: nuke pid and lease files if dhclient failed

Otherwise we won't retry dhclient again on that interface. In
FCOS/RHCOS, we want to bake in `ip=dhcp,dhcp6` so we automatically try
getting a DHCPv6 lease if DHCPv4 failed.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1793591

4 years ago90kernel-modules: don't install any block driver if not needed
Kairui Song [Tue, 29 Oct 2019 08:29:14 +0000 (16:29 +0800)] 
90kernel-modules: don't install any block driver if not needed

If hostonly mode is in use, and there isn't any block device included
as hostonly device, then the initramfs won't need any block driver.

Eg. for kdump built image, there could be only one nfs mount point,
or the initramfs may only execute some network operation then reboot.

In such case, skip block driver installation to save space and time.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agoWrite dns values passed by ip argument to ifcfg-* files
Jan Macku [Fri, 1 Nov 2019 13:58:56 +0000 (14:58 +0100)] 
Write dns values passed by ip argument to ifcfg-* files

4 years agoReplace ln with systemctl
Jan Macku [Fri, 8 Nov 2019 15:24:13 +0000 (16:24 +0100)] 
Replace ln with systemctl

4 years ago35network-legacy: using 'replace' instead of 'add' to add route
Jacob Wen [Tue, 26 Nov 2019 07:50:36 +0000 (15:50 +0800)] 
35network-legacy: using 'replace' instead of 'add' to add route

This is a simple trick to honor RFC 3442:
If the DHCP server returns both a Classless Static Routes option and
a Router option, the DHCP client MUST ignore the Router option.

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
4 years ago95iscsi: Fix /etc/iscsi installation
Kairui Song [Fri, 29 Nov 2019 13:29:58 +0000 (21:29 +0800)] 
95iscsi: Fix /etc/iscsi installation

Previous all files are installed with inst_dir, which will not install
the files under /etc/iscsi/, and it create folders with the same of the
files which is wrong.

Now only use inst_dir to install the config dir and ensure it
exists, and use inst_multiple to install the config files.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agonetwork-manager: don't run NetworkManager when there are no connections
Lubomir Rintel [Mon, 2 Dec 2019 01:19:51 +0000 (02:19 +0100)] 
network-manager: don't run NetworkManager when there are no connections

NetworkManager would unnecessarily bring up the devices, colliding with
further attempts to rename the devices.

This is arguably a NetworkManager bug and should eventually be fixed there.
Running NetworkManager without the connection is unnecessary regardless.

4 years agoCheck .hmac of boot.iso in fips mode
Brian C. Lane [Fri, 13 Dec 2019 17:47:43 +0000 (09:47 -0800)] 
Check .hmac of boot.iso in fips mode

Instead of carrying the kernel and hmac in the install.img (which takes
up more space) use the vmlinuz installed under /images/pxeboot/ and the
.hmac in the install.img /boot.

This check is triggered by the presence of /run/install/repo/images/pxeboot/vmlinuz

Related: rhbz#1782737

4 years agomodules/network-manager: Install `ip`
Colin Walters [Tue, 7 Jan 2020 20:53:53 +0000 (20:53 +0000)] 
modules/network-manager: Install `ip`

We don't need `ip` but having it is *really* useful for people debugging
in an emergency shell.

4 years agonetwork-legacy/ifup: dhclient should be started in oneshot mode
Lukas Nykryn [Thu, 9 Jan 2020 09:49:52 +0000 (10:49 +0100)] 
network-legacy/ifup: dhclient should be started in oneshot mode

since we handle the retries explicitly via rd.net.dhcp.retry

Without -1 if user sets ip=dhcp6 and there is no dhcp on the network,
dhclient seems to wait indefinitely, ignoring rd.net.timeout.dhcp

4 years agonetwork-legacy/ifup: fix typo when calling dhclient --timeout
Lukas Nykryn [Wed, 8 Jan 2020 15:20:29 +0000 (16:20 +0100)] 
network-legacy/ifup: fix typo when calling dhclient --timeout

4 years agofips: add 'ofb' and 'cts' block cipher modes
Alexey Kodanev [Fri, 29 Nov 2019 12:02:41 +0000 (15:02 +0300)] 
fips: add 'ofb' and 'cts' block cipher modes

Add cts, Linux-5.0 commit:
196ad6043e9f ("crypto: testmgr - mark cts(cbc(aes)) as FIPS allowed")

Linux 4.20 commits for 'ofb':
dfb89ab3f0a7 ("crypto: tcrypt - add OFB functional tests")
e497c51896b3 ("crypto: ofb - add output feedback mode")

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
4 years ago95ssh-client: improve nsswitch.conf parser
Petr Tesarik [Thu, 14 Nov 2019 18:06:08 +0000 (19:06 +0100)] 
95ssh-client: improve nsswitch.conf parser

The actual syntax of nsswitch.conf is slightly different from the
current regular expression:

- A comment can appear anywhere, not just at the beginning of a
  line.
- Action items take the general form [STATUS=ACTION] or
  [!STATUS=ACTION] (with some optional whitespace).
- A service name cannot include a colon. This is a nitpick,
  because there should never be more than a single colon per
  line.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
4 years agoRevert "travis: run TEST-14-IMSM on Fedora 29"
Lubomir Rintel [Thu, 7 Nov 2019 10:18:17 +0000 (11:18 +0100)] 
Revert "travis: run TEST-14-IMSM on Fedora 29"

We're on Fedora 31 that should be good enough for this test.

This reverts commit 7a2503ab8cec9473ad6dacf4f48b17344219f3c0.

4 years agotest: use hosts randomness, not rngd
Daniel Molkentin [Tue, 12 Nov 2019 14:41:54 +0000 (15:41 +0100)] 
test: use hosts randomness, not rngd

4 years agotest: Provide host's randomness via virtio
Daniel Molkentin [Tue, 12 Nov 2019 13:12:47 +0000 (14:12 +0100)] 
test: Provide host's randomness via virtio

4 years agoTEST-30-ISCSI: test iBFT boot as well
Lubomir Rintel [Thu, 24 Oct 2019 15:46:17 +0000 (17:46 +0200)] 
TEST-30-ISCSI: test iBFT boot as well

Setting up the machinery to boot with the aid of real networked boot loader
(such as iPXE) would involve much hassle, including possibly serving the kernel
and initrd via TFTP, etc.

Let us generate the iBFT table ourselves, with a Perl script. Include the
pregenerated table as well so that the test run won't depend on Perl. In the
end it's just reproducibly built static data, totally independent of the host
system.

4 years agogit2spec: include contents of binaries in patches
Lubomir Rintel [Thu, 7 Nov 2019 10:41:28 +0000 (11:41 +0100)] 
git2spec: include contents of binaries in patches

The patches don't include the binary files, such as the iBFT table for testing,
which makes %autosetup sad.

4 years agoDocumentation: dynamically set current version
Daniel Molkentin [Tue, 29 Oct 2019 15:40:19 +0000 (16:40 +0100)] 
Documentation: dynamically set current version

Fixes #369

4 years agospec: dracut-network is happy with either NM or dhclient
Lubomir Rintel [Thu, 7 Nov 2019 13:03:23 +0000 (14:03 +0100)] 
spec: dracut-network is happy with either NM or dhclient

4 years agoTEST-{20,50,60,70): set MACAddressPolicy=keep
Lubomir Rintel [Thu, 7 Nov 2019 14:15:21 +0000 (15:15 +0100)] 
TEST-{20,50,60,70): set MACAddressPolicy=keep

New systemd defaults to generating MAC addresses for software devices (whereas
previously they would inherit them from the first enslaved slave).

Sadly, among the things this breaks is our test fixture, where the dhcp servers
are configured to expect a particular MAC address. Disable this for the
affected tests, which are essentially the ones that use bridges and bonds.

4 years agoTEST-{20,30,31,40,50,60,70): wait for server interfaces to come up
Lubomir Rintel [Mon, 11 Nov 2019 17:12:58 +0000 (18:12 +0100)] 
TEST-{20,30,31,40,50,60,70): wait for server interfaces to come up

The network interfaces appear asynchronously and sometimes just too late,
after we're already halfway throught server-init.sh:

  + ip link set dev eth0 name ens3
  Cannot find device "eth0"
  + ip addr add 192.168.50.1/24 dev ens3
  Cannot find device "ens3"
  + dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases ens3 ens5
  ...
  [    8.040825] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:01:12:34:56
  [    8.047105] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
  ...
  No subnet declaration for ens3 (no IPv4 addresses).
  ** Ignoring requests on ens3.  If this is not what
     you want, please write a subnet declaration
     in your dhcpd.conf file for the network segment
     to which interface ens3 is attached. **

Whoopsie. Let's ensure all the interfaces are there before we proceed
fiddling around with them.

4 years agoTEST-50-MULTINIC: fix how a basename is determined
Lubomir Rintel [Mon, 11 Nov 2019 08:53:01 +0000 (09:53 +0100)] 
TEST-50-MULTINIC: fix how a basename is determined

Analogous to what commit 687e17aa7f2f ("network-manager: fix getting of
ifname from the sysfs path") fixes.

4 years agologtee: time out after a period of no output
Lubomir Rintel [Mon, 11 Nov 2019 16:12:34 +0000 (17:12 +0100)] 
logtee: time out after a period of no output

Travis cuts us short after 10 minutes of slience, giving us no chance to puke
out the output. Be faster.

4 years agoRevert "travis: run TEST-13-ENC-RAID-LVM on Fedora 29"
Lubomir Rintel [Thu, 7 Nov 2019 10:17:57 +0000 (11:17 +0100)] 
Revert "travis: run TEST-13-ENC-RAID-LVM on Fedora 29"

We're on Fedora 31 that should be good enough for this test.

This reverts commit 8238f41b34777c3c75b03a9b598d4b9e1c7bf911.

4 years agoTEST-13-ENC-RAID-LVM: increase memory
Lubomir Rintel [Mon, 11 Nov 2019 13:54:00 +0000 (14:54 +0100)] 
TEST-13-ENC-RAID-LVM: increase memory

In Fedora 31 it ooms until it has, uh, twice the memory.

4 years agodmraid: require kpartx binary
Doan Tran Cong Danh [Fri, 8 Nov 2019 03:53:41 +0000 (10:53 +0700)] 
dmraid: require kpartx binary

dmraid requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
4 years agomultipath: require kpartx binary
Doan Tran Cong Danh [Fri, 8 Nov 2019 03:53:41 +0000 (10:53 +0700)] 
multipath: require kpartx binary

multipath requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
4 years agoconfigure: find cflags and libs for fts on musl
Doan Tran Cong Danh [Wed, 6 Nov 2019 11:35:12 +0000 (18:35 +0700)] 
configure: find cflags and libs for fts on musl

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
4 years agoEnsure that udevadm --version reported an integer
Mikhail Novosyolov [Sat, 2 Nov 2019 18:32:38 +0000 (21:32 +0300)] 
Ensure that udevadm --version reported an integer

If it is not an integer, further script will fail unexepectedly.

4 years agoFail if udevadm could not be run
Mikhail Novosyolov [Sat, 2 Nov 2019 18:28:33 +0000 (21:28 +0300)] 
Fail if udevadm could not be run

Fixes: #668
4 years agonetwork-manager: fix getting of ifname from the sysfs path
Lubomir Rintel [Wed, 30 Oct 2019 18:25:51 +0000 (19:25 +0100)] 
network-manager: fix getting of ifname from the sysfs path

commit 5e0f8c8a4ced ('network-manager: remove useless use of basename')
somewhat carelessly didn't take into account that $_i has a slash at
the end which made the result of the ## substitution be just an empty
string.

The slash was put to the end of /sys/class/net/*/ to make sure we're only
iterating directories, but it's not strictly necessary. In an unlikely case
something else than a directory appears in /sys/class/net/, we'll already deal
with it gracefully. Remove it.

This fixes the TEST-30-ISCSI test.

4 years agokeep network device naming scheme on upgrade
Thomas Blume [Fri, 7 Jun 2019 13:34:09 +0000 (15:34 +0200)] 
keep network device naming scheme on upgrade

4 years ago01fips: trim off GRUB boot device from BOOT_IMAGE
Jonathan Lebon [Tue, 29 Oct 2019 20:54:10 +0000 (16:54 -0400)] 
01fips: trim off GRUB boot device from BOOT_IMAGE

E.g. in RHCOS, the `BOOT_IMAGE` from the cmdline is:

(hd0,gpt1)/ostree/rhcos-e493371e5ee8407889029ec979955a2b86fd7e3cae5a0591b9db1cd248d966e8/vmlinuz-4.18.0-146.el8.x86_64

Which of course is a GRUB thing, not an actual pathname we'll be able to
resolve. In fact, we can simply scrap it off from the variable. Our code
is already able to handle both cases: whether the device refers to a
separate boot partition, or just the root filesystem with a regular
`/boot` directory.

4 years ago01fips: add / in BOOT_IMAGE_HMAC filename for clarity
Jonathan Lebon [Tue, 29 Oct 2019 20:53:00 +0000 (16:53 -0400)] 
01fips: add / in BOOT_IMAGE_HMAC filename for clarity

It's already the case the `BOOT_IMAGE_PATH` today, in the non-empty
case, includes a trailing `/`, but let's add it to the path we build
here too to make it more obvious.

4 years ago01fips: run sha512hmac from directory HMAC file directory
Jonathan Lebon [Tue, 29 Oct 2019 20:47:34 +0000 (16:47 -0400)] 
01fips: run sha512hmac from directory HMAC file directory

That way, the HMAC file can contain a relative path instead of an
absolute one. The issue is that right now the kernel RPM bakes the
`/boot/vmlinuz-${kver}` path into the HMAC file which poses an issue for
rpm-ostree systems (and any other system where the kernel isn't simply
in the top-level `/boot`.

For now, we're hacking around this in rpm-ostree:
https://github.com/coreos/rpm-ostree/pull/1934

Though I'd like to propose the same change in the kernel spec file.

4 years ago01fips: fix HMAC file path resolution
Jonathan Lebon [Tue, 29 Oct 2019 13:35:41 +0000 (09:35 -0400)] 
01fips: fix HMAC file path resolution

There is a small regression in #343: when handling the 'separate boot
partition' case, we're checking for the kernel image in the wrong
location: `BOOT_IMAGE` is the `/boot`-relative path to the kernel image,
so `/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}` expands to e.g.
`/boot/mysubdir1/mysubdir2/mysubdir1/mysubdir2/vmlinuz...`.

We should be using `BOOT_IMAGE_NAME` here instead (and in fact, the next
if-statement does this correctly, so it might've just been accidentally
left out of #343).

4 years agoiscsi: remove bashisms
Harald Hoyer [Fri, 25 Oct 2019 12:29:17 +0000 (14:29 +0200)] 
iscsi: remove bashisms

4 years agoAdd documentation and Yocto examples
Böszörményi Zoltán [Fri, 25 Oct 2019 09:42:10 +0000 (11:42 +0200)] 
Add documentation and Yocto examples

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
4 years agoFix version reported by dracut --help
Böszörményi Zoltán [Fri, 25 Oct 2019 04:12:17 +0000 (06:12 +0200)] 
Fix version reported by dracut --help

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
4 years agoSet systemdutildir correctly
Böszörményi Zoltán [Thu, 24 Oct 2019 15:00:50 +0000 (17:00 +0200)] 
Set systemdutildir correctly

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
4 years agoHandle -r / --sysroot option in dracut.sh
Böszörményi Zoltán [Thu, 24 Oct 2019 10:44:45 +0000 (12:44 +0200)] 
Handle -r / --sysroot option in dracut.sh

It was documented but not implemented.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
4 years agoAllow running on a cross-compiled rootfs
Böszörményi Zoltán [Thu, 24 Oct 2019 09:28:55 +0000 (11:28 +0200)] 
Allow running on a cross-compiled rootfs

For the shell scripts, new environment variables were introduced.

dracutsysrootdir is the root directory, file existence checks use it.

DRACUT_LDCONFIG can override ldconfig with a different one that works
on the sysroot with foreign binaries.

DRACUT_LDD can override ldd with a different one that works
with foreign binaries.

DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot
may use symlinks that are valid only when running on the target
so a real file must be provided that exist in the sysroot.

DRACUT_INSTALL now supports debugging dracut-install in itself
when run by dracut but without debugging the dracut scripts.
E.g. DRACUT_INSTALL="valgrind dracut-install or
DRACUT_INSTALL="dracut-install --debug".

DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA,
DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ,
DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4,
DRACUT_COMPRESS_CAT: All of the compression utilities may be
overridden, to support the native binaries in non-standard places.

DRACUT_ARCH overrides "uname -m".

SYSTEMD_VERSION overrides "systemd --version".

The dracut-install utility was overhauled to support sysroot via
a new option -r and fixes for clang-analyze. It supports
cross-compiler-ldd from
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

DRACUT_INSTALL_PATH was introduced so dracut-install can work with
a different PATH. In a cross-compiled environment (e.g. Yocto), PATH
points to natively built binaries that are not in the host's /bin,
/usr/bin, etc. dracut-install still needs plain /bin and /usr/bin
that are relative to the cross-compiled sysroot.

The hashmap pool allocate_tile/deallocate_tile code was removed
because clang-analyze showed errors in it. hashmap_copy was removed
because it wasn't used and clang-analyze showed errors in it.

DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were
introduced so dracut-install can use different settings from
DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
4 years agoFine tune mksquashfs options for squash module
Kairui Song [Wed, 25 Sep 2019 05:47:40 +0000 (13:47 +0800)] 
Fine tune mksquashfs options for squash module

Drop some unneeded metadata in the squash image, and print the error
message if something went wrong.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agoSupport only fips=1 not fips
Jiri Konecny [Thu, 4 Apr 2019 13:31:18 +0000 (15:31 +0200)] 
Support only fips=1 not fips

It looks like only the 'fips=1' is really supported and it is working
correctly. So instead of failing on 'fips' not clear way give user
information why we are failing.

4 years agoFix boot with `fips` without a value
Jiri Konecny [Thu, 4 Apr 2019 11:10:22 +0000 (13:10 +0200)] 
Fix boot with `fips` without a value

If you boot system with `fips` and not `fips=1` then you will get unary
operator expected error. This will fix this problem.

4 years agoucode: properly include early only ucode
Daniel Molkentin [Thu, 28 Mar 2019 12:46:35 +0000 (13:46 +0100)] 
ucode: properly include early only ucode

Intel has notified us that some microcode updates are not safe
to be applied during runtime. To accomodate for that, microcode
files shipped by SUSE and openSUSE have an '.early' postfix such
that triggering

/sys/devices/system/cpu/microcode/reload

from a booted system cannot pick up the ucode by accident, while
still allowing the code to be picked up during initrd time.

This change is needed to make this scheme work also in a hostonly
situation.

Currently, this affects only 06-4f-01, which is now 06-4f-01.early.

If a distro does not change the filename, the behavior does not
change.

Reference: osc#1098915

4 years ago95iscsi: handle qedi like bnx2i
Daniel Molkentin [Tue, 12 Feb 2019 15:55:26 +0000 (16:55 +0100)] 
95iscsi: handle qedi like bnx2i

The new qedi driver needs to be handled just like
the bnx2i driver, so update 95iscsi scripts to do this.

References: bsc#1113712

Signed-off-by: Lee Duncan <lduncan@suse.com>
4 years agoswap for loop to POSIX shell compat
Nathan Rini [Tue, 9 Oct 2018 15:40:43 +0000 (09:40 -0600)] 
swap for loop to POSIX shell compat

4 years agotypo bugfix
Nathan Rini [Thu, 4 Oct 2018 16:53:49 +0000 (10:53 -0600)] 
typo bugfix

4 years agofix off by one
Nathan Rini [Thu, 4 Oct 2018 16:15:47 +0000 (10:15 -0600)] 
fix off by one

4 years agobugfix for initialization
Nathan Rini [Thu, 4 Oct 2018 16:04:29 +0000 (10:04 -0600)] 
bugfix for initialization
exit with error if all retries fail

4 years agoadd sleep and max number of retries
Nathan Rini [Wed, 3 Oct 2018 21:38:08 +0000 (15:38 -0600)] 
add sleep and max number of retries

4 years agoretry image download forever
Nathan Rini [Wed, 19 Sep 2018 18:05:05 +0000 (12:05 -0600)] 
retry image download forever

4 years agoiso-scan: Release resources on iso-scan boots with rd.live.ram
Frederick Grose [Tue, 30 Apr 2019 02:06:51 +0000 (22:06 -0400)] 
iso-scan: Release resources on iso-scan boots with rd.live.ram

Unmounting the image iso, detaching its loop device, and unmounting
its parent partition can simplify installation to the parent disk.

Note that programs or scripts using the /run/initramfs/live mount
point will fail.

4 years agoiscsi: fix error messages with iSCSI root
Martin Wilck [Thu, 21 Mar 2019 13:40:33 +0000 (14:40 +0100)] 
iscsi: fix error messages with iSCSI root

Fixes these error messages during intird build:

cat: '/sys/devices/platform/host2/flashnode_sess-*/is_boot_target': No such file or directory
/usr/lib/dracut/modules.d/95iscsi/module-setup.sh: line 91: [: -eq: unary operator expected
cat: '/sys/devices/platform/host3/flashnode_sess-*/is_boot_target': No such file or directory
/usr/lib/dracut/modules.d/95iscsi/module-setup.sh: line 91: [: -eq: unary operator expected

4 years agofix check whether the rootfs init is usable
Norbert Lange [Thu, 13 Dec 2018 15:20:30 +0000 (16:20 +0100)] 
fix check whether the rootfs init is usable

this now correctly handles:
-   plain files
-   relative symlinks
-   absolute symlinks

4 years agoadd mksh support
tpgxyz [Thu, 13 Dec 2018 23:39:15 +0000 (00:39 +0100)] 
add mksh support

4 years agodracut.spec: add 90ppcmac
Harald Hoyer [Fri, 25 Oct 2019 07:23:30 +0000 (09:23 +0200)] 
dracut.spec: add 90ppcmac

4 years agomodules.d: add a module for early fan control on PowerPC Macs
q66 [Mon, 22 Jul 2019 16:52:08 +0000 (18:52 +0200)] 
modules.d: add a module for early fan control on PowerPC Macs

The goal of this module is to enable automatic loading of the
thermal/fan control modules on PowerPC based Macs, as on some
modular kernel configurations this will not happen automatically
which will result in the fans spinning up to 100% until they are
manually loaded.

This is especially a problem in live systems where it takes some
time to boot up and the spin-up happens before the system even
leaves initramfs.

4 years ago35network-legacy: only skip waiting for interfaces if netroot is set
Martin Wilck [Fri, 27 Sep 2019 11:26:10 +0000 (13:26 +0200)] 
35network-legacy: only skip waiting for interfaces if netroot is set

Commmit 8a33e52e2f94 assumes that dracut's work is done if a root device
is found. This holds usually for booting computers, but it may be wrong
for other environments.

Only short-cut the waiting if $netroot is also set.

Fixes: 8a33e52e2f94 ("network: stop waiting for interfaces if root device is present")
References: bsc#1152006

4 years agofixup "Dracut: only login to one target at a time"
Martin Wilck [Tue, 1 Oct 2019 10:02:04 +0000 (12:02 +0200)] 
fixup "Dracut: only login to one target at a time"

On SLE15-SP1 at least, iscsiadm doesn't support combining --op and --login":

> # iscsiadm -m node -T iqn.2018-06.de.suse.zeus:01 --op=update  --name=node.startup --value=onboot --login
> iscsiadm: Invalid parameters. Login/logout and op passed in

This breaks iSCSI login in initrd, and thus, iSCSI boot.

Fix it by not coalescing everything into a single iscsiadm command.
Fixes: a59b776bc215 ("Dracut: only login to one target at a time")
References: bsc#1152650

4 years agoiscsiroot: remove bashisms
Martin Wilck [Thu, 4 Apr 2019 15:12:07 +0000 (17:12 +0200)] 
iscsiroot: remove bashisms

According to the dracut README, module code to be run in
the initrd must be POSIX-compliant. Replace remaining
bashisms (as reported by checkbashisms) with POSIX compliant
code.

The use of "type" is not strictly POSIX compliant, but it's
all over the place in dracut code. dash supports it, anyway.

4 years agoiscsiroot: try targets only once
Martin Wilck [Thu, 4 Apr 2019 14:16:40 +0000 (16:16 +0200)] 
iscsiroot: try targets only once

In multipath scenarios, "iscsiadm -m node" may contain
several records with the same target.
There's no point in trying "iscsiadm --login" multiple
time for the same target, through the same portal.

Moreover, warn if the desired target is not on the node
list.

4 years agoiscsiroot: there's never more than one target per call
Martin Wilck [Thu, 4 Apr 2019 13:40:14 +0000 (15:40 +0200)] 
iscsiroot: there's never more than one target per call

iscsi_target_name is set by iscsi_root, and thus can't have
more than one member. This allows us to get rid of one bashism
in iscsiroot.sh.

4 years agoiscsiroot: parse_iscsi_root overwrites command line args
Martin Wilck [Thu, 4 Apr 2019 13:29:04 +0000 (15:29 +0200)] 
iscsiroot: parse_iscsi_root overwrites command line args

iscsi_target_name, iscsi_target_ip, iscsi_target_port are
unconditionally overwritten by parse_iscsi_root. Don't set
them here, for code clarity.

4 years agonetwork: stop waiting for interfaces if root device is present
Martin Wilck [Thu, 21 Mar 2019 20:31:15 +0000 (21:31 +0100)] 
network: stop waiting for interfaces if root device is present

4 years agoiscsi: don't continue waiting if the root device is present
Martin Wilck [Thu, 21 Mar 2019 15:27:04 +0000 (16:27 +0100)] 
iscsi: don't continue waiting if the root device is present

dracut waits for every iscsiroot connection to be established
before switching root. This is not necessary in multipath scenarios,
where a single path is usually sufficient to set up the root device,
and where users expect booting to succeed unless all paths are down.

Don't wait for the iscsi portal to start if the root device has
already been found.

4 years agoDracut: only login to one target at a time
Lee Duncan [Mon, 25 Mar 2019 23:49:19 +0000 (16:49 -0700)] 
Dracut: only login to one target at a time

For handling the configuration where there are two
paths to an iscsi root target, each using a different
NIC. In such a case, the initramfs was trying to configure
the first NIC, then call iscsiroot to login to both targets,
which would fail for the 2nd target, since the path to the
2nd target was not yet configured. This would eventually
work after a timeout. But it's better to login to just
one target at a time.
This change makes the initramfs handle multiple paths to an
iscsi target better by logging into only one target at a time,
rather than trying to login to all targets when only one of
several NICs is up.

This can be further optimized by using the initrd parameter
"rd.iscsi.testroute", which would skip iscsiadm login attempts
for targets to which no route exists.

If the script is called again via the timeout initqueue,
we try "iscsiadm -L onboot" again, hoping that some targets
may now have become reachable.

4 years agoDocumentation: add systemd warning for rd.luks.key, clean up related text
jbash aka John Bashinski [Wed, 23 Oct 2019 12:46:46 +0000 (14:46 +0200)] 
Documentation: add systemd warning for rd.luks.key, clean up related text

Harald Hoyer <harald@redhat.com>: Squashed commit of the following:

commit 4b5e5da6061983964a85d1671bd1c97c48ee76f1
Author: jbash aka John Bashinski <jbash@velvet.com>
Date:   Thu Aug 1 13:21:35 2019 -0400

    Documentation: add systemd warning for rd.luks.key, clean up related text

4 years ago99squash: Only start the cleaner on switch-root
Kairui Song [Tue, 6 Aug 2019 07:39:31 +0000 (15:39 +0800)] 
99squash: Only start the cleaner on switch-root

Currently it starts the cleaner early and do the clean up job if switch
root is called. It's better to just start the service only on switch
root to avoid any risk of service dependency failure and make is
simpler.

Signed-off-by: Kairui Song <kasong@redhat.com>
4 years agodracut: check_vol_slaves_all must return 1 when lvm vgs failed
gaoyi [Wed, 14 Aug 2019 12:55:56 +0000 (08:55 -0400)] 
dracut: check_vol_slaves_all must return 1 when lvm vgs failed

reason:when filter/global_filter is set in lvm.conf, lvm vgs may be
failed

Signed-off-by: gaoyi <ymuemc@163.com>
4 years agoOnly generate hostonly-kernel-modules list in strict mode
Kairui Song [Tue, 20 Aug 2019 16:52:29 +0000 (00:52 +0800)] 
Only generate hostonly-kernel-modules list in strict mode

Fixes #617.

4 years agonet-lib: check if addr exists before checking for dad state
Lukas Nykryn [Mon, 7 Oct 2019 14:48:09 +0000 (16:48 +0200)] 
net-lib: check if addr exists before checking for dad state

Before we check if dad is done we should first make sure,
that there is a link local address where we do the check.

Due to this issue, on ipv6 only setups sometimes dhclient started
asking for ip address, before the link local address was present
and failed immediately.

4 years agodracut-functions.sh: remove declared unused variables
Daniel Molkentin [Wed, 16 Oct 2019 23:07:37 +0000 (01:07 +0200)] 
dracut-functions.sh: remove declared unused variables

4 years agodracut-init.sh: remove obsolete for_each_kmod_dep()
Daniel Molkentin [Wed, 16 Oct 2019 23:01:47 +0000 (01:01 +0200)] 
dracut-init.sh: remove obsolete for_each_kmod_dep()

4 years ago99base: Rework `/etc/initrd-release` to derive from real os-release
Colin Walters [Fri, 18 Oct 2019 18:26:04 +0000 (18:26 +0000)] 
99base: Rework `/etc/initrd-release` to derive from real os-release

I'd like to rework CoreOS Ignition (which runs in the initramfs)
to include some values from the *real* `/etc/os-release` in
HTTP headers.

Looking at this, it turns out dracut eats almost all of the useful
information from it.  I don't think `dracut` should be the `ID`
here...dracut's not an OS itself, it's a way to *build* little
operating systems.  It'd be kind of like if Fedora's Koji
injected itself into `/etc/os-release`.

This code dates back a long time; not sure of all the rationale
behind it.

I changed it so that we keep extending the VERSION/PRETTY_NAME
with the dracut version, but otherwise "pass through" the
rest of the real `/etc/os-release` we were built from unchanged.

4 years ago99base: Do not hardcode ANSI_COLOR
Daniel Molkentin [Thu, 17 Oct 2019 14:08:26 +0000 (16:08 +0200)] 
99base: Do not hardcode ANSI_COLOR

Take it from /etc/os-release instead, as distributions
usually customize this setting, but keep it as default value.

4 years ago01systemd-initrd: remove redundant code from 99base
Daniel Molkentin [Thu, 17 Oct 2019 14:07:58 +0000 (16:07 +0200)] 
01systemd-initrd: remove redundant code from 99base

4 years agoMake TEST-16-DMSQUASH Python 3 compatible
Böszörményi Zoltán [Thu, 3 Oct 2019 05:25:06 +0000 (07:25 +0200)] 
Make TEST-16-DMSQUASH Python 3 compatible

This change still supports Python 2.6 and 2.7 but loses support
for Python 2.5.

The reason for this change was that Fedora 30 does not ship
python-imgcreate but ships python3-imgcreate.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
4 years agoMerge branch 'nolange-fix_ipv2_for_busybox'
Harald Hoyer [Mon, 21 Oct 2019 12:43:44 +0000 (14:43 +0200)] 
Merge branch 'nolange-fix_ipv2_for_busybox'

4 years agoMerge branch 'fix_ipv2_for_busybox' of https://github.com/nolange/dracut into nolange...
Harald Hoyer [Mon, 21 Oct 2019 12:41:12 +0000 (14:41 +0200)] 
Merge branch 'fix_ipv2_for_busybox' of https://github.com/nolange/dracut into nolange-fix_ipv2_for_busybox

4 years agoUse eurlatgr as default console font
Marko Myllynen [Tue, 30 Oct 2018 10:30:11 +0000 (12:30 +0200)] 
Use eurlatgr as default console font

Fedora and others have used eurlatgr as the default console font
for some time now, or suggested using it:

https://fedoraproject.org/wiki/Changes/NewDefaultConsoleFont
https://wiki.archlinux.org/index.php/Linux_console#Fonts

The Fedora Change page lists some of the benefits and this file
lists all the characters (glyphs) supported by the font:

http://git.altlinux.org/people/legion/packages/kbd.git?p=kbd.git;a=blob;f=data/consolefonts/README.eurlatgr

The notable downside is that the font does not support Arabic,
Cyrillic or Hebrew as LatArCyrHeb-16 (partially) does, so in cases
where support for languages using them is needed a non-default
console font should be used. Fedora, for instance, uses langtable
to decide the console font to use based on installation language:

https://bugzilla.redhat.com/show_bug.cgi?id=1209460

4 years agoDo not sort the resulting /run/initramfs/state/etc/resolv.conf
Harald Hoyer [Mon, 21 Oct 2019 09:49:10 +0000 (11:49 +0200)] 
Do not sort the resulting /run/initramfs/state/etc/resolv.conf

nameserver priorities should be preserved

Resolves: https://github.com/dracutdevs/dracut/issues/652

4 years agoMove README to README.md
Colin Walters [Fri, 18 Oct 2019 18:27:17 +0000 (18:27 +0000)] 
Move README to README.md

The `README.md` was nearly empty.  Move the travis bits into
`README`, then rename `README` to `README.md`.

This matches the Github standard.  A major compelling feature
of Github is how prominently it displays a project's `README.md`,
so let's ensure ours has content.

4 years agotravis: switch to Bionic
Frantisek Sumsal [Mon, 23 Sep 2019 09:10:53 +0000 (11:10 +0200)] 
travis: switch to Bionic

4 years agotest: fix preserving server.log with V=1
Lubomir Rintel [Fri, 30 Aug 2019 13:44:48 +0000 (15:44 +0200)] 
test: fix preserving server.log with V=1

This is essentially equivalent to what commit 712f471ebfae
('test/test-functions: correctly move server.log') does for V=2.

4 years agoadded additional useful filesystem tools
logan [Fri, 6 Sep 2019 14:59:38 +0000 (08:59 -0600)] 
added additional useful filesystem tools

4 years agomodules.d: fix udev rules detection of multipath devices
Benjamin Marzinski [Tue, 3 Sep 2019 15:44:36 +0000 (10:44 -0500)] 
modules.d: fix udev rules detection of multipath devices

Starting with the 0.7.7 release of the multipath tools, the multipath
udev rules always set a value in ENV{DM_MULTIPATH_DEVICE_PATH} for any
device that multipath scans. A value of 0 means that the device is not
claimed by multipath, and a value of 1 means that it is. Because of
this, udev rules that check ENV{DM_MULTIPATH_DEVICE_PATH}=="?*" will
always return True, and act as if every scanned device is claimed by
multipath. Checking ENV{DM_MULTIPATH_DEVICE_PATH}=="1" will work
correctly for both the old and new versions of the multipath tools.

4 years agorootfs-block: suppress spurious printing of rootflags
Jonas Witschel [Sat, 31 Aug 2019 15:48:05 +0000 (17:48 +0200)] 
rootfs-block: suppress spurious printing of rootflags

getarg prints the value so it inadvertently shows up in the dracut
output.

4 years agocrypt: create locking directory /run/cryptsetup
Jonas Witschel [Sat, 31 Aug 2019 15:45:11 +0000 (17:45 +0200)] 
crypt: create locking directory /run/cryptsetup

For LUKS2 partitions cryptsetup needs a locking directory. If it does
not exist, cryptsetup will create it, but produce a warning

WARNING: Locking directory /run/cryptsetup is missing!

in the process that we do not want to see in the dracut output.

4 years agodracut.sh: suppress "ignored null byte in input" warning
Jonas Witschel [Fri, 30 Aug 2019 12:45:15 +0000 (14:45 +0200)] 
dracut.sh: suppress "ignored null byte in input" warning

Since Bash 4.4, command substitutions containing null bytes produce a
warning of the form

/usr/sbin/dracut: line 1958: warning: command substitution: ignored null byte in input

Remove the trailing null byte from the UEFI kernel command line file
before printing it to suppress this warning.

4 years agoadded debug-shell to initrd in systemd version >= 240
Ondrej Dubaj [Thu, 29 Aug 2019 12:31:06 +0000 (14:31 +0200)] 
added debug-shell to initrd in systemd version >= 240

4 years agoPrint an error if included item ('-i' option) doesn't exist or is neither a directory...
Renaud Métrich [Fri, 1 Mar 2019 10:37:59 +0000 (11:37 +0100)] 
Print an error if included item ('-i' option) doesn't exist or is neither a directory nor a regular file

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
4 years agoCheck /usr/sbin for fsck programs
Tomasz Paweł Gajc [Thu, 13 Dec 2018 22:45:34 +0000 (23:45 +0100)] 
Check /usr/sbin for fsck programs