Commit Graph

5755 Commits (053)

Author SHA1 Message Date
logan 4a8ad28808 added additional useful filesystem tools 2019-09-15 17:51:06 +00:00
Benjamin Marzinski 9dd9329f7a 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.
2019-09-04 13:43:20 +02:00
Jonas Witschel 3436067663 rootfs-block: suppress spurious printing of rootflags
getarg prints the value so it inadvertently shows up in the dracut
output.
2019-09-03 16:49:05 +02:00
Jonas Witschel f39aa529c5 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.
2019-09-03 16:49:05 +02:00
Jonas Witschel 0a01086456 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.
2019-09-03 11:28:56 +00:00
Ondrej Dubaj 707d4e79fe added debug-shell to initrd in systemd version >= 240 2019-08-29 15:06:59 +00:00
Renaud Métrich 7a3d661971 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>
2019-08-29 13:46:34 +00:00
Tomasz Paweł Gajc 04ff0a1bae Check /usr/sbin for fsck programs 2019-08-29 13:25:57 +00:00
Lubomir Rintel 4d573e3be0 dracut.spec: fix build on openSUSE
When testing the previous commit on openSUSE it turned out that it
didn't really work in the first place, without a few tweaks.
2019-08-29 13:16:00 +00:00
Lubomir Rintel 4e2cc49d75 dracut.spec: fix build with %fedora, %rhel and %suse_version undefined
The RPM build failed on due to missing and unpackaged files on my Fedora
machine that happened to have %fedora set to %nil for reasons long
forgotten.

This is probably not a likely scenario, but some of the conditions in the
SPEC file are still wrong and perhaps worth fixing.
2019-08-29 13:16:00 +00:00
Lukas Nykryn 8084f3f66d net-lib: fix typo $li -> $_li 2019-08-29 12:41:11 +02:00
Petr Vorel cd181d2c4c doc: Fix integrity key name
Default value of EVMKEYDESC (in evm-enable.sh) is "evm-key" and it's
also specified previously in this README file.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-08-29 10:21:22 +00:00
Frantisek Sumsal ead8729b44 man: fix several typos 2019-08-28 10:40:33 +02:00
Zbigniew Jędrzejewski-Szmek b1c5cae63f 50-dracut: synchronize option reading code with 51-dracut.install
initrd= option should also be dropped here. There is not reason
for the code to be different in the two places.
2019-08-27 18:33:13 +02:00
Zbigniew Jędrzejewski-Szmek 38b4f4b21c Do not require non-empty kernel cmdline
When booting with Fedora-Server-dvd-x86_64-30-20190411.n.0.iso,
/proc/cmdline is empty (libvirt, qemu host with bios, not sure if that
matters), after installation to disk, anaconda would "crash" in kernel-core
%posttrans, after calling kernel-install, because dracut would fail
with
> Could not determine the kernel command line parameters.
> Please specify the kernel command line in /etc/kernel/cmdline!

I guess it's legitimate, even if unusual, to have no cmdline parameters.
Two changes are done in this patch:
1. do not fail if the cmdline is empty.
2. if /usr/lib/kernel/cmdline or /etc/kernel/cmdline are present, but
   empty, ignore /proc/cmdline. If there's explicit configuration to
   have empty cmdline, don't ignore it.
2019-08-27 18:33:13 +02:00
Takashi Iwai f4e38c0da8 dracut-init.sh: Nuke unused install_kmod_with_fw function
Kill the no longer used function, so that anyone won't be confused and
try to modify this function in future.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1146769
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-26 14:57:37 +02:00
Takashi Iwai 999cfa8458 dracut-install: Support the compressed firmware files correctly
The compressed firmware support was supposed to be already
implemented, but it didn't work as expected in the end, because dracut
moved to use dracut-install binary.  This patch adds the support of
XZ-compressed firmware installation to dracut-install for fixing the
missing piece.

At best the firmware files should be uncompressed in initrd, but this
patch simply copies the compressed file as-is, as a quick workaround.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1146769
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-26 14:57:37 +02:00
Zbigniew Jędrzejewski-Szmek b91d3f15bf shutdown: fix shutdown with console=null
C.f. https://github.com/systemd/systemd/issues/13332.
2019-08-22 16:47:32 +02:00
Frantisek Sumsal 5b2258ea0d travis: fetch only tags
The original `git pull` would try to pull & merge changes from the
master branch, which breaks CI runs on PRs based on non-master branches
2019-08-22 11:15:13 +02:00
Frantisek Sumsal 44fb598605 git2spec: avoid malforming of SHA-1 hashes
When a SHA-1 hash of a specific commit is used as a tag, the regex
shenanigans later in the script can (and will) corrupt it in certain
cases.

e.g.:
$ perl -e '
$tag="6e8cd92261577230daa1098f7e05ec198c3c4281";
$tag=~s/[^0-9]+?([0-9]+)/$1/;
print("$tag\n");
'
68cd92261577230daa1098f7e05ec198c3c4281

(Notice the missing 'e')

Let's fix this by limiting the regex's scope to a non-SHA-1 tags only.
2019-08-22 11:15:13 +02:00
Kairui Song 6a74c03b4a dracut.sh: Adjust squash and strip order
Previously with squash module, some binaries will be reinstalled, but
stripping happens before that so new installed binaries is not stripped.
So adjust the squash and strip order, ensure new installed binaries are
stripped just the same way with the old binaries.

Also split squash into two stage to make the split easier, move the
squash temp dir into initdir so stripping will cover that too,
and print more usefule message.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-08-09 13:11:47 +02:00
Lukas Nykryn d1afff43ae 90kernel-modules-extra: don't resolve symlinks before instmod
When you install a third-party driver, you will probably end in a
situation, where the module will be in a different directory and
in $depmod_module_dir you will only have symlink. If we resolve the
symlink before we pass the module path to instmod, the dracut-install
will only include the module with its original path, but not the
symlink. Hence the module can't be automatically loaded.

Dracut-install is clever enough to handle symlinks and will include both
the symlink and the module to the initrd.
2019-08-02 14:39:09 +02:00
Harald Hoyer 23acf15227
README.md: comment out travis CI 2019-07-22 14:39:42 +02:00
Harald Hoyer b355c7a532
Makefile: fix VERSION 2019-07-22 14:36:23 +02:00
Harald Hoyer 960d8726db
dracut.spec: add 06rngd 2019-07-22 14:07:26 +02:00
Paul Robins ce4d04bf72 Include systemd volatile root service and binary 2019-07-22 14:05:48 +02:00
Daniel Molkentin b6b1bf9202 Consollidate the qemu virtualization detection
Eventually, we could add a full virt detection routine.
This would be useful e.g. to determine inclusion of
ucode for hostonly setups.
2019-07-19 16:26:42 +02:00
Lukas Nykryn b988934a38 fips: split loading the crypto modules and checking the kernel
In e54ab383 we moved the fips script to a later pahse of boot, since
the /boot might not be available early on.

The problem is that systemd-cryptsetup* services could be run now
started before the do_fips is executed and need the crypto modules
to decrypted the devices.

So let's split the do_fips and load the module before udev does the
trigger.
2019-07-19 16:26:05 +02:00
Lukas Nykryn b2616b5268 net-lib: strstr is not for globs 2019-07-19 16:25:33 +02:00
Jonas Witschel 12f023ab03 Replace $(arch) by $(uname -m) 2019-07-19 16:25:03 +02:00
Arnaud Rebillout c30070c8f5 99base: Don't let vinfo return 1
When DRACUT_SYSTEMD is set and DRACUT_QUIET=yes, vinfo returns 1. This
is a problem for hooks which end with vinfo, as then the hook returns 1.
Especially problematic if this is a shutdown hook, as it will be
restarted again and again.

This commit fixes that.

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
2019-07-19 16:24:20 +02:00
Дамјан Георгиевски c8b35bf96a move setting the "systemdutildir" variable before it's used
on line 1086 it's used to check for the uefi_stub:
"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"

so it needs to be defined before that
2019-07-19 16:23:57 +02:00
Jonas Witschel 305c6f91bb dracut.sh: fix EFI directory if ESP is mounted to /efi
The EFI executables produced by dracut --uefi must be placed in the
subdirectory /EFI/Linux of the EFI system partition (ESP) according to
the Boot Loader Specification, see
https://systemd.io/BOOT_LOADER_SPECIFICATION#logic

This is done correctly for the mount points /boot and /boot/efi, but for
the mount point /efi, the files are placed in /efi/Linux instead of the
correct /efi/EFI/Linux. This commit fixes the directory so that the EFI
executables are picked up correctly by conforming boot loaders.

Apart from complying to the specification, the change is also in line
with the commit message of 5c57209ba5
("dracut.sh: add default path for --uefi") which introduced this feature
as well as the documentation in dracut.8.asc.
2019-07-19 16:23:24 +02:00
Lubomir Rintel 393fb1ac05 test/MULTINIC: correctly note activated devices when using network-manager
The .did-setup files are not there. What is there is the NetworkManager
connection files.
2019-07-19 16:21:56 +02:00
Lubomir Rintel 9dfd73bcbd test/BONDBRIDGETEAMVLAN: don't assert against ifcfg files
The network-manager module writes keyfiles instead of ifcfg files. Just
check whether the configuration got actually applied correctly.
2019-07-19 16:21:56 +02:00
Lubomir Rintel 2b1b3bcdcb test/IFCFG: make sure the network-legacy plugin is being used
If the network-manager plugin is used instead, it wouldn't write out
ifcfg files and we wouldn't have anything to check.

While at that, also enable the test.
2019-07-19 16:21:56 +02:00
Lubomir Rintel 70787ab619 test: copy BONDBRIDGETEAMVLAN to IFCFG
The IFCFG test will make sure the network-legacy plugin keeps writing
out correct ifcfg files.

This is a separate commit so that actual changes are visible in the
following one.
2019-07-19 16:21:56 +02:00
Lubomir Rintel 35efada5ec network: parse root=dhcp also with network-manager module
Move the logic from network-legacy to common network code.
2019-07-19 16:21:13 +02:00
Lubomir Rintel 381ab6b7cd network-manager: generate configuration with netroot=
If the root is on network, let nm-initrd-generator create configuration
even if none was explicitly specified on the command line.

Also do the same if /tmp/net.ifaces exists, because the anaconda plugin
creates an empty file in that location in hopes that will make us
configure the network.
2019-07-19 16:21:13 +02:00
Lubomir Rintel 4be95b67a7 network-manager: also read out next-server from NM state 2019-07-19 16:21:13 +02:00
Lubomir Rintel 5e0f8c8a4c network-manager: remove useless use of basename 2019-07-19 16:21:13 +02:00
Lubomir Rintel e318ba30fb test/{10,12,13,14,17,30,31}: increase the disk sizes
On Fedora 30 the paritition sizes turn out to be too small again:

  + mkdir -p /sysroot
  + mount /dev/dracut/root /sysroot
  + cp -a -t /sysroot /source/bin /source/dev /source/etc /source/lib /source/lib64 /source/proc /source/root /source/sbin /source/sys /source/tmp /source/usr /source/var
  cp: error writing '/sysroot/usr/lib64/libkrb5.so.3.3': No space left on device
  cp: error writing '/sysroot/usr/lib64/libkrb5support.so.0.1': No space left on device

It turns out that there has been quite some size increase in some libraries,
notably glibc, though not all -- some even shrunk, ruling out a toolchain
problem. Here's are files over 1M we install on Fedora 30:

   f29    f30
  2.7M => 6.4M /usr/lib64/{libc-2.28.so => libc-2.29.so}
  3.1M => 6.0M /usr/lib64/libcrypto.so.1.1.1c
  2.0M => 3.5M /usr/lib64/{libm-2.28.so => libm-2.29.so}
  2.9M => 2.8M /usr/lib/systemd/{libsystemd-shared-239.so => libsystemd-shared-241.so}
  1.7M => 2.5M /usr/lib64/libunistring.so.2.1.0
  2.3M => 2.4M /usr/lib64/bind9-export/libdns-export.so.1105.0.0
  1.2M => 2.1M /usr/bin/bash
  1.1M => 1.4M /usr/lib64/libkrb5.so.3.3
  1.2M => 1.4M /usr/lib64/libgcrypt.so.20.2.4
  612K => 1.1M /usr/lib64/libssl.so.1.1.1c

This increases the image sizes to accomodate for this. There's probably
little else we can do.
2019-07-19 16:19:44 +02:00
Kairui Song d9721f20d8 95fcoe: load 'libfcoe' module as a fallback
The kernel may only enable 'libfcoe' module. Some modules like bnx2fc
provides FCoE but only depend on 'libfcoe'. Loading 'fcoe' module may
fail but the kernel do support FCoE.

'libfcoe' will be installed as a dependency when installing block device
drivers if it's required. So no need to install it in installkernel.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-07-19 16:19:07 +02:00
Takashi Iwai 3e53195bce dracut-install: Add support for compressed kernel modules
When a module is compressed, uncompress it before packing into initrd.
Since initrd is already compressed, it makes no sense to put the
compressed module files.

The patch contains a slight refactoring and adds a helper function to
get the command for uncompressing a file per extension.
2019-07-19 16:17:35 +02:00
Frank Deng 11e1f68065 35network-legacy: fix classless static route parsing 2019-07-19 16:16:26 +02:00
Lubomir Rintel c21c1d459e TEST-70-BONDBRIDGETEAMVLAN: get rid of duplicate makefile 2019-07-19 16:13:46 +02:00
Lubomir Rintel 43c8c4ce04 fs-lib: drop a bashism
Bash 5 apparently longer propagates variable assignments to local variables
in front of function calls when in POSIX mode:

  [lkundrak@demiurge ~]$ cat feh.sh
  print_VAR () {
          echo "$VAR";
  }

  testfunc () {
          local VAR="OLD"
          VAR=NEW print_VAR
  }

  testfunc
  [lkundrak@demiurge ~]$ bash4 --posix feh.sh
  NEW
  [lkundrak@demiurge ~]$ bash5 --posix feh.sh
  OLD
  [lkundrak@demiurge ~]$ bash5 feh.sh
  NEW
  [lkundrak@demiurge ~]$

It works the way it did in Bash 4 in non-POSIX mode, for external programs,
or for non-local variables. Don't ask me why -- it's probably some
compatibility thing for some sad old people.

However, this precisely happens when fsck_single() is calling into the
fsck_drv_com(), assigned to _drv by fsck_able(). That ruins the
TEST-70-BONDBRIDGETEAMVLAN test's server and probably more.

Let's pass the fsck driver binary via the function argument instead. It's
less messy anyway.
2019-07-19 16:13:22 +02:00
Kairui Song 7b76fa924d 95iscsi: Fix network setup code for iscsi
- The network script and config could be in
  "/etc/sysconfig/network-scripts", so try look for network config in
  all possible path.

- The regex used for sed is not working, so fix it too.

- Make bootproto a local variable

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-07-19 16:12:47 +02:00
Lubomir Rintel 7934c6f918 test: tell systemd to reboot on fatal errors
Otherwise systemd would freeze execution, causing the test to time out
instead of failing fast.
2019-07-19 16:10:54 +02:00
Lubomir Rintel c27ed38bb2 test/TEST-14-IMSM: detect failure to compose the test setup root
The dracut-root-block-created line should not be created if we fail to copy
in the required files to sysroot. Let's turn on -e to trap failures and
poweroff on them, like some other tests do.

Also remove the &&. Not only it is unnecessary with -e, but defeats it.
From bash(1):

  The shell does not exit if the command that fails is [...] part of any
  command executed in a && or || list except the command following the
  final && or || [...]
2019-07-19 16:10:15 +02:00