Commit Graph

5449 Commits (ceca74ccc397795db68ca6ffbe49d65af2178a50)

Author SHA1 Message Date
Martin Wilck ceca74ccc3 dracut-functions: add ip_params_for_remote_addr() helper
This helper function takes a remote IP address, and tries to
determine the dracut command line arguments ip= and ifname= that
will make this remote address reachable during boot.

Functionality was taken from the module-setup.sh scripts of 95iscsi and 95nfs,
cleaned up and fixed some issues in particular with statically configured
networks, where the old code would print the unsupported string
"$ifname:static".
2020-08-04 08:43:32 +02:00
Enzo Matsumiya 019610af26 95nvmf: add NVMe over TCP support
Add support to boot from an NVMe over TCP device.

Example of supported command line formats:

nvme.discover=tcp:192.168.1.3::4420
nvme.discover=tcp:192.168.1.3 # will use 4420 as default svcid

- Create is_nvmf() function to handle all fabrics types
- Fix parse_nvmf_discover() to correctly use the default values
- Auxiliary function to validate an IP connection
- Fix inverted result for getargbool when reading "rd.nonvmf" command line parameter

Requires rd.neednet=1
Requires adding/replacing STARTMODE in /etc/sysconfig/network/ifcfg-ethX to "nfsroot"
to avoid shutdown hanging in initiator

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
2020-08-04 08:22:25 +02:00
q66 63b05a8e67 dracut.sh: fix ia32 detection for uefi executables 2020-08-03 18:51:49 +02:00
q66 fa1b98e4ea mkinitrd-dracut.sh: use vmlinux regex for ppc*, vmlinuz for i686
Previously this would not catch ppc64le, now it does; same with
i686.
2020-08-03 17:59:01 +02:00
q66 05ce5c41b6 90ppcmac: respect DRACUT_ARCH, don't exclude ppcle 2020-08-03 16:47:51 +02:00
Kairui Song f7ad1479f2 90kernel-modules: add pci_hyperv
Install pci_hyperv for SR-IOV devices on hyperv machines.
2020-08-03 15:57:04 +02:00
Jóhann B. Guðmundsson 0cf01f125a As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 8cb5ac1b30 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson d9149c6ca7 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson c437933cb0 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson e1130a8340 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 0c1bd016ec As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 317d841c78 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 5cb2a4004d As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 38ba90bf88 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 265f696b53 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
q66 d8d5cb839c dracut.sh: fix early microcode detection logic
This fixes two issues:

1) on non-x86 systems in non-hostonly config this would cause
   an annoying warning on every initramfs generation
2) on non-x86 systems in hostonly config this would result in
   early microcode not getting disabled
2020-07-26 10:25:42 +02:00
Thomas Blume 3b869230a0 95iscsi: fix ipv6 target discovery
ipv6 addresses need square brackets, otherwise the iscsi discovery and log-in,
which adds the iscsi port after another colon will get confused and fail.
2020-07-09 21:19:43 +02:00
Martin Wilck 46f3156426 91zipl: parse-zipl.sh: honor SYSTEMD_READY
The zipl partition should not be mounted if SYSTEMD_READY=0 is set.
Otherwise booting issues with multipath will result.
2020-07-09 18:06:50 +02:00
Kairui Song 5a4c346933 dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL
On Fedora/RHEL, libcryto will verify both itself and libssl on start, if
libssl is missing, FIPS self test will fail. However libssl is not a
dependency of libcryto so dracut will not install it, unless some other
binary or library pulls it in. Systemd requires libssl, so in most cases
it just worked, but could fail in some corner cases where systemd is not
used.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-07-02 17:05:23 +02:00
Kairui Song de3cb0e321 dracut.sh: Move the library workaround after squash
Ensure the workaround is also valid when dracut-squash module is used

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-07-02 17:05:23 +02:00
Lukas Nykryn 6dafdda4a6 install: also install post weak dependencies of kernel modules 2020-07-02 16:06:44 +02:00
Beniamino Galvani 5c3d0a9647 cms: regenerate NetworkManager connections
After changing the kernel command line, the cmsifup script calls ifup
to activate the interface. However, ifup is only available in the
network-legacy module; when using the network-manager module, we
should regenerate connections according to the command line; then
later NM will be run and will activate the device.
2020-06-25 10:58:34 +02:00
Beniamino Galvani 6e1e87cd25 network-manager: move connection generation to a lib file
Move the connection generation code to a library file so that it can
be reused from other places.
2020-06-25 10:58:34 +02:00
Daniel Molkentin 55b0d2edaf 95iscsi: fix missing space when compiling cmdline args
Reference: bsc#1172816
2020-06-17 21:01:03 +02:00
Hannes Reinecke 2f03d69f9d 95nvmf: add module for NVMe-oF
Add a module for booting from NVMe-oF devices.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-06-17 09:34:53 +02:00
Kairui Song 5f8063c6f2 95nfs: only install rpc services for NFS < 4 when hostonly is strict
Most rpc services are not needed for NFSv4, so skip these components
to save space. rpc.idmapd is still needed in case of
nfs4_disable_idmapping is set to 0.
2020-05-29 16:51:45 +02:00
Harald Hoyer 871d63c3be Fix CI badges in README.md and fix dracut description
While fixing the CI badges, I removed some old crufty README text.
2020-05-29 16:15:42 +02:00
Beniamino Galvani eb770a4a20 network-manager: set kernel hostname from the command line
Since commit ff70adf873ef ("initrd: save hostname to a file in /run"),
the initrd generator of NetworkManager parses the hostname from 'ip='
options of the kernel command line and writes it to
/run/NetworkManager/initrd/hostname.

When that file exists, set the kernel hostname.

In presence of multiple hostnames in the command line, the last one
wins. Hostnames from command line always have precedence over ones
received through DHCP. This is a bit different from the legacy network
module that gives higher precedence to the hostname (from DHCP or
command line) of the last interface that is brought up, which depends
on the udev order.
2020-05-29 14:42:42 +02:00
Harald Hoyer 7169e5f0e4 dracut.conf.5.asc: document how to config --no-compress in the config
Fixes: https://github.com/dracutdevs/dracut/issues/824
2020-05-29 14:08:52 +02:00
Harald Hoyer c800d1a7b9 dracut.cmdline.7.asc: clarify usage of `rd.lvm.vg` and `rd.lvm.lv`
Fixes: https://github.com/dracutdevs/dracut/issues/816
2020-05-29 13:28:27 +02:00
Harald Hoyer b448655ba7 CI: remove Fedora 30, add Fedora 32 2020-05-29 10:53:57 +02:00
Alexander Tsoy 50cc23ba32 busybox: simplify listing of supported utilities
'--list' option is supported since busybox-1.20.0, which was released
in 2010.
2020-05-29 10:27:59 +02:00
Alexander Tsoy f769154bcc dracut-functions: fix find_binary() to return full path
Fixes: a01204202b (Allow running on a cross-compiled rootfs)
2020-05-29 10:27:59 +02:00
Kairui Song 2a61132865 Remove cleanup_trace_mem calls
In commit 49c4172 all shell based memory tracing functions are removed,
there are some left over. Remove them as well.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-05-27 16:51:52 +02:00
Kairui Song 424f01e2a0 99memstrack: hook script should not call exit
With memstrack module, rd.break may not work because the hook scripts
are sourced, not executed, so the exit call will make pre-pivot queue
exit early. See 98dracut-systemd/dracut-pre-pivot.sh, everything after
"source_hook cleanup" will be ignored.

Replace with return instead.

Credits go to Lukas Nykryn <lnykryn@redhat.com> who helped discover and
debug this issue.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-05-27 16:51:52 +02:00
Tomasz Paweł Gajc 1ec7b694b5 install dependant libs too
By default rng-tools are compiled with pkcs11 support.
Make sure opensc-pkcs11.so library is installed inside initramfs to prevent error on boot
2020-05-20 15:45:38 +02:00
Javier Martinez Canillas ff366790a6 51-dracut-rescue.install: Don't use BLS fragment shipped by kernel package
For the GRUB and zipl bootloaders the BLS fragment that is shipped by the
kernel package is used, so the same fragment is used for the rescue entry.

But there are cases where this BLS fragment is not suitable. For example,
if the boot directory is on a btrfs subvolume the path in the linux and
initrd fiels need to be adjusted with the real path. Otherwise GRUB won't
be able to read them.

The GRUB and zipl kernel-install plugins already take care of this before
installing the BLS fragments, so just copy the installed fragment that has
the updated paths instead of using the BLS shipped by the kernel package.

Resolves: rhbz#1827882

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2020-05-07 15:16:00 +02:00
Fabian Vogt 32dfd41688 Fix test in lsinitrd
If $uefi is empty, this evaluated to true previously,
resulting in "initrd in UEFI: : 13M".
2020-05-04 11:48:09 +02:00
Derek Hageman cb9e6881dd 90crypt/module-setup.sh: fix force on multiple lines
The first line in crypttab with a "force" option causes all subsequent
lines to be included as if they also had it set because the variable
used to track it is not reset between loop iterations.  So fix that by
just setting it to empty before the check for the force option.
2020-05-01 11:43:47 +02:00
Harald Hoyer c6a2ebffe5 90kernel-modules/module-setup.sh: add sg kernel module
Fixes udevd messages about failure of `modprobe -bv sg`.
2020-04-30 21:51:58 +02:00
Harald Hoyer 5bfebf0f04 90crypt/module-setup.sh: try to catch kernel config changes
If a crypto kernel module changes from compiled in to module, the
encrypted disk might fail to open, because the kernel module was
not included in the initramfs.

This patch tries heuristically to catch such modules.

Fixes https://github.com/dracutdevs/dracut/issues/706
2020-04-24 12:29:05 +02:00
Harald Hoyer 586a56c287 Install crypto modules in 90kernel-modules
We don't want to play catch up with hash and encryption algorithms.
To be safe, just use the hammer and include all crypto.

Fixes https://github.com/dracutdevs/dracut/issues/802
2020-04-24 11:40:15 +02:00
Peter Georg faea4e4ddb Always pull in machinery to read ifcfg files
So far machinery is only pulled in if the user has not yet included any
ifcfg files.
2020-04-21 22:27:11 +02:00
Kairui Song 7dd8a2f4d3 Add 99memstrack module
memstrack is a new tool to track the overall memory usage and
allocation, which can help off load the improve the builtin module
memory tracing function in dracut.

With this change, the rd.memdebug=4 behavior is similiar with before,
but the report is defered to pre-pivot, so the memory usage info
during the whole initramfs run is traced. And the ourput format is
changed a bit:

  dracut-pre-pivot[519]: ======== Report format module_summary: ========
  dracut-pre-pivot[519]: Module squashfs using 10.4MB (2658 pages), peak allocation 10.4MB (2671 pages)
  dracut-pre-pivot[519]: Module qxl using 3.4MB (865 pages), peak allocation 3.4MB (880 pages)
  dracut-pre-pivot[519]: Module crc32c_intel using 2.0MB (519 pages), peak allocation 3.0MB (769 pages)
  dracut-pre-pivot[519]: Module serio_raw using 2.0MB (505 pages), peak allocation 3.6MB (918 pages)
  dracut-pre-pivot[519]: Module virtio_console using 1.6MB (416 pages), peak allocation 1.6MB (419 pages)
  ... snip ...
  dracut-pre-pivot[519]: ======== Report format module_summary END ========

It now contains more detail and also includes the peak usage which could
be more helpful.

And now it have a rd.memdebug=5, which will print more detail about
the stack trace of the top memory user, also printed on pri-pivot:

  dracut-pre-pivot[519]: ======== Report format module_top: ========
  dracut-pre-pivot[519]: Top stack usage of module squashfs:
  dracut-pre-pivot[519]:   (null) Pages: 2658 (peak: 2671)
  dracut-pre-pivot[519]:     (null) Pages: 2658 (peak: 2671)
  dracut-pre-pivot[519]:       async_page_fault (0xffffffff81a01149) Pages: 1448 (peak: 1461)
  dracut-pre-pivot[519]:         do_async_page_fault (0xffffffff8105c509) Pages: 1448 (peak: 1461)
  dracut-pre-pivot[519]:           do_page_fault (0xffffffff8106296a) Pages: 1448 (peak: 1461)
  dracut-pre-pivot[519]:             do_user_addr_fault (0xffffffff810626bd) Pages: 1448 (peak: 1461)
  dracut-pre-pivot[519]:               handle_mm_fault (0xffffffff812940c4) Pages: 1448 (peak: 1461)
  dracut-pre-pivot[519]:                 __handle_mm_fault (0xffffffff81293627) Pages: 1195 (peak: 1208)
  dracut-pre-pivot[519]:                   __do_fault (0xffffffff8128b07e) Pages: 1195 (peak: 1208)
  dracut-pre-pivot[519]:                     filemap_fault (0xffffffff8124c0b9) Pages: 1195 (peak: 1208)
  dracut-pre-pivot[519]:                       __do_page_cache_readahead (0xffffffff812585da) Pages: 1063 (peak: 1076)
  dracut-pre-pivot[519]:                         read_pages (0xffffffff812583c2) Pages: 1063 (peak: 1076)
  dracut-pre-pivot[519]:                           squashfs_readpage squashfs (0xffffffffc0022073) Pages: 1039 (peak: 1052)
  dracut-pre-pivot[519]:                             squashfs_readpage_block squashfs (0xffffffffc0024334) Pages: 744 (peak: 744)
  dracut-pre-pivot[519]:                               squashfs_copy_cache squashfs (0xffffffffc0021a3f) Pages: 744 (peak: 744)
  dracut-pre-pivot[519]:                                 pagecache_get_page (0xffffffff8124abf7) Pages: 744 (peak: 744)
  dracut-pre-pivot[519]:                                   __page_cache_alloc (0xffffffff81247df6) Pages: 744 (peak: 744)
  dracut-pre-pivot[519]:                                     alloc_pages_current (0xffffffff812cdca7) Pages: 744 (peak: 744)
  dracut-pre-pivot[519]:                                       __alloc_pages_nodemask (0xffffffff812b3107) Pages: 744 (peak: 744)
  dracut-pre-pivot[519]:                                         __alloc_pages_nodemask (0xffffffff812b3107) Pages: 1488 (peak: 1488)
  dracut-pre-pivot[519]: Top stack usage of module qxl:
  dracut-pre-pivot[519]:   (null) Pages: 865 (peak: 880)
  dracut-pre-pivot[519]:     entry_SYSCALL_64_after_hwframe (0xffffffff81a0008c) Pages: 855 (peak: 858)
  dracut-pre-pivot[519]:       do_syscall_64 (0xffffffff81002a5a) Pages: 855 (peak: 858)
  dracut-pre-pivot[519]:         __x64_sys_finit_module (0xffffffff8117ccea) Pages: 811 (peak: 811)
  dracut-pre-pivot[519]:           __do_sys_finit_module (0xffffffff8117cc6e) Pages: 811 (peak: 811)
  dracut-pre-pivot[519]:             load_module (0xffffffff8117c6be) Pages: 802 (peak: 802)
  dracut-pre-pivot[519]:               do_init_module (0xffffffff81179e72) Pages: 802 (peak: 802)
  dracut-pre-pivot[519]:                 do_one_initcall (0xffffffff81000d5a) Pages: 802 (peak: 802)
  dracut-pre-pivot[519]:                   serio_raw_poll serio_raw (0xffffffffc0200054) Pages: 802 (peak: 802)
  dracut-pre-pivot[519]:                     __pci_register_driver (0xffffffff81557804) Pages: 802 (peak: 802)
  dracut-pre-pivot[519]:                       driver_register (0xffffffff8167ed24) Pages: 802 (peak: 802)
  dracut-pre-pivot[519]:                         bus_add_driver (0xffffffff8167cbb2) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                           driver_attach (0xffffffff8167d28e) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                             bus_for_each_dev (0xffffffff8167b62c) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                               __driver_attach (0xffffffff8167e18f) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                                 device_driver_attach (0xffffffff8167e0ed) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                                   driver_probe_device (0xffffffff8167de6c) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                                     really_probe (0xffffffff8167d9c9) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                                       pci_device_probe (0xffffffff81559627) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                                         local_pci_probe (0xffffffff81557f98) Pages: 801 (peak: 801)
  dracut-pre-pivot[519]:                                           qxl_pci_probe qxl (0xffffffffc01f0387) Pages: 773 (peak: 773)
  dracut-pre-pivot[519]:                                             drm_fbdev_generic_setup drm_kms_helper (0xffffffffc01b30c5) Pages: 773 (peak: 773)
  dracut-pre-pivot[519]:                                               drm_fbdev_client_hotplug drm_kms_helper (0xffffffffc01b2656) Pages: 773 (peak: 773)
  dracut-pre-pivot[519]:                                                 __drm_fb_helper_initial_config_and_unlock drm_kms_helper (0xffffffffc01b1a28) Pages: 770 (peak: 770)
  dracut-pre-pivot[519]:                                                   drm_fb_helper_generic_probe drm_kms_helper (0xffffffffc01b2fa5) Pages: 770 (peak: 770)
  dracut-pre-pivot[519]:                                                     vzalloc (0xffffffff812aa39c) Pages: 770 (peak: 770)
  dracut-pre-pivot[519]:                                                       __vmalloc_node_range (0xffffffff812aa200) Pages: 768 (peak: 768)
  ... snip ...
  ======== Report format module_top END ========

This could be very helpful for debuging memory usage issues.
2020-04-20 20:22:37 +02:00
Kairui Song 49c4172f4e Remove memtrace-ko and rd.memdebug=4 support in dracut
This feature could be off loaded to memstrack, which have better
accurecy, better performance, and have more detailed tracing features.

Also simplify make_trace_mem a bit.

And currently rd.memdebug=4 is unstable, fails from time to time.
2020-04-20 20:22:37 +02:00
Beniamino Galvani 87bffc36e7 network-manager: install libnss DNS and mDNS plugins
Install libnss_dns.so and libnss_mdns4_minimal.so plugins for the Name
Service Switch (NSS) functionality of glibc so that name resolution
through /etc/resolv.conf and mDNS works in the initrd.

Fixes: #772
2020-04-20 16:47:56 +02:00
Harald Hoyer 3a4a212649 systemd: skip dependency add for non-existent units
Fixes: https://github.com/dracutdevs/dracut/issues/795
2020-04-20 16:24:15 +02:00
Mikhail Novosyolov de34ba76e5 i18n: Always install /etc/vconsole.conf
/etc/vconsole.conf must be installed always, even in generic initrds, not only host-only ones.
systemd-vconsole-setup is run at initrd stage and expects either /etc/vconsole.conf or kernel cmdline options to exist.

I have also proposed a change in systemd-vconsole-setup that makes it behave better if /etc/vconsole.conf does not exist:
https://github.com/systemd/systemd/pull/15479
But it is just a fallback. If /etc/vconsole.conf does not exist in initrd and if that patch is applied on systemd,
then the default consoel font is set despite the one being set in /etc/vconsole.conf and this setting is inherited
when new TTYs are opened. This leads to full ignorance of settings in /etc/vconsole.conf.
It is incorrect, and that is why this file must be copied to initrds always, but not only on host-only initrds.

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

Signed-off-by: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
2020-04-20 15:37:28 +02:00
Jonas Witschel 8e1a4dc5f8 dracut-lib.sh: quote variables in parameter expansion patterns
According to POSIX.1-2017, 2.6.2 Parameter Expansion:

${parameter%[word]} [...] The word shall be expanded to produce a
pattern.

This means if word contains variables that itself contain special
characters like asterisks or backslashes, these are treated as pattern
characters unless the variable is quoted. Try e.g. the following example
in bash, dash or (busybox) ash:

i='a\c'; j='\'; echo "${i%$j*}"

This prints "a\c" because "$j*" is expanded to "\*", escaping the
asterisk. In contrast,

i='a\c'; j='\'; echo "${i%"$j"*}"

produces the expected result "a" because the backslash is not specially
treated any more after quoting.

The quotes that this commit adds have been previously removed in commit
f9c96cf56f, citing issues with busybox
hush without further specifying the actual error. I tested a recent
busybox build (upstream commit 9aa751b08ab03d6396f86c3df77937a19687981b)
and couldn't find any problems. Note that the above example always
produces "a\c" in hush regardless of quoting $j, making hush unsuitable
for use with dracut, but using quotes in parameter expansions generally
works.

The unquoted variables break the "rd.luks.uuid/name" kernel command line
options in dracut 050 because

str_replace "$luksname" '\' '\\'

in modules.d/90crypt/parse-crypt.sh is not able to escape the
backslashes any more, see GH-723, GH-727: backslashes in the
systemd-cryptsetup@.service unit name stay unescaped for use in udev
(cf. commit 0f6d93eb9d), leading to
failures in starting the unit.

This partially reverts commit f9c96cf56f.
2020-04-20 14:59:02 +02:00