Compare commits

..

217 Commits
050 ... 051

Author SHA1 Message Date
Daniel Molkentin
e473057ae1 Update AUTHORS, NEWS 2020-12-14 15:34:35 +01:00
Adam Williamson
b3e55bde30 Drop 51-dracut-rescue-postinst.sh entirely
It is only installed on RHEL 8+, but as noted in the first commit
that tried to do this - 0bb9a683 - we already have branches for
all RHEL releases, so there's no point keeping such a conditional
on the master branch. After 0bb9a683, 51-dracut-rescue-postinst.sh
was re-added because Fedora 30 needed it, with a FIXME saying to
remove it after F30 was released. But instead of that happening, it
got changed to a conditional to install it on Fedora <= 30 or RHEL
<= 8 in 9e68789d and the FIXME was removed, then in 9eb1d1ed that
conditional was simplified to only refer to RHEL, so we wound up
with this situation.

Note the last two commits were never ported to the RHEL-8 branch,
so it's broken, I will send a separate PR for that.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-12-14 14:01:28 +01:00
Daniel Molkentin
8cceee8059 Revert "Retrieve service, rpc and protcol entries via getent in hostonly mode"
The underlying issues this was trying to solve is to get a cheap
workaround for the fact that (open)SUSE with atomic support moved
/etc stock files to /usr/etc in order to improve compatibility. But
now that even nsswitch.conf moved, this is no longer enough. And it
might be more trouble to support once it's in an official release.

So let's rather drop it now.

This reverts commit e0524af2bf.
2020-12-14 12:44:00 +01:00
Jóhann B. Guðmundsson
5f0d35b665 Adding stalebot file 2020-12-14 11:59:16 +01:00
Daniel Molkentin
3a12309c0d Revert "Add --uefi-output for custom output filename"
This reverts commit f8f3b0f358.
2020-12-02 00:25:20 +01:00
Jiri Konecny
cb495a073e Improve documentation of iso-scan/filename feature
From the current man page it's really hard to tell what will be output of this
command.
2020-12-01 01:12:37 +01:00
Lukas Nykryn
7c2521091f multipathd: fix the comparison
From shellcheck:
/usr/lib/dracut/modules.d/90multipath/multipathd.sh:3:32: warning[SC2039]: In POSIX sh, == in place of = is undefined.
/usr/lib/dracut/modules.d/90multipath/multipathd.sh:3:32: warning[SC2193]: The arguments to this comparison can never be equal.
2020-11-27 10:00:03 +01:00
Daniel Molkentin
6fee16eab0 06dbus: consider dbus-broker 2020-11-25 18:21:39 +01:00
Daniel Molkentin
209f157d2a 06dbus: Add busctl as a more useful tool 2020-11-25 18:21:39 +01:00
Daniel Molkentin
f57b1b9368 06dbus: Include dbus or messagebus group and user, depending on distro 2020-11-25 18:21:39 +01:00
Daniel Molkentin
09eb4de3d4 35network-wicked: openSUSE Factory has reintroduced libexec 2020-11-25 18:21:39 +01:00
Daniel Molkentin
1517f4c504 35network-wicked: install ip utility anyway 2020-11-25 18:21:39 +01:00
Daniel Molkentin
983aee0ef1 35network-wicked: Run wicked early enough to unlock block devices 2020-11-25 18:21:39 +01:00
Daniel Molkentin
7825c32bd6 06dbus: Do not install superfluous services 2020-11-25 18:21:39 +01:00
Daniel Molkentin
5fc7c05321 40network: introduce wicked option 2020-11-25 18:21:39 +01:00
Daniel Molkentin
ed7ce0d64f 35network-wicked: introduce wicked support module 2020-11-25 18:21:39 +01:00
Daniel Molkentin
e1845955ff 06dbus: introduce dbus support 2020-11-25 18:21:39 +01:00
leo-lb
f8f3b0f358 Add --uefi-output for custom output filename
Closes #921
2020-11-24 19:38:30 +01:00
Kairui Song
8c8af8a2cd 95fcoe: don't install if there is no FCoE hostonly devices
When in hostonly mode, 95fcoe module will still be installed even there
is no FCoE hostonly device. So use the new block_is_fcoe helper to check
for hostonly device in hostonly mode, avoid installing unneccessary module.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-11-23 17:23:38 +01:00
Kairui Song
4339d47cf8 95fcoe: ensure needed modules are installed
If fcoe module is loaded, the initramfs will always try load libfcoe
and bnx2fc, so also ensure they are installed if needed.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-11-18 14:18:01 +01:00
Daniel Molkentin
1a5845b45f dracut-install: Globbing support for resolving "firmware:"
Implements #849
2020-11-18 14:11:30 +01:00
Gaël PORTAY
952c2e4e9b dracut-bash-completion.sh: add positional argument completion 2020-11-16 00:00:04 +01:00
Petr Pavlu
6685d99448 Prevent creating unexpected files on the host when running dracut
Library file modules.d/99base/dracut-lib.sh contains initialization code
that makes sure certain directories and links are created when a system
runs from the produced initramfs. This file is normally sourced only
from initramfs scripts. However, modules.d/99base/module-setup.sh
includes it also when an initramfs image is being created to gain access
to some of the functions in this library. This can result in creating
unexpected directories and links on the current root file system when
the dracut command is executed.

For instance, during a system installation when dracut is invoked to
create an initial initramfs, the target sysroot might not contain
directory /run/initramfs but have /var/log. This situation results in
the code in modules.d/99base/dracut-lib.sh creating an unexpected link
/var/log/log that points to /run/initramfs/log. This link is then also
present on the installed system.

The patch fixes the problem by skipping the described logic in
modules.d/99base/dracut-lib.sh when the PREFIX variable is non-empty
which indicates that a target initramfs is being prepared. The variable
is set by modules.d/99base/module-setup.sh prior to including
dracut-lib.sh.
2020-11-15 00:47:39 +01:00
A. Wilcox
3aec4fca0b configure: Find FTS library with --as-needed
When LDFLAGS contains ``-Wl,--as-needed``, the FTS library will be
ignored if it is specified before the .c source.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
Fixes: 62f27ee6f1 ("configure: find cflags and libs for fts on musl")
2020-11-15 00:32:14 +01:00
Colin Walters
6b8ee4fc37 Don't print when a module is explicitly omitted (by default)
dracut builds today are fairly verbose to start, but on top of
that many of the messages tend to liberally use the
exclamation point `!` which calls attention to them.

I see these a lot when looking at rpm-ostree build logs
and it'd be nicer if we were quiet when there wasn't
an actual problem.

In this specific case, if the builder is explicitly adding
`--omit=foo`, there's no reason for us to say:

`dracut: dracut module 'foo' will not be installed, because it's in the list to be omitted!`

We already print the command line to start, so the information
is there.

Demote this message to debug.
2020-11-14 19:38:29 +01:00
Daniel Molkentin
5840c466dc 95nfs: /var/lib/nfs/statd/sm is /var/lib/nfs/sm on SUSE
Reference: boo#1177462
2020-11-14 19:28:56 +01:00
Daniel Molkentin
e0524af2bf Retrieve service, rpc and protcol entries via getent in hostonly mode
Sometimes, systems have more elaborate backends in nsswitch.conf,
the complexity of which we do not want in the initrd. SUSE systems
with atomic for instance, where those files may also reside in /usr/etc.

With this change, the unavaiable nsswitch.conf backends will be silently
ignored, and we still end up with all the information we need.

Reference: boo#1165366
2020-11-14 19:28:56 +01:00
Daniel Molkentin
1ec85e5232 Remove uses of bash (and bash specific syntax) in runtime scripts
dracutinstall picks up interpreters and includes bash despite
the users' wishes or expectations, as modules should not require
bashisms at runtime.

Fixes #951
2020-11-14 16:36:38 +01:00
Jonathan Lebon
a23a4680e7 90crypt: pull in remote-cryptsetup.target enablement
This should've been part of #964. As mentioned there, the
`initrd-cryptsetup.target` approach was reverted in the end, and we went
back to relying in `remote-cryptsetup.target`:

https://github.com/systemd/systemd/pull/17467

So we do need to ship the enablement symlink for it.
2020-11-14 15:30:34 +01:00
David Tardon
0f89c0dff6 90multipath: install kpartx's 11-dm-parts.rules
This makes /dev/disk/by-uuid links point to the right device.
2020-11-14 15:15:13 +01:00
Jonathan Lebon
09804a4629 Revert "90crypt: ship initrd-cryptsetup.target"
This reverts commit 8f56daa8c3.

The addition of `initrd-cryptsetup.target` was reverted in systemd:
https://github.com/systemd/systemd/pull/17467
2020-11-05 14:22:52 +01:00
Kairui Song
831e310adf 90qemu-net: install less module for strict hostonly mode 2020-10-30 10:13:37 +01:00
Kairui Song
5698258d30 90qemu-net: in hostonly mode, only install if network is needed
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
3b45c7e1a0 95nfs: Install less module if hostonly mode is strict
For strict hostonly mode, only install currently loaded modules instead
of a bunch of driver that may not be needed.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
5817934936 90kernel-modules: Install less modules for hostonly mode
Rearrange some module installation mode, install less modules for
hostonly mode.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
6375d5d504 90kernel-modules: install block drivers more strictly
For strict hostonly mode, only install block drivers needed for hostonly
devices.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
5a49fd3656 04watchdog-modules: Simplify install_kernel using new added helper
The new added get_dev_modules helper can help simplify the driver
detection code by a lot.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
cbafcd0fc7 dracut-init.sh: Add a helper for detect device kernel modules
Use udevadm to detect the required kernel modules to load a given
device. udevadm will follow the device chain, help detect all required
parent device drivers as well.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
ab17cb8515 dracut-functions.sh: Fix check_block_and_slaves_all
check_block_and_slaves_all $func $dev should return 0, if $func return 0
for any checked device. Currently if any device don't have any sub
device, 1 is returned instead.

So remove the sub device checking statement. Also remove the same
statement in check_block_and_slaves, the "[[ -f $_x/dev ]]" in the for
loop is enought to ensure sub device exists.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Kairui Song
c69961b403 90kernel-network-modules: Don't install iscsi related module
These modules are installed in 95iscsi, no need to repeat here.
2020-10-26 14:16:19 +01:00
Kairui Song
1e92f7285d Add a --hostonly-nics option
Currently when network is enabled, dracut will install all network
drivers that are currently loaded, but some time only one NIC is needed
for the initramfs.

So for strict hostonly mode, add a --hostonly-nics option, user can
provide a list of NICs to be enabled, and only needed drivers for
specifed NICs will be installed so save space.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-26 14:16:19 +01:00
Rumbaut Thomas
e4483e5917 Configure the runner for team interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=1881463
2020-10-26 12:52:24 +01:00
Kairui Song
83c65fd3db 99squash: Check require module earlier, and properly
Let 99squash fail earlier if required modules are not enabled or
missing, using the new added helper.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-21 17:04:00 +02:00
Kairui Song
c050190f86 dracut-functions: add a helper to check if kernel module is available
It's like check_kernel_config, help to check if a kernel module is
enabled (cover built-in or compiled module case).

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-21 17:04:00 +02:00
Jonathan Lebon
8f56daa8c3 90crypt: ship initrd-cryptsetup.target
This was added in https://github.com/systemd/systemd/pull/17149 and is
the designated cryptsetup target for all encrypted volumes that need to
be opened in the initrd.

So it effectively replaces `cryptsetup.target` and
`remote-cryptsetup.target` there. I've removed the latter since it was
added recently (by me) in #930, but kept `cryptsetup.target` since we've
been shipping it for a long time now.
2020-10-21 16:43:53 +02:00
Jonathan Lebon
9fb2431a88 Revert "90crypt: pull in remote-cryptsetup.target enablement"
This reverts commit 7ea391b527.

We've moved away from this in
https://github.com/systemd/systemd/pull/17149.
2020-10-21 16:43:53 +02:00
Frederick Grose
12ab0dce66 dmsquash-live/iso-scan: Provide an easy reference to iso-scan device.
With commit 3c8c807, /run/initramfs/isoscan and /run/initramfs/live
mountpoints are unmounted upon rd.live.ram boots.  Save a link to
the iso-scan device in /run/initramfs/isoscandev to easily remount
the source, if desired.
2020-10-20 15:46:49 +02:00
Daniel Molkentin
f51d013384 99memstrack: use /bin/bash
/usr/local/bin causes trouble for distros that do not use /usr/bin == /bin
/usr/bin/env likewise, plus the use of env is not needed here
2020-10-12 14:05:09 +02:00
Jonathan Lebon
512c51d267 98dracut-systemd: don't wait for root device if remote cryptsetup active
This is a plain and simple hack around dependency issues between dracut
and systemd.

When using Tang-pinned LUKS root devices, we want to rely on
`systemd-cryptsetup@.service` to unlock it. However, that service only
runs `After=remote-fs-pre.target`, while `dracut-initqueue.service` has
`Before=remote-fs-pre.target` (which makes sense because we don't want
to attempt networked root devices before networking is up).

However, the rootfs-generator here wants to make sure that the root
device exists *before* exiting the initqueue via an initqueue/finished
"devexists" hook. This will never work though because by design
`systemd-cryptsetup@.service`, which unlocks the root device, won't run
until after we exit.

So we have a dependency cycle:

    initqueue -> devexists hook -> root device ->
        systemd-cryptsetup@.service -> remote-fs-pre.target -> initqueue

There's no clean way to break this. The root issue is that there's no
way right now to split sequencing of systemd services across the
initqueue/online and initqueue/finished events because it's all bundled
in a single service. (The deeper root issue of course is that we have
two init systems. :) ).

Here we do a tactical fix: if there's a `systemd-cryptsetup@.service`
instance, let's assume it's for the root device and skip waiting for it
to show up if it depends on `remote-fs-pre.target`.
2020-10-12 11:07:41 +02:00
Đoàn Trần Công Danh
7990ab91f9 cryptroot-ask: unify /etc/crypttab and rd.luks.key
dracut feeds whatever it receives in password field of
crypttab(5) to `cryptsetup -d`, treating them as plain-text key file.

Meanwhile, dracut treats the key file from `rd.luks.key` differently,
by have some special rules to decrypt those key files that has extension of
`gpg` and `img`.

Let's begin to treat them the same.

This is a backward-incompatible change for those people
that uses plain-text key-file that has extension of `gpg` and `img`.
However, those setup is questionable to begin with.
2020-10-08 13:56:44 +02:00
Nicolas Chauvet
a298f5f285 90kernel-modules: arm: add drivers/hwmon for arm/arm64
In the case of the s805x the drivers/hwmon directory contains the
scpi_hwmon kernel module.
On a running system, lsmod would output the following dependencies:
 arm_scpi               24576  2 clk_scpi,scpi_hwmon

It means that if the clock driver is bundled in the initramfs it will
bring arm_scpi. But if scpi_hwmon is missing the scpi will be incomplete
and it can lead to crashes.

When the hwmon is bundled, no crash occurs

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-10-07 16:04:08 +02:00
Đoàn Trần Công Danh
811c814677 rootfs-block: only write root argument for block device
Some filesystem (e.g. ZFS, and btrfs subvolumes) don't use block
devices. Should they be mounted as `/`, `find_root_block_device`
yields nothing, hence dracut will append this problematic argument
to kernel cmdline:

	root=/dev/block

On a machine that employ root ZFS on LUKS, which was setup with
an OpenPGP-encrypted key file, this argument renders that machine
unbootable. Remove that `root=/dev/block` manually could boot the
machine.

Let check if that device is a block device before write down `root`
argument. This is consistent with the check for block device in
`find_block_device`.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2020-10-05 17:17:40 +02:00
Jonathan Lebon
7ea391b527 90crypt: pull in remote-cryptsetup.target enablement
This is enabled upstream in
https://github.com/systemd/systemd/pull/17149.
2020-10-05 15:53:32 +02:00
Jonathan Lebon
7c923f1de8 00systemd: add missing cryptsetup-related targets
We want these in the initramfs. Things related to clevis and systemd's
`cryptsetup-generator` reference these targets.
2020-10-05 14:43:58 +02:00
Hannes Reinecke
251b424727 95nvmf: Implement 'fc,auto' commandline syntax
Add a 'fc,auto' commandline syntax for nvmf.discover to force
nvmf autodiscovery on FC-NVMe.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke
0e2ef80993 95nvmf: add nvmf-autoconnect script
Add a script to run FC autoconnect.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke
f0ac6cb462 95nvmf: Fixup FC connections
D-Bus doesn't run in the initrd, so our usual trick of activating
custom systemd services from udev doesn't work.
So add a rule to create initqueue entries for each possible
connection.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke
e9a614b50c 95nvmf: add documentation
Add documentation for 95nvmf module to dracut.cmdline

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Hannes Reinecke
4087fd4d1a 95nvmf: rework parameter handling
Always add the nvmf.discover parameters to /etc/nvme/discovery
when parsing the dracut commandline, and rely on NVMe autodiscovery
when no parameters are given.
And modify the syntax to use a comma ',' as a separator for nvmf.discover
as the semicolon ':' is already used for the FC-NVMe transport address format.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2020-10-02 15:55:14 +02:00
Daniel Molkentin
ee9b9b1241 dracut-install: fix edge-case regression with weak modules
This was introduced with 6dafdda4a6, but
is actually caused by the fact that modules that have already been
installed cause dracut_install() to return without adding the module
to the hashmap. This can happen if an earlier-run dracut module chose
to install the same module. Now modprobe statements like:

softdep usb_storage post: uas
softdep uas pre: usb_storage

(which look weird, but are perfectly valid), cause
dracut_install() to enter an infinite recursion if and only if
at least one of the files has previously been installed by another
module.

Fix this by also adding already installed modules to the hashmap.
2020-10-02 15:49:09 +02:00
David Tardon
4916dfc2b9 dracut-install: ignore bogus preload libs
If there are any nonexistent libraries listed in /etc/ld.so.preload, ldd
prints error messages like:

ERROR: ld.so: object '/usr/lib64/libfoo.so.1' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

This causes resolve_deps() to return error, which leads to symlinks
(like usr/bin/awk) not being copied into the initrd.
2020-10-02 15:34:40 +02:00
Harald Hoyer
ee6ce31003 dracut.spec: Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
2020-10-02 14:05:51 +02:00
Harald Hoyer
9eb1d1ed5e dracut.spec: remove fedora pre 30 quirks 2020-10-02 13:48:48 +02:00
Nicolas Chauvet
dee4f26adc 50drm: Check drm_encoder_init along drm_crtc_init
Some modules are involved in the display output without to rely on
drm_crtc_init.

This is the case for the meson_dw_hdmi. This module need to be included
into the initramfs in both hostonly and generic modes.

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-09-28 21:08:12 +00:00
Nicolas Chauvet
5afd3cfc96 50drm: Include drm platform drivers in hostonly
On arm, many drm drivers are located in the plaform bus.

Adding the platform bus will allow drm drivers to be included in the
initramfs when using hostonly mode.

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-09-28 21:08:12 +00:00
Nicolas Chauvet
89cd7a4629 50drm: fix ambiguous redirects
If i contains a space, there is a need to protect the variable usage in some cases.

This will occurs when a next patch will enable platform bus with such case:
'/sys/bus/platform/devices/Fixed MDIO bus.0'

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-09-28 21:08:12 +00:00
Peter Robinson
38ea7e821b Include devfreq drivers in initrd
Some SoCs now have drivers that user devfreq in early init and fail
if the drivers are missing so make sure we have them in the initrd.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2020-09-23 13:44:21 +02:00
Beniamino Galvani
f3e328a7fd dracut.spec: include the 04watchdog-modules module
Include the 04watchdog-modules module that was added in 39d90012a6
("04watchdog: split the watchdog module install").
2020-09-21 13:25:14 +02:00
Antz
37502d4c89 90crypt: make rd.luks.key usable with encrypted keydev.
Introduce prefix `keysource:` for the values of `rd.luks.partuuid`,
`rd.luks.serial` and `rd.luks.uuid`.
If specified, ask for passphrase instead of waiting for keydevs to come
online.
2020-09-18 21:59:00 +02:00
Kairui Song
39d90012a6 04watchdog: split the watchdog module install
In some cases, user only want to include the watchdog module, not the
wdctl or any other userspace helper. For example, systemd have a
RebootWatchdogSec option that use watchdog to prevent reboot hangs. And
it can help prevent machines hangs when reboot directly within the
initramfs stage. So split the module installation to a standlone module.

Also when watchdog-module get included, install driver for all loaded
watchdog instaed of only install driver for active watchdog. Both
watchdog and watchdog-module return 255 in check(), so it's enabled only
when manually included, the watchdog may get configured/activated later.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-09-17 14:52:48 +02:00
GuoChuang
d76e9ad5d7 fix graphics startup failure with the rhgb paramter in CentOS8.2 2020-09-03 15:27:14 +02:00
Beniamino Galvani
f87605e3ab dracut.cmdline.7.asc: fix typo 2020-09-02 22:35:28 +02:00
Daniel Molkentin
a5372b8ba8 Add --version to man page 2020-08-28 23:28:25 +02:00
Daniel Molkentin
ff2d8bdfb3 dracut.sh: Add --version 2020-08-28 23:28:25 +02:00
Jóhann B. Guðmundsson
d418e292e3 Fix CoC URL 2020-08-28 18:04:03 +00:00
Jóhann B. Guðmundsson
ff78577d3f Fix Unicode and dracut install labeler 2020-08-28 17:41:41 +00:00
Jóhann B. Guðmundsson
d2b3289aa5 Fix Unicode 2020-08-28 17:16:53 +00:00
Jóhann B. Guðmundsson
de27127752 Adding security policy 2020-08-28 18:58:52 +02:00
Jóhann B. Guðmundsson
0132527b8f Adding documentation template 2020-08-28 18:58:52 +02:00
Jóhann B. Guðmundsson
455c5dbd35 Adding a feature request template 2020-08-28 18:58:52 +02:00
Jóhann B. Guðmundsson
cd1a002512 Adding a bug report template 2020-08-28 18:58:52 +02:00
Tomasz Paweł Gajc
b7a7735c1d Do not start inside container
Host should take care of good entropy pool
#791
2020-08-28 17:34:22 +02:00
Jóhann B. Guðmundsson
fece5bfcac Adding a pull request template 2020-08-28 14:03:11 +00:00
Jóhann B. Guðmundsson
d795211778 Adding code of conduct 2020-08-28 13:55:54 +00:00
Érico Rolim
497916e13b dracut.sh: fix some indentation.
Command level inside conditional and tab/space usage.
2020-08-24 11:29:34 +02:00
Érico Rolim
3b92d8bf84 dracut.sh: fix errors pointed out by shellcheck.
- use [ ] instead of calling test manually, as most of the script is
doing.

- use quotes in hostonly_cmdline blocks, specially when dealing with the
conf files, whose names are set by users/system administrators

- uefi_splash_image was being assigned set to `${dracutsysroot}...`, which
is a variable that doesn't exist.

- we don't want the conditional to run the output of fsfreeze as
commands. Instead, we just need to know if any of the fsfreeze commands
failed.
2020-08-24 10:27:29 +02:00
Daniel Molkentin
1855efb15a Document initqueue/online hook 2020-08-21 17:40:59 +02:00
Daniel Molkentin
e096d861ed 01fips: turn info calls into fips_info calls
systemd lets stdout go to journal only. Usually, this is desired
behavior to ensure that plymouth does not get disrupted.

However in the 01fips case, the system has to halt when the integrity
check fails to satisfy FIPS requirements. So the user will not be able
to inspect the journal.

As this is special to the fips module, we introduce a fips_info() which
works like info(), but deviates the output to stderr when running with
systemd.

Reference: bsc#1164076
2020-08-21 15:56:53 +02:00
Daniel Molkentin
da4c9a950f 01fips: modprobe failures during manual module loading is not fatal
Users might see

"modprobe: FATAL: Module xyz not found in directory"

The output from modprobe is semantically wrong in this case and
confuses users. Keep the warning for debugging purposes, but reduce
the severeness.

It now reads "Module xyz not found in directory"

Reference: bsc#1169997
2020-08-21 15:56:53 +02:00
наб
31d0b55b86 95cifs: pass rootflags to mount 2020-08-21 15:24:58 +02:00
наб
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
Jóhann B. Guðmundsson
5da70385bc Removing dracut entry not compat with new plugin 2020-08-07 21:25:56 +02:00
Jóhann B. Guðmundsson
c4f2b11b89 New label trigger file 2020-08-07 20:47:13 +02:00
Jóhann B. Guðmundsson
0e30f33a32 New labels file 2020-08-07 20:47:13 +02:00
Daniel Molkentin
3f4771ebf4 .github: fix path to label workflow mapping file 2020-08-07 19:05:20 +02:00
Jóhann B. Guðmundsson
fc1d50b270 Update master-labels.yml
Removing branches not sure if they work with the cron scheduler in workflow actions
2020-08-07 18:23:43 +02:00
Jóhann B. Guðmundsson
cafd314b70 Update master-labels.yml
Fixing bad intentation
2020-08-07 18:03:25 +02:00
Jóhann B. Guðmundsson
ac733934fa Switching label triggers from pull requests to cron 2020-08-07 18:03:25 +02:00
Jóhann B. Guðmundsson
2be5e3ac4c Adding the labels trigger file for the RHEL-8 branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
9521b435d0 Adding the labels trigger file for the RHEL-7 branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
64748b3383 Adding the labels trigger file for the RHEL-6 branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
76d8b30f4e Adding the labels trigger file for the Master branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
4cd8f2c90e Adding the labels file for the RHEL-8 branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
3b20f5c72e Adding the labels file for the RHEL-7 branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
27047bb5c6 Adding the labels file for the RHEL-6 branch 2020-08-07 17:04:02 +02:00
Jóhann B. Guðmundsson
80f1ce6c13 Adding the labels file for master 2020-08-07 17:04:02 +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
mwberry
fea53784ad UEFI Mode: only write kernel cmdline to UEFI binary
The kernel command line was being written both into
/etc/cmdline.d/01-default.conf and the UEFI executable.
During boot, getcmdline would concatenate these two
resulting in all arguments being duplicated. Some
args, such as ip=, are sensitive to the number of
times they are specified.
2020-08-05 18:30:44 +02:00
Mikhail Novosyolov
f84ad9e062 Allow $DRACUT_INSTALL to be not an absolute path
/usr/sbin/dracut-install is a symlink:
$ file /usr/sbin/dracut-install
/usr/sbin/dracut-install: symbolic link to ../lib/dracut/dracut-install

It resulted to "dracut-install not found" error:

+++ for p in $DRACUT_PATH
+++ [[ -L /sbin/dracut-install ]]
+++ [[ -x /sbin/dracut-install ]]
+++ for p in $DRACUT_PATH
+++ [[ -L /bin/dracut-install ]]
+++ [[ -x /bin/dracut-install ]]
+++ for p in $DRACUT_PATH
+++ [[ -L /usr/sbin/dracut-install ]]
+++ printf '%s\n' dracut-install
+++ return 0
++ DRACUT_INSTALL=dracut-install
++ [[ -n dracut-install ]]
++ [[ -n dracut-install ]]
++ DRINSTALLPARTS=0
++ for i in $DRACUT_INSTALL
++ DRINSTALLPARTS=1
++ [[ 1 = 1 ]]
++ [[ -x dracut-install ]]
++ dfatal 'dracut-install not found!'
++ set +x
dracut: dracut-install not found!

[ -x <not a path to file> ] is not correct and will always be false.
But actually it is available. Let's just allow it to be not an absolute path.
Maybe some other places can be improved to avoid DRACUT_INSTALL being not an absolute path.

Signed-off-by: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
2020-08-05 17:46:30 +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
4159819fbb 99squash: simplify the code
The new dracutsysrootdir could be used to replace the shell function
required_in_root, so drop it and also simplify the code.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 14:24:53 +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
Gaël PORTAY
30ea52f88c dracut.modules.7.asc: fix reference to insmodpost module
The module 96insmodpost was renamed to 90kernel-modules since commit
5078c98a (move insmodpost and blacklisting to 90kernel-modules)
2020-08-04 11:08:10 +02:00
Gaël PORTAY
e902207014 dracut.modules.7.asc: fix another typo 2020-08-04 11:08:10 +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
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
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
Harald Hoyer
11474b808b TEST-99: exclude /etc/dnf/* from check
file /etc/dnf/modules.d/eclipse.module.rpmmoved is not owned by any package
2020-04-09 22:11:16 +02:00
Daniel Molkentin
3b626094bd mkinitrd-suse.sh: Fix i586 platform detection
Reference: boo#1168341
2020-04-07 21:10:43 +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
Daniel Molkentin
db44331dc4 Makefile: really make externally defined CFLAGS work
The fix in aed52a6cfb43ebea372328fd5837c1f341c3f0df does not
work (second line will be ignored on override), so expand the implicitly
defined rule and add them there.
2020-03-19 16:46:54 +01:00
Daniel Molkentin
c490ea8b2b Make externally defined CFLAGS work 2020-03-19 16:46:54 +01:00
Harald Hoyer
dfe2247a43 dracut.sh: add check for invalid configuration files
Emit a warning about possible misconfigured configuration files, where
the spaces around values are missing for +=""

Better report a possible source of problems. We can fix annoying false
positives later.
2020-03-18 16:34:35 +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
Dusty Mabe
97a931c7d9 don't prefer $TMPDIR over --tmpdir
Ability to use `$TMPDIR` was introduced in bc1e69b but
causes the `--tmpdir` option on the command line to be
ignored. Switch to only using `$TMPDIR` if `--tmpdir`
wasn't specified.
2020-03-16 14:45:01 +01:00
Harald Hoyer
91418b13dc TEST-03-USR-MOUNT/test.sh: increase loglevel
to debug the spurious fails
2020-03-12 14:17:45 +01:00
Harald Hoyer
ca8ca19091 .travis.yml: reformat 2020-03-12 13:54:39 +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
Harald Hoyer
3b396a7d50 TEST-41-NBD-NM/Makefile: should be based on TEST-40-NBD not TEST-20-NFS 2020-03-12 13:30:24 +01:00
Harald Hoyer
d5bfaf58ab github actions: use test container directly 2020-03-12 13:21:42 +01:00
Harald Hoyer
a22ab24d53 test: use dd from /dev/zero, instead of creating files with a hole 2020-03-12 12:46:15 +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
fc6f458c3b TEST-12-RAID-DEG/create-root.sh: more udevadm settle 2020-03-11 14:02:46 +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
Harald Hoyer
058739bf69 README.md: fix github action badge links 2020-03-11 12:59:58 +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
Alexander Tsoy
a76aa8e390 Makefile: fix VERSION again
The variable is not undefined anymore after the first assignment, so
we should check if variable is empty instead.
2020-03-09 08:50:20 +01:00
Daniel Molkentin
2293609dcb 95dcssblk: fix script permissions 2020-03-06 13:51:06 +01:00
Topi Miettinen
bc1e69b691 Use TMPDIR if available
Use environment variable TMPDIR (typically /run/user/$UID) as default
temporary directory, if available. This should be more private
location than /var/tmp. Path specified with --tmpdir is takes
precedence over TMPDIR and /var/tmp is still used as last resort if
neither TMPDIR is set nor --tmpdir is used.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2020-03-06 11:40:00 +01:00
Martin Wilck
0386e46277 dracut.sh: don't call fsfreeze on subvol of root file system
dracut.sh already doesn't call fsfreeze if the output file is on
the root file system. For btrfs, however, this is not sufficient.
Because fsfreeze is a superblock operation, and all btrfs subvolumes
share the same superblock, fsfreeze may freeze the entire system
if the subvolume on which the output file is written and / are
subvolumes of the same file system. Avoid this by comparing file
system UUIDs for btrfs.

Fixes: de576db3c2 ("call fsfreeze(8) on /boot to flush initramfs data & metadata to media")
2020-03-06 11:37:16 +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
5a720ebf67 dracut.spec: add 90nvdimm 2020-03-06 10:52:06 +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
Đoàn Trần Công Danh
eb8a7a9635 Makefile: merge main-version and git-version earlier
With GNU Make 4.3 on both ArchLinux, and VoidLinux,
GITVERION is always empty because of bad substitution.
Change '\#' to simply '#' can fix it,
but we don't need that complation.

We can merge DRACUT_MAIN_VERSION and GITVERSION into DRACUT_FULL_VERSION.
Because, GITVERSION will be attached back to DRACUT_MAIN_VERSION in all
situation.

While we're at it, detect if we're in git worktree by:
limiting GIT_CEILING_DIRECTORIES to parent directory of
dracut's top level directory; instead of checking for .git directory,
in order to support git-worktree, in such case, .git will be a file, see
gitrepository-layout(5)
2020-03-06 09:49:40 +01:00
Harald Hoyer
9e68789d66 dracut.spec: add version check for deprecated files 2020-03-04 14:39:39 +01:00
Harald Hoyer
3ba12b2249 test/TEST-35-ISCSI-MULTI: bump disk space 2020-03-04 14:39:22 +01:00
151 changed files with 2687 additions and 1176 deletions

56
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@@ -0,0 +1,56 @@
# Dracut Code of Conduct
This code of conduct outlines our expectations for participants within the Dracut community, as well as steps for reporting unacceptable behavior.
We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored.
Anyone who violates this code of conduct may be banned from the community.
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer responsible for enforcement Harald Hoyer <harald@redhat.com>.
All complaints will be reviewed and investigated promptly and fairly and will result in a response that is deemed necessary and appropriate to the circumstances.
Project maintainers are obligated to respect the privacy and security of the reporter of any incident.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq.
Translations are available at https://www.contributor-covenant.org/translations.

26
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,26 @@
---
name: "\U0001F41B Bug report"
about: A report of an error in a recent Dracut version
labels: 'bug'
---
**Describe the bug**
A clear and concise description of what the error is.
**Distribution used**
Which distribution was this behaviour seen in?
**Dracut version**
Which dracut version was this behaviour seen in?
**Init system**
Which init system is being used?
**To Reproduce**
Steps or code to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add any other context you like about the problem here.

View File

@@ -0,0 +1,8 @@
---
name: "\U0001F4D6 Documentation"
about: Suggest an improvement for documentation in Dracut
labels: 'documents'
---
**Describe the documentation**
A clear and concise description of what should be better documented.

View File

@@ -0,0 +1,8 @@
---
name: "\U00002728 Feature Request"
about: A request for enhancement in Dracut
labels: 'enhancement'
---
**Describe the enhancement**
A clear and concise description of what the enhancement is that you would like to see.

3
.github/SECURITY.md vendored Normal file
View File

@@ -0,0 +1,3 @@
Security is very important to us. If you discover any issue regarding security, we'd appreciate a non-public disclosure of
the information, so please disclose the information responsibly by sending an email to Harald Hoyer harald@redhat.com and not by creating a GitHub issue.
We will respond swiftly to fix verifiable security issues with the disclosure being coordinated with distributions and relevant security teams.

296
.github/labeler.yml vendored Normal file
View File

@@ -0,0 +1,296 @@
needs review:
- "*"
repository:
- ./*
github:
- .github/*
- .github/**/*
dracut-install:
- install/*
- install/**/*
example:
- examples/*
- examples/**/*
- examples/**/**/*
modules:
- modules.d/*
- modules.d/**/*
bash:
- modules.d/00bash/*
bootchart:
- modules.d/00bootchart/*
dash:
- modules.d/00dash/*
mksh:
- modules.d/00mksh/*
systemd:
- modules.d/00systemd/*
warpclock:
- modules.d/00warpclock/*
fips:
- modules.d/01fips/*
systemd-initrd:
- modules.d/01systemd-initrd/*
caps:
- modules.d/02caps/*
systemd-networkd:
- modules.d/02systemd-networkd/*
modsign:
- modules.d/03modsign/*
rescue:
- modules.d/03rescue/*
watchdog:
- modules.d/04watchdog/*
busybox:
- modules.d/05busybox/*
rngd:
- modules.d/06rngd/*
i18n:
- modules.d/10i18n/*
convertfs:
- modules.d/30convertfs/*
network-legacy:
- modules.d/35network-legacy/*
network-manager:
- modules.d/35network-manager/*
network:
- modules.d/40network/*
ifcfg:
- modules.d/45ifcfg/*
url-lib:
- modules.d/45url-lib/*
drm:
- modules.d/50drm/*
gensplash:
- modules.d/50gensplash/*
plymouth:
- modules.d/50plymouth/*
cms:
- modules.d/80cms/*
lvmmerge:
- modules.d/80lvmmerge/*
cio_ignore:
- modules.d/81cio_ignore/*
btrfs:
- modules.d/90btrfs/*
crypt:
- modules.d/90crypt/*
dm:
- modules.d/90dm/*
dmraid:
- modules.d/90dmraid/*
dmsquash-live:
- modules.d/90dmsquash-live/*
dmsquash-live-ntfs:
- modules.d/90dmsquash-live-ntfs/*
kernel-modules:
- modules.d/90kernel-modules/*
kernel-modules-extra:
- modules.d/90kernel-modules-extra/*
kernel-network-modules:
- modules.d/90kernel-network-modules/*
livenet:
- modules.d/90livenet/*
lvm:
- modules.d/90lvm/*
mdraid:
- modules.d/90mdraid/*
multipath:
- modules.d/90multipath/*
nvdimm:
- modules.d/90nvdimm/*
ppcmac:
- modules.d/90ppcmac/*
qemu:
- modules.d/90qemu/*
qemu-net:
- modules.d/90qemu-net/*
stratis:
- modules.d/90stratis/*
crypt-gpg:
- modules.d/91crypt-gpg/*
crypt-loop:
- modules.d/91crypt-loop/*
zipl:
- modules.d/91zipl/*
cifs:
- modules.d/95cifs/*
dasd:
- modules.d/95dasd/*
dasd_mod:
- modules.d/95dasd_mod/*
dasd_rules:
- modules.d/95dasd_rules/*
dcssblk:
- modules.d/95dcssblk/*
debug:
- modules.d/95debug/*
fcoe:
- modules.d/95fcoe/*
fcoe-uefi:
- modules.d/95fcoe-uefi/*
fstab-sys:
- modules.d/95fstab-sys/*
iscsi:
- modules.d/95iscsi/*
lunmask:
- modules.d/95lunmask/*
nbd:
- modules.d/95nbd/*
nfs:
- modules.d/95nfs/*
nvmf:
- modules.d/95nvmf/*
qeth_rules:
- modules.d/95qeth_rules/*
resume:
- modules.d/95resume/*
rootfs-block:
- modules.d/95rootfs-block/*
ssh-client:
- modules.d/95ssh-client/*
terminfo:
- modules.d/95terminfo/*
udev-rules:
- modules.d/95udev-rules/*
virtfs:
- modules.d/95virtfs/*
zfcp:
- modules.d/95zfcp/*
zfcp_rules:
- modules.d/95zfcp_rules/*
znet:
- modules.d/95znet/*
securityfs:
- modules.d/96securityfs/*
biosdevname:
- modules.d/97biosdevname/*
masterkey:
- modules.d/97masterkey/*
dracut-systemd:
- modules.d/98dracut-systemd/*
ecryptfs:
- modules.d/98ecryptfs/*
integrity:
- modules.d/98integrity/*
pollcdrom:
- modules.d/98pollcdrom/*
selinux:
- modules.d/98selinux/*
syslog:
- modules.d/98syslog/*
usrmount:
- modules.d/98usrmount/*
base:
- modules.d/99base/*
fs-lib:
- modules.d/99fs-lib/*
img-lib:
- modules.d/99img-lib/*
memstrack:
- modules.d/99memstrack/*
shutdown:
- modules.d/99shutdown/*
squash:
- modules.d/99squash/*
uefi-lib:
- modules.d/99uefi-lib/*
test:
- test/*
- test/**/*

10
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,10 @@
This pull request changes...
## Changes
## Checklist
- [ ] I have tested it locally
- [ ] I have reviewed and updated any documentation if relevant
- [ ] I am providing new code and test(s) for it
Fixes #

20
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- documents
- enhancement
- regression
- wiki
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue is being marked as stale because it has not had any recent activity.
It will be closed if no further activity occurs.
If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days.
Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -13,7 +13,9 @@ on:
jobs:
test:
runs-on: ubuntu-latest
#container: quay.io/haraldh/dracut-fedora:30
container:
image: quay.io/haraldh/dracut-fedora:31
options: "--privileged"
timeout-minutes: 45
strategy:
matrix:
@@ -51,4 +53,4 @@ jobs:
fetch-depth: 0
- name: "TEST-${{ matrix.test }}"
run: docker run --privileged -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:31 /dracut/fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
run: ./fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

View File

@@ -1,6 +1,6 @@
## The test container is created with https://github.com/dracutdevs/fedora-container
name: Fedora-30
name: Fedora-32
on:
push:
@@ -13,7 +13,9 @@ on:
jobs:
test:
runs-on: ubuntu-latest
#container: quay.io/haraldh/dracut-fedora:30
container:
image: quay.io/haraldh/dracut-fedora:32
options: "--privileged"
timeout-minutes: 45
strategy:
matrix:
@@ -30,11 +32,17 @@ jobs:
"15",
"17",
"20",
"21",
"30",
"31",
"35",
"36",
"40",
"41",
"50",
"51",
"60",
"61",
"99",
]
fail-fast: false
@@ -45,4 +53,4 @@ jobs:
fetch-depth: 0
- name: "TEST-${{ matrix.test }}"
run: docker run --privileged -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:30 /dracut/fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
run: ./fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

15
.github/workflows/labels.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Label the Pull Requests automatically via Cron
on:
schedule:
- cron: '*/15 * * * *'
jobs:
label:
runs-on: ubuntu-18.04
steps:
- uses: paulfantom/periodic-labeler@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
LABEL_MAPPINGS_FILE: .github/labeler.yml

View File

@@ -31,3 +31,6 @@ Lidong Zhong <lidong.zhong@suse.com> <lzhong@suse.com>
Nikoli <nikoli@gmx.us> <nikoli@lavabit.com>
Peter Robinson <pbrobinson@fedoraproject.org> <pbrobinson@gmail.com>
Xunlei Pang <xlpang@redhat.com> <xpang@redhat.com>
Daniel Molkentin <daniel.molkentin@suse.com> <dmolkentin@suse.com>
Thomas Blume <thomas.blume@suse.com> <Thomas.Blume@suse.com>
Brian C. Lane <bcl@redhat.com> <bcl@brianlane.com>

View File

@@ -2,7 +2,7 @@ language: generic
dist: bionic
sudo: required
services:
- docker
- docker
env:
matrix:
- IMAGE=latest
@@ -44,7 +44,7 @@ before_script:
script:
## The test container is created with https://github.com/dracutdevs/fedora-container
- docker run --privileged -it -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
- docker run --privileged -it -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
notifications:
webhooks:

View File

@@ -1,68 +0,0 @@
#!/bin/bash
export LANG=C
KERNEL_VERSION="$1"
KERNEL_IMAGE="$2"
[[ -f /etc/os-release ]] && . /etc/os-release
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
systemd-machine-id-setup
fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
[[ $MACHINE_ID ]] || exit 1
[[ -f $KERNEL_IMAGE ]] || exit 1
INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
dropindirs_sort()
{
suffix=$1; shift
args=("$@")
files=$(
while (( $# > 0 )); do
for i in ${1}/*${suffix}; do
[[ -f $i ]] && echo ${i##*/}
done
shift
done | sort -Vu
)
for f in $files; do
for d in "${args[@]}"; do
if [[ -f "$d/$f" ]]; then
echo "$d/$f"
continue 2
fi
done
done
}
# source our config dir
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
[[ -e $f ]] && . "$f"
done
[[ $dracut_rescue_image != "yes" ]] && exit 0
if [[ ! -f $INITRDFILE ]]; then
dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
((ret+=$?))
fi
if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
cp --reflink=auto "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
((ret+=$?))
fi
new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
((ret+=$?))
exit $ret

View File

@@ -105,8 +105,12 @@ case "$COMMAND" in
echo "linux $BOOT_DIR/linux"
echo "initrd $BOOT_DIR/initrd"
} > $LOADER_ENTRY
else
if [[ -e "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" ]]; then
cp -aT "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" $LOADER_ENTRY
else
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
fi
sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
fi

67
AUTHORS
View File

@@ -2,74 +2,82 @@ Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Hannes Reinecke <hare@suse.com>
Daniel Molkentin <dmolkentin@suse.com>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Daniel Molkentin <dmolkentin@suse.com>
Kairui Song <kasong@redhat.com>
Dave Young <dyoung@redhat.com>
Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Lubomir Rintel <lkundrak@v3.sk>
Lukas Nykryn <lnykryn@redhat.com>
Lubomir Rintel <lkundrak@v3.sk>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Kairui Song <kasong@redhat.com>
Jóhann B. Guðmundsson <johannbg@gmail.com>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.com>
Alexander Tsoy <alexander@tsoy.me>
Martin Wilck <mwilck@suse.de>
Frederick Grose <fgrose@sugarlabs.org>
WANG Chao <chaowang@redhat.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Hans de Goede <hdegoede@redhat.com>
Jonathan Lebon <jonathan@jlebon.com>
Peter Jones <pjones@redhat.com>
Andreas Thienemann <andreas@bawue.net>
Martin Wilck <mwilck@suse.de>
Frantisek Sumsal <frantisek@sumsal.cz>
Peter Robinson <pbrobinson@fedoraproject.org>
Frantisek Sumsal <frantisek@sumsal.cz>
Fabian Vogt <fvogt@suse.com>
Colin Walters <walters@verbum.org>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Nicolas Chauvet <kwizart@gmail.com>
Xunlei Pang <xlpang@redhat.com>
Colin Walters <walters@verbum.org>
Brian C. Lane <bcl@redhat.com>
Daniel Drake <drake@endlessm.com>
Angelo "pallotron" Failla <pallotron@fb.com>
Brian C. Lane <bcl@redhat.com>
Thomas Blume <thomas.blume@suse.com>
Ville Skyttä <ville.skytta@iki.fi>
Beniamino Galvani <bgalvani@redhat.com>
Böszörményi Zoltán <zboszor@pr.hu>
Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Jonathan Lebon <jonathan@jlebon.com>
Renaud Métrich <rmetrich@redhat.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
Javier Martinez Canillas <javierm@redhat.com>
Jonas Witschel <diabonas@gmx.de>
Leho Kraav <leho@kraav.com>
Moritz Maxeiner <moritz@ucworks.org>
Nathan Rini <nate@ucar.edu>
Nicolas Chauvet <kwizart@gmail.com>
Ondrej Mosnacek <omosnace@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Fabian Deutsch <fabiand@fedoraproject.org>
Javier Martinez Canillas <javierm@redhat.com>
Kamil Rytarowski <n54@gmx.com>
Lidong Zhong <lidong.zhong@suse.com>
Marc Grimme <grimme@atix.de>
Mike Gilbert <floppym@gentoo.org>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
q66 <daniel@octaforge.org>
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Chao Wang <chaowang@redhat.com>
David Tardon <dtardon@redhat.com>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Norbert Lange <norbert.lange@andritz.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Takashi Iwai <tiwai@suse.de>
Thomas Blume <thomas.blume@suse.com>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
tpgxyz <tpgxyz@gmail.com>
Adam Williamson <awilliam@redhat.com>
Anton Blanchard <anton@samba.org>
@@ -79,7 +87,9 @@ Chris Leech <cleech@redhat.com>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Doan Tran Cong Danh <congdanhqx@gmail.com>
Gaël PORTAY <gael.portay@collabora.com>
Jan Synacek <jsynacek@redhat.com>
Jiri Konecny <jkonecny@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
@@ -88,12 +98,12 @@ Marian Ganisin <mganisin@redhat.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Max Resch <resch.max@gmail.com>
Michael Ploujnikov <plouj@somanetworks.com>
Norbert Lange <norbert.lange@andritz.com>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Steven Brudenell <steven.brudenell@gmail.com>
Stig Telfer <stelfer@cray.com>
Thomas Backlund <tmb@mageia.org>
Topi Miettinen <toiwoton@gmail.com>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
@@ -107,6 +117,7 @@ Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Daniel Schaal <farbing@web.de>
Denis Silakov <dsilakov@virtuozzo.com>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Dusty Mabe <dusty@dustymabe.com>
Erwan Velu <erwan.velu@enovance.com>
Evgeny Vereshchagin <evvers@ya.ru>
Guido Trentalancia <guido@trentalancia.net>
@@ -115,7 +126,6 @@ Ian Dall <ian@beware.dropbear.id.au>
Imran Haider <imran1008@gmail.com>
James Buren <ryuo@frugalware.org>
Jan Macku <jamacku@redhat.com>
Jiri Konecny <jkonecny@redhat.com>
Joey Boggs <jboggs@redhat.com>
Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
@@ -125,9 +135,9 @@ Lukas Wunner <lukas@wunner.de>
Marko Myllynen <myllynen@redhat.com>
Michal Koutný <mkoutny@suse.com>
Mike Snitzer <snitzer@redhat.com>
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Minfei Huang <mhuang@redhat.com>
Nikoli <nikoli@gmx.us>
Patrick Talbert <ptalbert@redhat.com>
Pedro Monreal <pmgdeb@gmail.com>
Pingfan Liu <piliu@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
@@ -136,26 +146,29 @@ Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@us.ibm.com>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Tony Asleson <tasleson@redhat.com>
Topi Miettinen <toiwoton@gmail.com>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Érico Rolim <erico.erc@gmail.com>
наб <nabijaczleweli@nabijaczleweli.xyz>
A. Wilcox <AWilcox@Wilcox-Tech.com>
Alexander Kurtz <alexander@kurtz.be>
Alexander Miroshnichenko <alex@millerson.name>
Alexander Sosedkin <asosedkin@redhat.com>
Alexander Todorov <atodorov@redhat.com>
Alexey Kodanev <alexey.kodanev@oracle.com>
Andreas Schwab <schwab@suse.de>
Andreas Stieger <astieger@suse.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Antz <antzz@protonmail.ch>
Arnaud Rebillout <arnaud.rebillout@collabora.com>
Artem Savkov <asavkov@redhat.com>
Attila Bruncsak <bruncsak@users.noreply.github.com>
B. Wilson <x@wilsonb.com>
Ben Howard <ben.howard@redhat.com>
Benjamin Marzinski <bmarzins@redhat.com>
Brandon Philips <brandon@ifup.co>
Brian C. Lane <bcl@brianlane.com>
Bruno E. O. Meneguele <bmeneg@redhat.com>
Bryn M. Reeves <bmr@redhat.com>
Canek Peláez Valdés <caneko@gmail.com>
@@ -164,24 +177,29 @@ Chad Dupuis <chad.dupuis@cavium.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Cong Wang <amwang@redhat.com>
Dan Fuhry <dfuhry@datto.com>
Daniel Molkentin <daniel.molkentin@suse.com>
Dave Jones <davej@redhat.com>
David Disseldorp <ddiss@suse.de>
David Michael <david.michael@coreos.com>
Denis Volkov <denis@simpletexting.net>
Dennis Schridde <devurandom@gmx.net>
Derek Hageman <hageman@inthat.cloud>
Derek Higgins <derekh@redhat.com>
Donovan Tremura <neurognostic@protonmail.ch>
Duane Griffin <duaneg@dghda.com>
Dusty Mabe <dusty@dustymabe.com>
Elan Ruusamäe <glen@delfi.ee>
Enno Boland <g@s01.de>
Enzo Matsumiya <ematsumiya@suse.de>
Eugene S. Sobolev <sobolev@protei.ru>
Eugene Syromiatnikov <esyr@redhat.com>
Fabian Vogt <fvogt@suse.de>
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Florian Gamböck <mail@floga.de>
Frank Deng <frank.deng@oracle.com>
François Cami <fcami@fedoraproject.org>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
GuoChuang <guo.chuang@zte.com.cn>
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Hendrik Brueckner <brueckner@linux.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org>
@@ -199,6 +217,7 @@ Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Johannes Thumshirn <jthumshirn@suse.com>
Jonas Jonsson <jonas@websystem.se>
Jonas Witschel <diabonas@archlinux.org>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lee Duncan <lduncan@suse.com>
@@ -226,11 +245,12 @@ Olivier Blin <dev@blino.org>
Ondrej Dubaj <odubaj@redhat.com>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Patrick Talbert <ptalbert@redhat.com>
Paul Robins <exp@users.noreply.github.com>
Pavel Zhukov <pzhukov@redhat.com>
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Pekka Wallendahl <wyrmiyu@gmail.com>
Peter Georg <peter.georg@physik.uni-regensburg.de>
Petr Pavlu <petr.pavlu@suse.com>
Petr Tesarik <ptesarik@suse.com>
Petr Vorel <pvorel@suse.cz>
Prarit Bhargava <prarit@redhat.com>
@@ -239,7 +259,9 @@ Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de>
Ruben Kerkhof <ruben@rubenkerkhof.com>
Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
Rusty Bird <rustybird@openmailbox.org>
Sebastian Mitterle <smitterl@redhat.com>
Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
@@ -265,13 +287,14 @@ jbash aka John Bashinski <jbash@velvet.com>
jloeser <jloeser@suse.de>
johannes <johannes.brechtmann@gmail.com>
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
leo-lb <lle-bout@zaclys.net>
logan <logancaldwell23@gmail.com>
masem <matej.semian@gmail.com>
maximilian attems <max@stro.at>
mulhern <amulhern@redhat.com>
mwberry <mwberry@users.noreply.github.com>
nabijaczleweli <nabijaczleweli@gmail.com>
privb0x23 <privb0x23@users.noreply.github.com>
q66 <daniel@octaforge.org>
tpg <tpgxyz@gmail.com>
xtraeme <xtraeme@voidlinux.eu>
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Дамјан Георгиевски <gdamjan@gmail.com>

View File

@@ -1,8 +1,13 @@
-include dracut-version.sh
DRACUT_MAIN_VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || :)
DRACUT_MAIN_VERSION ?= $(DRACUT_VERSION)
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_MAIN_VERSION),)
DRACUT_MAIN_VERSION = $(DRACUT_VERSION)
endif
DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_FULL_VERSION),)
DRACUT_FULL_VERSION = $(DRACUT_VERSION)
endif
-include Makefile.inc
@@ -13,8 +18,7 @@ pkglibdir ?= ${libdir}/dracut
sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 $(KMOD_CFLAGS)
CFLAGS ?= -O2 -g -Wall -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
bashcompletiondir ?= ${datadir}/bash-completion/completions
pkgconfigdatadir ?= $(datadir)/pkgconfig
@@ -45,6 +49,9 @@ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
%.o : %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(KMOD_CFLAGS) $< -o $@
DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
install/hashmap.o\
@@ -92,14 +99,14 @@ endif
%.xml: %.asc
@rm -f -- "$@"
asciidoc -a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" -d manpage -b docbook -o "$@" $<
asciidoc -a "version=$(DRACUT_FULL_VERSION)" -d manpage -b docbook -o "$@" $<
dracut.8: dracut.usage.asc dracut.8.asc
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
@rm -f -- dracut.xml
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
-a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" \
-a "version=$(DRACUT_FULL_VERSION)" \
-a numbered \
-d book -b docbook -o dracut.xml dracut.asc
@rm -f -- dracut.html
@@ -112,7 +119,7 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
dracut.pc: Makefile.inc Makefile
@echo "Name: dracut" > dracut.pc
@echo "Description: dracut" >> dracut.pc
@echo "Version: $(DRACUT_MAIN_VERSION)$(GITVERSION)" >> dracut.pc
@echo "Version: $(DRACUT_FULL_VERSION)" >> dracut.pc
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
@@ -182,7 +189,7 @@ endif
dracut-version.sh:
@rm -f dracut-version.sh
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)$(GITVERSION)" > dracut-version.sh
@echo "DRACUT_VERSION=$(DRACUT_FULL_VERSION)" > dracut-version.sh
clean:
$(RM) *~

268
NEWS
View File

@@ -1,3 +1,264 @@
dracut-051
==========
dracut:
- allow running on a cross-compiled rootfs
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.
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.
- don't call fsfreeze on subvol of root file system
- Use TMPDIR (typically /run/user/$UID) if available
- dracut.sh: add check for invalid configuration files
Emit a warning about possible misconfigured configuration files, where
the spaces around values are missing for +=""
- dracut-functions: fix find_binary() to return full path
- dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL
- dracut.sh: fix early microcode detection logic
- dracut.sh: fix ia32 detection for uefi executables
- dracut.sh: Add --version
- dracut.sh: Add --hostonly-nics option
- EFI Mode: only write kernel cmdline to UEFI binary
- Allow $DRACUT_INSTALL to be not an absolute path
- Don't print when a module is explicitly omitted (by default)
- Remove uses of bash (and bash specific syntax) in runtime scripts
- dracut-init.sh: Add a helper for detect device kernel modules
- dracut-functions.sh: Fix check_block_and_slaves_all
- dracut-functions.sh: add a helper to check if kernel module is available
Documentation
- dracut.cmdline.7.asc: clarify usage of `rd.lvm.vg` and `rd.lvm.lv`
- dracut.conf.5.asc: document how to config --no-compress in the config
- fix CI badges in README.md and fix dracut description
- dracut.modules.7.asc: fix typos
- dracut.modules.7.asc: fix reference to insmodpost module
- Add --version to man page
- Adding code of conduct
- Document initqueue/online hook
dracut-install:
- install: also install post weak dependencies of kernel modules
- install: Globbing support for resolving "firmware:"
mkinitrd:
- use vmlinux regex for ppc*, vmlinuz for i686
mkinitrd-suse:
- fix i586 platform detection
modules:
00systemd:
- skip dependency add for non-existent units
- add missing cryptsetup-related targets
05busybox:
- simplify listing of supported utilities
06rngd:
- install dependant libs too
- Do not start inside container
10i18n:
- i18n: Always install /etc/vconsole.conf
35network-legacy:
- dhclient-script: Fix typo in output of BOUND & BOUND6 cases
- simplify fallback dhcp setup
35network-manager:
- ensure that nm-run.sh is executed when needed
- install libnss DNS and mDNS plugins
- always pull in machinery to read ifcfg files
- set kernel hostname from the command line
- move connection generation to a lib file
40network:
- fix glob matching ipv6 addresses
- net-lib.sh: support infiniband network mac addresses
45url-lib:
- drop NSS if it's not in curl --version
80cms:
- regenerate NetworkManager connections
90btrfs:
- force preload btrfs module
- Install crypto modules in 90kernel-modules
90crypt:
- cryptroot-ask: no warn if /run/cryptsetup exist
- install crypto modules in 90kernel-modules
- try to catch kernel config changes
- fix force on multiple lines
- pull in remote-cryptsetup.target enablement
- cryptroot-ask: unify /etc/crypttab and rd.luks.key
90dmsquash-live:
- iso-scan.sh: Provide an easy reference to iso-scan device
90kernel-modules:
- remove nfit from static module list (see nvdimm module)
- install crypto modules in 90kernel-modules
- add sg kernel module
- add pci_hyperv
- install block drivers more strictly
- install less modules for hostonly mode
- arm: add drivers/hwmon for arm/arm64
90kernel-network-modules
- on't install iscsi related module (use 95iscsi)
90lvm:
- remove unnecessary ${initdir} from lvm_scan.sh
- fix removal of pvscan from udev rules
- do not add newline to cmdline
90multipath:
- add automatic configuration for multipath
(adds 'rd.multipath=default' to use the default config)
- install kpartx's 11-dm-parts.rules
90nvdimm:
- new module for NVDIMM support
90ppcmac:
- respect DRACUT_ARCH, don't exclude ppcle
90qemu-net:
- in hostonly mode, only install if network is needed
- install less module for strict hostonly mode
91zipl:
- parse-zipl.sh: honor SYSTEMD_READY
95cifs:
- pass rootflags to mount
- install new softdeps (sha512, gcm, ccm, aead2)
95dasd:
- only install /etc/dasd.conf if present
95dcssblk:
- fix script permissions
95fcoe:
- fix pre-trigger stage by replacing exit with return in lldpad.sh
- default rd.nofcoe to false
- don't install if there is no FCoE hostonly devices
95iscsi:
- fix missing space when compiling cmdline args
- fix ipv6 target discovery
95nfs:
- only install rpc services for NFS < 4 when hostonly is strict
- Change the order of NFS servers during the boot
(next-server option has higher priority than DHCP-server itself)
- install less module if hostonly mode is strict
95nvmf:
- add module for NVMe-oF
- add NVMe over TCP support
95resume:
- do not resume on iSCSI, FCoE or NBD
95rootfs-block:
- mount-root.sh: fix writing fstab file with missing fsck flag
- only write root argument for block device
95zfcp:
- match simplified rd.zfcp format too
95zfcp_rules:
- parse-zfcp.sh: remove rule existence check
95znet:
- add a rd.znet_ifname= option
98dracut-systemd:
- remove memtrace-ko and rd.memdebug=4 support in dracut
- remove cleanup_trace_mem calls
- dracut-initqueue: Print more useful info in case of timeout
- as of v246 of systemd "syslog" and "syslog-console" switches have been deprecated
- don't wait for root device if remote cryptsetup active
99base:
- dracut-lib.sh: quote variables in parameter expansion patterns
- remove memtrace-ko and rd.memdebug=4 support in dracut
- remove cleanup_trace_mem calls
- see new module 99memstrack
- prevent creating unexpected files on the host when running dracut
99memstrack:
- 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.
99squash:
- don't hardcode the squash sub directories
- improve pre-requirements check
- check require module earlier, and properly
new modules:
- nvmf
- watchdog-modules
- dbus
- network-wicked
removed modules:
- stratis
test suite:
- use dd from /dev/zero, instead of creating files with a hole
- TEST-03-USR-MOUNT/test.sh: increase loglevel
- TEST-12-RAID-DEG/create-root.sh: more udevadm settle
- TEST-35-ISCSI-MULTI: bump disk space
- TEST-41-NBD-NM/Makefile: should be based on TEST-40-NBD not TEST-20-NFS
- TEST-99: exclude /etc/dnf/* from check
dracut-050
==========
@@ -54,6 +315,9 @@ dracut-install:
- add support for compressed firmware files
- dracut_mkdir(): create parent directories as needed.
configure:
- Find FTS library with --as-needed
test suite:
- lots of cleanups
- add github actions
@@ -85,6 +349,7 @@ livenet:
dmsquash-live:
- Support a flattened squashfs.img
- Remove obsolete osmin.img processing
dracut-systemd:
- Start systemd-vconsole-setup before dracut-cmdline-ask
@@ -274,6 +539,9 @@ nfs:
fips:
- fixed creating path to .hmac of kernel based on BOOT_IMAGE
- turn info calls into fips_info calls
- modprobe failures during manual module loading is not fatal
lunmask:
- add module to handle LUN masking

View File

@@ -3,16 +3,17 @@ dracut
dracut is an event driven initramfs infrastructure.
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](.github/CODE_OF_CONDUCT.md)
[![Build Status](https://travis-ci.org/dracutdevs/dracut.svg?branch=master)](https://travis-ci.org/dracutdevs/dracut)
![Fedora-30](https://github.com/dracutdevs/dracut/workflows/Fedora-30/badge.svg?branch=master)
![Fedora-31](https://github.com/dracutdevs/dracut/workflows/Fedora-31/badge.svg?branch=master)
[![Fedora-31](https://github.com/dracutdevs/dracut/workflows/Fedora-31/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-31)
[![Fedora-32](https://github.com/dracutdevs/dracut/workflows/Fedora-32/badge.svg?branch=master)](https://github.com/dracutdevs/dracut/actions?query=workflow%3AFedora-32)
dracut (the tool) is used to create an initramfs image by copying tools
and files from an installed system and combining it with the
dracut framework, usually found in /usr/lib/dracut/modules.d.
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
Unlike other implementations, dracut hard-codes as little
as possible into the initramfs. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs. This is all driven off of
device availability. Therefore, instead of scripts hard-coded to do
@@ -20,10 +21,7 @@ various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
This helps to keep the time required in the initramfs as little as
possible so that things like a 5 second boot aren't made impossible as
a result of the very existence of an initramfs. It's likely that
we'll grow some hooks for running arbitrary commands in the flow of
the script, but it's worth trying to resist the urge as much as we can
as hooks are guaranteed to be the path to slow-down.
a result of the very existence of an initramfs.
Most of the initramfs generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install

2
configure vendored
View File

@@ -85,7 +85,7 @@ EOF
found=no
for lib in "-lc" "-lfts"; do
${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1
${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib >/dev/null 2>&1
ret=$?
if test $ret -eq 0; then
FTS_LIBS="$lib"

View File

@@ -73,6 +73,17 @@ _dracut() {
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
fi
local args
_count_args
if [[ $args -eq 1 ]]; then
_filedir
return 0
elif [[ $args -eq 2 ]]; then
comps=$(cd /lib/modules; echo [0-9]*)
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
}
complete -F _dracut dracut

View File

@@ -41,31 +41,36 @@ str_ends() { [ "${1%*"$2"}" != "$1" ]; }
# search in the usual places to find the binary.
find_binary() {
local _delim
local _path
local l
local p
[[ -z ${1##/*} ]] || _delim="/"
if [[ "$1" == *.so* ]]; then
for l in libdirs ; do
if { $DRACUT_LDD "$dracutsysrootdir$l$_delim$1" &>/dev/null; }; then
printf "%s\n" "$1"
_path="${l}${_delim}${1}"
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &>/dev/null; }; then
printf "%s\n" "${_path}"
return 0
fi
done
if { $DRACUT_LDD "$dracutsysrootdir$_delim$1" &>/dev/null; }; then
printf "%s\n" "$1"
_path="${_delim}${1}"
if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &>/dev/null; }; then
printf "%s\n" "${_path}"
return 0
fi
fi
if [[ "$1" == */* ]]; then
if [[ -L $dracutsysrootdir$_delim$1 ]] || [[ -x $dracutsysrootdir$_delim$1 ]]; then
printf "%s\n" "$1"
_path="${_delim}${1}"
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
printf "%s\n" "${_path}"
return 0
fi
fi
for p in $DRACUT_PATH ; do
if [[ -L $dracutsysrootdir$p$_delim$1 ]] || [[ -x $dracutsysrootdir$p$_delim$1 ]]; then
printf "%s\n" "$1"
_path="${p}${_delim}${1}"
if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
printf "%s\n" "${_path}"
return 0
fi
done
@@ -521,7 +526,6 @@ check_block_and_slaves() {
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
@@ -540,7 +544,6 @@ check_block_and_slaves_all() {
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
@@ -669,6 +672,11 @@ check_kernel_config()
return 1
}
# 0 if the kernel module is either built-in or available
# 1 if the kernel module is not enabled
check_kernel_module() {
modprobe -S $kernel --dry-run $1 &>/dev/null || return 1
}
# get_cpu_vendor
# Only two values are returned: AMD or Intel
@@ -723,3 +731,166 @@ btrfs_devs() {
printf -- "%s\n" "$_dev"
done
}
iface_for_remote_addr() {
set -- $(ip -o route get to "$1")
echo $3
}
local_addr_for_remote_addr() {
set -- $(ip -o route get to "$1")
echo $5
}
peer_for_addr() {
local addr=$1
local qtd
# quote periods in IPv4 address
qtd=${addr//./\\.}
ip -o addr show | \
sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
}
netmask_for_addr() {
local addr=$1
local qtd
# quote periods in IPv4 address
qtd=${addr//./\\.}
ip -o addr show | sed -n 's,^.* '"$qtd"'/\([0-9]*\) .*$,\1,p'
}
gateway_for_iface() {
local ifname=$1 addr=$2
case $addr in
*.*) proto=4;;
*:*) proto=6;;
*) return;;
esac
ip -o -$proto route show | \
sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
}
# This works only for ifcfg-style network configuration!
bootproto_for_iface() {
local ifname=$1
local dir
# follow ifcfg settings for boot protocol
for dir in network-scripts network; do
[ -f "/etc/sysconfig/$dir/ifcfg-$ifname" ] && {
sed -n "s/BOOTPROTO=[\"']\?\([[:alnum:]]\{1,\}\)[\"']\?.*\$/\1/p" \
"/etc/sysconfig/$dir/ifcfg-$ifname"
return
}
done
}
is_unbracketed_ipv6_address() {
strglob "$1" '*:*' && ! strglob "$1" '\[*:*\]'
}
# Create an ip= string to set up networking such that the given
# remote address can be reached
ip_params_for_remote_addr() {
local remote_addr=$1
local ifname local_addr peer netmask= gateway ifmac
[[ $remote_addr ]] || return 1
ifname=$(iface_for_remote_addr "$remote_addr")
[[ $ifname ]] || {
berror "failed to determine interface to connect to $remote_addr"
return 1
}
# ifname clause to bind the interface name to a MAC address
if [ -d "/sys/class/net/$ifname/bonding" ]; then
dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
elif [ -e "/sys/class/net/$ifname/address" ] ; then
ifmac=$(cat "/sys/class/net/$ifname/address")
[[ $ifmac ]] && printf 'ifname=%s:%s ' "${ifname}" "${ifmac}"
fi
bootproto=$(bootproto_for_iface "$ifname")
case $bootproto in
dhcp|dhcp6|auto6) ;;
dhcp4)
bootproto=dhcp;;
static*|"")
bootproto=;;
*)
derror "bootproto \"$bootproto\" is unsupported by dracut, trying static configuration"
bootproto=;;
esac
if [[ $bootproto ]]; then
printf 'ip=%s:%s ' "${ifname}" "${bootproto}"
else
local_addr=$(local_addr_for_remote_addr "$remote_addr")
[[ $local_addr ]] || {
berror "failed to determine local address to connect to $remote_addr"
return 1
}
peer=$(peer_for_addr "$local_addr")
# Set peer or netmask, but not both
[[ $peer ]] || netmask=$(netmask_for_addr "$local_addr")
gateway=$(gateway_for_iface "$ifname" "$local_addr")
# Quote IPv6 addresses with brackets
is_unbracketed_ipv6_address "$local_addr" && local_addr="[$local_addr]"
is_unbracketed_ipv6_address "$peer" && peer="[$peer]"
is_unbracketed_ipv6_address "$gateway" && gateway="[$gateway]"
printf 'ip=%s:%s:%s:%s::%s:none ' \
"${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
fi
}
# block_is_nbd <maj:min>
# Check whether $1 is an nbd device
block_is_nbd() {
[[ -b /dev/block/$1 && $1 == 43:* ]]
}
# block_is_iscsi <maj:min>
# Check whether $1 is an nbd device
block_is_iscsi() {
local _dir
local _dev=$1
[[ -L "/sys/dev/block/$_dev" ]] || return
_dir="$(readlink -f "/sys/dev/block/$_dev")" || return
until [[ -d "$_dir/sys" || -d "$_dir/iscsi_session" ]]; do
_dir="$_dir/.."
done
[[ -d "$_dir/iscsi_session" ]]
}
# block_is_fcoe <maj:min>
# Check whether $1 is an FCoE device
# Will not work for HBAs that hide the ethernet aspect
# completely and present a pure FC device
block_is_fcoe() {
local _dir
local _dev=$1
[[ -L "/sys/dev/block/$_dev" ]] || return
_dir="$(readlink -f "/sys/dev/block/$_dev")"
until [[ -d "$_dir/sys" ]]; do
_dir="$_dir/.."
if [[ -d "$_dir/subsystem" ]]; then
subsystem=$(basename $(readlink $_dir/subsystem))
[[ $subsystem == "fcoe" ]] && return 0
fi
done
return 1
}
# block_is_netdevice <maj:min>
# Check whether $1 is a net device
block_is_netdevice() {
block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1"
}
# get the corresponding kernel modules of a /sys/class/*/* or/dev/* device
get_dev_module() {
udevadm info -a "$1" | sed -n 's/\s*DRIVERS=="\(\S\+\)"/\1/p'
}

View File

@@ -183,7 +183,7 @@ for i in $DRACUT_INSTALL ; do
DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
done
if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then
if [[ $DRINSTALLPARTS = 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1 ; then
dfatal "dracut-install not found!"
exit 10
fi
@@ -839,7 +839,7 @@ check_module() {
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
dinfo "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
ddebug "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
return 1
fi

View File

@@ -265,6 +265,9 @@ example:
**-v, --verbose**::
increase verbosity level (default is info(4))
**--version**::
display version and exit
**-q, --quiet**:: decrease verbosity level (default is info(4))
**-c, --conf** _<dracut configuration file>_::
@@ -659,18 +662,18 @@ Harald Hoyer
Victor Lowther
Amadeusz Żołnowski
Hannes Reinecke
Daniel Molkentin
Will Woods
Philippe Seewer
Warren Togami
Amadeusz Żołnowski
Jeremy Katz
David Dillow
Will Woods
SEE ALSO
--------
*dracut.cmdline*(7) *dracut.conf*(5) *lsinitrd*(1)

View File

@@ -113,6 +113,9 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
iso-scan/filename
~~~~~~~~~~~~~~~~~
Mount all mountable devices and search for ISO pointed by the argument. When
the ISO is found set it up as a loop device. Device containing this ISO
image will stay mounted at /run/initramfs/isoscandev.
Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work
by copying the original kernel cmdline parameters.
@@ -188,8 +191,8 @@ It should be attached to any report about dracut problems.
_/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.
**rd.memdebug=[0-4]**::
Print memory usage info at various points, set the verbose level from 0 to 4.
**rd.memdebug=[0-5]**::
Print memory usage info at various points, set the verbose level from 0 to 5.
+
Higher level means more debugging output:
+
@@ -198,10 +201,14 @@ It should be attached to any report about dracut problems.
1 - partial /proc/meminfo
2 - /proc/meminfo
3 - /proc/meminfo + /proc/slabinfo
4 - /proc/meminfo + /proc/slabinfo + tracekomem
NOTE: tracekomem is a shell script utilizing kernel trace to track
the rough total memory consumption of kernel modules during
loading. It may override other trace configurations.
4 - /proc/meminfo + /proc/slabinfo + memstrack summary
NOTE: memstrack is a memory tracing tool that tracks the total memory
consumption, and peak memory consumption of each kernel modules
and userspace progress during the whole initramfs runtime, report
is genereted and the end of initramsfs run.
5 - /proc/meminfo + /proc/slabinfo + memstrack (with top memory stacktrace)
NOTE: memstrack (with top memory stacktrace) will print top memory
allocation stack traces during the whole initramfs runtime.
----
**rd.break**::
@@ -277,12 +284,12 @@ LVM
disable LVM detection
**rd.lvm.vg=**__<volume group name>__::
only activate the volume groups with the given name. rd.lvm.vg can be
specified multiple times on the kernel command line.
only activate all logical volumes in the the volume groups with the given name.
rd.lvm.vg can be specified multiple times on the kernel command line.
**rd.lvm.lv=**__<logical volume name>__::
only activate the logical volumes with the given name. rd.lvm.lv can be
specified multiple times on the kernel command line.
**rd.lvm.lv=**__<volume group name>/<logical volume name>__::
only activate the logical volumes with the given name.
rd.lvm.lv can be specified multiple times on the kernel command line.
**rd.lvm.conf=0**::
remove any _/etc/lvm/lvm.conf_, which may exist in the initramfs
@@ -298,6 +305,8 @@ crypto LUKS
The comparisons also matches, if _<luks uuid>_ is only the beginning of the
LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times.
_<luks uuid>_ may be prefixed by the keyword `keysource:`, see
_rd.luks.key_ below.
**rd.luks.allow-discards=**__<luks uuid>__::
Allow using of discards (TRIM) requests for LUKS partitions with the given
@@ -393,6 +402,49 @@ head -32c /dev/urandom > rootkey.key
cryptsetup --batch-mode --key-file rootkey.key \
luksFormat /dev/sda47
--
You can also use regular key files on an encrypted _keydev_.
Compared to using GPG encrypted keyfiles on an unencrypted
device this provides the following advantages:
- you can unlock your disk(s) using multiple passphrases
- better security by not loosing the key stretching mechanism
To use an encrypted _keydev_ you *must* ensure that it becomes
available by using the keyword `keysource`, e.g.
`rd.luks.uuid=keysource:aaaa`
_aaaa_ being the uuid of the encrypted _keydev_.
Example:
Lets assume you have three disks _A_, _B_ and _C_ with the uuids
_aaaa_, _bbbb_ and _cccc_. +
You want to unlock _A_ and _B_ using keyfile _keyfile_. +
The unlocked volumes be _A'_, _B'_ and _C'_ with the uuids
_AAAA_, _BBBB_ and _CCCC_. +
_keyfile_ is saved on _C'_ as _/keyfile_.
One luks keyslot of each _A_, _B_ and _C_ is setup with a
passphrase. +
Another luks keyslot of each _A_ and _B_ is setup with _keyfile_.
To boot this configuration you could use:
[listing]
--
rd.luks.uuid=aaaa
rd.luks.uuid=bbbb
rd.luks.uuid=keysource:cccc
rd.luks.key=/keyfile:UUID=CCCC
--
Dracut asks for the passphrase for _C_ and uses the
keyfile to unlock _A_ and _B_. +
If getting the passphrase for _C_ fails it falls back to
asking for the passphrases for _A_ and _B_.
If you want _C'_ to stay unlocked, specify a luks name for
it, e.g. `rd.luks.name=cccc=mykeys`, otherwise it gets closed
when not needed anymore.
===============================
MD RAID
@@ -431,6 +483,9 @@ MULTIPATH
**rd.multipath=0**::
disable multipath detection
**rd.multipath=default**::
use default multipath settings
FIPS
~~~~
**rd.fips**::
@@ -600,7 +655,7 @@ interface name. Better name it "bootnet" or "bluesocket".
boolean, bring up network even without netroot set
**vlan=**__<vlanname>__:__<phydevice>__::
Setup vlan device named <vlanname> on <phydeivce>.
Setup vlan device named <vlanname> on <phydevice>.
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005),
VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005),
DEV_PLUS_VID_NO_PAD (eth0.5)
@@ -615,9 +670,13 @@ interface name. Better name it "bootnet" or "bluesocket".
Bond without parameters assumes
bond=bond0:eth0,eth1:mode=balance-rr
**team=**__<teammaster>__:__<teamslaves>__::
**team=**__<teammaster>__:__<teamslaves>__[:__<teamrunner>__]::
Setup team device <teammaster> on top of <teamslaves>.
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
<teamrunner> is the runner type to be used (see *teamd.conf*(5)); defaults to
activebackup.
Team without parameters assumes
team=team0:eth0,eth1:activebackup
**bridge=**__<bridgename>__:__<ethnames>__::
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
@@ -809,6 +868,23 @@ FCoE
+
NOTE: letters in the MAC-address must be lowercase!
NVMf
~~~~
**rd.nvmf.hostnqn=**__<hostNQN>__::
NVMe host NQN to use
**rd.nvmf.hostid=**__<hostID>__::
NVMe host id to use
**rd.nvmf.discover=**__{rdma|fc|tcp}__,__<traddr>__,[__<host_traddr>__],[__<trsvcid>__]::
Discover and connect to a NVMe-over-Fabric controller specified by
_<traddr>_ and the optionally _<host_traddr>_ or _<trsvcid>_.
The first argument specifies the transport to use; currently only
'rdma', 'fc', or 'tcp' are supported.
The _<traddr>_ parameter can be set to 'auto' to select
autodiscovery; in that case all other parameters are ignored.
This parameter can be specified multiple times.
NBD
~~~
**root=**??? **netroot=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
@@ -860,6 +936,11 @@ ZNET
RHEL/Fedora with ccw_init, which is called from udev for certain
devices on z-series.
rd.znet can be specified multiple times on the kernel command line.
**rd.znet_ifname=**__<ifname>__:__<subchannels>__::
Assign network device name <interface> (i.e. "bootnet") to the NIC
corresponds to the subchannels. This is useful when dracut's default
"ifname=" doesn't work due to device having a changing MAC address.
+
[listing]
.Example

View File

@@ -80,12 +80,13 @@ Configuration files must have the extension .conf; other extensions are ignored.
Specify additional files to include in the initramfs, separated by spaces,
if they exist.
*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}__"::
*compress=*"__{cat|bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}__"::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass arguments, it will be called
with exactly those arguments. Depending on what you pass, this may result in
an initramfs that the kernel cannot decompress.
To disable compression, use "cat".
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)

View File

@@ -93,13 +93,18 @@ udev state.
==== Initqueue settled
This hooks (initqueue/settled) gets executed every time udev has settled.
This hook (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes
This hook (initqueue/timeout) gets executed, when the main loop counter becomes
half of the rd.retry counter.
==== Initqueue online
This hook (initqueue/online) gets executed whenever a network interface comes online
(that is, once it is up and configured by the configured network module).
==== Initqueue finished
This hook (initqueue/finished) is called after udev has settled and
@@ -146,8 +151,8 @@ FIXME
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
udev has settled and the basic device drivers have been loaded.
A simple example module is _90kernel-modules_, which modprobes a kernel module
after udev has settled and the basic device drivers have been loaded.
All module installation information is in the file module-setup.sh.
@@ -159,7 +164,7 @@ check():
return 0
----
The we create the install() function, which installs a cmdline hook with
Then we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.

224
dracut.sh
View File

@@ -140,7 +140,7 @@ Creates initial ramdisk images for preloading modules
--confdir [DIR] Specify configuration directory to use *.conf files
from. Default: /etc/dracut.conf.d
--tmpdir [DIR] Temporary directory to be used instead of default
/var/tmp.
${TMPDIR:-/var/tmp}.
-r, --sysroot [DIR] Specify sysroot directory to collect files from.
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
@@ -175,6 +175,8 @@ Creates initial ramdisk images for preloading modules
--hostonly-i18n Install only needed keyboard and font files according
to the host configuration (default).
--no-hostonly-i18n Install all keyboard and font files available.
--hostonly-nics [LIST]
Only enable listed NICs in the initramfs.
--persistent-policy [POLICY]
Use [POLICY] to address disks and partitions.
POLICY can be any directory name found in /dev/disk.
@@ -242,6 +244,7 @@ Creates initial ramdisk images for preloading modules
--kernel-image [FILE] location of the kernel image
--regenerate-all Regenerate all initramfs images at the default location
for the kernel versions found on the system
--version Display version
If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -252,6 +255,14 @@ For example:
EOF
}
long_version() {
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
. $dracutbasedir/dracut-version.sh
fi
echo "dracut $DRACUT_VERSION"
}
# Fills up host_devs stack variable and makes sure there are no duplicates
push_host_devs() {
local _dev
@@ -279,6 +290,14 @@ read_arg() {
fi
}
check_conf_file()
{
if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then
printf '\ndracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!\n' >&2
printf 'dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.\n\n' >&2
fi
}
dropindirs_sort()
{
local suffix=$1; shift
@@ -407,7 +426,9 @@ rearrange_params()
--long kernel-image: \
--long no-hostonly-i18n \
--long hostonly-i18n \
--long hostonly-nics: \
--long no-machineid \
--long version \
-- "$@")
if (( $? != 0 )); then
@@ -569,6 +590,8 @@ while :; do
hostonly_cmdline_l="yes" ;;
--hostonly-i18n)
i18n_install_all_l="no" ;;
--hostonly-nics)
hostonly_nics_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
--no-hostonly-i18n)
i18n_install_all_l="yes" ;;
--no-hostonly-cmdline)
@@ -608,6 +631,7 @@ while :; do
kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--no-machineid)
machine_id_l="no";;
--version) long_version; exit 1 ;;
--) shift; break;;
*) # should not even reach this point
@@ -703,10 +727,14 @@ if [[ ! -d $confdir ]]; then
fi
# source our config file
[[ -f $conffile ]] && . "$conffile"
if [[ -f $conffile ]]; then
check_conf_file "$conffile"
. "$conffile"
fi
# source our config dir
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
check_conf_file "$f"
[[ -e $f ]] && . "$f"
done
@@ -732,6 +760,7 @@ unset NPATH
(( ${#fstab_lines_l[@]} )) && fstab_lines+=( "${fstab_lines_l[@]}" )
(( ${#install_items_l[@]} )) && install_items+=" ${install_items_l[@]} "
(( ${#install_optional_items_l[@]} )) && install_optional_items+=" ${install_optional_items_l[@]} "
(( ${#hostonly_nics_l[@]} )) && hostonly_nics+=" ${hostonly_nics_l[@]} "
# these options override the stuff in the config file
(( ${#dracutmodules_l[@]} )) && dracutmodules="${dracutmodules_l[@]}"
@@ -765,6 +794,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
[[ $fw_dir ]] || fw_dir="$dracutsysrootdir/lib/firmware/updates:$dracutsysrootdir/lib/firmware:$dracutsysrootdir/lib/firmware/$kernel"
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
[[ $tmpdir ]] || tmpdir="$TMPDIR"
[[ $tmpdir ]] || tmpdir=$dracutsysrootdir/var/tmp
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
[[ $compress_l ]] && compress=$compress_l
@@ -1140,7 +1170,7 @@ if [[ ! $print_cmdline ]]; then
case $(uname -m) in
x86_64)
EFI_MACHINE_TYPE_NAME=x64;;
ia32)
i?86)
EFI_MACHINE_TYPE_NAME=ia32;;
*)
dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
@@ -1181,19 +1211,26 @@ fi
if [[ $early_microcode = yes ]]; then
if [[ $hostonly ]]; then
[[ $(get_cpu_vendor) == "AMD" ]] \
&& ! check_kernel_config CONFIG_MICROCODE_AMD \
&& unset early_microcode
[[ $(get_cpu_vendor) == "Intel" ]] \
&& ! check_kernel_config CONFIG_MICROCODE_INTEL \
&& unset early_microcode
if [[ $(get_cpu_vendor) == "AMD" ]]; then
check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode
elif [[ $(get_cpu_vendor) == "Intel" ]]; then
check_kernel_config CONFIG_MICROCODE_INTEL || unset early_microcode
else
unset early_microcode
fi
else
! check_kernel_config CONFIG_MICROCODE_AMD \
&& ! check_kernel_config CONFIG_MICROCODE_INTEL \
&& unset early_microcode
fi
# Do not complain on non-x86 architectures as it makes no sense
case $(uname -m) in
x86_64|i?86)
[[ $early_microcode != yes ]] \
&& dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y"
;;
*) ;;
esac
fi
# Need to be able to have non-root users read stuff (rpcbind etc)
@@ -1600,7 +1637,9 @@ if [[ $kernel_only != yes ]]; then
(( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
(( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
if [[ $kernel_cmdline ]] && [[ $uefi != yes ]]; then
printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
fi
for line in "${fstab_lines[@]}"; do
line=($line)
@@ -1648,15 +1687,6 @@ if [[ $kernel_only != yes ]]; then
# Now we are done with lazy resolving, always install dependencies
unset DRACUT_RESOLVE_LAZY
export DRACUT_RESOLVE_DEPS=1
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
for _dir in $libdirs; do
for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
[[ -e "$_f" ]] || continue
inst_libdir_file "libgcc_s.so*"
break 2
done
done
fi
for ((i=0; i < ${#include_src[@]}; i++)); do
@@ -1718,7 +1748,7 @@ fi
if [[ $do_strip = yes ]] ; then
# Prefer strip from elfutils for package size
declare strip_cmd=$(command -v eu-strip)
test -z "$strip_cmd" && strip_cmd="strip"
[ -z "$strip_cmd" ] && strip_cmd="strip"
for p in $strip_cmd xargs find; do
if ! type -P $p >/dev/null; then
@@ -1811,7 +1841,7 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
dinfo "Stored kernel commandline:"
for conf in $initdir/etc/cmdline.d/*.conf ; do
[ -e "$conf" ] || continue
dinfo "$(< $conf)"
dinfo "$(< "$conf")"
_stored_cmdline=1
done
fi
@@ -1822,23 +1852,8 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Install squash loader ***"
if ! check_kernel_config CONFIG_SQUASHFS; then
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
exit 1
fi
if ! check_kernel_config CONFIG_OVERLAY_FS; then
dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
exit 1
fi
if ! check_kernel_config CONFIG_DEVTMPFS; then
dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
exit 1
fi
readonly squash_dir="$initdir/squash/root"
readonly squash_img=$initdir/squash/root.img
# Currently only move "usr" "etc" to squashdir
readonly squash_img="$initdir/squash/root.img"
readonly squash_candidate=( "usr" "etc" )
mkdir -m 0755 -p $squash_dir
@@ -1849,57 +1864,15 @@ if dracut_module_included "squash"; then
# Move some files out side of the squash image, including:
# - Files required to boot and mount the squashfs image
# - Files need to be accessible without mounting the squash image
required_in_root() {
local file=$1
local _sqsh_file=$squash_dir/$file
local _init_file=$initdir/$file
if [[ -e $_init_file ]]; then
return
fi
if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
derror "$file is required to boot a squashed initramfs but it's not installed!"
return
fi
if [[ ! -d $(dirname $_init_file) ]]; then
required_in_root $(dirname $file)
fi
if [[ -L $_sqsh_file ]]; then
cp --preserve=all -P $_sqsh_file $_init_file
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
# Relative symlink
required_in_root ${_sqsh_file#$squash_dir/}
return
fi
if [[ -e $squash_dir$_sqsh_file ]]; then
# Absolute symlink
required_in_root ${_sqsh_file#/}
return
fi
required_in_root ${module_spec#$squash_dir/}
else
if [[ -d $_sqsh_file ]]; then
mkdir $_init_file
else
mv $_sqsh_file $_init_file
fi
fi
}
required_in_root etc/initrd-release
for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
# - Initramfs marker
for file in \
$squash_dir/usr/lib/modules/*/modules.* \
$squash_dir/usr/lib/dracut/* \
$squash_dir/etc/initrd-release
do
required_in_root ${module_spec#$squash_dir/}
done
for dracut_spec in $squash_dir/usr/lib/dracut/*;
do
required_in_root ${dracut_spec#$squash_dir/}
[[ -d $file ]] && continue
DRACUT_RESOLVE_DEPS=1 dracutsysrootdir=$squash_dir inst ${file#$squash_dir}
rm $file
done
mv $initdir/init $initdir/init.stock
@@ -1910,17 +1883,14 @@ if dracut_module_included "squash"; then
# accessible before mounting the image.
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir"
hostonly="" instmods "loop" "squashfs" "overlay"
# Only keep systemctl outsite if we need switch root
if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
inst "systemctl"
fi
# Remove duplicated files
for folder in "${squash_candidate[@]}"; do
# Remove duplicated files in squashfs image, save some more space
[[ ! -d $initdir/$folder/ ]] && continue
for file in $(find $initdir/$folder/ -not -type d);
do
for file in $(find $initdir/$folder/ -not -type d); do
if [[ -e $squash_dir${file#$initdir} ]]; then
mv $squash_dir${file#$initdir} $file
fi
@@ -1928,6 +1898,28 @@ if dracut_module_included "squash"; then
done
fi
if [[ $kernel_only != yes ]]; then
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
for _dir in $libdirs; do
for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
[[ -e "$_f" ]] || continue
inst_libdir_file "libgcc_s.so*"
break 2
done
done
# FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
if [[ $DRACUT_FIPS_MODE ]]; then
for _dir in $libdirs; do
for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
[[ -e "$_f" ]] || continue
inst_libdir_file -o "libssl.so*"
break 2
done
done
fi
fi
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \
@@ -2018,10 +2010,10 @@ umask 077
if [[ $uefi = yes ]]; then
if [[ $kernel_cmdline ]]; then
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
elif [[ $hostonly_cmdline = yes ]] && [ -d $initdir/etc/cmdline.d ];then
for conf in $initdir/etc/cmdline.d/*.conf ; do
elif [[ $hostonly_cmdline = yes ]] && [ -d "$initdir/etc/cmdline.d" ];then
for conf in "$initdir"/etc/cmdline.d/*.conf ; do
[ -e "$conf" ] || continue
printf "%s " "$(< $conf)" >> "$uefi_outdir/cmdline.txt"
printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt"
done
else
do_print_cmdline > "$uefi_outdir/cmdline.txt"
@@ -2034,7 +2026,7 @@ if [[ $uefi = yes ]]; then
[[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
[[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
[[ -s "${dracutsysrootdir}${uefi_splash_image}" ]] && \
uefi_splash_image="${dracutsysroot}${uefi_splash_image}" || unset uefi_splash_image
uefi_splash_image="${dracutsysrootdir}${uefi_splash_image}" || unset uefi_splash_image
if objcopy \
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
@@ -2075,20 +2067,54 @@ fi
command -v restorecon &>/dev/null && restorecon -- "$outfile"
btrfs_uuid() {
btrfs filesystem show "$1" | sed -n '1s/^.*uuid: //p'
}
freeze_ok_for_btrfs() {
local mnt uuid1 uuid2
# If the output file is on btrfs, we need to make sure that it's
# not on a subvolume of the same file system as the root FS.
# Otherwise, fsfreeze() might freeze the entire system.
# This is most conveniently checked by comparing the FS uuid.
[[ "$(stat -f -c %T -- "/")" == "btrfs" ]] || return 0
mnt=$(stat -c %m -- "$1")
uuid1=$(btrfs_uuid "$mnt")
uuid2=$(btrfs_uuid "/")
[[ "$uuid1" && "$uuid2" && "$uuid1" != "$uuid2" ]]
}
freeze_ok_for_fstype() {
local outfile=$1
local fstype
[[ "$(stat -c %m -- "$outfile")" == "/" ]] && return 1
fstype=$(stat -f -c %T -- "$outfile")
case $fstype in
msdos)
return 1;;
btrfs)
freeze_ok_for_btrfs "$outfile";;
*)
return 0;;
esac
}
# We sync/fsfreeze only if we're operating on a live booted system.
# It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
if test -d $dracutsysrootdir/run/systemd/system; then
if [ -d "$dracutsysrootdir/run/systemd/system" ]; then
if ! sync "$outfile" 2> /dev/null; then
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
exit 1
fi
# use fsfreeze only if we're not writing to /
if [[ "$(stat -c %m -- "$outfile")" != "/" && "$(stat -f -c %T -- "$outfile")" != "msdos" ]]; then
if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then
if [[ "$(stat -c %m -- "$outfile")" != "/" ]] && freeze_ok_for_fstype "$outfile"; then
if ! (fsfreeze -f "$(dirname "$outfile")" 2>/dev/null && fsfreeze -u "$(dirname "$outfile")" 2>/dev/null); then
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
fi
fi

View File

@@ -77,6 +77,7 @@ Requires: xz
Requires: gzip
%if 0%{?fedora} || 0%{?rhel}
Recommends: memstrack
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
@@ -98,7 +99,7 @@ Requires: libkcapi-hmaccalc
%description
dracut contains tools to create bootable initramfses for the Linux
kernel. Unlike previous implementations, dracut hard-codes as little
kernel. Unlike other implementations, dracut hard-codes as little
as possible into the initramfs. dracut contains various modules which
are driven by the event-based udev. Having root on MD, DM, LVM2, LUKS
is supported as well as NFS, iSCSI, NBD, FCoE with the dracut-network
@@ -202,11 +203,10 @@ cp %{SOURCE1} .
%endif
${NULL}
make %{?_smp_mflags}
%make_build
%install
make %{?_smp_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
%make_install %{?_smp_mflags} \
libdir=%{_prefix}/lib
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
@@ -278,12 +278,6 @@ rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel}
# FIXME: remove after F30
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%files
%if %{with doc}
%doc README.md HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
@@ -348,7 +342,9 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/04watchdog-modules
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/06dbus
%{dracutlibdir}/modules.d/06rngd
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
@@ -365,7 +361,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90stratis
%{dracutlibdir}/modules.d/90nvdimm
%{dracutlibdir}/modules.d/90ppcmac
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
@@ -373,6 +369,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95lunmask
%{dracutlibdir}/modules.d/95nvmf
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95terminfo
@@ -403,6 +400,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99memstrack
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99shutdown
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
@@ -431,6 +429,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/02systemd-networkd
%{dracutlibdir}/modules.d/35network-manager
%{dracutlibdir}/modules.d/35network-legacy
%{dracutlibdir}/modules.d/35network-wicked
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/90kernel-network-modules
@@ -475,9 +474,5 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%files config-rescue
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%if 0%{?fedora} || 0%{?rhel}
# FIXME: remove after F30
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%changelog

View File

@@ -27,6 +27,7 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <glob.h>
#include <libgen.h>
#include <limits.h>
#include <stdbool.h>
@@ -123,6 +124,7 @@ static inline void fts_closep(FTS **p) {
}
#define _cleanup_fts_close_ _cleanup_(fts_closep)
#define _cleanup_globfree_ _cleanup_(globfree)
static size_t dir_len(char const *file)
@@ -569,6 +571,9 @@ static int resolve_deps(const char *src)
if (strstr(buf, "cannot read header"))
break;
if (strstr(buf, "cannot be preloaded"))
break;
if (strstr(buf, destrootdir))
break;
@@ -807,8 +812,7 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
log_debug("'%s' already exists", fulldstpath);
/* dst does already exist */
return ret;
}
} else {
/* check destination directory */
fulldstdir = strdup(fulldstpath);
@@ -925,6 +929,7 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
log_info("cp '%s' '%s'", fullsrcpath, fulldstpath);
ret += cp(fullsrcpath, fulldstpath);
}
}
if (ret == 0) {
i = strdup(dst);
@@ -1325,8 +1330,33 @@ static int install_all(int argc, char **argv)
return r;
}
static int install_firmware(struct kmod_module *mod)
static int install_firmware_fullpath(const char *fwpath)
{
const char *fw;
_cleanup_free_ char *fwpath_xz = NULL;
fw = fwpath;
struct stat sb;
int ret, r;
if (stat(fwpath, &sb) != 0) {
r = asprintf(&fwpath_xz, "%s.xz", fwpath);
if (r < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
if (stat(fwpath_xz, &sb) != 0) {
log_debug("stat(%s) != 0", fwpath);
return 1;
}
fw = fwpath_xz;
}
ret = dracut_install(fw, fw, false, false, true);
if (ret == 0) {
log_debug("dracut_install '%s' OK", fwpath);
}
return ret;
}
static int install_firmware(struct kmod_module *mod) {
struct kmod_list *l;
_cleanup_kmod_module_info_free_list_ struct kmod_list *list = NULL;
int ret;
@@ -1351,8 +1381,6 @@ static int install_firmware(struct kmod_module *mod)
ret = -1;
STRV_FOREACH(q, firmwaredirs) {
_cleanup_free_ char *fwpath = NULL;
_cleanup_free_ char *fwpath_xz = NULL;
const char *fw;
struct stat sb;
int r;
@@ -1362,29 +1390,24 @@ static int install_firmware(struct kmod_module *mod)
exit(EXIT_FAILURE);
}
fw = fwpath;
if (stat(fwpath, &sb) != 0) {
r = asprintf(&fwpath_xz, "%s.xz", fwpath);
if (r < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
if (stat(fwpath_xz, &sb) != 0) {
log_debug("stat(%s) != 0", fwpath);
continue;
}
fw = fwpath_xz;
}
ret = dracut_install(fw, fw, false, false, true);
if (ret == 0)
log_debug("dracut_install '%s' OK", fwpath);
}
if ((strstr(value, "*") != 0 || strstr(value, "?") != 0 || strstr(value, "[") != 0) && stat(fwpath, &sb) != 0) {
int i;
_cleanup_globfree_ glob_t globbuf;
glob(fwpath, 0, NULL, &globbuf);
for (i = 0; i < globbuf.gl_pathc; i++) {
install_firmware_fullpath(globbuf.gl_pathv[i]);
if (ret != 0) {
log_info("Possible missing firmware %s for kernel module %s", value, kmod_module_get_name(mod));
}
}
} else {
install_firmware_fullpath(fwpath);
if (ret != 0) {
log_info("Possible missing firmware %s for kernel module %s", value, kmod_module_get_name(mod));
}
}
}
}
return 0;
}
@@ -1482,8 +1505,12 @@ static int install_dependent_modules(struct kmod_list *modlist)
ret = install_dependent_modules(modlist);
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
if (ret == 0)
if (ret == 0) {
int r;
ret = install_dependent_modules(modpre);
r = install_dependent_modules(modpost);
ret = ret ? : r;
}
}
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
@@ -1545,8 +1572,12 @@ static int install_module(struct kmod_module *mod)
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
if (ret == 0)
if (ret == 0) {
int r;
ret = install_dependent_modules(modpre);
r = install_dependent_modules(modpost);
ret = ret ? : r;
}
}
return ret;

View File

@@ -206,7 +206,7 @@ if [ "$bin" = "MZ" ]; then
fi
if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
if [ -n $uefi ]; then
if [ -n "$uefi" ]; then
echo -n "initrd in UEFI: $uefi: "
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
if [ -f "$TMPDIR/osrel.txt" ]; then

View File

@@ -57,10 +57,10 @@ default_kernel_images() {
s390|s390x)
regex='image'
;;
ppc|ppc64)
ppc*)
regex='vmlinux'
;;
i386|x86_64)
i?86|x86_64)
regex='vmlinuz'
;;
arm*)

View File

@@ -171,7 +171,7 @@ default_kernel_images() {
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
i?86|x86_64)
regex='vmlinuz'
;;
arm*)

View File

@@ -65,6 +65,8 @@ install() {
$systemdutildir/system-generators/systemd-gpt-auto-generator \
\
$systemdsystemunitdir/cryptsetup.target \
$systemdsystemunitdir/cryptsetup-pre.target \
$systemdsystemunitdir/remote-cryptsetup.target \
$systemdsystemunitdir/emergency.target \
$systemdsystemunitdir/sysinit.target \
$systemdsystemunitdir/basic.target \
@@ -241,6 +243,7 @@ install() {
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service \
; do
[[ -f $systemdsystemunitdir/$i ]] || continue
systemctl -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
done

View File

@@ -1,5 +1,17 @@
#!/bin/sh
# systemd lets stdout go to journal only, but the system
# has to halt when the integrity check fails to satisfy FIPS.
if [ -z "$DRACUT_SYSTEMD" ]; then
fips_info() {
info "$*"
}
else
fips_info() {
echo "$*" >&2
}
fi
mount_boot()
{
boot=$(getarg boot=)
@@ -45,7 +57,7 @@ mount_boot()
[ -e "$boot" ] || return 1
mkdir /boot
info "Mounting $boot as /boot"
fips_info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
elif [ -d "$NEWROOT/boot" ]; then
rm -fr -- /boot
@@ -65,19 +77,27 @@ do_rhevh_check()
warn "HMAC sum mismatch"
return 1
fi
info "rhevh_check OK"
fips_info "rhevh_check OK"
return 0
}
nonfatal_modprobe()
{
modprobe $1 2>&1 > /dev/stdout |
while read -r line || [ -n "$line" ]; do
echo "${line#modprobe: FATAL: }" >&2
done
}
fips_load_crypto()
{
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
fips_info "Loading and integrity checking all crypto modules"
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
if ! nonfatal_modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
# check if kernel provides generic algo
_found=0
while read _k _s _v || [ -n "$_k" ]; do
@@ -92,7 +112,7 @@ fips_load_crypto()
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
info "Self testing crypto algorithms"
fips_info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt
}
@@ -106,7 +126,7 @@ do_fips()
KERNEL=$(uname -r)
info "Checking integrity of kernel"
fips_info "Checking integrity of kernel"
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
@@ -145,7 +165,7 @@ do_fips()
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
fi
info "All initrd crypto checks done"
fips_info "All initrd crypto checks done"
> /tmp/fipsdone

View File

@@ -0,0 +1,38 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
return 0
}
installkernel() {
local -A _drivers
local _alldrivers _wdtdrv _wdtppath _dir
for _wd in /sys/class/watchdog/*; do
! [ -e $_wd ] && continue
_wdtdrv=$(get_dev_module $_wd)
if [[ $_wdtdrv ]]; then
instmods $_wdtdrv
for i in $_wdtdrv; do
_drivers[$i]=1
done
fi
done
# ensure that watchdog module is loaded as early as possible
_alldrivers="${!_drivers[*]}"
[[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf
return 0
}

View File

@@ -7,7 +7,7 @@ check() {
# called by dracut
depends() {
return 0
return "watchdog-modules"
}
# called by dracut
@@ -27,53 +27,7 @@ install() {
inst_hook cleanup 00 "$moddir/watchdog.sh"
inst_hook cleanup 99 "$moddir/watchdog.sh"
fi
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
inst_multiple -o wdctl
}
installkernel() {
local -A _drivers
local _alldrivers _active _wdtdrv _wdtppath _dir
[[ -d /sys/class/watchdog/ ]] || return
for _dir in /sys/class/watchdog/*; do
[[ -d "$_dir" ]] || continue
[[ -f "$_dir/state" ]] || continue
_active=$(< "$_dir/state")
! [[ $hostonly ]] || [[ "$_active" = "active" ]] || continue
# device/modalias will return driver of this device
_wdtdrv=$(< "$_dir/device/modalias")
# There can be more than one module represented by same
# modalias. Currently load all of them.
# TODO: Need to find a way to avoid any unwanted module
# represented by modalias
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
if [[ $_wdtdrv ]]; then
instmods $_wdtdrv
for i in $_wdtdrv; do
_drivers[$i]=1
done
fi
# however in some cases, we also need to check that if there is
# a specific driver for the parent bus/device. In such cases
# we also need to enable driver for parent bus/device.
_wdtppath=$(readlink -f "$_dir/device")
while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do
_wdtppath=$(readlink -f "$_wdtppath/..")
[[ -f "$_wdtppath/modalias" ]] || continue
_wdtdrv=$(< "$_wdtppath/modalias")
_wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null)
if [[ $_wdtdrv ]]; then
instmods $_wdtdrv
for i in $_wdtdrv; do
_drivers[$i]=1
done
fi
done
done
# ensure that watchdog module is loaded as early as possible
_alldrivers="${!_drivers[*]}"
[[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf
return 0
}

View File

@@ -14,15 +14,16 @@ depends() {
# called by dracut
install() {
local _i _progs _path _busybox
local _i _path _busybox
local _progs=()
_busybox=$(type -P busybox)
inst $_busybox /usr/bin/busybox
for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
do
_progs="$_progs $_i"
for _i in $($_busybox --list); do
[[ ${_i} == busybox ]] && continue
_progs+=("${_i}")
done
for _i in $_progs; do
for _i in "${_progs[@]}"; do
_path=$(find_binary "$_i")
[ -z "$_path" ] && continue
ln_r /usr/bin/busybox $_path

View File

@@ -0,0 +1,70 @@
#!/bin/bash
# called by dracut
check() {
require_binaries dbus-daemon || return 1
return 255
}
depends() {
echo systemd
return 0
}
adjust_dependencies() {
sed -i -e \
'/^\[Unit\]/aDefaultDependencies=no\
Conflicts=shutdown.target\
Before=shutdown.target' \
"$initdir"${1}
}
install() {
inst_multiple \
$systemdsystemunitdir/dbus.service \
$systemdsystemunitdir/dbus.socket \
/usr/bin/dbus-send \
/usr/bin/busctl
adjust_dependencies $systemdsystemunitdir/dbus.service
if [[ -e /usr/bin/dbus-daemon ]]; then
inst_multiple \
/usr/bin/dbus-daemon
fi
if [[ -e /usr/bin/dbus-broker ]]; then
inst_multiple \
$systemdsystemunitdir/dbus-broker.service \
/usr/bin/dbus-broker \
/usr/bin/dbus-broker-launch
adjust_dependencies $systemdsystemunitdir/dbus-broker.service
fi
inst_dir /etc/dbus-1/system.d
inst_dir /usr/share/dbus-1/services
inst_dir /usr/share/dbus-1/system-services
inst_multiple /etc/dbus-1/system.conf
inst_multiple /usr/share/dbus-1/system.conf \
/usr/share/dbus-1/services/org.freedesktop.systemd1.service
inst_multiple $(find /var/lib/dbus)
grep '^\(d\|message\)bus:' /etc/passwd >> "$initdir/etc/passwd"
grep '^\(d\|message\)bus:' /etc/group >> "$initdir/etc/group"
sed -i -e \
'/^\[Unit\]/aDefaultDependencies=no\
Conflicts=shutdown.target\
Before=shutdown.target
/^\[Socket\]/aRemoveOnStop=yes' \
"$initdir"/usr/lib/systemd/system/dbus.socket
#We need to make sure that systemd-tmpfiles-setup.service->dbus.socket will not wait local-fs.target to start,
#If swap is encrypted, this would make dbus wait the timeout for the swap before loading. This could delay sysinit
#services that are dependent on dbus.service.
sed -i -Ee \
'/^After/s/(After[[:space:]]*=.*)(local-fs.target[[:space:]]*)(.*)/\1-\.mount \3/' \
"$initdir"/usr/lib/systemd/system/systemd-tmpfiles-setup.service
}

View File

@@ -33,6 +33,8 @@ check() {
install() {
inst rngd
inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
# make sure dependant libs are installed too
inst_libdir_file opensc-pkcs11.so
systemctl -q --root "$initdir" add-wants sysinit.target rngd.service
}

View File

@@ -2,6 +2,7 @@
Description=Hardware RNG Entropy Gatherer Daemon
DefaultDependencies=no
Before=systemd-udevd.service
ConditionVirtualization=!container
[Service]
ExecStart=/usr/sbin/rngd -f

View File

@@ -230,9 +230,7 @@ install() {
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
fi
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${VCONFIG_CONF} ]]; then
inst_simple ${VCONFIG_CONF}
else
if ! dracut_module_included "systemd"; then
mksubdirs ${initdir}${VCONFIG_CONF}
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
fi
@@ -263,6 +261,11 @@ install() {
if checks; then
install_base
# https://github.com/dracutdevs/dracut/issues/796
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${VCONFIG_CONF} ]]; then
inst_simple ${VCONFIG_CONF}
fi
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
install_local_i18n || install_all_kbd
else

View File

@@ -164,7 +164,7 @@ case $reason in
;;
BOUND)
echo "dhcp: BOND setting $netif"
echo "dhcp: BOUND setting up $netif"
unset layer2
if [ -f /sys/class/net/$netif/device/layer2 ]; then
read layer2 < /sys/class/net/$netif/device/layer2
@@ -223,7 +223,7 @@ case $reason in
;;
BOUND6)
echo "dhcp: BOND6 setting $netif"
echo "dhcp: BOUND6 setting up $netif"
setup_interface6
set | while read line || [ -n "$line" ]; do

View File

@@ -376,23 +376,6 @@ else
fi
# No ip lines default to dhcp
ip=$(getarg ip)
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6
else
do_dhcp -4
fi
for s in $(getargs nameserver); do
[ -n "$s" ] || continue
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
fi
# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
@@ -473,19 +456,37 @@ done
# no ip option directed at our interface?
if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
ret=1
if [ -e /tmp/net.bootdev ]; then
BOOTDEV=$(cat /tmp/net.bootdev)
if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then
load_ipv6
do_dhcp
ret=$?
fi
else
if getargs 'ip=dhcp6'; then
# No ip lines, no bootdev -> default to dhcp
ip=$(getarg ip)
if getargs 'ip=dhcp6' || [ -z "$ip" -a "$netroot" = "dhcp6" ]; then
load_ipv6
do_dhcp -6
ret=$?
fi
if getargs 'ip=dhcp'; then
if getargs 'ip=dhcp' || [ -z "$ip" -a "$netroot" != "dhcp6" ]; then
do_dhcp -4
ret=$?
fi
fi
for s in $(getargs nameserver); do
[ -n "$s" ] || continue
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
if [ "$ret" -eq 0 ] && [ -n "$(ls /tmp/leaseinfo.${netif}*)" ]; then
> /tmp/net.${netif}.did-setup
if [ -e /sys/class/net/${netif}/address ]; then
> /tmp/net.$(cat /sys/class/net/${netif}/address).did-setup
fi
fi
fi

View File

@@ -1,9 +1,12 @@
#!/bin/sh
#
# Format:
# team=<teammaster>:<teamslaves>
# team=<teammaster>:<teamslaves>[:<teamrunner>]
#
# teamslaves is a comma-separated list of physical (ethernet) interfaces
# teamrunner is the runner type to be used (see teamd.conf(5)); defaults to activebackup
#
# team without parameters assumes team=team0:eth0,eth1:activebackup
#
parseteam() {
@@ -15,8 +18,11 @@ parseteam() {
done
case $# in
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
*) die "team= requires two parameters" ;;
0) teammaster=team0; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
1) teammaster=$1; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner="activebackup" ;;
3) teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner=$3 ;;
*) die "team= requires zero to three parameters" ;;
esac
return 0
}
@@ -26,16 +32,18 @@ for team in $(getargs team); do
unset teammaster
unset teamslaves
unset teamrunner
parseteam "$team" || continue
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
echo "teamrunner=\"$teamrunner\"" >> /tmp/team.${teammaster}.info
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using $teamrunner."
mkdir -p /etc/teamd
printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf"
fi
done

View File

@@ -37,6 +37,7 @@ install() {
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
inst_rules 85-nm-unmanaged.rules
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh"
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
inst /usr/libexec/nm-dhcp-helper
@@ -47,8 +48,11 @@ install() {
fi
# We don't install the ifcfg files from the host automatically.
# But if the user chooses to include them, we pull in the machinery to read them.
if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
# But the user might choose to include them, so we pull in the machinery to read them.
inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
fi
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
}

View File

@@ -1,7 +1,9 @@
#!/bin/sh
type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
fi
/usr/libexec/nm-initrd-generator -- $(getcmdline)
nm_generate_connections

View File

@@ -0,0 +1,20 @@
#!/bin/bash
type getcmdline >/dev/null 2>&1 || . /lib/dracut-lib.sh
nm_generate_connections()
{
rm -f /run/NetworkManager/system-connections/*
/usr/libexec/nm-initrd-generator -- $(getcmdline)
if getargbool 0 rd.neednet; then
for i in /usr/lib/NetworkManager/system-connections/* \
/run/NetworkManager/system-connections/* \
/etc/NetworkManager/system-connections/* \
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
break
done
fi
}

View File

@@ -10,6 +10,10 @@ for i in /usr/lib/NetworkManager/system-connections/* \
else
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
fi
if [ -s /run/NetworkManager/initrd/hostname ]; then
cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname
fi
break
done
@@ -22,3 +26,5 @@ do
source_hook initqueue/online $ifname
/sbin/netroot $ifname
done
> /tmp/nm.done

View File

@@ -0,0 +1,66 @@
#!/bin/bash
# called by dracut
check() {
local _program
require_binaries wicked || return 1
# do not add this module by default
return 255
}
# called by dracut
depends() {
echo systemd dbus
return 0
}
# called by dracut
installkernel() {
return 0
}
# called by dracut
install() {
inst_hook cmdline 99 "$moddir/wicked-config.sh"
# Seems to not execute if in initqueue/settled
inst_hook pre-udev 99 "$moddir/wicked-run.sh"
# even with wicked configuring the interface, ip is useful
inst_multiple ip
inst_dir /etc/wicked/extensions
inst_dir /usr/share/wicked/schema
inst_dir /usr/lib/wicked/bin
inst_dir /var/lib/wicked
inst_multiple /etc/wicked/*.xml
inst_multiple /etc/wicked/extensions/*
inst_multiple /etc/dbus-1/system.d/org.opensuse.Network*
inst_multiple /usr/share/wicked/schema/*
inst_multiple /usr/lib/wicked/bin/*
inst_multiple /usr/libexec/wicked/bin/*
inst_multiple /usr/sbin/wicked*
wicked_units="
$systemdsystemunitdir/wickedd.service \
$systemdsystemunitdir/wickedd-auto4.service \
$systemdsystemunitdir/wickedd-dhcp4.service \
$systemdsystemunitdir/wickedd-dhcp6.service \
$systemdsystemunitdir/wickedd-nanny.service"
inst_multiple $wicked_units
for unit in $wicked_units; do
sed -i 's/^After=.*/After=dbus.service/g' $initdir/$unit
sed -i 's/^Before=\(.*\)/Before=\1 dracut-pre-udev.service/g' $initdir/$unit
sed -i 's/^Wants=\(.*\)/Wants=\1 dbus.service/g' $initdir/$unit
sed -i -e \
'/^\[Unit\]/aDefaultDependencies=no\
Conflicts=shutdown.target\
Before=shutdown.target' \
"$initdir"$unit
done
}

View File

@@ -0,0 +1,5 @@
#!/bin/sh
getcmdline > /tmp/cmdline.$$.conf
wicked show-config --ifconfig dracut:cmdline:/tmp/cmdline.$$.conf > /tmp/dracut.xml
rm -f /tmp/cmdline.$$.conf

View File

@@ -0,0 +1,6 @@
#!/bin/sh
# ensure wickedd is running
systemctl start wickedd
# detection wrapper around ifup --ifconfig "final xml" all
wicked bootstrap --ifconfig /tmp/dracut.xml all

View File

@@ -7,12 +7,25 @@ check() {
# called by dracut
depends() {
echo -n "kernel-network-modules "
if ! dracut_module_included "network-legacy" && [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ] ; then
echo "network-manager"
else
echo "network-legacy"
is_qemu_virtualized && echo -n "qemu-net "
for module in network-wicked network-manager network-legacy ; do
if dracut_module_included "$module" ; then
network_handler="$module"
break
fi
done;
if [ -z "$network_handler" ]; then
if require_binaries wicked; then
network_handler="network-wicked"
elif [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ]; then
network_handler="network-manager"
else
network_handler="network-legacy"
fi
fi
echo "kernel-network-modules $network_handler"
return 0
}

View File

@@ -510,7 +510,7 @@ ip_to_var() {
[ -n "$6" ] && dev=$6
[ -n "$7" ] && autoconf=$7
case "$8" in
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
[0-9a-fA-F]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
dns1="$8"
[ -n "$9" ] && dns2="$9"
;;
@@ -570,6 +570,11 @@ parse_ifname_opts() {
# udev requires MAC addresses to be lower case
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
;;
21)
ifname_if=$1
# udev requires MAC addresses to be lower case
ifname_mac=$(echo $2:$3:$4:$5:$6:$7:$8:$9:${10}:${11}:${12}:${13}:${14}:${15}:${16}:${17}:${18}:${19}:${20}:${21} | sed 'y/ABCDEF/abcdef/')
;;
*)
die "Invalid arguments for ifname="
;;

View File

@@ -19,11 +19,13 @@ install() {
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
inst_multiple -o ctorrent
inst_multiple curl
if curl --version | grep -qi '\bNSS\b'; then
# also install libs for curl https
inst_libdir_file "libnsspem.so*"
inst_libdir_file "libnsssysinit.so*"
inst_libdir_file "libsoftokn3.so*"
inst_libdir_file "libsqlite3.so*"
fi
for _dir in $libdirs; do
[[ -d $dracutsysrootdir$_dir ]] || continue

View File

@@ -31,15 +31,15 @@ installkernel() {
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
# loading of the driver if needed
if [[ $hostonly ]]; then
for i in /sys/bus/{pci/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
[[ -e $i ]] || continue
if hostonly="" dracut_instmods --silent -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i); then
if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then
if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(<"$i"); then
if strstr "$(modinfo -F filename $(<"$i") 2>/dev/null)" radeon.ko; then
hostonly='' instmods amdkfd
fi
fi
done
else
dracut_instmods -o -s "drm_crtc_init|drm_dev_register" "=drivers/gpu/drm" "=drivers/staging"
dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging"
fi
}

View File

@@ -35,4 +35,9 @@ fi
IFACES="$IFACES $DEVICE"
echo "$IFACES" >> /tmp/net.ifaces
exec ifup "$DEVICE"
if [ -x /usr/libexec/nm-initrd-generator ]; then
type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
nm_generate_connections
else
exec ifup "$DEVICE"
fi

View File

@@ -26,8 +26,6 @@ depends() {
# called by dracut
installkernel() {
instmods btrfs
# Make sure btfs can use fast crc32c implementations where available (bsc#1011554)
instmods crc32c-intel
}
# called by dracut
@@ -48,5 +46,7 @@ install() {
inst_multiple -o btrfsck btrfs-zero-log
inst $(command -v btrfs) /sbin/btrfs
# Hack for slow machines
# see https://github.com/dracutdevs/dracut/issues/658
echo "rd.driver.pre=btrfs" > ${initdir}/etc/cmdline.d/00-btrfs.conf
}

View File

@@ -8,7 +8,7 @@ NEWROOT=${NEWROOT:-"/sysroot"}
. /lib/dracut-lib.sh
mkdir -m 0700 /run/cryptsetup
mkdir -p -m 0700 /run/cryptsetup
# if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then
@@ -20,8 +20,11 @@ fi
# default luksname - luks-UUID
luksname=$2
# is_keysource - ask for passphrase even if a rd.luks.key argument is set
is_keysource=${3:-0}
# number of tries
numtries=${3:-10}
numtries=${4:-10}
# TODO: improve to support what cmdline does
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; then
@@ -134,9 +137,12 @@ unset allowdiscards
ask_passphrase=1
if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
if cryptsetup --key-file "$luksfile" $cryptsetupopts luksOpen "$device" "$luksname"; then
if readkey "$luksfile" / "$device" \
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"; then
ask_passphrase=0
fi
elif [ "$is_keysource" -ne 0 ]; then
info "Asking for passphrase because $device is a keysource."
else
while [ -n "$(getarg rd.luks.key)" ]; do
if tmp=$(getkey /tmp/luks.keys $device); then
@@ -151,7 +157,7 @@ else
info "No key found for $device. Will try $numtries time(s) more later."
initqueue --unique --onetime --settled \
--name cryptroot-ask-$luksname \
$(command -v cryptroot-ask) "$device" "$luksname" "$(($numtries-1))"
$(command -v cryptroot-ask) "$device" "$luksname" "$is_keysource" "$(($numtries-1))"
exit 0
fi
unset tmp
@@ -178,6 +184,15 @@ if [ $ask_passphrase -ne 0 ]; then
unset _timeout
fi
if [ "$is_keysource" -ne 0 -a ${luksname##luks-} != "$luksname" ]; then
luks_close="$(command -v cryptsetup) close"
{
printf -- '[ -e /dev/mapper/%s ] && ' "$luksname"
printf -- '%s "%s"\n' "$luks_close" "$luksname"
} >> "$hookdir/cleanup/31-crypt-keysource.sh"
unset luks_close
fi
unset device luksname luksfile
# mark device as asked

View File

@@ -25,11 +25,32 @@ depends() {
# called by dracut
installkernel() {
hostonly="" instmods drbg
arch=$(uname -m)
[[ $arch == x86_64 ]] && arch=x86
[[ $arch == s390x ]] && arch=s390
[[ $arch == aarch64 ]] && arch=arm64
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
instmods dm_crypt
# in case some of the crypto modules moved from compiled in
# to module based, try to install those modules
# best guess
[[ $hostonly ]] || [[ $mount_needs ]] && {
# dmsetup returns s.th. like
# cryptvol: 0 2064384 crypt aes-xts-plain64 :64:logon:cryptsetup:....
dmsetup table | while read name _ _ is_crypt cipher _; do
[[ $is_crypt != "crypt" ]] && continue
# get the device name
name=/dev/$(dmsetup info -c --noheadings -o blkdevname ${name%:})
# check if the device exists as a key in our host_fs_types
if [[ ${host_fs_types[$name]+_} ]]; then
# split the cipher aes-xts-plain64 in pieces
_OLD_IFS=$IFS
IFS='-:'
set -- $cipher
IFS=$_OLD_IFS
# try to load the cipher part with "crypto-" prepended
# in non-hostonly mode
hostonly= instmods $(for k in "$@"; do echo "crypto-$k";done)
fi
done
}
return 0
}
# called by dracut
@@ -92,6 +113,7 @@ install() {
set -- ${luksoptions}
IFS="${OLD_IFS}"
forceentry=""
while [ $# -gt 0 ]; do
case $1 in
force)
@@ -122,6 +144,8 @@ install() {
inst_script "$moddir/crypt-run-generator.sh" "/sbin/crypt-run-generator"
if dracut_module_included "systemd"; then
# the cryptsetup targets are already pulled in by 00systemd, but not
# the enablement symlinks
inst_multiple -o \
$systemdutildir/system-generators/systemd-cryptsetup-generator \
$systemdutildir/systemd-cryptsetup \
@@ -129,6 +153,8 @@ install() {
$systemdsystemunitdir/systemd-ask-password-console.service \
$systemdsystemunitdir/cryptsetup.target \
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
$systemdsystemunitdir/remote-cryptsetup.target \
$systemdsystemunitdir/initrd-root-device.target.wants/remote-cryptsetup.target \
systemd-ask-password systemd-tty-ask-password-agent
fi

View File

@@ -49,6 +49,12 @@ else
if [ -n "$PARTUUID" ]; then
for uuid in $PARTUUID; do
is_keysource=0
_uuid=$uuid
uuid=${uuid#keysource:}
[ $uuid != $_uuid ] && is_keysource=1
unset _uuid
uuid=${uuid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$uuid="); then
luksname="${luksname#$uuid=}"
@@ -61,7 +67,7 @@ else
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$is_keysource" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
@@ -81,6 +87,12 @@ else
elif [ -n "$SERIAL" ]; then
for serialid in $SERIAL; do
is_keysource=0
_serialid=$serialid
serialid=${serialid#keysource:}
[ $serialid != $_serialid ] && is_keysource=1
unset _serialid
serialid=${serialid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$serialid="); then
luksname="${luksname#$serialid=}"
@@ -93,7 +105,7 @@ else
printf -- 'ENV{ID_SERIAL_SHORT}=="*%s*", ' "$serialid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$is_keysource" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
@@ -113,6 +125,12 @@ else
elif [ -n "$LUKS" ]; then
for luksid in $LUKS; do
is_keysource=0
_luksid=$luksid
luksid=${luksid#keysource:}
[ $luksid != $_luksid ] && is_keysource=1
unset _luksid
luksid=${luksid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$luksid="); then
luksname="${luksname#$luksid=}"
@@ -126,7 +144,7 @@ else
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
printf -- '$env{DEVNAME} %s %s %s"\n' "$luksname" "$is_keysource" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
@@ -143,15 +161,16 @@ else
fi
fi
if [ $is_keysource -eq 0 ]; then
uuid=$luksid
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
printf -- '[ -e /dev/disk/by-id/dm-uuid-CRYPT-LUKS?-*%s*-* ] || exit 1\n' $uuid \
>> "$hookdir/initqueue/finished/90-crypt.sh"
{
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
} >> "$hookdir/emergency/90-crypt.sh"
fi
done
elif getargbool 0 rd.auto; then
if [ -z "$DRACUT_SYSTEMD" ]; then

View File

@@ -268,20 +268,6 @@ do_live_overlay() {
}
# end do_live_overlay()
# we might have a genMinInstDelta delta file for anaconda to take advantage of
if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then
OSMINSQFS=/run/initramfs/live/${live_dir}/osmin.img
# decompress the delta data
dd if=$OSMINSQFS of=/run/initramfs/osmin.img 2> /dev/null
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
losetup -r $OSMIN_SQUASHED_LOOPDEV /run/initramfs/osmin.img
mkdir -m 0755 -p /run/initramfs/squashfs.osmin
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin
OSMIN_LOOPDEV=$( losetup -f )
losetup -r $OSMIN_LOOPDEV /run/initramfs/squashfs.osmin/osmin
umount -l /run/initramfs/squashfs.osmin
fi
# we might have an embedded fs image on squashfs (compressed live)
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
@@ -370,12 +356,6 @@ if [ -n "$FSIMG" ]; then
fi
fi
if [ -b "$OSMIN_LOOPDEV" ]; then
# set up the devicemapper snapshot device, which will merge
# the normal live fs image, and the delta, into a minimzied fs image
echo "0 $sz snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV P 8" | dmsetup create --readonly live-osimg-min
fi
if [ -n "$reloadsysrootmountunit" ]; then
eval "$reloadsysrootmountunit"
systemctl daemon-reload

View File

@@ -22,6 +22,7 @@ do_iso_scan() {
mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
if [ -f "/run/initramfs/isoscan/$isofile" ]; then
losetup -f "/run/initramfs/isoscan/$isofile"
ln -s $dev /run/initramfs/isoscandev
rm -f -- "$job"
exit 0
else

View File

@@ -3,6 +3,7 @@
# called by dracut
installkernel() {
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
local _hostonly_drvs
find_kernel_modules_external () {
local _OLDIFS
@@ -19,17 +20,24 @@ installkernel() {
IFS=$_OLDIFS
}
is_block_dev() {
[ -e /sys/dev/block/$1 ] && return 0
record_block_dev_drv() {
for _mod in $(get_dev_module /dev/block/$1); do
[[ " $_hostonly_drvs " != *$_mod* ]] && _hostonly_drvs+=" $_mod"
done
[[ "$_hostonly_drvs" ]] && return 0
return 1
}
install_block_modules_strict () {
hostonly='' instmods $_hostonly_drvs
}
install_block_modules () {
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix
instmods \
scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
=ide nvme vmd nfit \
virtio_blk
=drivers/usb/storage \
=ide nvme vmd \
virtio_blk virtio_scsi
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
}
@@ -41,7 +49,6 @@ installkernel() {
ohci-hcd ohci-pci \
uhci-hcd \
xhci-hcd xhci-pci xhci-plat-hcd \
"=drivers/pinctrl" \
${NULL}
hostonly=$(optional_hostonly) instmods \
@@ -49,15 +56,15 @@ installkernel() {
"=drivers/tty/serial" \
"=drivers/input/serio" \
"=drivers/input/keyboard" \
"=drivers/usb/storage" \
"=drivers/pci/host" \
"=drivers/pci/controller" \
"=drivers/pinctrl" \
${NULL}
instmods \
yenta_socket \
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
virtio virtio_ring virtio_pci virtio_scsi \
virtio virtio_ring virtio_pci pci_hyperv \
"=drivers/pcmcia"
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
@@ -65,9 +72,11 @@ installkernel() {
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
instmods \
"=drivers/clk" \
"=drivers/devfreq" \
"=drivers/dma" \
"=drivers/extcon" \
"=drivers/gpio" \
"=drivers/hwmon" \
"=drivers/hwspinlock" \
"=drivers/i2c/busses" \
"=drivers/mfd" \
@@ -91,9 +100,19 @@ installkernel() {
find_kernel_modules_external | instmods
if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then
# if not on hostonly mode, or there are hostonly block device
# install block drivers
if ! [[ $hostonly ]] || \
for_each_host_dev_and_slaves_all record_block_dev_drv;
then
hostonly='' instmods sg sr_mod sd_mod scsi_dh ata_piix
if [[ "$hostonly_mode" == "strict" ]]; then
install_block_modules_strict
else
install_block_modules
fi
fi
# if not on hostonly mode, install all known filesystems,
# if the required list is not set via the filesystems variable
@@ -104,6 +123,15 @@ installkernel() {
elif [[ "${host_fs_types[*]}" ]]; then
hostonly='' instmods "${host_fs_types[@]}"
fi
arch=${DRACUT_ARCH:-$(uname -m)}
# We don't want to play catch up with hash and encryption algorithms.
# To be safe, just use the hammer and include all crypto.
[[ $arch == x86_64 ]] && arch=x86
[[ $arch == s390x ]] && arch=s390
[[ $arch == aarch64 ]] && arch=arm64
instmods "=crypto" "=arch/$arch/crypto" "=drivers/crypto"
fi
:
}

View File

@@ -14,22 +14,33 @@ depends() {
installkernel() {
# Include wired net drivers, excluding wireless
local _arch=${DRACUT_ARCH:-$(uname -m)}
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
local _net_symbols='eth_type_trans|register_virtio_device|usbnet_open'
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
local _net_drivers
if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then
_s390drivers="=drivers/s390/net"
dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
fi
dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_drivers" "=drivers/net" ${_s390drivers:+"$_s390drivers"}
if [[ $hostonly_mode == 'strict' ]] && [[ $hostonly_nics ]]; then
for _nic in $hostonly_nics; do
_net_drivers=$(get_dev_module /sys/class/net/$_nic)
if ! [[ $_net_drivers ]]; then
derror "--hostonly-nics contains invalid NIC '$_nic'"
continue
fi
hostonly="" instmods $_net_drivers
done
return 0
fi
dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/net"
#instmods() will take care of hostonly
instmods \
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
}
# called by dracut

View File

@@ -91,7 +91,7 @@ export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
if [ -n "$SNAPSHOT" ] ; then
# HACK - this should probably be done elsewhere or turned into a function
# Enable read-write LVM locking
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' ${initdir}/etc/lvm/lvm.conf
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' /etc/lvm/lvm.conf
# Expected SNAPSHOT format "<orig lv name>:<snap lv name>"
ORIG_LV=${SNAPSHOT%%:*}

View File

@@ -36,7 +36,7 @@ cmdline() {
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
printf " rd.lvm.lv=%s " "${DM_VG_NAME}/${DM_LV_NAME} "
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
fi
done
@@ -101,7 +101,7 @@ install() {
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{SYSTEMD_WANTS}+\?=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
else
sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules

View File

@@ -83,11 +83,12 @@ install() {
dmsetup \
kpartx \
mpath_wait \
mpathconf \
mpathpersist \
multipath \
multipathd \
mpathpersist \
xdrgetuid \
xdrgetprio \
xdrgetuid \
/etc/xdrdevices.conf \
/etc/multipath.conf \
/etc/multipath/* \
@@ -109,7 +110,9 @@ install() {
fi
if dracut_module_included "systemd"; then
inst_simple "${moddir}/multipathd-configure.service" "${systemdsystemunitdir}/multipathd-configure.service"
inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
systemctl -q --root "$initdir" enable multipathd-configure.service
systemctl -q --root "$initdir" enable multipathd.service
else
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
@@ -122,6 +125,6 @@ install() {
inst_rules 40-multipath.rules 56-multipath.rules \
62-multipath.rules 65-multipath.rules \
66-kpartx.rules 67-kpartx-compat.rules \
11-dm-mpath.rules
11-dm-mpath.rules 11-dm-parts.rules
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
for i in $(multipath -l -v1); do
if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then

View File

@@ -0,0 +1,19 @@
[Unit]
Description=Device-Mapper Multipath Default Configuration
Before=iscsi.service iscsid.service lvm2-activation-early.service
Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target
After=systemd-udev-trigger.service systemd-udev-settle.service
Before=local-fs-pre.target multipathd.service
DefaultDependencies=no
Conflicts=shutdown.target
ConditionKernelCommandLine=rd.multipath=default
ConditionPathExists=!/etc/multipath.conf
[Service]
Type=oneshot
ExecStartPre=-/usr/bin/mkdir -p /etc/multipath/multipath.conf.d
ExecStart=/usr/sbin/mpathconf --enable
[Install]
WantedBy=sysinit.target

View File

@@ -1,5 +1,10 @@
#!/bin/sh
if [ "$(getarg rd.multipath)" = "default" ] && [ ! -e /etc/multipath.conf ]; then
mkdir -p /etc/multipath/multipath.conf.d
mpathconf --enable
fi
if getargbool 1 rd.multipath -d -n rd_NO_MULTIPATH && [ -e /etc/multipath.conf ]; then
modprobe dm-multipath
multipathd -B || multipathd

View File

@@ -0,0 +1,31 @@
#!/bin/bash
# called by dracut
check() {
if [[ ! $hostonly ]]; then
return 0
fi
[[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] && \
grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
# Directories to search for NVDIMM "providers" (firmware drivers)
# These modules call "nvdimm_bus_register()".
local _provider_dirs='=drivers/nvdimm =drivers/acpi =arch/powerpc'
#instmods() will take care of hostonly
dracut_instmods -o -s nvdimm_bus_register $_provider_dirs
}
# called by dracut
install() {
inst_multiple -o ndctl /etc/ndctl/keys/tpm.handle /etc/ndctl/keys/*.blob
}

View File

@@ -17,9 +17,9 @@
# called by dracut
check() {
local _arch="$(uname -m)"
local _arch=${DRACUT_ARCH:-$(uname -m)}
# only for PowerPC Macs
[[ "$_arch" == ppc* && "$_arch" != ppc*le ]] || return 1
[[ "$_arch" == ppc* && "$_arch" != ppc64le ]] || return 1
return 0
}
@@ -36,7 +36,7 @@ installkernel() {
}
# only PowerMac3,6 has a module, special case
if [[ "$(uname -m)" == ppc ]]; then
if [[ "${DRACUT_ARCH:-$(uname -m)}" != ppc64* ]]; then
if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then
instmods therm_windtunnel
fi

View File

@@ -2,15 +2,20 @@
# called by dracut
check() {
if [[ $hostonly ]] || [[ $mount_needs ]]; then
if [[ $hostonly ]]; then
return 255
fi
if [[ $mount_needs ]]; then
is_qemu_virtualized && return 0
return 255
fi
return 0
}
# called by dracut
installkernel() {
# qemu specific modules
hostonly='' instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci
hostonly=$(optional_hostonly) instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci
}

View File

@@ -1,33 +0,0 @@
#!/bin/bash
# called by dracut
check() {
require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1
return 255
}
# called by dracut
depends() {
echo dm
return 0
}
# called by dracut
installkernel() {
instmods xfs
}
# called by dracut
install() {
inst_multiple stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs
if dracut_module_included "systemd"; then
inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service"
systemctl -q --root "$initdir" enable stratisd-init.service
else
inst_hook pre-mount 25 "$moddir/stratisd-start.sh"
inst_hook cleanup 25 "$moddir/stratisd-stop.sh"
fi
}

View File

@@ -1,15 +0,0 @@
[Unit]
Description=A daemon that manages a pool of block devices to create flexible file systems
Documentation=man:stratisd(8)
Before=local-fs-pre.target
DefaultDependencies=no
[Service]
Type=simple
ExecStart=/sbin/stratisd-init --debug
KillSignal=SIGINT
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=sysinit.target

View File

@@ -1,3 +0,0 @@
#!/bin/sh
stratisd-init --debug > /dev/kmsg 2>&1 &

View File

@@ -1,6 +0,0 @@
#!/bin/sh
[ -f /lib/dracut-lib.sh ] && . /lib/dracut-lib.sh
pid=$(pidof stratisd-init)
[ -n "$pid" ] && kill ${pid}

View File

@@ -31,7 +31,7 @@ if [ -n "$zipl_arg" ] ; then
esac
if [ "$zipl_env" ] ; then
{
printf 'ACTION=="add|change", SUBSYSTEM=="block", %s=="%s", RUN+="/sbin/initqueue --settled --onetime --unique --name install_zipl_cmdline /sbin/install_zipl_cmdline.sh %s"\n' \
printf 'ACTION=="add|change", SUBSYSTEM=="block", %s=="%s", ENV{SYSTEMD_READY}!="0", RUN+="/sbin/initqueue --settled --onetime --unique --name install_zipl_cmdline /sbin/install_zipl_cmdline.sh %s"\n' \
${zipl_env} ${zipl_val} ${zipl_arg}
echo "[ -f /tmp/install.zipl.cmdline-done ]" >$hookdir/initqueue/finished/wait-zipl-conf.sh
} >> /etc/udev/rules.d/99zipl-conf.rules

View File

@@ -30,5 +30,5 @@ cifs_to_var() {
if [ ! "$cifsuser" -o ! "$cifspass" ]; then
die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL."
fi
options="user=$cifsuser,pass=$cifspass"
options="user=$cifsuser,pass=$cifspass,$(getarg rootflags=)"
}

View File

@@ -16,7 +16,7 @@ echo server: $server
echo path: $path
echo options: $options
mount.cifs //$server/$path $NEWROOT -o $options && { [ -e /dev/root ] || ln -s null /dev/root ; }
mount.cifs "//$server/$path" "$NEWROOT" -o "$options" && { [ -e /dev/root ] || ln -s null /dev/root ; }
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -f -- "$job"' > $hookdir/initqueue/cifs.sh

View File

@@ -25,11 +25,11 @@ depends() {
installkernel() {
instmods cifs ipv6
# hash algos
instmods md4 md5 sha256
instmods md4 md5 sha256 sha512
# ciphers
instmods aes arc4 des ecb
instmods aes arc4 des ecb gcm aead2
# macs
instmods hmac cmac
instmods hmac cmac ccm
}
# called by dracut

View File

@@ -18,8 +18,9 @@ depends() {
install() {
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
if [[ $hostonly ]]; then
inst -H /etc/dasd.conf
conf=/etc/dasd.conf
if [[ $hostonly && -f $conf ]] ; then
inst -H $conf
fi
inst_rules 56-dasd.rules
inst_rules 59-dasd.rules

0
modules.d/95dcssblk/module-setup.sh Normal file → Executable file
View File

0
modules.d/95dcssblk/parse-dcssblk.sh Normal file → Executable file
View File

View File

@@ -2,22 +2,15 @@
# called by dracut
check() {
local _fcoe_ctlr
[[ $hostonly ]] || [[ $mount_needs ]] && {
for c in /sys/bus/fcoe/devices/ctlr_* ; do
[ -L $c ] || continue
_fcoe_ctlr=$c
done
[ -z "$_fcoe_ctlr" ] && return 255
is_fcoe() {
block_is_fcoe $1 || return 1
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves is_fcoe || return 255
[ -d /sys/firmware/efi ] || return 255
for c in /sys/bus/fcoe/devices/ctlr_* ; do
[ -L $c ] || continue
fcoe_ctlr=$c
done
[ -z "$fcoe_ctlr" ] && return 255
}
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
return 0
}

View File

@@ -1,8 +1,8 @@
#!/bin/bash
if ! getargbool 0 rd.nofcoe ; then
if getargbool 0 rd.nofcoe ; then
info "rd.nofcoe=0: skipping lldpad activation"
exit 0
return 0
fi
# Note lldpad will stay running after switchroot, the system initscripts

View File

@@ -2,13 +2,12 @@
# called by dracut
check() {
local _fcoe_ctlr
is_fcoe() {
block_is_fcoe $1 || return 1
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for c in /sys/bus/fcoe/devices/ctlr_* ; do
[ -L $c ] || continue
_fcoe_ctlr=$c
done
[ -z "$_fcoe_ctlr" ] && return 255
for_each_host_dev_and_slaves is_fcoe || return 255
}
require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
@@ -23,7 +22,7 @@ depends() {
# called by dracut
installkernel() {
instmods fcoe 8021q edd
instmods fcoe libfcoe 8021q edd bnx2fc
}
get_vlan_parent() {

View File

@@ -13,7 +13,7 @@
# fcoe=eth0:nodcb:vn2vn
# fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
if ! getargbool 0 rd.nofcoe ; then
if getargbool 0 rd.nofcoe ; then
info "rd.nofcoe=0: skipping fcoe"
return 0
fi

View File

@@ -213,6 +213,9 @@ handle_netroot()
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
fi
if strglobin $iscsi_target_ip '*:*:*' && ! strglobin $iscsi_target_ip '['; then
iscsi_target_ip="[$iscsi_target_ip]"
fi
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1

View File

@@ -9,20 +9,9 @@ check() {
# If hostonly was requested, fail the check if we are not actually
# booting from root.
is_iscsi() {
local _dev=$1
[[ -L "/sys/dev/block/$_dev" ]] || return
cd "$(readlink -f "/sys/dev/block/$_dev")"
until [[ -d sys || -d iscsi_session ]]; do
cd ..
done
[[ -d iscsi_session ]]
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
pushd . >/dev/null
for_each_host_dev_and_slaves is_iscsi
for_each_host_dev_and_slaves block_is_iscsi
local _is_iscsi=$?
popd >/dev/null
[[ $_is_iscsi == 0 ]] || return 255
@@ -65,7 +54,7 @@ install_ibft() {
if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
echo -n "rd.iscsi.ibft=1 "
fi
echo -n "rd.iscsi.firmware=1"
echo -n "rd.iscsi.firmware=1 "
fi
done
}
@@ -120,27 +109,7 @@ install_iscsiroot() {
done
[ -z "$iscsi_address" ] && return
local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
# follow ifcfg settings for boot protocol
for _path in \
"/etc/sysconfig/network-scripts/ifcfg-$ifname" \
"/etc/sysconfig/network/ifcfg-$ifname" \
; do
[ -f "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path")
done
if [ $bootproto ]; then
printf 'ip=%s:%s ' ${ifname} ${bootproto}
else
printf 'ip=%s:static ' ${ifname}
fi
if [ -e /sys/class/net/$ifname/address ] ; then
ifmac=$(cat /sys/class/net/$ifname/address)
printf 'ifname=%s:%s ' ${ifname} ${ifmac}
fi
ip_params_for_remote_addr "$iscsi_address"
if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then
if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then
@@ -243,6 +212,7 @@ install() {
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
if ! dracut_module_included "systemd"; then
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
else

View File

@@ -7,11 +7,9 @@ check() {
# if an nbd device is not somewhere in the chain of devices root is
# mounted on, fail the hostonly check.
[[ $hostonly ]] || [[ $mount_needs ]] && {
is_nbd() { [[ -b /dev/block/$1 && $1 == 43:* ]] ;}
_rootdev=$(find_root_block_device)
[[ -b /dev/block/$_rootdev ]] || return 1
check_block_and_slaves is_nbd "$_rootdev" || return 255
check_block_and_slaves block_is_nbd "$_rootdev" || return 255
}
require_binaries nbd-client || return 1

View File

@@ -1,5 +1,22 @@
#!/bin/bash
# return value:
# 'nfs4': Only nfs4 founded
# 'nfs': nfs with version < 4 founded
# '': No nfs founded
get_nfs_type() {
local _nfs _nfs4
for fs in "${host_fs_types[@]}"; do
[[ "$fs" == "nfs" ]] && _nfs=1
[[ "$fs" == "nfs3" ]] && _nfs=1
[[ "$fs" == "nfs4" ]] && _nfs4=1
done
[[ "$_nfs" ]] && echo "nfs" && return
[[ "$_nfs4" ]] && echo "nfs4" && return
}
# called by dracut
check() {
# If our prerequisites are not met, fail anyways.
@@ -7,11 +24,7 @@ check() {
require_binaries rpc.statd mount.nfs mount.nfs4 umount || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ "$fs" == "nfs" ]] && return 0
[[ "$fs" == "nfs3" ]] && return 0
[[ "$fs" == "nfs4" ]] && return 0
done
[[ "$(get_nfs_type)" ]] && return 0
return 255
}
return 0
@@ -25,7 +38,7 @@ depends() {
# called by dracut
installkernel() {
hostonly='' instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files
hostonly=$(optional_hostonly) instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files
}
cmdline() {
@@ -34,7 +47,6 @@ cmdline() {
local nfs_root
local nfs_address
local lookup
local ifname
### nfsroot= ###
nfs_device=$(findmnt -t nfs4 -n -o SOURCE /)
@@ -56,29 +68,16 @@ cmdline() {
lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1)
nfs_address=${lookup##* }
fi
ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
if [ -d /sys/class/net/$ifname/bonding ]; then
dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
return
elif [ -e /sys/class/net/$ifname/address ] ; then
ifmac=$(cat /sys/class/net/$ifname/address)
printf 'ifname=%s:%s ' ${ifname} ${ifmac}
fi
bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname)
if [ $bootproto ]; then
printf 'ip=%s:%s ' ${ifname} ${bootproto}
else
printf 'ip=%s:static ' ${ifname}
fi
[[ $nfs_address ]] || return
ip_params_for_remote_addr "$nfs_address"
}
# called by dracut
install() {
local _i
local _nsslibs
inst_multiple -o portmap rpcbind rpc.statd mount.nfs \
mount.nfs4 umount rpc.idmapd sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf"
inst_multiple -o rpc.idmapd mount.nfs mount.nfs4 umount sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf"
inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
if [[ $hostonly_cmdline == "yes" ]]; then
@@ -106,10 +105,17 @@ install() {
inst_hook pre-udev 99 "$moddir/nfs-start-rpc.sh"
inst_hook cleanup 99 "$moddir/nfsroot-cleanup.sh"
inst "$moddir/nfsroot.sh" "/sbin/nfsroot"
# For strict hostonly, only install rpcbind for NFS < 4
if [[ $hostonly_mode != "strict" ]] || [[ "$(get_nfs_type)" != "nfs4" ]]; then
inst_multiple -o portmap rpcbind rpc.statd
fi
inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
[ -d "$initdir/var/lib/nfs/statd/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
[ -d "$initdir/var/lib/nfs/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm"
# Rather than copy the passwd file in, just set a user for rpcbind
# We'll save the state and restart the daemon from the root anyway
@@ -121,5 +127,6 @@ install() {
chmod 770 "$initdir/var/lib/rpcbind"
grep -q '^rpc:' $dracutsysrootdir/etc/passwd \
&& grep -q '^rpc:' $dracutsysrootdir/etc/group
dracut_need_initqueue
}

View File

@@ -112,8 +112,8 @@ nfsroot_from_dhcp() {
[ -n "$new_root_path" ] && nfsroot_to_var "$nfs:$new_root_path"
[ -z "$path" ] && [ "$(getarg root=)" = "/dev/nfs" ] && path=/tftpboot/%s
[ -z "$server" ] && server=$srv
[ -z "$server" ] && server=$new_dhcp_server_identifier
[ -z "$server" ] && server=$new_next_server
[ -z "$server" ] && server=$new_dhcp_server_identifier
[ -z "$server" ] && server=${new_root_path%%:*}
}

View File

@@ -1,8 +1,6 @@
#!/bin/sh
if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
@@ -17,8 +15,8 @@ if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
# Start rpc.statd as mount won't let us use locks on a NFSv4
# filesystem without talking to it. NFSv4 does locks internally,
# rpc.lockd isn't needed
[ -z "$(pidof rpc.statd)" ] && rpc.statd
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
command -v rpc.statd >/dev/null && [ -z "$(pidof rpc.statd)" ] && rpc.statd
command -v rpc.idmapd >/dev/null && [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
else
warn 'Kernel module "sunrpc" not in the initramfs, or support for filesystem "rpc_pipefs" missing!'
fi

View File

@@ -24,6 +24,7 @@
#
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/nfs-lib.sh
# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)

View File

@@ -0,0 +1,10 @@
#
# nvmf-initqueue.rules
#
# D-Bus doesn't run in the initrd, which means that we cannot use our
# usual trick of starting custom systemd services.
# So use a rule to create initqueue entries instead.
ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \
RUN+="/sbin/initqueue --onetime --unique --name nvmf-connect-$env{NVMEFC_TRADDR}-$env{NVMEFC_HOST_TRADDR} /usr/sbin/nvme connect-all --transport=fc --traddr=$env{NVMEFC_TRADDR} --host-traddr=$env{NVMEFC_HOST_TRADDR}"

120
modules.d/95nvmf/module-setup.sh Executable file
View File

@@ -0,0 +1,120 @@
#!/bin/bash
# called by dracut
check() {
require_binaries nvme || return 1
[ -f /etc/nvme/hostnqn ] || return 255
[ -f /etc/nvme/hostid ] || return 255
is_nvmf() {
local _dev=$1
local trtype
[[ -L "/sys/dev/block/$_dev" ]] || return 0
cd -P "/sys/dev/block/$_dev" || return 0
if [ -f partition ] ; then
cd ..
fi
for d in device/nvme* ; do
[ -L "$d" ] || continue
if readlink "$d" | grep -q nvme-fabrics ; then
trtype=$(cat "$d"/transport)
break
fi
done
[[ "$trtype" == "fc" ]] || [[ "$trtype" == "tcp" ]] || [[ "$trtype" == "rdma" ]]
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
pushd . >/dev/null
for_each_host_dev_and_slaves is_nvmf
local _is_nvmf=$?
popd >/dev/null
[[ $_is_nvmf == 0 ]] || return 255
if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ] ; then
if [ ! -f /etc/nvme/discovery.conf ] ; then
echo "No discovery arguments present"
return 255
fi
fi
}
return 0
}
# called by dracut
depends() {
echo bash rootfs-block network
return 0
}
# called by dracut
installkernel() {
instmods nvme_fc lpfc qla2xxx
hostonly="" instmods nvme_tcp nvme_fabrics
}
# called by dracut
cmdline() {
local _hostnqn
local _hostid
gen_nvmf_cmdline() {
local _dev=$1
local trtype
[[ -L "/sys/dev/block/$_dev" ]] || return 0
cd -P "/sys/dev/block/$_dev" || return 0
if [ -f partition ] ; then
cd ..
fi
for d in device/nvme* ; do
[ -L "$d" ] || continue
if readlink "$d" | grep -q nvme-fabrics ; then
trtype=$(cat "$d"/transport)
break
fi
done
[ -z "$trtype" ] && return 0
nvme list-subsys ${PWD##*/} | while read x dev trtype traddr host_traddr state ana; do
[ "$trtype" != "${trtype#NQN}" ] && continue
echo -n " nvmf.discover=$trtype,${traddr#traddr=},${host_traddr#host_traddr=}"
done
}
if [ -f /etc/nvme/hostnqn ] ; then
_hostnqn=$(cat /etc/nvme/hostnqn)
echo -n " nvmf.hostnqn=${_hostnqn}"
fi
if [ -f /etc/nvme/hostid ] ; then
_hostid=$(cat /etc/nvme/hostid)
echo -n " nvmf.hostid=${_hostid}"
fi
[[ $hostonly ]] || [[ $mount_needs ]] && {
pushd . >/dev/null
for_each_host_dev_and_slaves gen_nvmf_cmdline
popd >/dev/null
}
}
# called by dracut
install() {
if [[ $hostonly_cmdline == "yes" ]]; then
local _nvmf_args=$(cmdline)
[[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
fi
inst_simple "/etc/nvme/hostnqn"
inst_simple "/etc/nvme/hostid"
inst_multiple ip sed
inst_script "${moddir}/nvmf-autoconnect.sh" /sbin/nvmf-autoconnect.sh
inst_multiple nvme
inst_hook cmdline 99 "$moddir/parse-nvmf-boot-connections.sh"
inst_simple "/etc/nvme/discovery.conf"
inst_rules /usr/lib/udev/rules.d/71-nvmf-iopolicy-netapp.rules
inst_rules "$moddir/95-nvmf-initqueue.rules"
dracut_need_initqueue
}

View File

@@ -0,0 +1,5 @@
#!/bin/bash
[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1
echo add > /sys/class/fc/fc_udev_device/nvme_discovery
exit 0

View File

@@ -0,0 +1,143 @@
#!/bin/sh
#
# Supported formats:
# nvmf.hostnqn=<hostnqn>
# nvmf.hostid=<hostid>
# nvmf.discover=<transport>,<traddr>,<host-traddr>,<trsvcid>
#
# Examples:
# nvmf.hostnqn=nqn.2014-08.org.nvmexpress:uuid:37303738-3034-584d-5137-333230423843
# nvmf.discover=rdma,192.168.1.3,,4420
# nvmf.discover=tcp,192.168.1.3,,4420
# nvmf.discover=tcp,192.168.1.3
# nvmf.discover=fc,nn-0x200400a098d85236:pn-0x201400a098d85236,nn-0x200000109b7db455:pn-0x100000109b7db455
# nvmf.discover=fc,auto
#
# Note: FC does autodiscovery, so typically there is no need to
# specify any discover parameters for FC.
#
type is_ip >/dev/null 2>&1 || . /lib/net-lib.sh
if getargbool 0 rd.nonvmf ; then
warn "rd.nonvmf=0: skipping nvmf"
return 0
fi
initqueue --onetime modprobe --all -b -q nvme nvme_tcp nvme_core nvme_fabrics
validate_ip_conn() {
if ! getargbool 0 rd.neednet ; then
warn "$trtype transport requires rd.neednet=1"
return 1
fi
local_address=$(ip -o route get to $traddr | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
# confirm we got a local IP address
if ! is_ip "$local_address" ; then
warn "$traddr is an invalid address";
return 1
fi
ifname=$(ip -o route get to $local_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
if ip l show "$ifname" >/dev/null 2>&1 ; then
warn "invalid network interface $ifname"
return 1
fi
# confirm there's a route to destination
if ip route get "$traddr" >/dev/null 2>&1 ; then
warn "no route to $traddr"
return 1
fi
}
parse_nvmf_discover() {
traddr="none"
trtype="none"
hosttraddr="none"
trsvcid=4420
OLDIFS="$IFS"
IFS=,
set $1
IFS="$OLDIFS"
case $# in
2)
[ -n "$1" ] && trtype=$1
[ -n "$2" ] && traddr=$2
;;
3)
[ -n "$1" ] && trtype=$1
[ -n "$2" ] && traddr=$2
[ -n "$3" ] && hosttraddr=$3
;;
4)
[ -n "$1" ] && trtype=$1
[ -n "$2" ] && traddr=$2
[ -n "$3" ] && hosttraddr=$3
[ -n "$4" ] && trsvcid=$4
;;
*)
warn "Invalid arguments for nvmf.discover=$1"
return 0
;;
esac
if [ "$traddr" = "none" ] ; then
warn "traddr is mandatory for $trtype"
return 0;
fi
if [ "$trtype" = "fc" ] ; then
if [ "$traddr" = "auto" ] ; then
rm /etc/nvme/discovery.conf
return 1
fi
if [ "$hosttraddr" = "none" ] ; then
warn "host traddr is mandatory for fc"
return 0
fi
elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ] ; then
warn "unsupported transport $trtype"
return 0
fi
if [ "$trtype" = "tcp" ]; then
validate_ip_conn
fi
if [ "$trtype" = "fc" ] ; then
echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr" >> /etc/nvme/discovery.conf
else
echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf
fi
return 0
}
nvmf_hostnqn=$(getarg nvmf.hostnqn=)
if [ -n "$nvmf_hostnqn" ] ; then
echo "$nvmf_hostnqn" > /etc/nvme/hostnqn
fi
nvmf_hostid=$(getarg nvmf.hostid=)
if [ -n "$nvmf_hostid" ] ; then
echo "$nvmf_hostid" > /etc/nvme/hostid
fi
for d in $(getargs nvmf.discover=); do
parse_nvmf_discover "$d" || break
done
# Host NQN and host id are mandatory for NVMe-oF
[ -f "/etc/nvme/hostnqn" ] || exit 0
[ -f "/etc/nvme/hostid" ] || exit 0
if [ -f "/etc/nvme/discovery.conf" ] ; then
/sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
if [ "$trtype" = "tcp" ] ; then
> /tmp/net.$ifname.did-setup
fi
else
# No nvme command line arguments present, try autodiscovery
if [ "$trtype" = "fc" ] ; then
/sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
fi
fi

Some files were not shown because too many files have changed in this diff Show More