Commit Graph

3270 Commits (c8ebb80590be2dbe0cb63c9696903889b51efc75)

Author SHA1 Message Date
наб dae2759e61 95cifs: install new softdeps (sha512, gcm, ccm, aead2) 2020-08-21 15:24:58 +02:00
mulhern fe761330e5 Remove stratis module
It is obsolete. An approach which does not start the daemon is being worked
on.

Signed-off-by: mulhern <amulhern@redhat.com>
2020-08-20 18:39:44 +02:00
Frederick Grose f7e924c577 dmsquash-live-root: Remove obsolete osmin.img processing.
osmin.img is no longer used by anaconda or generated by
livemedia-creator.  livecd-creator will soon drop it as well.
Removing this code will allow OverlayFS boots to proceed  when
osmin.img is present in the .iso image.
2020-08-11 20:18:44 +02:00
Daniel Molkentin 74f83fb9f3 95nvmf: fix typo in the example documentation 2020-08-11 20:00:12 +02:00
Thomas Blume 376ce85105 net-lib.sh: support infiniband network mac addresses
Infiniband MAC addresses have 20 octets.

Reference: bsc#996146
2020-08-07 12:00:59 +02:00
Daniel Molkentin 01b7163a59 90lvm: do not add newline to cmdline
Fixes #862
2020-08-06 09:53:55 +02:00
Thomas Blume 3f5bf54fbf 35network-legacy: simplify fallback dhcp setup
suppress redundant calls to network setup

combine code for "no ip option directed at our interface" and
"No ip lines default to dhcp"
correct evaluation of return code for creating did-setup files
fix application of "load_ipv6" call to ipv6 setup only

Reference: bsc#1173402
2020-08-05 12:32:24 +02:00
Denis Volkov 09a691af3b Change the order of NFS servers during the boot
NFS server provided by DHCP in next-server option has higher priority than DHCP-server itself
2020-08-04 17:33:41 +02:00
David Tardon d9e27b0917 match simplified rd.zfcp format too
The simplified format was introduced by commit
c8aa1d949a .
2020-08-04 16:27:48 +02:00
David Tardon ae83919a7a match the whole string 2020-08-04 16:27:48 +02:00
Kairui Song cfd872392c 99squash: improve pre-requirements check
Check for systemd-initrd and squashfs-tools in check() to fail early if
it won't work.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 14:24:53 +02:00
Kairui Song 3a2beb037c 99squash: Don't hardcode the squash sub directories
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 14:24:53 +02:00
Kairui Song dc9596155d dracut-initqueue: Print more useful info in case of timeout
Currently when initqueue timeout, it span the console with
"dracut-initqueue timeout - starting timeout scripts", which isn't very
helpful as we still don't know what actually happened. Try to improve
this by print what is actually being waited.

Besides, only print "starting timeout scripts" when there are
actual timeout scripts to use.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 14:00:06 +02:00
Norbert Lange acc782bad5 mount-root.sh: fix writing fstab file with missing fsck flag
if the kernel argument rootflags is set, then dracut will
not parse the rootfs fstab and rootfsck wil not be set.

if the filesystem can be fsck'ed then its unmounted,
and an entry to the local fstab is written, omitting the last
field.

mounting /sysroot using fstab will then fail.

This change makes sure that the filed is always written.

Signed-off-by: Norbert Lange <norbert.lange@andritz.com>
2020-08-04 13:26:33 +02:00
Kairui Song 5c025a7d2a 99memstrack: Only start tracking service when rd.memdebug=4|5
Currently systemd will always start the tracking service, it will
exit early if rd.memdebug<=3 so there is no issue here, but it
leave a message of: "Started Memstrack Anylazing Service.".
Better to avoid such message if it's not used.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 12:53:14 +02:00
Alexander Tsoy 07417b7fc5 lvm: fix removal of pvscan from udev rules
udev rules provided by lvm 2.02.128 and newer uses '+=' instead of '='.
2020-08-04 12:30:40 +02:00
Daniel Molkentin 480aa9695f 95resume: Do not resume on iSCSI, FCoE or NBD
The iSCSI configuration is started after dracut checks for resume,
so we run into a timeout here. Additionally it's questionable if
resume on iSCSI makes sense (or is even supported on the platform).

Same holds true for Network Block Devices and FcOE, cover those as well

References: bsc#999663

Original-patch-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Daniel Molkentin <daniel.molkentin@suse.com>
2020-08-04 10:37:57 +02:00
Alexander Tsoy fe02bc78ac lvm: remove unnecessary ${initdir} from lvm_scan.sh
lvm_scan.sh runs in the initramfs, so paths should not be prefixed with
${initdir}.
2020-08-04 09:53:51 +02:00
Martin Wilck 880d155967 95nfs: use ip_params_for_remote_addr()
Use the new helper function.
2020-08-04 08:43:32 +02:00
Martin Wilck 6dbae7e772 95iscsi: use ip_params_for_remote_addr()
Use the new helper function.
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 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
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
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
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
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
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
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
Martin Wilck 25c7a13985 90nvdimm: include nvdimm keys in initrd
This is necessary to actually unlock NVDIMM keys during boot.
2020-04-17 18:22:36 +02:00
Kairui Song 872eb69936 95znet: Add a rd.znet_ifname= option
qeth device may have a different IP for each boot, so the rd.ifname=
option will no longer work. So for znet device, introduce a
rd.znet_ifname= options, to subchannel id instead of MAC address as the
identifier and rename the interface.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-04-14 12:56:13 +02:00
Ben Howard b8a92b7156 multipath: add automatic configuration for multipath
Add support for 'rd.multipath=default' for using the default
configuration on boot. The intended purpose for this is to help support
ostree-based image boots from multipathed devices (such as Fedora and
Red Hat CoreOS).
2020-04-03 23:48:32 +02:00
Alexander Sosedkin 3a043feea1 url-lib: drop NSS if it's not in curl --version 2020-04-02 22:09:39 +02:00
Patrick Talbert b68930ed3d dhclient-script: Fix typo in output of BOUND & BOUND6 cases
No bonding going on here.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
2020-03-19 20:45:41 +01:00
Sebastian Mitterle defb1611c7 dasd: only install /etc/dasd.conf if present
`dasd.conf` needn't be present on system even if modules have been loaded.

Check if file exists to avoid error message during kernel update
```bash
dracut-install: ERROR: installing '/etc/dasd.conf'
dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.YvVRx5/initramfs -H /etc/dasd.conf
```
2020-03-19 18:05:30 +01:00
Đoàn Trần Công Danh 17d62d1206 cryptroot-ask: no warn if /run/cryptsetup exist
In either case:
- encrypted device is decrypted, udev will trigger device changes again,
- multiple encrypted device,

cryptroot-ask will run multiple time, then report:
> mkdir: cannot create directory '/run/cryptsetup': File exists

Pass `-p` into mkdir to ignore that warning.
2020-03-16 18:26:33 +01:00
Lukas Nykryn 7069132ec7 network: fix glob matching ipv6 addresses
In this case we want to cover three cases
1) ip_address:ip_address
2) number:macaddress
3) :macaddress

We consider something an IPv6 address if it starts with number and
contains ":", but IPv6 addresses are in hexa.
2020-03-12 13:46:46 +01:00
Beniamino Galvani 3dcaa97ca4 network-manager: ensure that nm-run.sh is executed when needed
The network-manager command line hook must install a
initqueue/finished hook to ensure that nm-run.sh is executed when
there are network connections to activate.

Fixes: #694
2020-03-12 11:42:37 +01:00
Harald Hoyer 0402b3777b btrfs: force preload btrfs module
fixes https://github.com/dracutdevs/dracut/issues/658

raid6_pq and xor takes time doing benchmarking

[    3.983009] request_module fs-btrfs succeeded, but still no fs?
2020-03-11 13:38:12 +01:00
Thomas Blume 8446c8f9de 95fcoe: default rd.nofcoe to false
rd.nofcoe should default to false, e.g. fcoe should be enabled unless
overwritten from the command line.
The same applies for lldapd.sh.
2020-03-11 12:29:03 +01:00
Radek Vykydal 7fb8f939a5 Fix pre-trigger stage by replacing exit with return in lldpad.sh
Using exit makes the pre-trigger stage finish after running 03-lldpad.sh
pre-trigger hook.
2020-03-10 12:47:55 +01:00
Daniel Molkentin 2293609dcb 95dcssblk: fix script permissions 2020-03-06 13:51:06 +01:00
Daniel Molkentin 7a04712ad0 95zfcp_rules/parse-zfcp.sh: remove rule existence check
Reference: bsc#1008352

Original-Patch-By: Michal Suchanek <msuchanek@suse.com>
2020-03-06 11:32:41 +01:00
Daniel Molkentin db9b5851f3 99base: Remove duplicate nfsroot_to_var from dracut-lib.sh
It already lives in nfs-lib.sh, which is the more correct library scope.

Fixes #17
2020-03-06 11:02:15 +01:00
Martin Wilck 18420d9ce5 90kernel-modules: remove nfit from static module list
The 90nvdimm module now resolves the nfit dependency when it's
necessary, so it's not necessary any more to pack it always.
2020-03-06 10:52:06 +01:00
Martin Wilck 7ef5ead6f4 Add module "90nvdimm" for NVDIMM support
Detection of persistent memory devices works mostly out of the box
already. Only the "provider" modules for ndbus devices, which are responsible
to extract information of available NVDIMM devices and their configuration
from system firmware, are only indirectly linked into the module stack.
Examples for such modules are nfit.ko, nd_e820.ko, and virtio-pmem.ko.

Add a module that resolves these dependencies.
2020-03-06 10:52:06 +01:00
Marek Marczykowski-Górecki ebeed55c07 Consider also drm_dev_register when looking for gpu driver
DRM drivers are filtered for drm_crtc_init symbol,
but not all drivers use it. Especially, cirrus driver
doesn't use it since Linux 5.2.

The practical result is text plymouth theme instead of graphical when in qemu.

Fix it by looking also for drm_dev_register symbol.
Suggested by @haraldh
Fixes #712
2020-03-04 10:41:04 +01:00
Daniel Molkentin f2d33a7f61 90kernel-modules: Add PCI host controller modules
Currently there is no usb support on RPi4 in the
initrd phase as the pcie-brcmstb module is missing.
If part of the boot is handled from a USB stick
(e.g. with Ignition), the stick cannot be accessed.

Reference: boo#1162669
2020-03-04 09:23:09 +01:00
Daniel Molkentin 7dc918cad1 90crypt: install crypt-run-generator in non-systemd environments 2020-03-04 09:22:09 +01:00
Daniel Molkentin 452cb40497 90crypt: Do not call cryptsetup in a systemd environment
systemd provides its own cryptsetup facilities, and the
cryptsetup binary might not even exist, failing
to execute the discard flag processing.

Fixes #602
2020-03-04 09:22:09 +01:00
nabijaczleweli 38c8fed48a Enable resume module if hibernation's enabled on the host
Ref: 34b56de12a
Fixes https://github.com/dracutdevs/dracut/issues/496
2020-03-03 19:51:08 +01:00
Alexander Miroshnichenko 3ea80545d6 stratis module: fix start order
Change start script order to pre-mount as stratis require fully initialized udev.
2020-02-28 20:43:01 +01:00
Frantisek Sumsal ef8915d7af fcoe/fcoe-genrules.sh: use $name instead of $env{INTERFACE}
Followup to a8ba1c4e25 and
11a5501d0f
2020-02-28 20:41:37 +01:00
Frantisek Sumsal 11a5501d0f cms/cmssetup.sh: use $name instead of $env{INTERFACE}
Followup to a8ba1c4e25
2020-02-28 16:32:11 +01:00
Harald Hoyer 63b67a48f9 nbd/parse-nbdroot.sh: don't create mount unit
let the generator do its thing
2020-02-27 15:27:30 +01:00
Harald Hoyer a8ba1c4e25 network-legacy/net-genrules.sh: use $name instead of $env{INTERFACE}
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

Related links:
 - systemd/systemd#12700 (udev PR)
 - systemd/systemd#12291 (related udev issue)
 - systemd/systemd#14935 (this issue, udev side)
 - #732 (this issue, dracut side)

Fixes: #732
2020-02-27 13:49:21 +01:00
Jonathan Lebon 4985aa8c6e network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic
Previously, we were doing `setup_net` from `ifup` for any setup that
wasn't DHCP, since those are already taken care of by `dhclient-script`.

The issue is that the case-statement we use to detect this doesn't catch
options like `ip=dhcp,dhcp6`.

Fix this by reworking the logic here to just check if a
`setup_net_$netif.sh` hook exists. If so, then we know that `setup_net`
will be called for this interface later.

This was causing issues in RHCOS which now ships with `ip=dhcp,dhcp6` to
support IPv6 environments[1]. The code here would make us do `setup_net`
pre-emptively which IIUC would then cause the initqueue to finish
earlier even if we had more udev netif events to process.

[1] https://github.com/coreos/coreos-assembler/pull/1067

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1803926
2020-02-25 14:34:58 +01:00
Jonathan Lebon 7795fde44c network-legacy/ifup: drop redundant if-statement
No need to check that `$ret` is 0, we're already running inside an
if-statement block which checks this.
2020-02-25 14:34:58 +01:00
Harald Hoyer 16abea2592
systemd: install systemd-tty-ask-password-agent systemd-ask-password
fixes https://github.com/dracutdevs/dracut/issues/726
2020-02-18 15:33:23 +01:00
Eugene S. Sobolev c7ee6b3dbb network/net-lib.sh: Configure all iBFT interfaces
Added boolean command line option rd.iscsi.mp
2020-02-14 10:42:34 +01:00
Lukas Nykryn 76f6566fd7 Revert "wait for IPv6 RA if using none/static IPv6 assignment"
This reverts commit c603419030.

wait_for_ipv6_dad_link is only called from dhclient script,
so the original intent "wait for IPv6 RA if using none/static IPv6 assignment"
does not seem to be correct.

Anyway, this brings an issue on isolated networks, where you don't
have any routes outside. dhclient-script hangs on this check
and after it times out, dhclient is able to set the address normally.
2020-02-11 14:23:27 +01:00
Lukas Nykryn 962310483f dhclient-script: ipv6 uses different variables for nameservers
new_domain_name_servers and new_domain_search is only provided vit IPv4

see: https://src.fedoraproject.org/rpms/dhcp/blob/HEAD/f/dhclient-script#_148
2020-02-11 14:23:03 +01:00
Lukas Nykryn 579fbb9fc4 40network: bump rd.net.timeout.carrier to 10 seconds
On some devices kernel currently takes 5.2 seconds to detect carrier,
so let's make the default in dracut bit more sensible.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1772010
2020-02-10 14:37:15 +01:00
Harald Hoyer 350ec5d9dd
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
2020-01-24 13:42:46 +01:00
Harald Hoyer 2ee69a40c8
add missing crypto modules for aarch64
Fixes https://github.com/dracutdevs/dracut/issues/711
2020-01-23 13:47:53 +01:00
Jonathan Lebon d0de58f232 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
2020-01-23 09:32:25 +01:00
Kairui Song f4ad2e5c89 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>
2020-01-17 07:26:24 +01:00
Jan Macku cb86c560b0 Write dns values passed by ip argument to ifcfg-* files 2020-01-14 09:33:38 +01:00
Jan Macku 70b19acf94 Replace ln with systemctl 2020-01-14 09:29:51 +01:00
Jacob Wen d5e818f349 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>
2020-01-14 09:26:12 +01:00
Kairui Song 4598b5540e 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>
2020-01-14 09:25:29 +01:00
Lubomir Rintel 5965710e01 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.
2020-01-14 09:24:42 +01:00
Brian C. Lane 05b75703b0 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
2020-01-14 09:23:21 +01:00
Colin Walters 7fea85ce5f modules/network-manager: Install `ip`
We don't need `ip` but having it is *really* useful for people debugging
in an emergency shell.
2020-01-14 09:17:22 +01:00
Lukas Nykryn 2181c80c91 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
2020-01-14 09:16:48 +01:00
Lukas Nykryn 212043f94d network-legacy/ifup: fix typo when calling dhclient --timeout 2020-01-14 09:16:23 +01:00
Alexey Kodanev 958ca9e912 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>
2019-11-29 18:56:56 +01:00
Petr Tesarik 7d47d1c423 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>
2019-11-22 17:54:00 +01:00
Doan Tran Cong Danh 41a37bc626 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>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh cf31ed2ae6 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>
2019-11-10 01:47:30 +01:00
Lubomir Rintel 687e17aa7f network-manager: fix getting of ifname from the sysfs path
commit 5e0f8c8a4c ('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.
2019-11-05 14:18:01 +01:00
Thomas Blume 3f4bbca751 keep network device naming scheme on upgrade 2019-11-05 11:37:22 +01:00
Jonathan Lebon cc6792a01e 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.
2019-10-31 11:12:36 +01:00
Jonathan Lebon ca4aa84851 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.
2019-10-31 11:12:36 +01:00
Jonathan Lebon ba813779bf 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.
2019-10-31 11:12:36 +01:00
Jonathan Lebon 9e759aa969 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).
2019-10-31 11:12:36 +01:00
Harald Hoyer 27f758e12c
iscsi: remove bashisms 2019-10-25 14:29:17 +02:00
Böszörményi Zoltán a01204202b 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>
2019-10-25 11:58:58 +02:00
Jiri Konecny 0d609ae274 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.
2019-10-25 11:47:04 +02:00
Jiri Konecny 7ff0fcb723 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.
2019-10-25 11:47:04 +02:00
Daniel Molkentin e3edd247ce 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>
2019-10-25 11:38:17 +02:00
Nathan Rini 916ac45cbe swap for loop to POSIX shell compat 2019-10-25 11:37:43 +02:00
Nathan Rini 0bac59ee5e typo bugfix 2019-10-25 11:37:43 +02:00
Nathan Rini fb3d292800 fix off by one 2019-10-25 11:37:43 +02:00
Nathan Rini 1b38fa412c bugfix for initialization
exit with error if all retries fail
2019-10-25 11:37:43 +02:00
Nathan Rini 66bfa66add add sleep and max number of retries 2019-10-25 11:37:43 +02:00
Nathan Rini 678627f349 retry image download forever 2019-10-25 11:37:43 +02:00
Frederick Grose 3c8c807db1 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.
2019-10-25 11:35:15 +02:00
Martin Wilck 78efd6988e 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
2019-10-25 11:34:24 +02:00
Norbert Lange 1aa2d1eddf fix check whether the rootfs init is usable
this now correctly handles:
-   plain files
-   relative symlinks
-   absolute symlinks
2019-10-25 11:30:43 +02:00
tpgxyz 519186e9e6 add mksh support 2019-10-25 11:29:30 +02:00
q66 159175d525 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.
2019-10-25 09:20:04 +02:00
Martin Wilck 9b9dd9993e 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
2019-10-25 09:18:12 +02:00
Martin Wilck c0e5e48aab 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
2019-10-25 09:18:12 +02:00
Martin Wilck 28749d9973 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.
2019-10-25 09:18:12 +02:00
Martin Wilck ac7582af48 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.
2019-10-25 09:18:12 +02:00
Martin Wilck 0d5597044f 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.
2019-10-25 09:18:12 +02:00
Martin Wilck 5fbe772b44 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.
2019-10-25 09:18:12 +02:00
Martin Wilck 906896e220 network: stop waiting for interfaces if root device is present 2019-10-25 09:18:12 +02:00
Martin Wilck f551886f5c 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.
2019-10-25 09:18:12 +02:00
Lee Duncan 1ab6778ee4 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.
2019-10-25 09:18:12 +02:00
Kairui Song 5d88809319 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>
2019-10-23 14:40:24 +02:00
Lukas Nykryn daa49cc221 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.
2019-10-23 10:44:26 +02:00
Colin Walters 72ae1c4fe7 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.
2019-10-22 13:49:03 +02:00
Daniel Molkentin 8e9b094b21 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.
2019-10-22 13:49:03 +02:00
Daniel Molkentin 8a063c50a3 01systemd-initrd: remove redundant code from 99base 2019-10-22 13:49:03 +02:00
Harald Hoyer 1fcc70fe57
Merge branch 'nolange-fix_ipv2_for_busybox' 2019-10-21 14:43:44 +02:00
Harald Hoyer 5e7ef0ab3d
Merge branch 'fix_ipv2_for_busybox' of https://github.com/nolange/dracut into nolange-fix_ipv2_for_busybox 2019-10-21 14:41:12 +02:00
Marko Myllynen 42d93d3482 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
2019-10-21 13:07:07 +02:00
Harald Hoyer 22c8a5c73f
Do not sort the resulting /run/initramfs/state/etc/resolv.conf
nameserver priorities should be preserved

Resolves: https://github.com/dracutdevs/dracut/issues/652
2019-10-21 11:50:20 +02:00
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
Ondrej Dubaj 707d4e79fe added debug-shell to initrd in systemd version >= 240 2019-08-29 15:06:59 +00:00
Tomasz Paweł Gajc 04ff0a1bae Check /usr/sbin for fsck programs 2019-08-29 13:25:57 +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
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
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
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
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
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
Frank Deng 11e1f68065 35network-legacy: fix classless static route parsing 2019-07-19 16:16:26 +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
Max Resch 705eb4eeb2 ask for a password on readkey failure
continue asking for a password if readkey for cryptsetup input failed,
e.g. wrong password in the password file
2019-07-19 16:09:01 +02:00
Renaud Métrich adee5b97bc rngd: new module running early during boot to help generating entropy
when system's default entropy sources are poor (e.g. use of SSD disks or
UEFI RNG not available)

On systems with low entropy at boot, the boot can take up to several
hours, specially when NBDE is used (e.g. clevis) which makes use of
the random number generator.

Enabling rngd service at boot early, because dracut-initqueue runs,
enables to initialize the random number generator in a couple of seconds
instead of minutes or hours.

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2019-07-19 16:05:45 +02:00
Michal Koutný 42e004feb9 debug: Add dd into debug module
When at it also deduplicate the list of installed utilities.
2019-07-19 16:02:47 +02:00
Lianbo Jiang 84c862d8f3 99base: enable the initqueue in both 'dracut --add-device' and 'dracut --mount' cases.
The commit 9f3c31cd8d ("99base: enable initqueue if extra devices are added")
only covers 'dracut --add-device' case, but it did not cover 'dracut --mount'
case, which causes the kdump failure in the Amazon virtual machine.

Lets make sure that the initqueue is enabled in both cases in order to wake up
the device in time.

Reported-by: Xiao Liang <xiliang@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2019-07-19 15:51:21 +02:00
Kairui Song 90ac0a2d77 99squash: fail early if can't install require modules in initramfs
insmods will consider all arguments as optional modules by default, but
for squash module, all listed modules are required, if any of them is
missing the initramfs won't boot. So pass the '-c' argument to let instmos
know all those modules are mandatory, it will fail and give an error if
it failed to install any of those modules.
2019-07-19 15:37:25 +02:00
Daniel Molkentin 4f19427641 95fcoe: Fix startup when fcoe module is included
The parse-fcoe.sh hook is sourced, and hence must not contain
exit 0 calls. Otherwise, the cmdline sequence will be interupted,
and no error will be reported to systemd. Use return instead.

Reference: boo#1136977
2019-07-19 00:25:06 +02:00
Thomas Blume 8c6ab479ab call netroot on wicked dhcp setup 2019-07-19 00:24:15 +02:00
Thomas Blume 9cc1b76087 nfsroot follow ifcfg settings for boot protocol 2019-07-19 00:23:34 +02:00
Lukas Nykryn 9f96bb4c73 01fips: add cfb cipher
Required by FIPS standard
2019-07-16 14:31:32 +02:00
Kairui Song 8365177644 fips: ensure fs module for /boot is installed
When using dracut with  --hostonly and --no-hostonly-default-device,
/boot will be inaccessible as dracut will most fs modules unless
specified. But FIPS require /boot to be accessible, and it will try
to mount it on boot. It will fail if corresponding fs module is missing.

For most case /boot will be a simple partition, include the fs module
will be enough for FIPS to mount it. For other cases users have to pass
extra parameters by themselves.

Suggested-by: Kenneth Dsouza <kdsouza@redhat.com>
Signed-off-by: Kairui Song <kasong@redhat.com>
2019-03-22 12:58:09 +01:00
Renaud Métrich 33cfad0b8f iscsi: always popd, even if there is no iscsi device 2019-03-04 10:43:21 +01:00
Böszörményi Zoltán 0d08f43d71 Fix 98dracut-systemd/dracut-emergency.sh
/dev/consoles does not exist. It's /proc/consoles.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-02-12 14:56:12 +01:00
Lukas Nykryn 94eccd15c5 95iscsi: /sys/devices/platform/*/flashnode_sess-*/is_boot_target sometimes does not exist
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 90: [: -eq: unary operator expected
2019-02-07 16:19:00 +01:00
Lukas Nykryn ad906d85ea 95iscsi: fix a typo in a name of iscsiuio 2019-02-07 11:52:07 +01:00
Thomas Abraham 38ccf7c8e5 91zipl: Don't use contents of commented lines
Comment lines should be ignored. They should not be used for determining
the /boot/zipl device
2019-02-07 11:48:34 +01:00
Frantisek Sumsal 53cb081b4c 00systemd: check if systemd version is a number
The recent systemd upstream introduced a slightly modified version
string which included information about a git commit, which however
broke the version check in dracut. Unfortunately, the (( )) bash syntax
went along with it in certain cases and introduced a pretty nasty issue,
when the systemd would boot up but with slightly changed environment.

To prevent this from happening in the future, let's at least check if
the version parsed from the `systemd --version` output is a comparable
number.
2019-01-31 13:52:41 +01:00
Jens Heise 44f2fe5170 10i18n: Fix keymaps not getting included sometimes
Eliminate erroneous substring matches when looking up already processed keymaps to prevent necessary keymaps not getting added to the initramfs sometimes e.g. if there are the files 'compose.latin1' and 'compose.latin1.add' the unfixed version would skip processing 'compose.latin1' if find returned 'compose.latin1.add' first due to the directory listing not being in sorted order.
2019-01-26 16:12:14 +01:00
Patrick Talbert 7c6d2ad916 95fcoe: Add the rd.nofcoe option to disable the FCoE module from the command line
Images built with the fcoe module will always run the lldpad
service as part of their pre-trigger scripts if the network
is active. This prevents network installations in
environments where, for security reasons, LLDPDU frames
cause a switchport shutdown.

Add a new rd.nofcoe option to cause dracut to skip the
lldpad.sh script and the entire 95-fcoe module.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
2019-01-18 14:10:19 +01:00
Lukas Nykryn fca93eac19 95iscsi: decouple iscsi from sysinit.target 2019-01-15 14:14:27 +01:00
Lukas Nykryn 88820dc781 Revert "95iscsi: drop systemd dracut service dependencies for iscsid"
This reverts commit 765b20333d.
2019-01-15 14:14:27 +01:00
Daniel Molkentin 32f68c1f9a emergency mode: use sulogin
- allow emergency login on every console
  specified in the kernel cmdline
- require password for hostonly images
- emergency mode: Manually multiplex emergency infos

This will bring all vital information to all ttys specified
as console devices, regardless of wether they hold the C flag.

Reference: FATE#325386
Reference: #449
2019-01-10 10:16:15 +01:00
Lukas Nykryn 61afc70454 95iscsi: rd.iscsi.initiator should have priority over stored configuration 2019-01-10 10:10:02 +01:00
Đoàn Trần Công Danh 09d2a1605b remove bashism in various boot scripts
When using dash as initramfs shell, the boot process is broken.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2019-01-07 12:01:55 +01:00
Norbert Lange f9c96cf56f remove superfluous quotes in parameter expansion
as this breaks busybox hush shell.
offending functions can be found with
grep -r '${[^}]*"[^}]*}'
2018-12-13 15:13:03 +01:00
Norbert Lange a3ad33daf9 net-lib: remove calls to ip with -oneline option
busybox seems to not properly support this option,
and it can be be safely ommitted or replaced
with piping the output through head.

Rev 2:
*   rebased on master
*   addressed open points from review
2018-12-12 16:13:50 +01:00
Harald Hoyer ebe1821635
95iscsi/module-setup.sh: do not require 'hostname' anymore 2018-12-04 10:27:17 +01:00
Harald Hoyer f6e3b59e5e network: skip already enslaved interfaces 2018-12-04 08:50:42 +01:00
Thierry Vignaud a6bc200c28 kill bogus comment
should have been killed in commit 4a855e6beb
2018-11-30 16:06:14 +01:00
Lubomir Rintel 79a17b0112 network-manager: call the online hook for connected devices
Look for "connection-uuid" instead of "managed" to determine the devices
that are actually activated with a connection and call the online hook.

This fixes the anaconda-net root mount, which utilizes the online hook.
2018-11-30 15:26:18 +01:00