Compare commits

...

1654 Commits

Author SHA1 Message Date
Thomas Blume
52351cfa04 feat(livenet): add memory size check depending on live image size
For writeable live images, the memory must hold the complete image.
That means it must be at least the size of the image plus some RAM
necessary to run processes.
With too small RAM, the OOM Killer steps in and makes the boot hang.
This patch lets the system go into the emergency shell instead.

The default minimum RAM after subtracting the live image size is set to 1G.
The parameter rd.minmem is added to modify this.
2023-07-07 14:24:10 +02:00
Henrik Gombos
15d4f60eb1 chore(gentoo.conf): remove examples to avoid confusion
These examples are not used and not maintained and changing them
would not have an impact on Gentoo.
2023-06-29 08:25:57 +02:00
Michał Zegan
b7ef130271 fix(modsign): load keys to correct keyring
Until now, 03modsign module was loading keys from /lib/modules/keys/* into the
current session keyring.
This change makes it add keys to the secondary trusted keyring. This works
only as long as added certificate is signed by key from the same keyring.
2023-06-28 07:53:14 -04:00
Laszlo Gombos
179e1a992f fix(dmsquash-live-autooverlay): specify filesystemtype when it is already known 2023-06-26 09:56:15 -04:00
Laszlo Gombos
a71b905ef3 chore: remove git2spec.pl, it is no longer used 2023-06-26 09:54:04 -04:00
Laszlo Gombos
9aa332cad7 fix(fs-lib): remove quoting form the first argument of the e2fsck call
Fix regression.
2023-06-26 09:39:48 -04:00
Laszlo Gombos
f5cc202e99 fix(Makefile): remove leftover rpm build rules 2023-06-26 09:24:02 -04:00
Laszlo Gombos
ffc766d23d fix(Makefile): no longer upload to kernel.org 2023-06-26 09:16:12 -04:00
Martin Wilck
b490f6f7d7 feat(nvmf): add code for parsing the NBFT
Add code to parse the Nvme-oF Boot Firmware Table (NBFT) according
to the NVM Express Boot Specification 1.0 [1]. The implementation in
dracut follows a similar general approach as iBFT support in the
iscsi module.

NBFT support requires two steps:

(1) Setting up the network and routing according to the
    HFI ("Host Fabric Interface") records in the NBFT,
(2) Establishing the actual NVMe-oF connection.

(1) is accomplished by reading the NBFT using JSON output from
the "nvme nbft show" command, and transforming it into command
line options ("ip=", "rd.neednet", etc.) understood by dracut's
network module and its backends. The resulting network setup code
is backend-agnostic. It has been tested with the "network-legacy"
and "network-manager" network backend modules. The network setup
code supports IPv4 and IPv6 with static, RA, or DHCP configurations,
802.1q VLANs, and simple routing / gateway setup.

(2) is done using the "nvme connect-all" command [2] in the netroot handler,
which is invoked by networking backends when an interface gets fully
configured. This patch adds support for "netboot=nbft". The "nbftroot"
handler calls nvmf-autoconnect.sh, which contains the actual connect
logic. nvmf-autoconnect.sh itself is preserved, because there are
other NVMe-oF setups like NVMe over FC which don't depend on the
network.

The various ways to configure NVMe-oF are prioritized like this:

 1 FC autoconnect from kernel commandline (rd.nvmf.discover=fc,auto)
 2 NBFT, if present
 3 discovery.conf or config.json, if present, and cmdline.d parameters,
   if present (rd.nvmf.discovery=...)
 4 FC autoconnect (without kernel command line)

The reason for this priorization is that in the initial RAM fs, we try
to activate only those connections that are necessary to mount the root
file system. This avoids confusion, possible contradicting or ambiguous
configuration, and timeouts from unavailable targets.

A retry logic is implemented for enabling the NVMe-oF connections,
using the "settled" initqueue, the netroot handler, and eventually, the
"timeout" initqueue. This is similar to the retry logic of the iscsi module.
In the "timeout" case, connection to all possible NVMe-oF subsystems
is attempted.

Two new command line parameters are introduced to make it possible to
change the priorities above:

 - "rd.nvmf.nonbft" causes the NBFT to be ignored,
 - "rd.nvmf.nostatic" causes any statically configured NVMe-oF targets
   (config.json, discovery.conf, and cmdline.d) to be ignored.

These parameters may be helpful to skip attempts to set up broken
configurations.

At initramfs build time, the nvmf module is now enabled if an NBFT
table is detected in the system.

[1] https://nvmexpress.org/wp-content/uploads/NVM-Express-Boot-Specification-2022.11.15-Ratified.pdf
[2] NBFT support in nvme-cli requires the latest upstream code (> v2.4).

Signed-off-by: Martin Wilck <mwilck@suse.com>
Co-authored-by: John Meneghini <jmeneghi@redhat.com>
Co-authored-by: Charles Rose <charles.rose@dell.com>
2023-06-26 09:45:42 +02:00
Martin Wilck
f07117d68d fix(nvmf): support /etc/nvme/config.json
Since nvme-cli 2.0, configuration of subsystems to connect to is
stored under `/etc/nvme` in either `discovery.conf` or `config.json`.
Attempt discovery also if the latter exists, but not the former.
Also, install "config.json" if it's present on the root FS.

As before, "rd.nvmf.discover=fc,auto" will force either file to be ignored,
and NBFT-defined targets take precedence if found.
2023-06-26 09:45:42 +02:00
Martin Wilck
902f3a8f84 fix(nvmf): install 8021q module unconditionally
In NBFT setups, VLAN can be configured in the firmware.
Add the 8021q module in hostonly mode even if VLAN is currently
not used to be prepared for such configuration change.
2023-06-26 09:45:42 +02:00
Andrew Ammerlaan
17b8649eb9 fix(install.d): respect even more kernel-install vars, plus style fixes
- More verbose with KERNEL_INSTALL_VERBOSE=1

- Use KERNEL_INSTALL_CONF_ROOT if defined

- Fallback to /usr/lib/os-release if /etc/os-release does not exist

- Fallback to "Linux $KERNEL_VERSION" if no PRETTY_NAME found

- Styling fixes

Co-authored-by: Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2023-06-26 09:39:24 +02:00
Andrew Ammerlaan
a037634ad7 fix(install.d): respect more kernel-install env variables
- If kernel-install has defined a staging area for us
(KERNEL_INSTALL_STAGING_AREA) install generated initrd/uki.efi there.
The actual install is then handled by 90-loaderentry.install or
90-uki-copy-install.

- Also skip regeneration if an uki.efi already exists.

- Pass --kernel-image to dracut, this is required to generate an uki (uefi=yes)

- Add --no-uefi argument to dracut rescue image generation, this ensures that
it at least installs correctly. TODO: Rework 51-dracut-rescue.install to also
work with uki's.

This fixes installing a kernel with uefi=yes in dracut config and layout=uki
in kernel/install.conf.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2023-06-26 09:39:24 +02:00
Andrew Ammerlaan
09d3ec1648 fix(dracut.sh): also prevent fsfreeze for tmpfs
KERNEL_INSTALL_STAGING_AREA is often on tmpfs, it cannot be frozen

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2023-06-26 09:39:24 +02:00
Laszlo Gombos
4000a1ecff fix(dmsquash-live): allow other fstypes
Use det_fs to determine fstype and provide fallback instead of
just calling blkid.

Many other dracut modules (e.g. fs-lib, btrfs, mdraid) are already
using det_fs to determine fstype.
2023-06-26 09:37:19 +02:00
Laszlo Gombos
995ac6f887 test(DMSQUASH): add test for NTFS
Add a test case for mounting the root filesystem from
a squashfs image file that is store on an NTFS drive.

The test case is using ntfs3 module to mount the NTFS drive.
2023-06-26 09:37:19 +02:00
Laszlo Gombos
d96754eaa5 test(16): check for failure after each sub-test run
The test case had a bug where it only checked for
at least one of the passing instead of all the subtests passing.
2023-06-26 09:37:19 +02:00
Laszlo Gombos
dfa408c9de fix(bluetooth): make bluetooth rules more strict
Only warn if bluetooth kernel module is loaded
at the time of initrd generation in hostonly mode.
2023-06-26 09:32:39 +02:00
Antonio Alvarez Feijoo
e84d65c5b0 fix(bluetooth): add missing files
- org.bluez.service dbus system service
- bluetooth.service override conf
2023-06-26 09:32:39 +02:00
Antonio Alvarez Feijoo
8079ceafca fix(bluetooth): include it if Appearance matches the value assigned for keyboard
Following the Bluetooth spec [1], Assigned Numbers Document, Rev. 2023-05-04,
Section 2.6.3, Appearance Sub-category, the Appearance value defined for
keyboards is 0x03C1.

This value must be checked to include the bluetooth module in hostonly mode,
because some Bluetooth keyboards do not set the Class attribute.

[1] https://www.bluetooth.com/specifications/assigned-numbers/
2023-06-26 09:32:39 +02:00
Henrik Gombos
0ecb038832 fix(bluetooth): warn user instead of including it by default
Bluetooth module can result in a known race condition at boot.
Discourage its usage by default.
2023-06-22 10:31:01 -07:00
Antonio Alvarez Feijoo
765e69ce4d fix(systemd-timedated): correct typo in override path 2023-06-22 17:08:15 +02:00
Antonio Alvarez Feijoo
2d08302191 fix(systemd-resolved): correct typo in override path 2023-06-22 17:08:15 +02:00
Antonio Alvarez Feijoo
f0dc7ec96b fix(systemd-networkd): correct typos in override paths 2023-06-22 17:08:15 +02:00
Antonio Alvarez Feijoo
3e2f685ecb fix(dracut-init.sh): correct check in is_qemu_virtualized function
Do not redirect `systemd-detect-virt` to /dev/null, otherwise, the `vm` variable
is always empty. This function was working only thanks to the following /sys
check.

Reported-by: Raymund Will <rw@suse.com>
2023-06-22 17:08:06 +02:00
Michal Koutný
7ed765dd23 fix(btrfs): do not require module via cmdline when --no-kernel
initrd built without modules would fail when it attempts to load a
kernel module. (Use case scenario: kernel with built-in module.)

synthesize an the cmdline only when modules are truly installed.
2023-06-20 07:52:02 -07:00
Antonio Alvarez Feijoo
2b47a2efe9 fix(btrfs): add missing cmdline function
Otherwise `dracut --print-cmdline` does not print the command line option added
by the btrfs module.
2023-06-20 07:52:02 -07:00
Laszlo Gombos
2ff7b4702c ci: conditionally add tgt to Gentoo container
This commit allows to run test 30 and test 35 on a Gentoo.

Use the newly introduced conditional for nfs4 support as well.
2023-06-19 10:15:22 +02:00
Laszlo Gombos
d06153f896 ci: re-enable lvm on Gentoo container
Gentoo changed it's policy and now lvm needs to be enabled explicitly.

See https://www.gentoo.org/support/news-items/2022-11-19-lvm2-default-USE-flags.html

No need to install thin-provisioning-tools explicitelly, it is
pulled in as a dependency of the lvm2 package.
2023-06-19 10:15:22 +02:00
Laszlo Gombos
a9ecb5e325 ci: disable initramfs generation inside Gentoo container
Disabling initramfs generation saves installing 4 additional packages.
2023-06-19 10:15:22 +02:00
Laszlo Gombos
5803ece5c2 ci: add extra packages for tests to Gentoo container
Add cryptsetup, multipath-tools and open-iscsi
to the Gentoo container for tests 10, 14, 30, 35.
2023-06-19 10:15:22 +02:00
Henrik Gombos
6fd6b36d5e ci: switching the musl test to 18 (uefi) 2023-06-19 09:31:55 +02:00
Henrik Gombos
af31df4b36 test(ISCSI): make test-30 use the test dracut modules
Introduce test_dracut that is meant to be shared between tests
in test-functions.
2023-06-16 19:48:14 -04:00
Henrik Gombos
dcf4665bfc ci: add dependencies to Debian container
- add systemd-boot-efi for test 18
- tgt is needed for test 30 and 35
- nbd-server is needed for test 40
- gawk dependency has been introduced by f32e95bcad
- install dracut instead of initramfs-tools to match actual usage
- remove workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962300
as it is now fixed on Debian 12.
2023-06-15 08:56:44 +02:00
Laszlo Gombos
ec2c7e1aa4 test(UEFI): add test case for UEFI boot
Include OVMF in containers if it is not already present.
2023-06-14 10:52:30 -04:00
Henrik Gombos
c1b3f88d50 docs: remove rd.lvm.snapsize and rd.lvm.snapshot 2023-06-12 07:58:19 -04:00
Henrik Gombos
4235c035ff fix(Makefile): execute command -v instead of which 2023-06-12 07:52:41 -04:00
lilinjie
e2f961a2bd fix(network-legacy): typo
Signed-off-by: lilinjie <lilinjie@uniontech.com>
2023-06-12 08:04:54 +02:00
Laszlo Gombos
3f8f115a27 fix(network,dbus): improve dependency checking
Decouple implementation details of the backend
dependencies from the meta module.

Call check_module for each submodule instead
of reimplementing sub-package dependencies
inside the meta module itself.

Add missing NetworkManager binary to the
network-manager dracut module check.
2023-06-09 08:55:48 -04:00
Antonio Alvarez Feijoo
cd6f683d63 fix(systemd-pcrphase): only include systemd-pcrphase-initrd.service
The only systemd-pcrphase related unit configured to run in the initrd is
systemd-pcrphase-initrd.service.
Both systemd-pcrphase.service and systemd-pcrphase-sysinit.service contain
`ConditionPathExists=!/etc/initrd-release`.
2023-06-08 15:54:38 +02:00
Antonio Alvarez Feijoo
1ef00735ae fix(systemd-tmpfiles): do not include systemd-tmpfiles-clean.timer
The systemd-tmpfiles-clean.timer unit is configured not to run in the initrd
since https://github.com/systemd/systemd/commit/fe7f113c
2023-06-08 15:54:38 +02:00
Antonio Alvarez Feijoo
eff2a93981 fix(systemd-journald): do not include systemd-journal-flush.service
The systemd-journal-flush.service unit is configured not to run in the initrd
since https://github.com/systemd/systemd/commit/fe7f113c
2023-06-08 15:54:38 +02:00
Antonio Alvarez Feijoo
925febf89d fix(systemd): do not include systemd-random-seed.service
The systemd-random-seed.service unit is configured not to run in the initrd
since https://github.com/systemd/systemd/commit/fe7f113c

Also, the systemd-random-seed-load.service does not exist since
https://github.com/systemd/systemd/commit/c35b956d
2023-06-08 15:54:38 +02:00
Mike Gilbert
c1588995ae fix(dracut.sh): correct path for UEFI stub on split-usr systems
systemd always installs the UEFI stub in ${prefix}/lib/systemd/boot/efi.

On split-usr systems, systemdutildir is ${rootprefix}/lib/systemd, which
makes dracut look in the wrong place.

Instead, grab 'prefix' from systemd.pc and store it in 'systemd_prefix'.

Bug: https://bugs.gentoo.org/765208
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
2023-06-08 08:21:54 +02:00
Henrik Gombos
aa20bbb5b1 feat(dracut-init.sh): do not print by default if an udev rule is skipped 2023-06-07 12:15:36 -04:00
Henrik Gombos
c5e036b157 test: move more makeroot dependencies into test-makeroot dracut module 2023-06-07 16:32:30 +02:00
Andrew Halaney
afb5717e67 fix(kernel-modules): add interconnect drivers
Many devicetree based systems require interconnect drivers to function
properly. Include those in the initramfs.

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
2023-06-06 16:33:02 +02:00
Henrik Gombos
d244b316f2 test(LVM-THIN): avoid thin pool size warning
Avoid the following warning by reducing thin pool size

> "Sum of all thin volume sizes exceeds the size of thin pool
> and the size of whole volume group.
2023-06-06 15:40:41 +02:00
Henrik Gombos
739b9e1b38 ci: cleanup containers
Remove /etc/profile.d/dracut-test.sh from test containers
No use to override default command
Remove references to docker. These files work just fine
with podman as well.
2023-06-06 15:36:59 +02:00
Henrik Gombos
ae7cd94b34 test: add empty default test_cleanup implementation 2023-06-06 15:00:32 +02:00
Henrik Gombos
f1346763ab test: move more common test code to test-functions
Move KVERSION and USE_NETWORK definition to test-functions.
Add option for qemu_add_drive_args to initialize drive with size.
2023-06-06 15:00:32 +02:00
Frederick Grose
5ac581ef66 fix(resolve-deps): check the existing file—not the source
Check for dependencies on the file actually installed, otherwise,
such as when the shebang is a link not equal to the initramfs link,
the wrong file may be tested.
2023-06-06 08:51:58 +02:00
Martin Wilck
07af8d5874 fix(dracut-lib.sh): remove successful finished initqueue scripts
If some "finished" initscripts keep failing, dracut will start
printing warnings after a while. But it will warn about all scripts
in the finished initqueue, not only those that have failed. That
makes it difficult to identify the script that has actually
caused the failure.

To avoid this, delete finished initqueue scripts when they succeed.
Also, instead of returning as soon as one of the scripts fails, try
all scripts, deleting those that succeed, and return failure if at
least one script failed.

If a previously deleted script is recreated by some other part of
the code, it will be re-run the next time the check_finished() function
is called, and will be re-deleted if it still succeeds.

The only case where I see that this might cause issues is if some
condition needs to be tested over and over again, because it succeeds
and then fails later (for example, a device showing up and then being
removed again). But I think that this is not the intended logic.
In general, when a device shows up or another "finished" condition
is met, we assume that this condition will hold at least until the
initramfs switches root and exits. If all conditions are met, the
current code will also exit the initqueue without retrying any of
the conditions again.
2023-06-05 17:27:27 +02:00
Henrik Gombos
7310a641e2 fix(udev-rules): remove firmware.rules 2023-06-05 10:24:58 -04:00
Henrik Gombos
fc182ed8cf docs: change ext3 to ext4
Promote ext4 instead of ext3 in the manual.
2023-06-05 15:53:09 +02:00
Henrik Gombos
2a26eec5cc fix(dracut.sh): silence the output of hardlinking files by default 2023-06-05 15:49:15 +02:00
Henrik Gombos
c8a703aaa7 fix(github): exempt issues in a milestone 2023-06-05 14:31:21 +02:00
Sergio E. Nemirowski
07b49a3ed7 fix(virtiofs): add virtio_pci kernel module to virtiofs
fix #2357

Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
2023-06-05 14:23:27 +02:00
Henrik Gombos
c08ae406bc ci: install multipath-tools into openSuse container 2023-05-25 13:37:03 +02:00
Henrik Gombos
d118754333 test: remove references of dhcpd3 from tests
dhcp3-server is no longer supported by Debian
and it is replaced by isc-dhcp-server.
2023-05-19 09:34:04 -04:00
Henrik Gombos
1843c16caf test: move test condition to test_check
This enables skipping the test instead of failing it.
2023-05-18 10:57:23 +02:00
Henrik Gombos
006890a2c3 test: upgrade to ext4
Most users use ext4 instead of ext3 or ext2. Upgrade tests to ext4.
2023-05-13 19:34:22 -04:00
Antonio Alvarez Feijoo
86c8a5a7c2 fix(dracut-systemd): rootfs-generator cannot write outside of generator dir
Although it was already documented in systemd.generator(7) that generators must
not write to locations other than those passed as arguments, since
https://github.com/systemd/systemd/commit/ca6ce62d systemd executes generators
in a mount namespace "sandbox", so now the hooks created by the rootfs-generator
are lost.

These hooks are created using the root= cmdline argument, so this patch moves
the creation of these hooks to a cmdline hook.

Fixes issue #2211
Fixes issue #2225
2023-05-10 08:10:01 -04:00
Antonio Alvarez Feijoo
acfa793b5c fix(dracut-systemd): check and create generator dir outside of inner function 2023-05-10 08:10:01 -04:00
Antonio Alvarez Feijoo
a7c04716a5 fix(dracut-systemd): do not hardcode the systemd generator directory
The normal directory is the first argument passed to the systemd generator,
so use it instead of hardcoding /run/systemd/generator.
2023-05-10 08:10:01 -04:00
Laszlo Gombos
6cd41ab517 ci: add more packages to allow testing more dracut containers 2023-05-10 08:04:08 -04:00
Laszlo Gombos
19c5439510 ci: simplify and sort 2023-05-10 08:04:08 -04:00
keentux
6178a9d83f fix(dracut.sh): handle imagebase for uefi
* UEFI creation didn't handle the ImageBase data for the PE file
  generation. Create an UKI thanks a stub file with a non zero BaseImage
  logs some warning ans generate a bad file offset management. The efi
  becomes unloadable.
* This commit parse the PE file header, get the data and apply the
  ImageBase on the objcopy command.

Fixes dracutdevs#2284

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
2023-05-08 22:04:09 -04:00
Daniel McIlvaney
67591e8855 fix(dracut-functions): avoid calling grep with PCRE (-P)
Invoking grep in Perl mode requires JIT'ing the Perl regex.
This can run into issues with SELinix policy which will generally try to
limit use of execmem in general purpose scripts. This occurs since the
JIT'd code will live in executable  memory.

The PCRE only '\K' command in the Perl REGEX can be replaced by a call
to awk instead.
2023-05-08 00:58:09 -04:00
Antonio Alvarez Feijoo
260883d96f fix(dracut-initramfs-restore.sh): handle /etc/machine-id empty or uninitialized
Handle the case where the user tries to debug the shutdown after explicitly
resetting the /etc/machine-id file.
2023-04-26 12:18:44 +00:00
Antonio Alvarez Feijoo
971b302d70 fix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized
Handle the case where the user tries to query the initrd content after
explicitly resetting the /etc/machine-id file.
2023-04-26 12:18:44 +00:00
Antonio Alvarez Feijoo
97fe09769d fix(dracut.sh): handle /etc/machine-id empty or uninitialized
Handle the case where the user tries to generate the initrd after explicitly
resetting the /etc/machine-id file.

Fixes issue #2267
2023-04-26 12:18:44 +00:00
Antonio Alvarez Feijoo
48c2cb457b feat(systemd-creds): introducing the systemd-creds module
Introducing the systemd-creds module.
2023-04-26 12:15:24 +00:00
Antonio Alvarez Feijoo
71e391ebdc fix(systemd-networkd): add missing conf files and services 2023-04-26 12:11:00 +00:00
Tao Liu
a62e895db9 fix(dracut-functions.sh): convert mmcblk to the real kernel module name
In some x86_64 platforms such as Intel Elkhartlake, an issue of missing
necessary modules due to udevadm drivers field unmatch the real kernel module
name is found:

  $ udevadm info -a /dev/block/179:1

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/mmc_host/mmc0/mmc0:0001':
    KERNELS=="mmc0:0001"
    SUBSYSTEMS=="mmc"
    DRIVERS=="mmcblk"
    ....

The DRIVERS field, aka mmcblk will be given to instmods to install the
corresponding mmc_block.ko kernel module. However mmc_block.ko cannot be
selected by string mmcblk, as a result, mmc_block.ko cannot be installed
in hostonly-mode strict, which will fail to bootup the machine such as in
kdump cases:

  $ /usr/lib/dracut/dracut-install -D /var/tmp --kerneldir /lib/modules/$(uname -r)/ -m mmcblk
  dracut-install: Failed to find module 'mmcblk'

In this patch, we will convert the string mmcblk to mmc_block, so the
kernel module can be successfully loaded.

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-04-14 04:40:04 +00:00
Tianhao Chai
297525c5c0 fix(multipath): remove dependency on multipathd.socket
This reverts commit e39ff407eca1d783ab44093c44db5ee401ff5b1d, removes
an incorrect `Also=` directive from multipathd.service.

`Also=multipathd.socket` is not the correct behavior for a
socket-activated service. This directive has been removed upstream
and dracut should do the same.

This fixes #2289, #2175 where in the cleanup hook running multipath
binary triggers activation of multipathd.service after it is stopped
as dracut prepares to switch root in initrd-cleanup.service.
2023-04-11 08:02:40 +02:00
Frederick Grose
1300a930e7 feat(lsinitrd): notify user on missing compressor
Provide a notice to user if the required compressor package is
missing.  This rather than failing silently.
2023-03-30 11:56:53 -04:00
Frederick Grose
a0d14d3bc6 fix(99base): adjust to allow mksh as initrd shell
Use printf instead of echo in str_replace() to preserve escapes.
Find command paths while PATH includes /usr/sbin. (switch_root was
  not found after the original environment is restored on Fedora.)
2023-03-29 08:11:36 +02:00
Dmitry Klochkov
8b951d20d4 fix(base): do not quote $CLINE in the set command
This is needed to correctly parse init arguments.

Fixes: 2fabaaa62d
2023-03-28 07:33:37 -04:00
Antonio Alvarez Feijoo
df2458a6b8 fix(systemd-ac-power): correct systemd-ac-power binary path
`systemd-ac-power` has been moved from `/usr/lib/systemd` to `/usr/bin/` since
https://github.com/systemd/systemd/commit/251dc2f1
2023-03-22 08:13:14 +01:00
Valentin Lefebvre
f32e95bcad fix(dracut.sh): use dynamically uefi's sections offset
* Uefi section are creating by `objcopy` with hardcoded sections
offset. This commit allow to have the correct offset between
each part of the efi file, needed to create an UKI. Offsets
are simply calculated so no sections overlap, as recommended
in  https://wiki.archlinux.org/title/Unified_kernel_image#Manually
Moreover, efi stub file's header is parsed to apply the correct
offsets according the section alignment factor.
* Remove EFI_SECTION_VMA_INITRD, no need anymore as initrd
section offset dynamically calculated

Fixes dracutdevs#2275

Signed-off-by: Valentin Lefebvre <valentin.lefebvre@suse.com>
2023-03-20 11:56:24 +00:00
Tao Liu
e9b4774239 fix(lvmthinpool-monitor): activate lvm thin pool before extend its size
The state of lvm thin pool may change into inactived state when kdump into
2nd kernel. As a result, lvextend will fail to extend its size. For example:

In 1st kernel:

  $ lvs
  LV       VG         Attr       LSize   Pool     Origin Data%  Meta%
  vol      vg00       Vwi-a-tz-- 300.00m thinpool        70.54
  thinpool vg00       twi-aotz-- 236.00m                 89.67  12.50
  ...

In 2nd kernel:

  LV       VG         Attr       LSize   Pool     Origin Data%  Meta%
  vol      vg00       Vwi-aotz-- 300.00m thinpool        70.54
  thinpool vg00       twi---tz-- 236.00m                 89.67  12.50
  ...

And the lvextend failing log:
[  8.483878] start-thinpool-monitor[590]: lvextend using policy requires the thin pool to be active.

In this patch, we will first activate lvm thin pool before calling lvextend
during kdump.

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-03-06 11:45:47 +01:00
dependabot[bot]
aca5120360 chore(deps): bump luizm/action-sh-checker from 0.5.0 to 0.6.0
Bumps [luizm/action-sh-checker](https://github.com/luizm/action-sh-checker) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/luizm/action-sh-checker/releases)
- [Commits](https://github.com/luizm/action-sh-checker/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: luizm/action-sh-checker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-01 09:16:33 +01:00
Laszlo Gombos
0e780720ef fix(dmsquash-live): restore compatibility with earlier releases
Follow-up to 40dd5c90e0 .
2023-02-28 08:34:40 +01:00
Pavel Valena
1ddcb137ea fix(dracut.sh): kmoddir does not handle trailing /
Fixes https://github.com/dracutdevs/dracut/issues/2236

+(/) only works in bash interactive mode. Using any non-interactive
bash run simply doesn't remove anything.

The solution is copied from dracut-lib.sh, trim().
2023-02-27 08:26:40 -05:00
Laszlo Gombos
6d554d9b98 fix(udev-rules): remove old eudev specific rule
Revert 64fb0900cb, no longer
needed.
2023-02-27 11:24:52 +01:00
Laszlo Gombos
d648bf805a fix(udev-rules): remove old redhat specific rule
The 40-redhat.rules rule has been removed upstream in 2010.
2023-02-27 11:24:52 +01:00
Laszlo Gombos
6a33e677ac fix(udev-rules): remove old edd_id extra rules
The 61-persistent-storage-edd.rules rule has been removed upstream
in 2012.
2023-02-27 11:24:52 +01:00
Laszlo Gombos
1edc41af97 fix(udev-rules): remove old debian specific rules
The last Debian release that carried 91-permissions.rules is wheezy.
2023-02-27 11:24:52 +01:00
“Masahiro
8f9ad06873 feat(test): nfs_fetch_url test into nfs test
This is to check the behavior of nfs_fetch_url() in nfs-lib.sh.
nfs_fetch_url() calls nfs_already_mounted() internally.
A file /nfs/client/root/fetchfile is on NFS server, which is fetched
from clients for testing with nfs_fetch_url().
2023-02-24 10:06:05 -05:00
“Masahiro
966b6cec1b fix(url-lib.sh): nfs_already_mounted() with trailing slash in nfs path
nfs_already_mounted() doesn't work when the installation ISO and kickstart file on a same NFS share are specified with inst.repo and inst.ks boot parameter as below.

   inst.repo=nfs:192.168.1.1:/home/data/rhel9.iso inst.ks=nfs:192.168.1.1:/home/data/ks.cfg

   NOTE: /home/data is configured for nfs share on 192.168.1.1

One problem is a file (not a directory) was passed into nfs_already_mounted().
nfs_already_mounted() is the function to judge if the given directory is already mounted.
So, filepath should be passed in nfs_fetch_url().

The other problem is about the trailing slash in the nfs path in /proc/mounts.

The /proc/mounts has an entry after nfs mount of inst.repo.

   192.168.1.1:/data/   /run/install/isodir  nfs  ro,relatime,<snip>

In this case, nfs_already_mounted() returns "/run/install/isodir//home/data/ks.cfg" wrongly. The following is from the log.

[   14.556279] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@156(nfs_fetch_url): nfs_already_mounted 192.168.122.1 /home/data/ks.cfg
[   14.556279] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@137(nfs_already_mounted): local server=192.168.122.1 path=/home/data/ks.cfg s= p=
...
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@140(nfs_already_mounted): '[' 192.168.122.1 = 192.168.122.1 ']'
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@141(nfs_already_mounted): '[' /home/data/ks.cfg = /home/data/ ']'
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@143(nfs_already_mounted): str_starts /home/data/ks.cfg /home/data/
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/dracut-lib.sh@51(str_starts): '[' ks.cfg '!=' /home/data/ks.cfg ']'
[   14.654966] localhost.localdomain dracut-initqueue[1282]: ///lib/url-lib.sh@144(nfs_already_mounted): echo /run/install/isodir//home/data/ks.cfg
...
[   14.658069] localhost.localdomain dracut-initqueue[934]: //lib/url-lib.sh@156(nfs_fetch_url): mntdir=/run/install/isodir//home/data/ks.cfg

This function doesn't expect the trailiing slash of the nfs path in /proc/mounts, so it should be removed before processing it.
2023-02-24 10:06:05 -05:00
Frantisek Sumsal
f9bcd4d2c8 ci: use CodeQL instead of LGTM
As LGTM is going to be shut down by EOY[0], let's move the code scanning to
CodeQL as recommended. Thanks to GH integration the results from such
scans will be shown both in the respective PR and in the Security ->
Code Scanning tab[1].

[0] https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/
[1] https://github.com/dracutdevs/dracut/security/code-scanning
2023-02-22 15:49:56 -05:00
Antonio Alvarez Feijoo
ae88e029c6 feat(dracut): use log level indicator in console output
Also, use the same format in messages printed to console before dracut-logger
is sourced.

Fixes issue #1065
2023-02-22 15:20:52 -05:00
Pavel Valena
df381b7e0c feat(kernel-modules): driver support for macbook keyboards
Discussed in: https://bugzilla.redhat.com/show_bug.cgi?id=2166209
2023-02-21 15:34:49 -05:00
Adrien Thierry
131822e26d fix(dracut-install): prevent possible infinite recursion with suppliers
During search for fw_devlink suppliers, it's possible to encounter a
situation where supplier A depends on supplier B, and supplier B has a
parent node that depends on supplier A. This leads to an infinite
recursion.

To fix this, make sure suppliers are only processed once.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-02-21 20:05:44 +00:00
John Meneghini
f3a7172db5 build: remove rpm spec file and build rules
As discussed in issue #2204 this patch removes the dracut.spec file from
the repository.  The advantage of this patch is that it creates a
dracut-version.tar.xv file that can be more easily consumed by the
downstream distributions because there's no rpm spec file included in
the distribution.

Tested with a downstream rpm spec fiie:

```
cd dracut
VERSION=`git describe --abbrev=0 --tags --always`
make clean
make dist
cp dracut-${VERSION}.tar.xz ../
cd ..

xz -d -v dracut-${VERSION}.tar.xz
tar rf dracut-${VERSION}.tar dracut.spec
xz -9 dracut-${VERSION}.tar

rm -rf rmpbuild
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
rpmbuild -ta --define "_topdir `pwd`/rpmbuild" -v dracut-${VERSION}.tar.xz
```

Fixes issue #2204
2023-02-16 20:15:37 +00:00
Adrien Thierry
89269d239f fix(kernel-modules): add UFS drivers
Add ufs to the list of block drivers as it is used in modern embedded
systems.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-02-15 12:59:13 +01:00
Adrien Thierry
87a76dbb57 fix(kernel-modules): use modalias info in get_dev_module()
When calling dracut with '--hostonly-mode=strict', get_dev_module() gets
called on the system's block devices to find the required drivers. The
driver name is retrieved using udevadm. However, the driver name
returned by udevadm is not necessarily the same as the module name.
This is the case for the Qualcomm UFS driver: udevadm returns
'ufshcd-qcom' while the module name is 'ufs-qcom', so dracut-install is
not able to find the module afterwards.

To solve this, make get_dev_module() also return the module alias info
from the modalias files contained in the sysfs directories parsed by
udevadm.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-02-15 12:59:13 +01:00
Jóhann B. Guðmundsson
c5dca3d689 fix(crypt): add missing libraries
Add missing libraries, closes #2137
2023-02-14 18:14:27 -08:00
Lubomir Rintel
61ceb35f40 revert(network-manager): avoid restarting NetworkManager
This reverts commit 77630365ae.

Its commit message states:

  On EL8.3 the NetworkManager keep restarting even if it exits successfully
  while waiting for Clevis to unlock. This patch ensures NetworkManager runs
  only once in initrd.

Yes; NetworkManager is run multiple times, so that it's able to
configure interfaces that haven't been seen previously (because bus was
slow to scan or device took time to initialize).

It's not clear what problem was the original commit trying to fix.
I suspect there was no problem, just a misunderstanding.
2023-02-14 16:56:34 +01:00
Antonio Alvarez Feijoo
a6dd5bfb9a fix(dracut.sh): handle sbsign errors for UEFI builds
`sbsign` does not issue any error if there is not enough disk space to create
the signed file using its `--output` option. So, verify the signed image after
its creation using `sbverify`.

Fixes issue #2197
2023-02-13 18:45:51 +00:00
Antonio Alvarez Feijoo
8602df7058 fix(dracut.sh): handle out of space error for UEFI builds
If `cp` fails, do not continue, print an error and exit, like it's already
being done for non-UEFI builds.
2023-02-13 18:45:51 +00:00
Martin Wilck
726d56ca0a fix(network): IPv6: don't wait for RA for static IPv6 assignments
This patch reverts commit
c603419 ("wait for IPv6 RA if using none/static IPv6 assignment").
It's not generally correct wait for a default route to be established
for an interface, or to wait for "proto ra" routes in general.
For example, if the system is a router itself, it will receive no
RAs. In isolated networks, no gateway may be advertized, either.
This is similar in spirit to 76f6566 ("Revert "wait for IPv6 RA
if using none/static IPv6 assignment"")

Whatever c603419 ("wait for IPv6 RA if using none/static IPv6 assignment")
was supposed to achieve, it should be done differently.
2023-02-13 16:17:45 +01:00
Martin Wilck
b074216be9 fix(network-legacy): always include af_packet
For static IPv4 configurations, we use arping to check for duplicate
IP addresses. arping requires the af_packet module to work, and if arping
fails, the IP address will not be set and booting will fail.
af_packet may not be loaded / required in the running system, for example if
the system had been booted in an IPv6 configuration, or if it had been
manually unloaded. Make sure it's included in initramfs in hostonly mode, too.
2023-02-13 16:17:45 +01:00
Martin Wilck
7ff255a448 fix(network): don't assume prefix length 64 by default
Assuming a default prefix length of 64 by default if no explicit
prefix length is given is wrong and known to cause connectivity
problems in some networks. A prefix length of 128 should be assumed
in this case.

See https://www.rfc-editor.org/rfc/rfc5942 (specifically section 5)
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684009
2023-02-13 16:17:45 +01:00
Martin Wilck
c3b65a493a fix(iscsi): prefix syntax for static iBFT IPv6 addresses
ibft_to_cmdline() formats a static IPv6 address like this
(without peer, gateway, hostname):

  ip="[fd09:9a46:b5c1:1fe:1::10/64]:::::ibft0:none"

This means that the "mask" field (4th) is left blank. When this is
parsed later by parse-ip-opts.sh, it bails out with the error
message "Sorry, automatic calculation of netmask is not yet supported".

parse-ip-opts.sh rather expects the prefix in the 4th field:

  ip="[fd09:9a46:b5c1:1fe:1::10]:::64::ibft0:none"

This syntax will be correctly transformed to the command

  ip addr add fd09:9a46:b5c1:1fe::10/64 dev ibft0

This patch fixes the formatting of the "ip=" line in ibft_to_cmdline().
2023-02-13 16:17:45 +01:00
Martin Wilck
aa5d9526ec fix(iscsi): install 8021q module unconditionally
In iBFT setups, VLAN can be configured in the firmware.
Add the 8021q module in hostonly mode even if VLAN is currently
not used to be prepared for such configuration change.
2023-02-13 16:17:45 +01:00
Adrien Thierry
3de4c73132 feat(dracut-install): add fw_devlink suppliers as module dependencies
Dracut currently finds kernel module dependencies using two methods:
depmod and softdeps. However, these are often insufficient on embedded
systems where a lot of driver dependencies are only described in the
device tree. This is often the case for low-level devices such as
clocks, regulators, pinctrls, etc.

This patch allows dracut to find those device tree dependencies, by
parsing the sysfs supplier nodes populated by fw_devlink.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-02-13 13:29:12 +00:00
Adrien Thierry
f0c3b68327 refactor(dracut-install): add Hashmap cleanup function
This is prep work for adding support for fw_devlink suppliers
dependencies.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-02-13 13:29:12 +00:00
Adrien Thierry
8ea8cf5f56 refactor(dracut-install): add function to install one dependent module
This is prep work for adding support for fw_devlink suppliers
dependencies.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2023-02-13 13:29:12 +00:00
dependabot[bot]
88aeca2a38 chore(deps): bump luizm/action-sh-checker from 0.2.2 to 0.5.0
Bumps [luizm/action-sh-checker](https://github.com/luizm/action-sh-checker) from 0.2.2 to 0.5.0.
- [Release notes](https://github.com/luizm/action-sh-checker/releases)
- [Commits](https://github.com/luizm/action-sh-checker/compare/v0.2.2...v0.5.0)

---
updated-dependencies:
- dependency-name: luizm/action-sh-checker
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-13 12:12:21 +00:00
Laszlo Gombos
16931f5236 chore(shfmt): update to pass with shfmt v3.5.1 2023-02-13 12:08:36 +00:00
Antonio Alvarez Feijoo
d777dd3dab fix(fips): move fips-boot script to pre-pivot
This is needed in s390x to be able to use the same `boot=` command line
parameter in grub and zipl. Otherwise, `boot=` would need to be added only to
`grub.cfg` (not `/etc/default/grub` and thereby not to `/boot/zipl/config`).

Signed-off-by: Raymund Will <rw@suse.com>
2023-02-13 12:00:01 +00:00
Antonio Alvarez Feijoo
ab26ad2c2a fix(fips): only unmount /boot if it was mounted by the fips module
The `do_fips` method should only unmount /boot if it was mounted in the
`mount_boot` method.

In addition, now the `mount_boot` method checks if /boot is already mounted.

Signed-off-by: Raymund Will <rw@suse.com>
2023-02-13 12:00:01 +00:00
Antonio Alvarez Feijoo
68d0653e35 feat(fips): add progress messages
This allows to better understand at what point a FIPS integrity test failed.

Signed-off-by: Raymund Will <rw@suse.com>
2023-02-13 12:00:01 +00:00
Antonio Alvarez Feijoo
1fabbb6412 fix(fips): do not blindly remove /boot
The `mount_boot` method called from fips-noboot.sh in the pre-pivot hook blindly
executes `rm -rf /boot` if there is no `boot=` command line parameter, without
first checking that /boot is not already mounted by other means.
2023-02-13 12:00:01 +00:00
Laszlo Gombos
c95075e2c7 chore(base): remove support for <udev-176
This reverts 579238a3ac.

Keep the support for prepare_udev_rules for out-of-tree
dracut modules and issue a deprecation warning.
2023-02-13 11:58:52 +00:00
Laszlo Gombos
d6cef3f28e fix(plymouth): remove /etc/system-release dependency
/etc/*release files should not be managed in the plymouth module
and more importantly dracut assumes /etc/os-release not
/etc/system-release
2023-02-13 11:18:58 +00:00
наб
e3a7112bef feat(resume): also consider resume= in the cmdline as enabling hibernation
Don't consider noresume to disable, that's a single-boot flag

Closes #924
2023-02-13 10:57:11 +00:00
Beniamino Galvani
d8a9a73df9 fix(network-manager): add "After" dependency on dbus.service
During shutdown, there is no ordering dependency between the nm-initrd service
and the D-Bus daemon, and so the latter can be stopped before. This causes
issues to NetworkManager, especially when team interfaces are present because
NM will see teamd dropping from the bus and will try to reactivate the
connection.

Add a "After" dependency to make sure the D-Bus daemon is stopped after NM on
shutdown.
2023-02-13 10:54:41 +00:00
Laszlo Gombos
1597076887 fix(fido2): libfido2.so depends on libz.so
Co-authored-by: cs50guy2
2023-02-13 10:51:42 +00:00
Antonio Alvarez Feijoo
9a531ca044 fix(dracut-install): continue parsing if ldd prints "cannot execute binary file"
When the kernel is compiled without IA32_EMULATION and the glibc 32-bit library
is installed on the system, `ldd` prints the following output:

```
> ldd /usr/lib64/libfido2.so.1.12.0
/bin/ldd: line 162: /lib/ld-linux.so.2: cannot execute binary file: Exec format error
	linux-vdso.so.1 (0x00007ffd627fa000)
	libcbor.so.0.9 => /lib64/libcbor.so.0.9 (0x00007f18d799f000)
	libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007f18d7400000)
	libudev.so.1 => /lib64/libudev.so.1 (0x00007f18d7971000)
	libhidapi-hidraw.so.0 => /lib64/libhidapi-hidraw.so.0 (0x00007f18d7968000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f18d794e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f18d7205000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f18d79f9000)
> echo $?
0
```

The `ldd` script uses the following code to resolve dependencies:

```
RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"
...
RTLD=
ret=1
for rtld in ${RTLDLIST}; do
  if test -x $rtld; then
    verify_out=`${rtld} --verify "$file"`
    ret=$?
    case $ret in
      [02]) RTLD=${rtld}; break;;
    esac
  fi
done
```

So, if the 32-bit library fails, the 64-bit library may work, so don't stop
parsing the `ldd` output unconditionally when the message "cannot execute binary
file" is printed.

Fixes issue #2190
2023-02-13 10:21:53 +00:00
0x5c
7b530f2636 fix: make iso-scan trigger udev events
Fixes #2183
2023-02-13 08:56:39 +01:00
Beniamino Galvani
ab07f6d1ee ci: enable test 60
It's hopefully stable now.
2023-02-13 08:53:39 +01:00
Beniamino Galvani
3d7c0ffbd6 fix(test): rename test 60
The test *also* checks the generation of ifcfg files, but it's primarily a test
for bonding, bridging and VLANs. Update the name to reflect this.
2023-02-13 08:53:39 +01:00
Beniamino Galvani
5e846cb132 fix(test): improve test 60
The test has the following issues:

 - it sets up a bridge on net1 and net2, however those interfaces
   are part of the same qemu hub and this causes switching loops;

 - the bonds are created on two interfaces but only one has a DHCP server, and
   this causes random failures;

 - the checks performed on the client are pretty limited.

Rework the test:

 - avoid the bridging loop;

 - update the topology to use a bond interface on the server side;

 - introduce additional checks on the client: start a ping and check that ports
   are properly attached to bonds and bridge;

 - make it possible to return module-specific information from the client; in
   the future this can be added for example to check that the NetworkManager or
   systemd-networkd configuration is correct.
2023-02-13 08:53:39 +01:00
Beniamino Galvani
8f44740f2c fix(test): remove leftover link file from server rootfs
01-client.link must be removed, otherwise it conflicts with 01-server.link that
sets a different naming policy.
2023-02-13 08:53:39 +01:00
Beniamino Galvani
9fb64d96ab fix(test): assign fixed address to bridge
Kernel uses the lowest MAC of all attached ports as MAC address of the
bridge. However, after the first port gets attached, DHCP can be started on the
bridge and it will use the MAC (and client-id) of the first port; so, the MAC
used for DHCP depends on the order of attachment of ports, which is not
guaranteed to be stable in general.

To make sure that the DHCP server always sees the request from the MAC of
enp0s1, assign that MAC to the bridge from the kernel command line.
2023-02-07 14:40:11 +01:00
Beniamino Galvani
462d9b9254 fix(test): bump DHCP timeout to 30 seconds
The current interval (3 seconds) is very low and causes sporadic failures
especially when DHCP is run on a bridge (TEST-50-MULTINIC); in that specific
case, interfaces take time to be attached to the bridge and before enp0s1 is
attached all DISCOVER packets are lost.

Bump the timeout to a more robust value of 30 seconds.
2023-02-07 14:40:11 +01:00
Beniamino Galvani
da95948333 fix(test): remove check on dhclient support for --timeout
The network-legacy dracut module already ignores the DHCP timeout option when
it's not supported by dhclient. Other network modules don't use dhclient for
DHCP.
2023-02-07 14:40:11 +01:00
Beniamino Galvani
d3993c7dab fix(test): adapt multinic test for new NetworkManager versions
Since version 1.42, NetworkManager creates a "external" connection for the
loopback interface. Ignore that connection in the multinic test.
2023-02-07 14:40:11 +01:00
Khem Raj
70aeb4c1a5 fix(install): do not undef _FILE_OFFSET_BITS
_FILE_OFFSET_BITS is a feature test macro to determine largefile
support. Usually its set to 64 on systems supporting LFS. Its also
needed to be set to 64 for supporting 64bit time_t on glibc on 32bit
systems. If its undefined explicitly, then 64bit time_t can not be
enabled.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-02-06 07:19:58 -05:00
dependabot[bot]
18c5fb6ae0 chore(deps): bump docker/build-push-action from 3 to 4
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 4.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-02 08:26:43 +01:00
Antonio Alvarez Feijoo
6f4a5c90ab fix(dracut.sh): --sysroot option broken if global variables not set in conf
When `$dracutsysrootdir` is set and references an existing directory, the
internal global variables are never set, unless their value is assigned via
configuration file.

The simple fix would be turn all:

```
[[ -d $dracutsysrootdir$var ]] || var=value
```
into:
```
[[ -z $var || ! -d $dracutsysrootdir$var ]] && var=value
```

But this patch also includes a refactoring, removing duplicate code using the
same `set_global_var` function to set and export global variables, and improving
readability.
2023-02-02 08:13:30 +01:00
Antonio Alvarez Feijoo
823de8fe53 refactor(dracut-init.sh): remove redundant "dracut" from "dracut module" prints
In a similar fashion than "Including module" prints.
2023-02-02 08:11:24 +01:00
Antonio Alvarez Feijoo
a10078a5c3 feat(dracut-init.sh): specify if a module cannot be found or cannot be installed
Do not print the same error message for both situations.
2023-02-02 08:11:24 +01:00
Antonio Alvarez Feijoo
1f84ff882f fix(lsinitrd.sh): handle filenames with special characters
Printing and unpacking of specific files passed as arguments does not work if
their filenames contain special characters with a hexadecimal character escape
(\x), which is often the case for systemd device units.
2023-01-31 08:44:57 +01:00
Antonio Alvarez Feijoo
eb75861c2a fix(dracut-systemd): remove unused argument
The `generator_wait_for_dev` function of the dracut rootfs systemd generator
only uses the first argument. Moreover, RDRETRY is unset at this point.
2023-01-27 16:55:03 +01:00
Antonio Alvarez Feijoo
a109c6123f feat(lvm): always include all drivers that LVM can use
This patch adds all the kernel modules that might be needed by LVM, to avoid
having to rebuild the initrd in hostonly mode after a dynamic change that
requires new drivers to boot.

For example, LVM allows to dynamically convert a linear logical volume to a
RAID-1 type (`lvconvert --type raid1 vg/lv`), which, in hostonly mode, will
require the user to manually rebuild the initrd again to include the new RAID
drivers in use, otherwise the system will fail to boot.
2023-01-27 16:16:35 +01:00
Antonio Alvarez Feijoo
1aafcab935 fix(dracut-init.sh): correct typo in comment 2023-01-27 08:03:54 +00:00
Antonio Alvarez Feijoo
cda6b00abc fix(dracut.sh): correct --help and --version exit codes
Both are valid options that cause regular program termination without errors, so
dracut should return 0.
2023-01-27 08:02:57 +00:00
Antonio Alvarez Feijoo
e971c788f0 refactor(virtiofs): remove exit after die
The `die` function already ends with `exit 1`.
2023-01-27 08:01:50 +00:00
Laszlo Gombos
3c16c76fb5 ci: fix Gentoo container used for testing 2023-01-19 14:22:22 +01:00
LinkTed
e3e8108eb7 fix(crypt-gpg): do not use always --card-status
If no GPG smart card is used then the card-status breaks the decryption
of the keyfile. Therefore, use the card-status only if a smart card is
used to decrypt the keyfie.

Fixes issue #2004
2023-01-06 15:07:49 -05:00
Jóhann B. Guðmundsson
f6bb4a36b7 docs(RELEASE.md): update release docs
- Remove the reference to Harald's git ci alias
- Added a missing push to master
- Added a warning not to add the Rendered View entry from the NEWS.md to
  the tags. ( Github adds that to the release with no way of removing it, see 058 )
- Added validation of the new tag ( Good practice )
- Clarify milestone handover.
2023-01-05 23:49:37 -05:00
Laszlo Gombos
b060945c45 ci: disable test 50
Test 50 (MULTINIC) seems to be the only test that prevents
the project from having an all passing continuous integration
test suite.
2023-01-04 10:18:08 +01:00
Antonio Alvarez Feijoo
88fe9205de fix: shellcheck 0.8.0 2023-01-04 05:38:58 +00:00
Laszlo Gombos
9333944436 fix(dmsquash-live): live:/dev/*
fix a bug introduced in 71cfa2e22

make sure root is set correctly for both of the following cases
 - "root=live:/dev/*"
 - "rd.live.image root=/dev/*"
2023-01-03 15:09:12 +01:00
Frederick Grose
10cf8e46f4 fix(load_fstype): avoid false positive searchs
Refactor to avoid substring matches
  and to speed processing.
Also avoid xtracing.
2022-12-30 09:13:00 -05:00
Laszlo Gombos
08b63a2529 fix: shellcheck 0.8.0 2022-12-30 09:10:00 -05:00
наб
94dcac7ccd refactor(dracut-install): strerror(errno) -> %m 2022-12-28 16:37:51 +01:00
наб
efd4ca271f perf(dracut-install): don't strdup() environment block 2022-12-28 16:37:51 +01:00
наб
77226cb412 perf(dracut-install): don't reallocate {src,dst}path in hmac_install() 2022-12-28 16:37:51 +01:00
наб
a20556f0e5 perf(dracut-install): don't strdup() excessively for dracut_install() 2022-12-28 16:37:51 +01:00
наб
e7ed8337bb perf(dracut-install): stat() w/unused buf -> access(F_OK) in dracut-install 2022-12-28 16:37:51 +01:00
наб
751a110f29 perf(dracut-install): multiple single-character strstr()s -> strpbrk() 2022-12-28 16:37:51 +01:00
наб
1e5237dd77 chore: remove src/install/hashmap.lo 2022-12-28 16:37:51 +01:00
Laszlo Gombos
9dbbebb133 feat(network-wicked): remove module
wicked is being phased out from openSUSE
https://news.opensuse.org/2022/01/28/bash-systemd-libvirt-update-in-tw/
2022-12-28 08:40:23 +01:00
Jóhann B. Guðmundsson
0aa08f0ebf docs: update NEWS.md and AUTHORS 2022-12-24 16:49:27 +00:00
Jóhann B. Guðmundsson
794ce5e3ee fix(NEWS.md): add missing entries
I somehow managed to screw the update of news when making a release fixing my
mistake.
2022-12-24 16:10:39 +00:00
Antonio Alvarez Feijoo
b3d219b475 fix(systemd-timedated): add missing dbus-org.freedesktop.timedate1.service
Without this service, timedatectl fails to run in the initrd.

```
sh-5.2# timedatectl
Failed to query server: Could not activate remote peer: activation request failed: unknown unit.
sh-5.2# systemctl status dbus | grep timedate
Dec 22 13:57:03 sd-net-test dbus-broker-launch[219]: Activation request for 'org.freedesktop.timedate1' failed: The systemd unit 'dbus-org.freedesktop.timedate1.service' could not be found.
```
2022-12-24 14:30:54 +00:00
Antonio Alvarez Feijoo
4fca292b95 fix(systemd-hostnamed): add missing dbus-org.freedesktop.hostname1.service
Without this service, hostnamectl fails to run in the initrd.

```
sh-5.2# hostnamectl
Failed to query system properties: Could not activate remote peer: activation request failed: unknown unit.
sh-5.2# systemctl status dbus | grep hostname
Dec 22 11:07:56 sd-net-test dbus-broker-launch[216]: Activation request for 'org.freedesktop.hostname1' failed: The systemd unit 'dbus-org.freedesktop.hostname1.service' could not be found.
```
2022-12-24 14:30:19 +00:00
Antonio Alvarez Feijoo
7ed0461810 fix(dbus-broker): add missing sockets.target.wants/dbus.socket
If dbus.socket is not started automatically in the initrd, all binaries that
require dbus to work fail.
2022-12-24 14:29:25 +00:00
Antonio Alvarez Feijoo
a540c95bbf fix(systemd-hostnamed): correct sysusers configuration
Lines of type 'g' don't take a GECOS field.
2022-12-24 14:28:28 +00:00
Laszlo Gombos
776075ea12 test(FULL SYSTEMD): make test 04 use the test dracut modules
Add test case for systemd.unit and  systemd.mask arguments
instead of extra test setup steps.
2022-12-22 09:09:03 +01:00
Laszlo Gombos
8f10cbe77f test(FULL SYSTEMD): remove unnecessary dependencies 2022-12-22 09:09:03 +01:00
Laszlo Gombos
b55563f635 feat(overlayfs): add new overlayfs module to dracut.spec 2022-12-22 08:15:35 +01:00
Antonio Alvarez Feijoo
b4de9ee107 fix(zipl): remove trailing spaces from zipl boot device name
Trailing spaces are misleading blkid input after fixes for shellcheck were
introduced in https://github.com/dracutdevs/dracut/commit/d75b029a

Test showing the wrong output:

```
localhost:~ # _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
localhost:~ # echo "[${_boot_zipl}]"
[/dev/disk/by-path/ccw-0.0.0000-part1  ]
localhost:~ # blkid -s TYPE -o udev "${_boot_zipl}"
localhost:~ # blkid -s TYPE -o udev ${_boot_zipl}
ID_FS_TYPE=ext2
```

Also, remove duplicate code by creating a function to get the zipl boot device,
prepend $dracutsysrootdir to /etc/fstab and print cmdline properly: start
with a space and do not print a newline.
2022-12-21 17:16:47 +00:00
Kenneth D'souza
e877be69b4 fix(lsinitrd.sh): add a missing path to image
The initramfs file for Fedora/RedHat CoreOS can be found under
`/lib/modules/${KERNEL_VERSION}/initramfs.img', add this path
to image search logic.

Signed-off-by: Kenneth D'souza <kennethdsouza94@gmail.com>
2022-12-21 16:53:20 +00:00
Antonio Alvarez Feijoo
9cc7ceec1e fix(dracut): allow to set persistent policy based on /dev/mapper device names
Currently, dracut only allows to configure the persistent policy to address
disks and partitions using any directory name found in /dev/disk, but there is
no defined way to set the default policy based on /dev/mapper device names. So,
for example, if the persistent policy is set by the distribution in any
configuration file, the user cannot set the default if he wants to.

The current workaround is to set persistent_policy="" in a conf file or pass
--persistent-policy " " (white space) as an argument. This patch aims to
establish a specific value for this case.
2022-12-21 16:29:39 +00:00
Kairui Song
d460941b51 fix(dracut-init): make require_kernel_modules ignore no kernel build
If --no-kernel is specified, kernel module checking won't work, just
skip it.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-12-21 17:07:46 +01:00
Kairui Song
7917d7976d fix(iscsi): don't install the module if kernel doesn't support iscsi
The cmdline hook of iscsi module will force check if iscsi_tcp module
is available, and abort the boot progress is not. But actually iscsi
module shouldn't be allowed to be installed in the first place if the
corresponding kernel doesn't support it.

So print an warning and refuse to install the iscsi dracut module
in such case, instead of dying on reboot.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-12-21 17:07:46 +01:00
Kairui Song
d4a9d6b4c0 feat(squash): use require_kernel_modules for better module checking
require_kernel_modules prints more friendly erorr message and make the
code cleaner.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-12-21 17:07:46 +01:00
Kairui Song
d3a5e6312a feat(dracut-init.sh): introduce a new helper require_kernel_modules
Some dracut modules won't work without certain kernel modules,
this helper will be helpful for checking such kernel configs in
check() and error out early.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-12-21 17:07:46 +01:00
Kairui Song
6c42d378ab fix(dracut-functions.sh): check_kernel_module should follow dracutsysrootdir
check_kernel_module calls modprobe and tries to dry-run a module load to
check if a module is available. modprobe supports `-d` to specify a
rootdir, so just pass dracutsysrootdir to it to make it work as expected
when building initramfs for another rootfs.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-12-21 17:07:46 +01:00
Laszlo Gombos
f66a02e5a9 ci: there is no longer a need for special handling test 04 2022-12-21 16:17:46 +01:00
Laszlo Gombos
2bb1c4f7f3 ci: reduce the timeout for local tests to 30 min
The main motivation here is to do not allow each test to grow beyond
30 min. If a longer test is needed for some reason, it should be
split into two tests.

Currently each local test is passing at 20 min.

The longest running local test is test 12: encrypted LVM PV
on a degraded RAID-5.
2022-12-21 16:17:46 +01:00
Laszlo Gombos
58e2311589 ci: run all local tests on all containers 2022-12-21 16:17:46 +01:00
Laszlo Gombos
31938c5980 refactor(dmsquash-live): move ntfs-3g code to dmsquash-live-ntfs
Since the installation of ntfs-3g binary is in the
dmsquash-live-ntfs module, calling ntfs-3g from dmsquash-live fails
when dmsquash-live-ntfs module is not installed anyways.
2022-12-21 14:30:48 +00:00
Antonio Alvarez Feijoo
d32d221efd fix(dracut.sh): split drivers_dir check
The directory where to look for kernel modules can be set via the -k/--kmoddir
command line option or the drivers_dir configuration option. Its current check
should be split into two different ones to avoid misleading error messages (see
referenced issue):
- First check that its basename matches the kernel version set for the initramfs
(via --kver or automatically set by "uname -r").
- Second check that the parent directory of the last provided directory contains
"/lib/modules/". This check was also fixed to avoid accepting other directories
like "xxxlib/modules".

Fixes issue #1608
2022-12-21 14:28:30 +00:00
Antonio Alvarez Feijoo
8d46cc01a9 perf(dracut.sh): do not mkdir $initdir/lib/dracut within a loop
This directory is always needed to store files like modules.txt and
build-parameter.txt, so always create it, but only in one place.
2022-12-21 14:14:45 +00:00
Antonio Alvarez Feijoo
e3ec51e128 fix(systemd-timesyncd): typo in systemd-time-wait-sync.service local conf path 2022-12-21 13:34:04 +00:00
Scott Moser
7d3184e430 fix(lvm): drop dm-eventd binary and libs from initramfs
Per David Teigland:

 > dmeventd is not meant to be run in the initrd. When it's started
 > later, it will monitor LVs activated by the initrd if needed.

So, lets git rid of the dmeventd binary and the libraries that were
being added for it.
2022-12-21 12:44:50 +00:00
Laszlo Gombos
5b92eeba83 test: disable debug logging by default
This makes the the tests more consistent, run faster by default
and less likely to timeout on the CI.
2022-12-21 12:39:45 +00:00
Laszlo Gombos
1586621b19 test: do not omit dash module
It should not be necessary to explicitly omit dash module.
If this is needed, that would mean that bash is not marked
as an explicit dependency for some modules.
2022-12-21 12:12:04 +00:00
Antonio Alvarez Feijoo
097dd367bb fix(dracut): shellcheck regression in DRACUT_INSTALL calls
If the DRACUT_INSTALL environment variable contains arguments (e.g.:
DRACUT_INSTALL="/usr/lib/dracut/dracut-install --debug"), its call cannot
be enclosed in double quotes. E.g.:

```
> export DRACUT_INSTALL="/usr/lib/dracut/dracut-install"
> "$DRACUT_INSTALL" > /dev/null
dracut-install: No SOURCE argument given
> export DRACUT_INSTALL="/usr/lib/dracut/dracut-install --debug"
> "$DRACUT_INSTALL" > /dev/null
-bash: /usr/lib/dracut/dracut-install --debug: No such file or directory
> $DRACUT_INSTALL > /dev/null
dracut-install: No SOURCE argument given

```
2022-12-21 12:10:01 +00:00
Laszlo Gombos
e450085eb8 ci: introduce more networking options into test containers
Add systemd-networked to Fedora container.
Add connman to Arch container.

This change enables manual testing of various network configurations
and also allows the ci to ensure that having additional networking
packages installed does not break the network meta module.
2022-12-21 11:31:24 +00:00
Mikhail Novosyolov
e0d57a8f5b fix(90kernel-modules): MMC and NVMe on kernels 6.0+
Commit 6f8191fdf41 ("block: simplify disk shutdown") in Linux kernels 6.0 and above
renamed blk_cleanup_disk to blk_mq_destroy_queue. Adapt code to handle both cases.

Because of this the kernel module mmc_block.ko was not included into initrd on kernel 6.1:
dracut-install: No symbol or path match for '/lib/modules/6.1.0-generic-0.rc7.1rosa2021.1-x86_64//kernel/drivers/mmc/core/mmc_block.ko.zst
while on kernel 5.15 it was included:
dracut-install: Handling /lib/modules/5.15.79-generic-1rosa2021.1-x86_64//kernel/drivers/mmc/core/mmc_block.ko.zst
dracut-install: Module mmc_block: symbol blk_cleanup_queue matched inclusion filter

It made booting OS from root on /dev/mmcblk* impossible.

Just adding blk_mq_destroy_queue was not enough to make mmc_block.ko be included into initrd
(maybe because call of blk_cleanup_disk() was removed and call of blk_mq_destroy_queue() was not added).
So also adding blk_mq_alloc_request which is used from mmc_block.

Fixes: https://github.com/dracutdevs/dracut/issues/2102
2022-12-19 07:53:15 -05:00
keentux
28f3772444 refactor: use read -r instead of cat
Fixes #2093: Bad style `var=$(cat <file>)`. Replace by `read -r var < file`

Signed-off-by: keentux <valentin.lefebvre@suse.com>
2022-12-19 10:43:37 +01:00
Laszlo Gombos
376c2360b5 ci: document workaround for Gentoo 2022-12-19 10:00:52 +01:00
Laszlo Gombos
7299c14e0e test: rpc.idmapd is optional for NFS
See dracut NFS module (95nfs/module-setup.sh).
2022-12-19 10:00:52 +01:00
Laszlo Gombos
fa18c4133d ci: add networking to Gentoo test containers
nfs-utils and dhcp is needed to test nfs.
nbd is needed to test nbd.
2022-12-19 10:00:52 +01:00
Laszlo Gombos
52d14607d1 fix(network): check if ip command fails 2022-12-17 07:29:54 -05:00
tupper
1d6f42c8a4 fix(network): two bugs which cause minutes long boot times
Caused by unneeded arping to the default gateway.
2022-12-17 07:29:54 -05:00
Laszlo Gombos
037eda7ce4 ci: install shfmt with dnf into openSuse container
Remove the special handling for shfmt binary.

No need to grab a specific version of the shfm binary that
is not tested together with the distribution.
2022-12-15 15:23:24 +01:00
Laszlo Gombos
718e49e0f7 ci: make sure portage command working inside Gentoo container
Do not remove /var/db/repos/gentoo as it breaks portage.
2022-12-15 15:23:24 +01:00
Laszlo Gombos
55ddaef4ca ci: add mdadm to Gentoo container to run test 10 2022-12-15 15:23:24 +01:00
Laszlo Gombos
22d56ca0e4 ci: add tools for thin provisioning to Debian and Gentoo container for test 17 2022-12-15 15:23:24 +01:00
Laszlo Gombos
4797c5b9e9 ci: add dmraid to Debian and Gentoo container to run test 14 2022-12-15 15:23:24 +01:00
Laszlo Gombos
43c16bfac4 ci: seperate local and network tests
Configure network module outside of test.sh scripts
to allow for parallelizm and flexibility.

Remove NM test directory wrappers and set network
in Github action instead.

This is in preparation to test other dracut network modules
such as systemd-networkd dracut module.
2022-12-07 17:14:42 +01:00
Laszlo Gombos
8fc0dac4a4 test: do not omit dracut networking modules
The main motivation of this change is to prepare to enable
testing all four networking dracut modules not just two.

There are four networking modules supported currently.
Omitting one networking module not only is not necessary but
confusing as if the test really wants to omit networking modules,
it should omit all three non-used dracut networking modules.
2022-12-07 17:14:42 +01:00
Antonio Alvarez Feijoo
7debf540ca feat(kernel-modules): exclude USB drivers in strict hostonly mode
Provide a way to avoid installing all USB drivers in some use cases where they
are not needed, i.e., machines without a USB bus.
2022-12-07 09:34:32 -05:00
Laszlo Gombos
a6395e4361 ci: install procps-ng into Fedora container 2022-12-07 08:49:07 +01:00
Laszlo Gombos
d0a5b039dd ci: set DEBUGFAIL to rd.debug when debug logging is enabled
GitHub Actions allow to opt-in to more debug logging both on
web UI and on the command line.

When GitHub Action debug logging is enabled also enable
additional dracut test debugging by setting DEBUGFAIL to rd.debug.

This is particularly useful when re-run failed jobs with
debug logging enabled.
2022-12-05 16:24:02 +00:00
Laszlo Gombos
bf545567ab ci: remove native dracut installation from the test containers
The installed packaged dracut version from a distributions can
interfere with testing latest dracut from source, which is the
primary goal of these containers.
2022-12-05 15:43:08 +01:00
Laszlo Gombos
3e77f5194e ci: teach manual test workflow to run several tests
Timesaver for running tests during development and reviews.
2022-12-05 10:44:45 +01:00
Laszlo Gombos
8c0fc137ca docs: document the new release process
Release tarballs are only available on github from now on.
2022-12-05 09:57:12 +01:00
Henrik Gombos
518133714b fix(base): do not require chroot inside initramfs
dracut can be invoked inside a chroot, but inside
the generated initramfs the chroot binary is not required.

add chroot to the generated initramfs if debug or selinux
dracut modules are enabled.
2022-12-05 09:19:42 +01:00
Laszlo Gombos
57ace7c75c test: remove dead code regarding special handling of test 99 2022-12-03 14:46:30 +00:00
Antonio Alvarez Feijoo
4b931bfb4f fix(systemd-coredump): correct systemd-coredump binary path
This issue went unnoticed because the systemd module always installs the
systemd-coredump binary using the right path.
2022-12-03 14:43:12 +00:00
Laszlo Gombos
d40617f720 feat(fs-lib): fsck_single can now handle PARTLABEL and PARTUUID
As an additional benefit, gentoo container now passing test-01.
2022-12-03 14:09:31 +00:00
Antonio Alvarez Feijoo
a86aea6518 fix(dracut.sh): use DRACUT_ARCH instead of uname -m
DRACUT_ARCH overrides `uname -m` since
https://github.com/dracutdevs/dracut/commit/a0120420
2022-12-03 11:33:50 +00:00
Antonio Alvarez Feijoo
240a1d34bd fix(base): remove grep dependency
The base module requires grep with the `rd.memdebug=1` command line parameter.
As this code is broken if grep is not added by other means and grep is only
required for this, rewriting this code to avoid the dependency.
2022-12-03 11:31:19 +00:00
keentux
4a9b165de0 refactor(zfcp_rules): use read -r instead of cat
Fixes #1268: Bad style `var=$(cat <file>)`. Replace by `read -r var < file`

Signed-off-by: keentux <valentin.lefebvre@suse.com>
2022-11-28 12:16:05 +01:00
Laszlo Gombos
fd9cd02cb2 test(TEST-99-RPM): remove test
This test is specific to rpm packaging and has been disabled
for a while.
2022-11-22 08:50:59 +01:00
Laszlo Gombos
ab23d89a20 test(16): make DMSQUASH test use the test dracut modules 2022-11-22 08:42:21 +01:00
Laszlo Gombos
fe88c3f7f1 ci: add tests 50,51,62 to the integration test suite
Test 50,51 tests root filesystem on NFS with multiple nics.
Test 62 tests skipcpio.
2022-11-22 08:34:05 +01:00
Laszlo Gombos
32f6dd1d5f fix(github): yml syntax and commit message for dependabot
Also fix commit message prefix.
chore(github):(deps): bump ... --> chore(deps): bump ...
2022-11-21 15:19:17 +00:00
Laszlo Gombos
9f6b4e5336 test: use -device instead of -watchdog to remove qemu warnings 2022-11-18 10:21:44 +00:00
Laszlo Gombos
fac851814f test: make test 01 and 02 use the test dracut modules 2022-11-18 10:21:44 +00:00
Laszlo Gombos
48641207f2 test: explicitly check if systemctl is available for systemd tests
Dracut tests already do similar checks for test 40, 62, 63 and 98.

This is useful when the full testsuite is run and systemd is not
available.
2022-11-18 10:19:50 +00:00
Laszlo Gombos
62f0981d16 chore(ci): bump docker/setup-buildx-action from 1 to 2
v2 has node 16 as default runtime.
2022-11-18 05:07:09 +00:00
Laszlo Gombos
62f7e0621a ci: add mkfs.ntfs and ntfs-3g to test containers
ntfs-3g is needed to test dmsquash-live-ntfs
2022-11-14 10:03:57 +01:00
Laura Hild
69e9fc84e2 docs: correct "rd.blacklist" 2022-11-11 19:49:44 -05:00
Antonio Alvarez Feijoo
e1058b07ea fix(dracut-systemd): run systemctl daemon-reload after remove_hostonly_files
Dependencies to systemd .device unit files are marked as "hostonly" in the
special file hostonly-files. These .device unit files can be removed using the
`rd.hostonly=0` command line parameter. But, since systemd v252
(https://github.com/systemd/systemd/pull/24054), the initrd-parse-etc.service
service does not run `systemctl daemon-reload`, so systemd keeps waiting
for these .device units to show up.
This means that if a hostonly device is not available for any reason at boot
time, using `rd.hostonly=0` has no effect and the system will not boot.
2022-11-11 20:10:30 +00:00
Laszlo Gombos
60c4b2f76a ci: upgrade to actions/checkout@v3
It resolves the following warning:
Please update the following actions to use Node.js 16: actions/checkout
2022-11-11 15:43:35 +01:00
Neal Gompa
33679fff5d fix(kernel-modules): add sysctl to initramfs to handle modprobe files
Users were seeing errors like this:

[     2.917246] dracut-pre-udev[717]: sh: line 1: /sbin/sysctl: No such file or directory

This was the result of modprobe.d files that needed to call sysctl
and failing because sysctl wasn't included in the initramfs.

This change makes it so that we have the binary included so those
modprobe configuration files work properly.
2022-11-11 11:26:13 +01:00
Laszlo Gombos
4a5785a859 test(ISCSI-NM): fix failing test
server fails to startup with /sbin/sysctl: not found
2022-11-07 18:04:47 +01:00
Laszlo Gombos
1d60dd74ee ci: remove non-existing modules from labeler 2022-11-07 18:04:47 +01:00
Laszlo Gombos
d3ac78af96 ci: teach labeler about test dracut modules 2022-11-07 18:04:47 +01:00
Laszlo Gombos
8d9868cf91 test: remove layering violation from the make system
Tests should not try to build dracut itself. Test should assume dracut
is built and availabnle to run.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
2d7508dc30 test: only set basedir if it is not set by the invoker
Set basedir in test-functions instead of Makefile.
This change will allow to use a different basedir without
modifying Makefiles.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
c799af4078 test: remove suppressing shellcheck messages
They are no longer needed.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
10277bb606 test: move more execution to dracut command line
use the -I argument to install dd and mkfs.btrfs
use the -i argument to install the hook
btrfs is already installed by the btrfs dracut module
sfdisk is not used
2022-11-07 18:04:47 +01:00
Laszlo Gombos
f6ffda48dd test: move more common dependencies from test case to test-root module
umount setsid sync binaries are used in all test cases to build rootfs
2022-11-07 18:04:47 +01:00
Laszlo Gombos
d8dbdcc287 test: remove unused dependencies 2022-11-07 18:04:47 +01:00
Laszlo Gombos
f26275b974 test: move more execution to dracut command line 2022-11-07 18:04:47 +01:00
Laszlo Gombos
d6e8d5bc2c test: move plymouth installation from test case to test-root module 2022-11-07 18:04:47 +01:00
Laszlo Gombos
3bb8a85098 test: remove unused variable 2022-11-07 18:04:47 +01:00
Laszlo Gombos
fff80cc094 test: install debug module into what test case is booting into
This will also make some of the non-essential tools optional
instead of a hard dependency.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
7eb0ac977e test: building ld cache explicitly is no longer needed
dracut.sh will build the ld cache now
2022-11-07 18:04:47 +01:00
Laszlo Gombos
9cc136728e test: move common dependencies from test case to test-root module 2022-11-07 18:04:47 +01:00
Laszlo Gombos
b17a3103a5 feat(test-root): add new module to share code between tests
Use dracut to make a root filesystem instead of each test case.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
79504b6179 test: move finished-false.sh from test case to test-makeroot module 2022-11-07 18:04:47 +01:00
Laszlo Gombos
2532113c44 test: move common dependencies from test case to test-makeroot module
poweroff cp umount sync dd are commonly used by test cases to make
root filesystem.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
54b963ca35 feat(test-makeroot): add new module to share code between tests
This module is used for tests to create root filesystem.
2022-11-07 18:04:47 +01:00
Laszlo Gombos
7f62a9b6c9 test: move poweroff handling from test case to test module 2022-11-07 18:04:47 +01:00
Laszlo Gombos
f5689b42bd feat(test): add new module to share code between tests 2022-11-07 18:04:47 +01:00
Laszlo Gombos
c449980741 test: shutdown is not used for running tests 2022-11-07 18:04:47 +01:00
Laszlo Gombos
ba0b1b093d ci: fix Arch container
packages should be installed with -Syu instead of -Sy.
2022-11-07 17:20:48 +01:00
Laszlo Gombos
40dd5c90e0 feat(overlayfs): add a new module called overlayfs
Also split ovlfs variable with two different meaning.
2022-11-07 15:51:45 +01:00
Laszlo Gombos
8caaad4fc2 fix(dmsquash-live): add support for NFS
Move overlayfs mount out into its own dedicated file
so that we can call into it directly for NFS support.

Add a new test case for overlayfs on top of NFS.
2022-11-07 15:51:45 +01:00
Laszlo Gombos
11eef2cfd2 ci: use prebuilt Linux kernel binaries for Gentoo container
Also remove dmsetup. It does not build and it is not required for ci.
2022-11-07 15:06:27 +01:00
Marcos Mello
f7079e77a1 refactor(fs-lib.sh): udevadm info --query=property instead of --query=env
env is a long time deprecated alias to property, not listed in the man page for more than a decade.
2022-11-07 12:44:57 +00:00
Marcos Mello
b12ee558f5 fix(dracut-init.sh): instmods: wrong variable name
It worked most of the time because `dracut-install -o` returns 0 in normal circumstances.
2022-11-07 09:36:21 +01:00
Antonio Alvarez Feijoo
e78f71b9da fix(dmsquash-live-ntfs): remove unnecessary command 2022-11-05 20:27:59 +00:00
Cole Robinson
8194f72af2 feat(qemu): add efi_secret driver
Despite the generic name, the only current use of the `efi_secret`
is exposing data in /sys that's been injected into a SEV/SEV-ES
virtual machine. More info:

https://docs.kernel.org/security/secrets/coco.html

This secret is probably a luks password, so we need this driver at
boot time.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-11-05 16:22:44 -04:00
Jeremy Linton
415e5519d1 fix(90kernel-modules): add (nonstandard) NVMe drivers
The M1/etc hardware has an quirky NVMe disk controller that needs
a dedicated NVMe driver. Rather than picking up just that
bit of hardware pick up drivers that register NVMe controllers.

This also picks up NVMe-OF style drivers, but seems like a better
long term solution on Arm platforms which tend to have a lot
of odd hardware.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
2022-11-04 13:41:54 -04:00
Antonio Alvarez Feijoo
1ec479006f refactor(multipath): do not install the pidof binary
dracut-lib.sh provides a custom version of pidof, so there is no need to install
the pidof binary. Also, source dracut-lib.sh in hook scripts when needed.

Fixes issue #2027
2022-11-04 14:48:48 +00:00
Tao Liu
e9ed44c886 fix(dracut-functions.sh): suppress findmnt error msg if /etc/fstab not exist
When the rootfs of a virtual machine is virtiofs shared folder,
the /etc/fstab file may not exist. As a result, the "findmnt --fstab"
will complain "findmnt: can't read (null): No such file or directory"
when trying to rebuild kdump initramfs within the vm.

This patch checks if /etc/fstab exist before calling "findmnt --fstab"
to suppress the error message.

Before:
$ kdumpctl rebuild
kdump: Rebuilding /boot/initramfs-5.14.0-182.el9.x86_64kdump.img
findmnt: can't read (null): No such file or directory
findmnt: can't read (null): No such file or directory
findmnt: can't read (null): No such file or directory

After:
$ kdumpctl rebuild
kdump: Rebuilding /boot/initramfs-5.14.0-182.el9.x86_64kdump.img

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-11-04 08:09:30 +01:00
Brian C. Lane
6b592f581c fix(dracut-logger.sh): this fixes the dlog_init check for /dev/log
The /dev/log check was not correct, it would continue working if
/dev/log was a broken symlink. This changes the logic to be more clear
-- /dev/log needs to be a socket, and writable, and logger needs to be
available. If any of those conditions fail, turn off syslog and only use
console logging.
2022-11-02 23:49:47 -04:00
Martin Wilck
cf31fcf804 feat(multipath): install tmpfiles.d config file
Recent multipath-tools (0.9.2) added a tmpfiles.d template. Install it
if present.
2022-10-27 08:33:23 +02:00
Laszlo Gombos
862ba52683 feat(dmsquash-live): add support for dash
Using dash instead of bash saves about 0.5M initramfs size.

Co-authored-by: nabijaczleweli <nabijaczleweli@nabijaczleweli.xyz>
2022-10-25 16:44:45 +02:00
Jóhann B. Guðmundsson
d345ca2efd feat(systemd-pcrphase): introducing the systemd-pcrphase module
Introducing the systemd-pcrphase module
2022-10-24 12:20:37 -04:00
Laszlo Gombos
444944ab37 fix(dracut.sh): make omit-drivers option do exact match for names
Modify the basic test case to use --omit-drivers and make it fail
without the PR and make it pass with the PR.

The test would fail with the following error without the PR:
FATAL: iscsiroot requested but kernel/initrd does not support iscsi
2022-10-24 15:19:37 +00:00
Laszlo Gombos
cc1c0ffdaa ci: integration test for openrc and musl 2022-10-24 10:45:52 -04:00
Laszlo Gombos
f2d181b778 chore(base): remove dead code
RD_TIMESTAMP is no longer used.
systemd-timestamp is not used.
2022-10-24 14:39:11 +00:00
Antonio Alvarez Feijoo
2d9f4b481b ci(suse.conf.example): update SUSE-specific config 2022-10-24 08:47:56 -04:00
Jóhann B. Guðmundsson
bdddfd561f feat(github): automating dependency updates
Let github's dependabot handle updating github's actions.
2022-10-24 08:44:37 -04:00
Tianhao Chai
02e646fc7e fix(multipath): install multipathd.socket 2022-10-22 11:50:08 -04:00
наб
77ac95d909 perf(90kernel-modules): use awk instead of shell monster
~120ms -> ~2ms

Downstream: https://bugs.debian.org/1017411
2022-10-22 13:08:07 +00:00
Antonio Alvarez Feijoo
03babd95e2 feat(systemd-portabled): introducing the systemd-portabled module
Introducing the systemd-portabled module.

It's intended to work only with raw binary disk images contained in regular
files, but not with directory trees.
2022-10-21 21:51:59 -04:00
Antonio Alvarez Feijoo
429f9de1c7 fix(network-manager): always install the library plugins directory
The library plugins directory is automatically added to the initrd if either
libnm-device-plugin-team.so or libnm-settings-plugin-ifcfg-rh.so are present on
the system, but both are optional libraries, and if it does not exist, the
NetworkManager issues a warning.
2022-10-21 21:49:56 -04:00
Antonio Alvarez Feijoo
cc669250af feat(dracut-init.sh): add inst_libdir_dir() helper
This helper function is similar to inst_libdir_file(), but it installs plain
directories located on a library directory instead of files.
2022-10-21 21:49:56 -04:00
Marcos Mello
f82edfed5c chore: adjust .kateconfig for C code 2022-10-21 21:09:28 -04:00
Marcos Mello
87d7df57c7 chore: remove editor configuration files from subdirectories
Keep only the toplevel ones.

Closes #1958
2022-10-21 21:09:28 -04:00
Antonio Alvarez Feijoo
b2d7561b98 fix(dracut): replace invalid lzo command with lzop for LZO compression
Fixes issue #1999
2022-10-21 23:41:10 +00:00
Marcos Mello
144279a597 refactor(dracut-install): resolve_deps: improve error message
Prefix + error description at the end.
2022-10-21 23:27:01 +00:00
Laszlo Gombos
ba0d7591a6 refactor(shutdown): move module specific code out of base module
dracut-lib.sh and the base module now does not have a knowledge
of oldroot and plymouth.

It improves the separation of concerns between the base module
and the shutdown module.
2022-10-21 22:36:03 +00:00
Antonio Alvarez Feijoo
23654c50b0 fix(network-legacy): check if dhclient has --timeout option
dhclient's --timeout option is not upstream, so a pre-check is needed before
using it.
2022-10-21 22:25:39 +00:00
Antonio Alvarez Feijoo
699e394589 fix(man): correct typo 2022-10-21 22:25:39 +00:00
Matt Coleman
a3c67d27e7 feat(dmsquash-live): add new dmsquash-live-autooverlay module 2022-10-15 14:01:27 -04:00
Matt Coleman
ef9ccd5446 ci: revert to actions/checkout@v1 in manualtest
This enables checkout to work in the Gentoo container.

See: https://github.com/actions/runner/issues/2115
2022-10-15 14:01:27 -04:00
Matt Coleman
61ae423bb0 docs: fix a typo in HACKING.md 2022-10-15 14:01:27 -04:00
Pavel Valena
8abffe7cca fix(dracut.spec): tpm2-tools is required for crypt module to work
tpm2-tools dependency can be can be pulled in case tmp2-tss package
is installed, using a soft conditional dependency.

https://bugzilla.redhat.com/show_bug.cgi?id=2077697
2022-10-07 11:59:19 +00:00
Martin Wilck
a90efdd704 fix(man): dracut.cmdline.7: clarify "rd.nvmf.discover=fc,auto" 2022-09-30 06:02:18 +00:00
Martin Wilck
2c26b70322 fix(network): avoid double brackets around IPv6 address
This code would add brackets twice. Fix it.
2022-09-30 06:02:18 +00:00
Martin Wilck
cf8986af7d feat(nvmf): set rd.neednet=1 if tcp records encountered
This is currently always the case for NBFT records.
We can do this now, as we run before parse-ip-options.sh
2022-09-30 06:02:18 +00:00
Martin Wilck
4b69e63b74 fix(man): dracut.cmdline(7): correct syntax for rd.nonvmf
rd.nonvmf=0 is a double negation, and wrong. Fix it.
2022-09-30 06:02:18 +00:00
Martin Wilck
f4e9ea879f fix(network): don't use same ifname multiple times
If multiple ibft interfaces exist, set_ifname() may reuse the same
name (usually "ibft0"), because it's usually called cmdline time,
when no interfaces exist in sysfs yet. Remember the number used
set and don't use it again.
2022-09-30 06:02:18 +00:00
Martin Wilck
a65fab6966 fix(nvmf): run cmdline hook before parse-ip-opts.sh
This way we can set "rd.neednet" and have it seen by parse-ip-options.sh
2022-09-30 06:02:18 +00:00
Martin Wilck
a93968b075 fix(nvmf): avoid calling "exit" in a cmdline hook
"exit" should never be executed in dracut hooks, because the
hooks are sourced by the main script.
2022-09-30 06:02:18 +00:00
Martin Wilck
556ef46aa9 fix(nvmf): make sure "rd.nvmf.discover=fc,auto" takes precedence
The command line may contain several rd.nvmf.discover options.
The "fc,auto" option should take precedence.
2022-09-30 06:02:18 +00:00
Martin Wilck
e93e46520d fix(nvmf): don't use "finished" queue for autoconnect
The "finished" initqueue is for testing if everything is alright,
not for triggering any actions.
2022-09-30 06:02:18 +00:00
Martin Wilck
03921ec09e fix(nvmf): don't create did-setup file
did-setup files are meant to indicate that an interface setup
was successful. Don't do it here.
2022-09-30 06:02:18 +00:00
Martin Wilck
a3cf4ec922 fix(nvmf): no need to load the nvme module
The module "nvme" is not required for NVMeoF.
2022-09-30 06:02:18 +00:00
Martin Wilck
b3ff3f3fbc fix(nvmf): don't try to validate network connections in cmdline hook
The cmdline hook runs before any network interfaces have been brought
up. There's no point in trying to validate the connections at this
stage.
2022-09-30 06:02:18 +00:00
Antonio Alvarez Feijoo
9664e98b5d fix(nvmf): nvme list-subsys prints the address using commas as separator
nvme-cli 1.x printed the address using spaces as separator, but nvme-cli 2.x
prints the address using commas as separator (exact output from sysfs). E.g.,
output from `cat /sys/class/nvme/nvme0/address`:

traddr=nn-0x201700a09890f5bf:pn-0x201900a09890f5bf,host_traddr=nn-0x200000109b579ef5:pn-0x100000109b579ef5

Also, I suppress rd.nvmf.discover= cmdline option if all fields are empty.
2022-09-30 06:02:18 +00:00
Laszlo Gombos
b17128465f ci: login and push containers as repository_owner 2022-09-30 05:42:27 +00:00
Laszlo Gombos
bc1bf6a19d test(SYSTEMD): make the man command succeed
Document the reason of the existing workaround.

Move the existing logic to the initramfs.testing generation phase
and make the steps more generic.

This change makes the test pass on debian.
2022-09-29 05:45:47 +00:00
Laszlo Gombos
31c4aac32d test: do not bring up the network interface if it is not needed
Notice that TEST-04 does not explicitelly includes dhclient
and dhclient-script for the rootfs.

Apply the same principle for all local tests that do not
need networking.

This should make the tests run faster and slightly more reliable.

This change also brings us to a better place where network-legacy
files are only gets included via proper dracut module inclusion.
2022-09-29 05:44:19 +00:00
Antonio Alvarez Feijoo
e2fdb30b56 fix(dracut-init.sh): add missing hostonly code in the inst_multiple function
It seems that commit https://github.com/dracutdevs/dracut/commit/4ef45f13 forgot
to add the code to handle the hostonly parameter in the inst_multiple function.
2022-09-29 05:41:17 +00:00
Antonio Alvarez Feijoo
0661a6a25b refactor(network-manager): use more precise global variables 2022-09-29 05:37:07 +00:00
Antonio Alvarez Feijoo
cd19da33f8 refactor(network-legacy): use more precise global variables 2022-09-29 05:37:07 +00:00
Antonio Alvarez Feijoo
1922b1264f refactor(systemd-timesyncd): use more precise global variables 2022-09-29 05:37:07 +00:00
Antonio Alvarez Feijoo
cbf7f4bc5b refactor(systemd-networkd): use more precise global variables 2022-09-29 05:37:07 +00:00
Antonio Alvarez Feijoo
744c6de5cd fix(network-manager): correct wrong local network configuration path 2022-09-29 05:37:07 +00:00
Antonio Alvarez Feijoo
2eb733cc11 fix(network-legacy): correct wrong local network configuration path 2022-09-29 05:37:07 +00:00
Antonio Alvarez Feijoo
b9dc999f87 fix(dracut.sh): correct wrong systemd variable paths
systemdsystemconfdir usually expands to /etc/systemd/system, but the local
configuration of systemd-networkd, systemd-timesyncd, portablectl and systemd
users is saved into directories whose parent is /etc/systemd
(systemdutilconfdir).

Also add missing exports.
2022-09-29 05:37:07 +00:00
Laszlo Gombos
027eee902d test(DMSQUASH): add test for overlay on top of a block device
Add a test for mounting root filesystem with overlay for /dev/sdb.

The existing test was testing mounting root filesystem with overlay
from a squashfs image file.
2022-09-29 05:27:49 +00:00
Laszlo Gombos
d091014f88 test(NFS): remove a workaround for systemd v230
Remove some more dead code.
Improve style and formatting.
Remove duplicated modules.
2022-09-29 05:25:42 +00:00
Laszlo Gombos
0da80a1841 refactor(base): remove str_replace from dracut-lib.sh
Remove duplicate implementation of `str_replace` to follow-up
commit 148e420be5
2022-09-29 05:23:07 +00:00
Laszlo Gombos
d7d80af981 ci: add Gentoo Linux container
The Gentoo container is configured to use openrc and musl to
test in those enviroments as well.
2022-09-29 05:21:06 +00:00
Laszlo Gombos
2a2c689740 chore(udev-rules): remove obsolete code
Arch linux no longer needs a special load-modules.sh file.
2022-09-29 05:16:08 +00:00
Laszlo Gombos
97345f0627 chore(base): do not output root entry while installing base
Silence the printing out root entry of passwd file
while including base module.

dracut: *** Including module: base ***
root0:0:root:/root:/bin/bash
dracut: *** Including module: fs-lib ***
2022-09-29 05:14:52 +00:00
Laszlo Gombos
b96f1afa4d ci: improve CI for containers
Login to GitHub Container Registry as the actor instead
of the repository owner.

Upgrade to login-action@v2 and build-push-action@v3 Github Actions.
2022-09-29 05:13:13 +00:00
Hari Bathini
bc1b23c292 fix(squash): build ld cache for squash loader
Commit dc21638c3f fixes kdump kernel crash, due to non-conventional
library path in powerpc, by copying /etc/ld.so.cache under initdir.
While that works in general, it is vulnerable to failure because of
missing links, when the CPU is reconfigured to run in compatibility
mode of older CPU version. Avoid this by running ldconfig for squash
loader to create the necessary links & ld cache for it. Doing this
also saves a few kilobyes of space as the copied ld cache is bigger
in size than the one needed for squash loader environment.

Fixes: dc21638c3f ("fix(squash): keep ld cache under initdir")
Cc: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
2022-09-29 04:57:14 +00:00
Pavel Valena
1157143d67 feat(dracut.sh): populate uefi_cmdline if no other cmdline is given
When creating uefi image in hostonly mode (with using --hostonly-cmdline),
it makes sense to copy current kernel commandline from /proc/cmdline,
in case there are no other options specified.

Usually, the cmdline.d/*.conf file is generated by module rootfs-block
(or other modules), but it might, not handle all cases correctly,
and specifying --kernel-cmdline every time is not much user-friendly.
2022-09-26 10:05:33 +00:00
Antonio Alvarez Feijoo
23684e4a2b feat(systemd): install systemd-sysroot-fstab-check
systemd-sysroot-fstab-check is a symlink to systemd-fstab-generator added in
systemd commit https://github.com/systemd/systemd/commit/cd7ad0cb
2022-09-26 10:02:41 +00:00
Antonio Alvarez Feijoo
e1de5bd2d7 fix(i18n): do not fail if FONT in /etc/vconsole.conf has the file extension
If the FONT option defined in /etc/vconsole.conf refers to a file with its
extension, not just the file name, dracut should not fail and install it. The
systemd-vconsole-setup service ends up calling setfont, which supports both file
names and files with extensions.
2022-09-26 09:47:31 +00:00
Frederick Grose
401158e58c fix(load_fstype): use $1 if $2 is missing
Use parameter expansion default value if the second argument is missing.
The current code mistakenly reuses the null second argument.
2022-09-26 09:46:03 +00:00
Kairui Song
481b87fa7a fix(dracut-initramfs-restore.sh): initramfs detection not working
The path detection is not working on latest Fedora and some other
distros, and it fails to extract the initramfs. It seems the if
statement is broken by a previous commit, so let's fix it.

Fixes: 3d8e1ad ('fix(dracut-initramfs-restore.sh): add missing default paths')
Signed-off-by: Kairui Song <kasong@tencent.com>
2022-09-26 09:12:51 +00:00
Antonio Alvarez Feijoo
928252a145 fix(systemd): add missing modprobe@.service
sys-kernel-config.mount needs modprobe@configfs.service since systemd v246.7
(https://github.com/systemd/systemd/commit/42cc2855), so the kernel configfs
fails to mount in the initrd.
2022-09-26 09:09:36 +00:00
Antonio Alvarez Feijoo
758f2e6937 feat(systemd-pstore): introducing the systemd-pstore module
Introducing the systemd-pstore module.
2022-09-26 09:08:35 +00:00
Laszlo Gombos
4012314f20 ci: add workflow for manual test run
This workflow allows it to run any of the 29 tests
on any of the 4 containers.

On commit, currently the CI only runs 24 tests out of the 116
possible combinations of test runs.

As the project grows, the usefulness of this tool will also grow.
2022-08-26 08:18:03 +00:00
Antonio Alvarez Feijoo
639fb95d7e docs: correct typo 2022-08-26 08:00:08 +00:00
Antonio Alvarez Feijoo
8410ee2290 fix(dracut.sh): remove duplicate "dracut:" string in logger functions
dracut-logger functions already prepend the "dracut:" prefix to the message.
2022-08-26 07:58:36 +00:00
Antonio Alvarez Feijoo
f082dad903 refactor(dracut.sh): use logger functions instead of printf
dracut-logger is sourced in dracut-init, so any printf calls after sourcing
dracut-init should be replaced with logger functions.
2022-08-26 07:58:36 +00:00
Laszlo Gombos
d6d555845e fix(man): point man pages to github.com instead of kernel.org 2022-08-26 07:54:19 +00:00
Laszlo Gombos
d87572ed8e docs: fix path to CONTRIBUTING.md 2022-08-26 07:49:44 +00:00
Laszlo Gombos
61275141df docs: clarify that rd.break stops before the breakpoint starts 2022-08-26 07:45:17 +00:00
Antonio Alvarez Feijoo
da2a092894 chore: add execute permission to all scripts
This avoids most of the rpmlint non-executable-script warnings.
2022-08-26 07:44:16 +00:00
Laszlo Gombos
1573bb815a test: list only the required modules explicitly
rootfs-block module would always include the following
modules: udev-rules base fs-lib

lvm module always includes rootfs-block

This is a follow-up to a1d4041cee
2022-08-26 07:24:55 +00:00
Antonio Alvarez Feijoo
b30a00c2a2 fix(shell-completion): add missing -p and --parallel options 2022-08-26 07:06:34 +00:00
Laszlo Gombos
78cafe465d fix(nfs,virtiofs): check kernel for builtin fs drivers
Check first for fs support in `/proc/filesystems` before attempting
to load the kernel module.

This is needed in the --no-kernel use case to avoid the error:
modprobe: FATAL: Module overlay not found in directory /lib/modules/<kver>
2022-08-18 06:25:20 +00:00
Antonio Alvarez Feijoo
4f20ae2620 fix(dracut-initramfs-restore.sh): hide unpack errors
With the current "try and fail" approach, the system log contains errors until
the correct initrd compression is reached.
2022-08-18 06:20:45 +00:00
Laszlo Gombos
bd13e0ae36 test: remove dracut.conf.test
Empty file and it is not used. Has not been used for over a decade :-)
2022-08-18 06:09:31 +00:00
David Tardon
aa0369a4a3 fix(skipcpio): ignore broken pipe
If lsinitrd is called from a context in which SIGPIPE is ignored (e.g.,
from a systemd unit with default setting of IgnoreSIGPIPE=), the
following line will result in an error being issued:

bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"

An example error from `kdumpctl start` (which internally just calls
`systemctl start kdump.service`):

kdumpctl[1287]: ERROR: src/skipcpio/skipcpio.c:191:main(): fwrite

A minimal reproducer:

systemd-run -t sh -c '/path/to/skipcpio /path/to/any/file | false'
2022-08-18 06:08:45 +00:00
gombi
bdef7793ba test: remove unused ci-matrix.txt file
The ci matrix is described in .github/workflows instead.
ci-matrix.txt file is unreferenced.
2022-08-18 06:05:51 +00:00
Laszlo Gombos
025906de23 docs: create CONTRIBUTING.md
Note down some commonly agreed, but not yet documented guidelines
to have a baseline that can be improved later.
2022-08-18 06:03:53 +00:00
Antonio Alvarez Feijoo
d4732be877 fix(systemd-networkd): typo in systemd-networkd.socket local conf path 2022-08-15 16:03:36 +00:00
Mike Gilbert
27b316df1f fix(virtiofs): make shebangs work on split-usr systems
Fixes: c29325a982013a315418cdb2318e90cf77e387b5
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
2022-08-15 16:00:47 +00:00
runsisi
2f791b401b fix(dracut-install): use stripped kernel module path as hash key
in install_dependent_modules we use &path[kerneldirlen] as the key for inserting,
let's do the same for checking.

otherwise installing kernel module has circular dependency from a custom kernel
module directory will cause infinite recursion and segfault.

$ grep ipmi kbuilt/lib/modules/5.10.121/modules.dep
kernel/drivers/char/ipmi/ipmi_msghandler.ko:
kernel/drivers/char/ipmi/ipmi_devintf.ko: kernel/drivers/char/ipmi/ipmi_msghandler.ko

$ grep ipmi kbuilt/lib/modules/5.10.121/modules.softdep
softdep ipmi_msghandler post: ipmi_devintf

$ ./dracut-install -D /tmp --kerneldir ~/working/kernel/linux-5.10.121/kbuilt/lib/modules/5.10.121 -m ipmi-devintf
Segmentation fault (core dumped)

(gdb) b install_dependent_modules
Breakpoint 1 at 0x7db0: file src/install/dracut-install.c, line 1513.
(gdb) bt
#0  install_dependent_modules (modlist=0x0) at src/install/dracut-install.c:1513
#1  0x000055555555c027 in install_dependent_modules (modlist=modlist@entry=0x555555579e90) at src/install/dracut-install.c:1553
#2  0x000055555555bf1c in install_dependent_modules (modlist=0x5555555799d0) at src/install/dracut-install.c:1548
#3  0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557a3f0) at src/install/dracut-install.c:1554
#4  0x000055555555bf1c in install_dependent_modules (modlist=0x555555579d60) at src/install/dracut-install.c:1548
#5  0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557b170) at src/install/dracut-install.c:1554
#6  0x000055555555bf1c in install_dependent_modules (modlist=0x55555557a0f0) at src/install/dracut-install.c:1548
#7  0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555575320) at src/install/dracut-install.c:1554
#8  0x000055555555bf1c in install_dependent_modules (modlist=0x55555557ab30) at src/install/dracut-install.c:1548
#9  0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557dd60) at src/install/dracut-install.c:1554
#10 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557b640) at src/install/dracut-install.c:1548
#11 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557e0f0) at src/install/dracut-install.c:1554
#12 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557b9d0) at src/install/dracut-install.c:1548
#13 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555574340) at src/install/dracut-install.c:1554
#14 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557cf70) at src/install/dracut-install.c:1548
#15 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x5555555768d0) at src/install/dracut-install.c:1554
#16 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557d750) at src/install/dracut-install.c:1548
#17 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557e700) at src/install/dracut-install.c:1554
#18 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557de90) at src/install/dracut-install.c:1548
#19 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555581c90) at src/install/dracut-install.c:1554
#20 0x000055555555bf1c in install_dependent_modules (modlist=0x555555571e60) at src/install/dracut-install.c:1548
#21 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555556b620) at src/install/dracut-install.c:1554
#22 0x000055555555bf1c in install_dependent_modules (modlist=0x555555583000) at src/install/dracut-install.c:1548
#23 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555556b640) at src/install/dracut-install.c:1554
#24 0x000055555555bf1c in install_dependent_modules (modlist=0x555555571b40) at src/install/dracut-install.c:1548
#25 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555574100) at src/install/dracut-install.c:1554
#26 0x000055555555c4b0 in install_module (mod=mod@entry=0x555555573bc0) at src/install/dracut-install.c:1617
#27 0x000055555555c93d in install_modules (argc=argc@entry=1, argv=argv@entry=0x7fffffffd6e0) at src/install/dracut-install.c:1952
#28 0x000055555555862a in main (argc=<optimized out>, argv=0x7fffffffd6a8) at src/install/dracut-install.c:2090

Signed-off-by: runsisi <runsisi@hust.edu.cn>
2022-08-15 15:38:08 +00:00
Laszlo Gombos
c73e7b99db fix(virtiofs): ismounted has a dependency on the base module
When dracut.sh is called with "--modules virtiofs", make sure
dracut-lib.sh is installed by making the base module a dependency.
2022-08-15 15:36:48 +00:00
Lukas Nykryn
85149b8596 fix(drm): add video drivers needed on hyper-v and similar
Due to non-availability of Hyper-V video driver hyperv_drm in kdump
initramfs, the console seems to be in hang state with no text over it.

We should also go through the /sys/bus/vmbus/devices and include drivers
referenced there.
2022-08-15 15:34:06 +00:00
Lukas Nykryn
bc965cd889 fix(kernel-modules): always include nvmem driver on nvmem_on_arm
These drivers are needed to boot on some SoCs like NXP i.MX
We should include them so installation images will work.
2022-08-15 15:32:30 +00:00
David Tardon
101b683e1a refactor(convertfs): drop duplicate def. of ismounted() 2022-08-15 08:29:34 +00:00
Laszlo Gombos
922c9e28ed fix(dmsquash-live): check kernel for built-in squashfs drivers
Check first for squashfs in `/proc/filesystems`.
This is needed in the --no-kernel use case to avoid the error:
modprobe: FATAL: Module overlay not found in directory /lib/modules/<kver>

Introduce load_fstype function to make it easier to check `/proc/filesystems`
before calling modprobe.
2022-08-15 06:07:39 +00:00
Laszlo Gombos
ec333c30ac ci: dependencies for testing nfs module for Debian
This change allows executing TEST-20-NFS on Debian.
2022-08-15 05:48:07 +00:00
Laszlo Gombos
22ab797948 fix(test): remove unnecessary setup steps
var/lib/nfs/rpc_pipefs is only needed for NFS mounts.
2022-08-15 05:47:24 +00:00
Laszlo Gombos
b8ffc87d13 test(16-DMSQUASH): make it pass on arch
Include additional kernel drivers and install squashfs-tools
into the arch container.
2022-08-15 05:25:54 +00:00
Laszlo Gombos
3adbcc0b71 docs(README.md): update wiki link
Point to the github (and remove kernel.org). Add link to News.
Remove broken badge links.
2022-08-15 05:18:25 +00:00
Jonathan Lebon
2334031a89 fix(90multipath): use RemainAfterExit=yes for multipathd-configure.service
Services of type `oneshot` should almost always use
`RemainAfterExit=yes`. This is a one-time action that we don't want to
rerun if the unit gets pulled in multiple times in the systemd
transaction.
2022-08-12 11:59:06 +00:00
Jonathan Lebon
0940be9058 fix(90multipath): create /etc/multipath only
The dropins path is `/etc/multipath/conf.d`, not
`/etc/multipath/multipath.conf.d`:

686797b7d0/Makefile.inc (L100)

But anyway, we don't need to create that directory. We only need to
create `/etc/multipath`.

While we're here, add a comment to explain this.
2022-08-12 11:59:06 +00:00
Antonio Alvarez Feijoo
da55e26634 fix(systemd): set right permissions for the machine-id file
Fixes issue #1864
2022-08-12 11:48:33 +00:00
Marcos Mello
ebbcf97dc7 fix(dracut-install): do not try to copy files from the root directory
HWCAP library path needs at least two parent directories, for example:

/lib64/power6x/libc.so.6
/lib64/glibc-hwcaps/power9/libpthread-2.28.so (glibc 2.33+)

Before:

dracut-install: Lib install: '/lib64/libz.so.1'
dracut-install: dracut_install('/lib64/libz.so', '/lib64/libz.so', 0, 0, 1)
dracut-install: dracut_install('//libz.so.1', '//libz.so.1', 0, 0, 1)
dracut-install: dracut_install('//libz.so', '//libz.so', 0, 0, 1)

After:

dracut-install: Lib install: '/lib64/libz.so.1'
dracut-install: dracut_install('/lib64/libz.so', '/lib64/libz.so', 0, 0, 1)
2022-08-12 11:45:59 +00:00
Marcos Mello
7f2b09339c refactor(dracut-install): do not call dirname() directly
Avoid its horrible API. Borrow dirname_malloc() from systemd:

https://github.com/systemd/systemd/blob/v251/src/basic/path-util.c#L775
https://github.com/systemd/systemd/blob/v251/src/basic/path-util.h#L150

(licence is LGPLv2.1 or later)
2022-08-12 11:45:59 +00:00
Pavel Valena
b72d0d7f9b fix(dracut.sh): do not fail on irregular files
If file is not a regular file (test -f), dracut.sh fails,
which is unexpected change of behaviour.
The workaround would be to create an empty file.

Fixes: #1835
2022-08-12 11:14:05 +00:00
joamonwx
897e5effe0 feat(dracut.sh): pass engine flag to sbsign allowing use with hardware devices 2022-08-12 11:12:41 +00:00
Brian C. Lane
c8f819e6c1 fix(dmsquash-live): run checkisomd5 on correct device
When the new grub2 iso is written to a usb drive the disk label points
to a partition that does not include the full iso image. This causes
checkisomd5 to run with the wrong data and it fails.

This patch adds a check that will test to see if there is a parent
device that is a disk, and to run checkisomd5 on it instead of on the
partition pointed to by the label.

When running from an iso this will return the original
/dev/disk/by-label/ path, and when running from a usb drive it will
return the parent device (eg. /dev/sda).

Resolves: rhbz#2107858
2022-08-12 10:46:36 +00:00
Antonio Alvarez Feijoo
72b700e3cb fix(dracut-init.sh): correct dracut-install source path 2022-08-12 10:30:15 +00:00
Antonio Alvarez Feijoo
5eb996a993 fix(lsinitrd.sh): correct skipcpio source path 2022-08-12 10:30:15 +00:00
Antonio Alvarez Feijoo
d2f6f445ed fix(dracut-init.sh): propagate the result code returned by dracut-install
Currently only the inst_multiple function propagates the result code returned by
dracut-install.
This was missing since 043 (e.g.: https://github.com/dracutdevs/dracut/blob/043/dracut-functions.sh#L751)
2022-08-12 10:25:56 +00:00
Frederick Grose
d0cd7cd387 fix(dmsquash-live-root): check kernel for built-in overlay drivers
Do not assume that `overlay` is always a module.  Check first for
`overlay` in `/proc/filesystems`. This is needed in the --no-kernel
use case to avoid the error: modprobe:
  FATAL: Module overlay not found in directory /lib/modules/<kver>

Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
2022-08-12 10:25:00 +00:00
Laszlo Gombos
5a5f9c5d4e ci: add glibc to the Arch Linux container
tgt has a dependency on glibc
2022-08-12 10:19:39 +00:00
David Tardon
1343d21d8c refactor(url-lib): write curl output directly to file
The redirection to stdout was originally added to workaround
https://bugzilla.redhat.com/show_bug.cgi?id=989133 (curl would create no
file if the source was empty), but I don't see that problem with current
curl.

A nice side-effect of this change is that curl shows download progress.
2022-08-12 10:15:04 +00:00
Antonio Alvarez Feijoo
fe8fa2b0ca fix(i18n): add required includes for keymaps
Commit https://github.com/dracutdevs/dracut/commit/f3441cc7 removed shell
options but didn't adapt all the code that requires nullglob and globstar.
This caused the initrd to be generated without the required includes for
keymaps.
2022-07-08 04:48:55 +00:00
Antonio Alvarez Feijoo
7fa0094c00 fix(man): correct typo
Fixes issue #1852
2022-06-24 20:28:51 +00:00
наб
13736c50c7 fix(dracut-install): correctly waitpid() for cp 2022-06-24 20:28:17 +00:00
наб
d010fa0d7f refactor(dracut-install): fork() instead of popen(), sanitise line reading
Also set LC_ALL=C to fix ldd output pattern matching in non-english locales.
2022-06-24 20:28:17 +00:00
наб
d2648f6dd8 perf(dracut-install): convert_abs_rel: don't allocate target parent realpath 2022-06-24 20:27:08 +00:00
наб
53dd6a9bbb feat(dracut-install): convert_abs_rel: canonicalise parent of from, too
This fixes, for example, .so versioning links:
  diff --git a/cur b/new3
  index 3804a347..22d089a9 100644
  --- a/cur
  +++ b/new3
  -Image: /boot/initrd.img-5.10.0-13-amd64: 15M
  +Image: initrd: 15M
  -console-setup
  -crw-rw-rw-   1 root     root       1,   3 date etc/console-setup/null
  -drwxr-xr-x  13 root     root            0 date etc
  +drwxr-xr-x  12 root     root            0 date etc
  -drwxr-xr-x   2 root     root            0 date etc/console-setup
  --rw-r--r--   1 root     root       122498 date etc/console-setup/cached_UTF-8_del.kmap
  --rw-r--r--   1 root     root         6240 date etc/ld.so.cache
  +-rw-r--r--   1 root     root         6308 date etc/ld.so.cache
  --rw-r--r--   1 root     root          152 Dec 15  2020 etc/udev/rules.d/10-console.rules
  --rwxr-xr-x   1 root     root        98048 Mar  3  2021 usr/bin/gzip
  --rwxr-xr-x   1 root     root        14976 Oct 11  2020 usr/bin/kbd_mode
  --rwxr-xr-x   1 root     root       220304 Oct 11  2020 usr/bin/loadkeys
  --rwxr-xr-x   1 root     root          229 date usr/bin/setupcon
  -lrwxrwxrwx   1 root     root           32 date usr/lib32/libnss_files.so.2 -> ../../lib32/libnss_files-2.31.so
  +lrwxrwxrwx   1 root     root           20 date usr/lib32/libnss_files.so.2 -> libnss_files-2.31.so
  -lrwxrwxrwx   1 root     root           37 date usr/lib64/ld-linux-x86-64.so.2 -> ../../lib/x86_64-linux-gnu/ld-2.31.so
  +lrwxrwxrwx   1 root     root           34 date usr/lib64/ld-linux-x86-64.so.2 -> ../lib/x86_64-linux-gnu/ld-2.31.so
  --rw-r--r--   1 root     root          185 date usr/lib/dracut/modules.txt
  +-rw-r--r--   1 root     root          171 date usr/lib/dracut/modules.txt
  -lrwxrwxrwx   1 root     root           46 date usr/lib/i386-linux-gnu/libnss_dns.so.2 -> ../../../lib/i386-linux-gnu/libnss_dns-2.31.so
  +lrwxrwxrwx   1 root     root           18 date usr/lib/i386-linux-gnu/libnss_dns.so.2 -> libnss_dns-2.31.so
  -lrwxrwxrwx   1 root     root           48 date usr/lib/i386-linux-gnu/libnss_files.so.2 -> ../../../lib/i386-linux-gnu/libnss_files-2.31.so
  +lrwxrwxrwx   1 root     root           20 date usr/lib/i386-linux-gnu/libnss_files.so.2 -> libnss_files-2.31.so
  +-rw-r--r--   1 root     root        19187 date usr/lib/modules/5.10.0-13-amd64/kernel/crypto/blake2b_generic.ko
  -drwxr-xr-x  21 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers
  +-rw-r--r--   1 root     root        25083 date usr/lib/modules/5.10.0-13-amd64/kernel/crypto/xor.ko
  +drwxr-xr-x  22 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers
  +drwxr-xr-x   2 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers/block
  +-rw-r--r--   1 root     root        74667 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers/block/loop.ko
  -drwxr-xr-x   4 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/fs
  +drwxr-xr-x   5 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/fs
  +drwxr-xr-x   2 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/fs/overlayfs
  +-rw-r--r--   1 root     root       285667 date usr/lib/modules/5.10.0-13-amd64/kernel/fs/overlayfs/overlay.ko
  --rw-r--r--   1 root     root        69130 date usr/lib/modules/5.10.0-13-amd64/modules.alias
  --rw-r--r--   1 root     root        64959 date usr/lib/modules/5.10.0-13-amd64/modules.alias.bin
  +-rw-r--r--   1 root     root        69907 date usr/lib/modules/5.10.0-13-amd64/modules.alias
  +-rw-r--r--   1 root     root        65907 date usr/lib/modules/5.10.0-13-amd64/modules.alias.bin
  --rw-r--r--   1 root     root        19517 date usr/lib/modules/5.10.0-13-amd64/modules.dep
  --rw-r--r--   1 root     root        28161 date usr/lib/modules/5.10.0-13-amd64/modules.dep.bin
  --rw-r--r--   1 root     root          131 date usr/lib/modules/5.10.0-13-amd64/modules.devname
  +-rw-r--r--   1 root     root        19635 date usr/lib/modules/5.10.0-13-amd64/modules.dep
  +-rw-r--r--   1 root     root        28409 date usr/lib/modules/5.10.0-13-amd64/modules.dep.bin
  +-rw-r--r--   1 root     root          157 date usr/lib/modules/5.10.0-13-amd64/modules.devname
  --rw-r--r--   1 root     root       107148 date usr/lib/modules/5.10.0-13-amd64/modules.symbols
  --rw-r--r--   1 root     root       129343 date usr/lib/modules/5.10.0-13-amd64/modules.symbols.bin
  +-rw-r--r--   1 root     root       107260 date usr/lib/modules/5.10.0-13-amd64/modules.symbols
  +-rw-r--r--   1 root     root       129476 date usr/lib/modules/5.10.0-13-amd64/modules.symbols.bin
  -lrwxrwxrwx   1 root     root           44 date usr/lib/systemd/system/ctrl-alt-del.target -> ../../../../lib/systemd/system/reboot.target
  +lrwxrwxrwx   1 root     root           13 date usr/lib/systemd/system/ctrl-alt-del.target -> reboot.target
  -lrwxrwxrwx   1 root     root           20 date usr/lib/systemd/systemd-udevd -> ../../../bin/udevadm
  +lrwxrwxrwx   1 root     root           17 date usr/lib/systemd/systemd-udevd -> ../../bin/udevadm
  -lrwxrwxrwx   1 root     root           87 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-audit.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-journald-audit.socket
  -lrwxrwxrwx   1 root     root           89 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-dev-log.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-journald-dev-log.socket
  -lrwxrwxrwx   1 root     root           81 date usr/lib/systemd/system/sockets.target.wants/systemd-journald.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-journald.socket
  -lrwxrwxrwx   1 root     root           86 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-udevd-control.socket
  -lrwxrwxrwx   1 root     root           85 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-udevd-kernel.socket
  +lrwxrwxrwx   1 root     root           32 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-audit.socket -> ../systemd-journald-audit.socket
  +lrwxrwxrwx   1 root     root           34 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-dev-log.socket -> ../systemd-journald-dev-log.socket
  +lrwxrwxrwx   1 root     root           26 date usr/lib/systemd/system/sockets.target.wants/systemd-journald.socket -> ../systemd-journald.socket
  +lrwxrwxrwx   1 root     root           31 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket -> ../systemd-udevd-control.socket
  +lrwxrwxrwx   1 root     root           30 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket -> ../systemd-udevd-kernel.socket
  -lrwxrwxrwx   1 root     root           83 date usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../kmod-static-nodes.service
  -lrwxrwxrwx   1 root     root           91 date usr/lib/systemd/system/sysinit.target.wants/systemd-ask-password-console.path -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-ask-password-console.path
  -lrwxrwxrwx   1 root     root           82 date usr/lib/systemd/system/sysinit.target.wants/systemd-journald.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-journald.service
  -lrwxrwxrwx   1 root     root           86 date usr/lib/systemd/system/sysinit.target.wants/systemd-modules-load.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-modules-load.service
  -lrwxrwxrwx   1 root     root           80 date usr/lib/systemd/system/sysinit.target.wants/systemd-sysctl.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-sysctl.service
  -lrwxrwxrwx   1 root     root           92 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-tmpfiles-setup-dev.service
  -lrwxrwxrwx   1 root     root           88 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-tmpfiles-setup.service
  -lrwxrwxrwx   1 root     root           79 date usr/lib/systemd/system/sysinit.target.wants/systemd-udevd.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-udevd.service
  -lrwxrwxrwx   1 root     root           86 date usr/lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-udev-trigger.service
  +lrwxrwxrwx   1 root     root           28 date usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service -> ../kmod-static-nodes.service
  +lrwxrwxrwx   1 root     root           36 date usr/lib/systemd/system/sysinit.target.wants/systemd-ask-password-console.path -> ../systemd-ask-password-console.path
  +lrwxrwxrwx   1 root     root           27 date usr/lib/systemd/system/sysinit.target.wants/systemd-journald.service -> ../systemd-journald.service
  +lrwxrwxrwx   1 root     root           31 date usr/lib/systemd/system/sysinit.target.wants/systemd-modules-load.service -> ../systemd-modules-load.service
  +lrwxrwxrwx   1 root     root           25 date usr/lib/systemd/system/sysinit.target.wants/systemd-sysctl.service -> ../systemd-sysctl.service
  +lrwxrwxrwx   1 root     root           37 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service -> ../systemd-tmpfiles-setup-dev.service
  +lrwxrwxrwx   1 root     root           33 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service -> ../systemd-tmpfiles-setup.service
  +lrwxrwxrwx   1 root     root           24 date usr/lib/systemd/system/sysinit.target.wants/systemd-udevd.service -> ../systemd-udevd.service
  +lrwxrwxrwx   1 root     root           31 date usr/lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service -> ../systemd-udev-trigger.service
  --rwxr-xr-x   1 root     root           20 Dec 15  2020 usr/lib/udev/console-setup
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libacl.so.1 -> ../../../lib/x86_64-linux-gnu/libacl.so.1.1.2253
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libacl.so -> ../../../lib/x86_64-linux-gnu/libacl.so.1.1.2253
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libacl.so.1 -> libacl.so.1.1.2253
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libacl.so -> libacl.so.1.1.2253
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libapparmor.so.1 -> ../../../lib/x86_64-linux-gnu/libapparmor.so.1.6.3
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libapparmor.so.1 -> libapparmor.so.1.6.3
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libattr.so.1 -> ../../../lib/x86_64-linux-gnu/libattr.so.1.1.2448
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libattr.so -> ../../../lib/x86_64-linux-gnu/libattr.so.1.1.2448
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libattr.so.1 -> libattr.so.1.1.2448
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libattr.so -> libattr.so.1.1.2448
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libaudit.so.1 -> ../../../lib/x86_64-linux-gnu/libaudit.so.1.0.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libaudit.so -> ../../../lib/x86_64-linux-gnu/libaudit.so.1.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libaudit.so.1 -> libaudit.so.1.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libaudit.so -> libaudit.so.1.0.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libblkid.so.1 -> ../../../lib/x86_64-linux-gnu/libblkid.so.1.1.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libblkid.so -> ../../../lib/x86_64-linux-gnu/libblkid.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libblkid.so.1 -> libblkid.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libblkid.so -> libblkid.so.1.1.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libbpf.so.0 -> ../../../lib/x86_64-linux-gnu/libbpf.so.0.3.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libbpf.so.0 -> libbpf.so.0.3.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libbsd.so.0 -> ../../../lib/x86_64-linux-gnu/libbsd.so.0.11.3
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libbsd.so -> ../../../lib/x86_64-linux-gnu/libbsd.so.0.11.3
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libbsd.so.0 -> libbsd.so.0.11.3
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libbsd.so -> libbsd.so.0.11.3
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libcap-ng.so.0 -> ../../../lib/x86_64-linux-gnu/libcap-ng.so.0.0.0
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libcap-ng.so -> ../../../lib/x86_64-linux-gnu/libcap-ng.so.0.0.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libcap-ng.so.0 -> libcap-ng.so.0.0.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libcap-ng.so -> libcap-ng.so.0.0.0
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libcap.so.2 -> ../../../lib/x86_64-linux-gnu/libcap.so.2.44
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libcap.so -> ../../../lib/x86_64-linux-gnu/libcap.so.2.44
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libcap.so.2 -> libcap.so.2.44
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libcap.so -> libcap.so.2.44
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libcrypto.so -> ../../../lib/x86_64-linux-gnu/libcrypto.so.1.1
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libcrypto.so -> libcrypto.so.1.1
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libcrypt.so.1 -> ../../../lib/x86_64-linux-gnu/libcrypt.so.1.1.0
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/libcrypt.so -> ../../../lib/x86_64-linux-gnu/libcrypt.so.1
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libcrypt.so.1 -> libcrypt.so.1.1.0
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/libcrypt.so -> libcrypt.so.1
  -lrwxrwxrwx   1 root     root           42 date usr/lib/x86_64-linux-gnu/libc.so.6 -> ../../../lib/x86_64-linux-gnu/libc-2.31.so
  +lrwxrwxrwx   1 root     root           12 date usr/lib/x86_64-linux-gnu/libc.so.6 -> libc-2.31.so
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/libdl.so.2 -> ../../../lib/x86_64-linux-gnu/libdl-2.31.so
  -lrwxrwxrwx   1 root     root           40 date usr/lib/x86_64-linux-gnu/libdl.so -> ../../../lib/x86_64-linux-gnu/libdl.so.2
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/libdl.so.2 -> libdl-2.31.so
  +lrwxrwxrwx   1 root     root           10 date usr/lib/x86_64-linux-gnu/libdl.so -> libdl.so.2
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libelf.so.1 -> ../../../lib/x86_64-linux-gnu/libelf-0.183.so
  -lrwxrwxrwx   1 root     root           41 date usr/lib/x86_64-linux-gnu/libelf.so -> ../../../lib/x86_64-linux-gnu/libelf.so.1
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libelf.so.1 -> libelf-0.183.so
  +lrwxrwxrwx   1 root     root           11 date usr/lib/x86_64-linux-gnu/libelf.so -> libelf.so.1
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libgcrypt.so.20 -> ../../../lib/x86_64-linux-gnu/libgcrypt.so.20.2.8
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libgcrypt.so -> ../../../lib/x86_64-linux-gnu/libgcrypt.so.20.2.8
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libgcrypt.so.20 -> libgcrypt.so.20.2.8
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libgcrypt.so -> libgcrypt.so.20.2.8
  -lrwxrwxrwx   1 root     root           52 date usr/lib/x86_64-linux-gnu/libgpg-error.so.0 -> ../../../lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libgpg-error.so -> ../../../lib/x86_64-linux-gnu/libgpg-error.so.0
  +lrwxrwxrwx   1 root     root           22 date usr/lib/x86_64-linux-gnu/libgpg-error.so.0 -> libgpg-error.so.0.29.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libgpg-error.so -> libgpg-error.so.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libip4tc.so.2 -> ../../../lib/x86_64-linux-gnu/libip4tc.so.2.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libip4tc.so.2 -> libip4tc.so.2.0.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libkmod.so.2 -> ../../../lib/x86_64-linux-gnu/libkmod.so.2.3.6
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libkmod.so.2 -> libkmod.so.2.3.6
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libkmod.so -> libkmod.so.2.3.6
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/liblz4.so.1 -> ../../../lib/x86_64-linux-gnu/liblz4.so.1.9.3
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/liblz4.so -> ../../../lib/x86_64-linux-gnu/liblz4.so.1.9.3
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/liblz4.so.1 -> liblz4.so.1.9.3
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/liblz4.so -> liblz4.so.1.9.3
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/liblzma.so.5 -> ../../../lib/x86_64-linux-gnu/liblzma.so.5.2.5
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/liblzma.so -> ../../../lib/x86_64-linux-gnu/liblzma.so.5.2.5
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/liblzma.so.5 -> liblzma.so.5.2.5
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/liblzma.so -> liblzma.so.5.2.5
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libmd.so.0 -> ../../../lib/x86_64-linux-gnu/libmd.so.0.0.4
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libmd.so -> ../../../lib/x86_64-linux-gnu/libmd.so.0.0.4
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libmd.so.0 -> libmd.so.0.0.4
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libmd.so -> libmd.so.0.0.4
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libmnl.so.0 -> ../../../lib/x86_64-linux-gnu/libmnl.so.0.2.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libmnl.so -> ../../../lib/x86_64-linux-gnu/libmnl.so.0.2.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libmnl.so.0 -> libmnl.so.0.2.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libmnl.so -> libmnl.so.0.2.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libmount.so.1 -> ../../../lib/x86_64-linux-gnu/libmount.so.1.1.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libmount.so -> ../../../lib/x86_64-linux-gnu/libmount.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libmount.so.1 -> libmount.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libmount.so -> libmount.so.1.1.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libmpfr.so.6 -> ../../../lib/x86_64-linux-gnu/libmpfr.so.6.1.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libmpfr.so.6 -> libmpfr.so.6.1.0
  -lrwxrwxrwx   1 root     root           42 date usr/lib/x86_64-linux-gnu/libm.so.6 -> ../../../lib/x86_64-linux-gnu/libm-2.31.so
  +lrwxrwxrwx   1 root     root           12 date usr/lib/x86_64-linux-gnu/libm.so.6 -> libm-2.31.so
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libnss_dns.so.2 -> ../../../lib/x86_64-linux-gnu/libnss_dns-2.31.so
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libnss_dns.so -> ../../../lib/x86_64-linux-gnu/libnss_dns.so.2
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libnss_dns.so.2 -> libnss_dns-2.31.so
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libnss_dns.so -> libnss_dns.so.2
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libnss_files.so.2 -> ../../../lib/x86_64-linux-gnu/libnss_files-2.31.so
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libnss_files.so -> ../../../lib/x86_64-linux-gnu/libnss_files.so.2
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libnss_files.so.2 -> libnss_files-2.31.so
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libnss_files.so -> libnss_files.so.2
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libnvpair.so.3 -> ../../../lib/x86_64-linux-gnu/libnvpair.so.3.0.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libnvpair.so.3 -> libnvpair.so.3.0.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libpam.so.0 -> ../../../lib/x86_64-linux-gnu/libpam.so.0.85.1
  -lrwxrwxrwx   1 root     root           41 date usr/lib/x86_64-linux-gnu/libpam.so -> ../../../lib/x86_64-linux-gnu/libpam.so.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libpam.so.0 -> libpam.so.0.85.1
  +lrwxrwxrwx   1 root     root           11 date usr/lib/x86_64-linux-gnu/libpam.so -> libpam.so.0
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 -> ../../../lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libpcre2-8.so -> ../../../lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 -> libpcre2-8.so.0.10.1
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libpcre2-8.so -> libpcre2-8.so.0.10.1
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libpcre.so.3 -> ../../../lib/x86_64-linux-gnu/libpcre.so.3.13.3
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libpcre.so.3 -> libpcre.so.3.13.3
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libpthread.so.0 -> ../../../lib/x86_64-linux-gnu/libpthread-2.31.so
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libpthread.so -> ../../../lib/x86_64-linux-gnu/libpthread.so.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libpthread.so.0 -> libpthread-2.31.so
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libpthread.so -> libpthread.so.0
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libreadline.so.8 -> ../../../lib/x86_64-linux-gnu/libreadline.so.8.1
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libreadline.so -> ../../../lib/x86_64-linux-gnu/libreadline.so.8
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libreadline.so.8 -> libreadline.so.8.1
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libreadline.so -> libreadline.so.8
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/librt.so.1 -> ../../../lib/x86_64-linux-gnu/librt-2.31.so
  -lrwxrwxrwx   1 root     root           40 date usr/lib/x86_64-linux-gnu/librt.so -> ../../../lib/x86_64-linux-gnu/librt.so.1
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/librt.so.1 -> librt-2.31.so
  +lrwxrwxrwx   1 root     root           10 date usr/lib/x86_64-linux-gnu/librt.so -> librt.so.1
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libseccomp.so.2 -> ../../../lib/x86_64-linux-gnu/libseccomp.so.2.5.1
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libseccomp.so.2 -> libseccomp.so.2.5.1
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libselinux.so -> ../../../lib/x86_64-linux-gnu/libselinux.so.1
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libselinux.so -> libselinux.so.1
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libsigsegv.so.2 -> ../../../lib/x86_64-linux-gnu/libsigsegv.so.2.0.6
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libsigsegv.so.2 -> libsigsegv.so.2.0.6
  -lrwxrwxrwx   1 root     root           51 date usr/lib/x86_64-linux-gnu/libsmartcols.so.1 -> ../../../lib/x86_64-linux-gnu/libsmartcols.so.1.1.0
  +lrwxrwxrwx   1 root     root           21 date usr/lib/x86_64-linux-gnu/libsmartcols.so.1 -> libsmartcols.so.1.1.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libtinfo.so.6 -> ../../../lib/x86_64-linux-gnu/libtinfo.so.6.2
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/libtinfo.so -> ../../../lib/x86_64-linux-gnu/libtinfo.so.6
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libtinfo.so.6 -> libtinfo.so.6.2
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/libtinfo.so -> libtinfo.so.6
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libtspi.so.1 -> ../../../lib/x86_64-linux-gnu/libtspi.so.1.2.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libtspi.so.1 -> libtspi.so.1.2.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libudev.so.1 -> ../../../lib/x86_64-linux-gnu/libudev.so.1.7.0
  -lrwxrwxrwx   1 root     root           42 date usr/lib/x86_64-linux-gnu/libudev.so -> ../../../lib/x86_64-linux-gnu/libudev.so.1
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libudev.so.1 -> libudev.so.1.7.0
  +lrwxrwxrwx   1 root     root           12 date usr/lib/x86_64-linux-gnu/libudev.so -> libudev.so.1
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libuuid.so.1 -> ../../../lib/x86_64-linux-gnu/libuuid.so.1.3.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libuuid.so -> ../../../lib/x86_64-linux-gnu/libuuid.so.1.3.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libuuid.so.1 -> libuuid.so.1.3.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libuuid.so -> libuuid.so.1.3.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libuutil.so.3 -> ../../../lib/x86_64-linux-gnu/libuutil.so.3.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libuutil.so.3 -> libuutil.so.3.0.0
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libzfs_core.so.3 -> ../../../lib/x86_64-linux-gnu/libzfs_core.so.3.0.0
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libzfs_core.so.3 -> libzfs_core.so.3.0.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libzfs.so.4 -> ../../../lib/x86_64-linux-gnu/libzfs.so.4.1.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libzfs.so.4 -> libzfs.so.4.1.0
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libz.so.1 -> ../../../lib/x86_64-linux-gnu/libz.so.1.2.11
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libz.so -> ../../../lib/x86_64-linux-gnu/libz.so.1.2.11
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.11
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libz.so -> libz.so.1.2.11
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libzstd.so.1 -> ../../../lib/x86_64-linux-gnu/libzstd.so.1.4.8
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libzstd.so -> ../../../lib/x86_64-linux-gnu/libzstd.so.1.4.8
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libzstd.so.1 -> libzstd.so.1.4.8
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libzstd.so -> libzstd.so.1.4.8
  --rwxr-xr-x   1 root     root       517176 Nov  2  2019 usr/local/lib/libgmp.so.10.3.0
  +-rwxr-xr-x   1 root     staff      517176 Nov  2  2019 usr/local/lib/libgmp.so.10.3.0
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/depmod -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/depmod -> ../bin/kmod
  -lrwxrwxrwx   1 root     root           19 date usr/sbin/halt -> ../../bin/systemctl
  +lrwxrwxrwx   1 root     root           16 date usr/sbin/halt -> ../bin/systemctl
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/insmod -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/insmod -> ../bin/kmod
  -lrwxrwxrwx   1 root     root           12 date usr/sbin/ip -> ../../bin/ip
  +lrwxrwxrwx   1 root     root            9 date usr/sbin/ip -> ../bin/ip
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/lsmod -> ../../bin/kmod
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/modinfo -> ../../bin/kmod
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/modprobe -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/lsmod -> ../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/modinfo -> ../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/modprobe -> ../bin/kmod
  -lrwxrwxrwx   1 root     root           19 date usr/sbin/poweroff -> ../../bin/systemctl
  +lrwxrwxrwx   1 root     root           16 date usr/sbin/poweroff -> ../bin/systemctl
  -lrwxrwxrwx   1 root     root           19 date usr/sbin/reboot -> ../../bin/systemctl
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/rmmod -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           16 date usr/sbin/reboot -> ../bin/systemctl
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/rmmod -> ../bin/kmod

Closes #1781
2022-06-24 20:27:08 +00:00
наб
06d316171c fix(dracut-install): convert_abs_rel: return valid path on error
convert_abs_rel() gets
  from  =/var/tmp/dracut.8dxnpY/initramfs/lib/x86_64-linux-gnu/libuuid.so.1.3.0
  target=/var/tmp/dracut.8dxnpY/initramfs/lib/x86_64-linux-gnu/libuuid.so
returning from is invalid; skip over the destdir:
  /lib/x86_64-linux-gnu/libuuid.so.1.3.0
2022-06-24 20:27:08 +00:00
наб
e7d6a1e30c perf(dracut-install): strdup()+[dirlen]=0 => strndup 2022-06-24 20:27:08 +00:00
Daan De Meyer
846a845375 fix(install.d): add --verbose if KERNEL_INSTALL_VERBOSE=1
If KERNEL_INSTALL_VERBOSE=1, let's make sure dracut also produces
extended output for debugging purposes.
2022-06-21 23:06:57 +00:00
Kairui Song
e4f1dbcc00 fix(dracut): typo error 'aggresive' -> 'aggressive'
This option was introduced not long ago, but unfortunately it was
misspelled and have affected following up commits. It's not a commonly
used option, at least not yet, so just rename and fix it.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-06-21 19:33:49 +00:00
Alberto Planas
90585c624a fix(integrity): do not enable EVM if there is no key
Track when a key is successfully loaded, and return 1 if no key has been
loaded.  This will not enable EVM if there are no keys available in the
system.

Fix #1847

Signed-off-by: Alberto Planas <aplanas@suse.com>
2022-06-21 07:05:01 +00:00
Alberto Planas
9d1004a4e9 fix(integrity): remove unused variable
Drop X509ID variable inside the `if`, and use the same comparison that
is already in evm_enable.

Signed-off-by: Alberto Planas <aplanas@suse.com>
2022-06-21 07:05:01 +00:00
Jóhann B. Guðmundsson
ad7d5bc8ea fix(Makefile): reduce the number of shell invocations
Makefile uses recursively expanded macros and as can be seen by simply
adding $(warning Call to shell) in front of $(shell ...) Foo's in the
Makefile, we are calling out to shell 9 times just to get the working
directory, a working directory which doesn't change during Make!

Let's save few pony's and reduce it to 2...
2022-06-21 05:40:09 +00:00
Jóhann B. Guðmundsson
29e9718f11 docs: update NEWS.md and AUTHORS 2022-06-19 22:35:26 +00:00
Martin Wilck
6d92326201 feat(dracut): support parallel execution with --parallel
Add an option --parallel which can currently be used with
--regenerate-all. With --regenerate-all --parallel, dracut will be
run in parallel for all kernels found.

Also introduce a config file equivalent setting: parallel="yes".
Making this work requires moving the code block that handles --regenerate-all
behind the code block for reading the config files.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2022-06-17 16:47:44 +00:00
Tao Liu
d9812fc4ae feat(lvm): add new module lvmthinpool-monitor
Previously dracut didn't support the feature of lvm thinpool autoextend.

The feature is useful to cases such as kdump, when vmcore to be saved to a
lvm thin volume. The thinpool should be able to autoextend, otherwise an
IO error will be caused and leaves an incomplete vmcore.

There is lvm2-monitor.service and dmeventd avaliable, however
considering [1], it is not suitable for kdump and memory limited cases.

This patch achieves the same by parallel looping a shell function in the
background, which calls lvextend periodically. If thredshold reaches,
autoextend it, if not then nothing happens.

[1]: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/message/YF254ZO3PJ3U56P4OKHV3JNYP2PJUMYX/

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-06-17 13:09:45 +00:00
наб
09a1e5afd2 fix(bluetooth): accept compressed firmwares in inst_multiple 2022-06-09 23:46:52 +00:00
наб
9d8387ed80 feat(dracut-install): support ZSTD-compressed firmware with .zst suffix
Coming in 5.19:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=23cfbc6ec44e5e80d5522976ff45ffcdcddfb230
2022-06-09 23:46:52 +00:00
наб
95aeed8975 fix(dracut): default to correct firmware search paths
1. /sys/module/firmware_class/parameters/path (fw_path_para), if any
2. /lib/firmware/updates/$(uname -r)
3. /lib/firmware/updates
4. /lib/firmware/$(uname -r)
5. /lib/firmware

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/firmware_loader/main.c?h=v5.17#n406
2022-06-09 23:46:52 +00:00
Laszlo Gombos
a1d4041cee test: list only the required modules explicitly
Test for module dependencies and increase test coverage.
2022-06-02 13:43:59 +00:00
Laszlo Gombos
6ee2baf314 fix(test): dmsquash-live test without an iso
Remove fedore specific parts and use squash filesystem as live root.
2022-06-02 13:42:20 +00:00
Conrad Hoffmann
1354d6339a fix(Makefile): use of potentially unset variable
`CWD` is not a Make variable. This may have worked accidentally for some
people if their shell happend to provide `CWD` and Make picked it up.

As is, this tends to pick up git versions of unrelated parent
directories, e.g. when packaging for distributions.
2022-06-02 12:25:44 +00:00
Antonio Alvarez Feijoo
77420527b0 docs(dracut.cmdline): add missing rd.nonvmf option
This is a specific option of the nvmf module.
2022-06-02 09:58:52 +00:00
Antonio Alvarez Feijoo
e405501e23 fix(nvmf): deprecate old nvmf cmdline options
Fixes issue #1831
2022-06-02 09:58:52 +00:00
Antonio Alvarez Feijoo
f63f411d52 fix(integrity): do not display any error if there is no IMA certificate
IMA appraisal can be used without digital signatures, just by storing hash
digests instead.
2022-05-26 19:22:13 +00:00
Antonio Alvarez Feijoo
b4522705c8 docs(dracut.cmdline): add missing evmx509 option
This is a specific option of the integrity module.
2022-05-26 19:22:13 +00:00
Laszlo Gombos
1befc64167 feat(gensplash): remove module
splashutils Gentoo package (a dependency for the gensplash dracut module)
is non existent in the official Gentoo repositories.
2022-05-16 19:01:17 +00:00
Antonio Alvarez Feijoo
e455273187 docs(dracut.conf): regenerate_all not supported
The regenerate_all option is used before sourcing the configuration files.
2022-05-16 19:00:27 +00:00
Antonio Alvarez Feijoo
9bef71094e fix(dracut.sh): format usage and add missing options
Set common format to each option and add missing options:
    --no-machineid
2022-05-11 04:43:10 +00:00
Antonio Alvarez Feijoo
a6c497dc7a docs(dracut): format and add missing options
Set common format to each option, correct default compression options and add
missing options:
    --rebuild
    --aggresive-strip
    --hostonly-mode
    --hostonly-nics
    --noimageifnotneeded
2022-05-11 04:43:10 +00:00
Antonio Alvarez Feijoo
20eba720a5 docs(dracut.conf): format and add missing options
Set common format to each option, add/correct default values and add missing
options:
    force_add_dracutmodules
    libdirs
    squash_compress
    aggresive_strip
    do_hardlink
    prefix
    hostonly_mode
    hostonly_nics
    sshkey
    regenerate_all
    noimageifnotneeded
    uefi
    machine_id
    enhanced_cpio
2022-05-11 04:43:10 +00:00
Antonio Alvarez Feijoo
1199f990bb fix(shell-completion): add missing options 2022-05-11 04:43:10 +00:00
Laszlo Gombos
0b339d7351 ci(integration): maintain only Fedora latest
Alphabetically ordering the distributions in the container section
2022-05-07 08:56:32 +00:00
German Maglione
8348c5636a ci(virtiofs): add virtiofs label
Add the label virtiofs to the label trigger file.

Signed-off-by: German Maglione <gmaglione@redhat.com>
2022-05-05 22:21:33 +00:00
German Maglione
4632f79995 feat(virtiofs): virtiofs root filesystem support
Currently dracut can't mount virtiofs as root filesystem.
Make possible to boot virtual machines off virtiofs,
passing "root=virtiofs:<mtag>", using the mount tag <mtag>
as root filesystem. Alternatively this module also supports
"rootfstype=virtiofs root=<mtag>"

Signed-off-by: German Maglione <gmaglione@redhat.com>
2022-05-05 22:21:33 +00:00
Wenchao Hao
319dc7fe10 fix(iscsi): do not exit in handle_netroot() if discovery failed
User may specify multiple netroot in cmdline, failed to connect one netroot
do not mean all netroot are not accessible. So if one netroot failed, do
not exit the discovery and login flow.

Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
2022-05-05 20:40:00 +00:00
Laszlo Gombos
b3ab3037e8 fix(test): remove stale comments 2022-05-04 21:36:04 +00:00
Laszlo Gombos
a7dfdf6acb fix(test): add support for dpkg to pass the test on debian 2022-05-04 07:30:45 +00:00
Antonio Alvarez Feijoo
d6343146c1 fix(lsinitrd.sh): always check that MACHINE_ID is not empty 2022-05-03 22:12:13 +00:00
Antonio Alvarez Feijoo
527fdfa151 fix(dracut.sh): always check that MACHINE_ID is not empty
On new installations, /etc/machine-id may exist and be empty, and
also /efi or /boot/efi may be a mount point, leading to an invalid
initramfs output file.
2022-05-03 22:12:13 +00:00
Laszlo Gombos
7f7dc9173d ci: on debian, default shell is not bash 2022-05-03 21:41:31 +00:00
Laszlo Gombos
ab798f6785 ci: install sudo for the debian container 2022-05-02 05:46:10 +00:00
Morten Linderud
8abd45d288 docs(dracut.usage): fix dracut.cmdline reference from section 5 to 7
Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-05-01 11:56:07 +00:00
Laszlo Gombos
08ed7b2d00 fix(dmsquash-live): mount live device with the correct type
fstype is not the correct type for the live device.
2022-04-29 22:12:05 +00:00
Laszlo Gombos
080f3e2e29 ci: add Debian Linux to limited tests 2022-04-29 22:10:44 +00:00
Antonio Alvarez Feijoo
012d7db27d fix(dracut.sh): avoid calling dfatal before dracut-logger is sourced
dracut-logger is sourced in dracut-init, so any earlier calls to logger
functions before dracut-init is sourced fail.

Fix issue #1758
2022-04-29 21:49:23 +00:00
Jóhann B. Guðmundsson
d0c6ab21d9 fix(dracut.spec): add connman module
Add the connman module to the spec file
2022-04-29 20:53:54 +00:00
David Tardon
42e8f17c24 feat(dracut-systemd): use Documentation= to point to man page 2022-04-26 18:24:15 +00:00
David Tardon
77c28b3020 fix(dracut-systemd): drop misleading man page reference
dracut-shutdown.service is not a part of the boot process, therefore the
reference to dracut.bootup(7) is misleading.
2022-04-26 18:24:15 +00:00
Masahiro Matsuya
485413627f fix(fedora.conf): vi binary is missing
/usr/bin/vi is just a wrapper shell script to run /usr/libexec/vi which is the vi binary.
/usr/bin/vi is available in initrd.img, but /usr/libexec/vi is missing.
As as result, vi command never works.
This PR is to add /usr/libexec/vi.
2022-04-26 07:09:15 +00:00
Antonio Alvarez Feijoo
ffc1985cb2 fix(man): add missing default paths 2022-04-25 21:29:30 +00:00
Antonio Alvarez Feijoo
49ea6c42db fix(lsinitrd.sh): add missing default paths 2022-04-25 21:29:30 +00:00
Antonio Alvarez Feijoo
28ef3bc6a6 fix(dracut.sh): add missing default output file paths 2022-04-25 21:29:30 +00:00
Coiby Xu
ab6f57339a fix(kernel-network-modules): allow specifying empty --hostonly-nics
Commit 1e92f728 ("Add a --hostonly-nics option") allows only installing
the network drivers for specified NICs. But it doesn't allow an emtpy
--hostonly-nics. Specifying empty hostonly-nics is needed to address the
following use cases,
 - drivers/s390/net is installed regardless of --hostonly-nics. There is
   no need to repeat it.
 - get_dev_module couldn't find the driver for a bond or a bridge
   network interface so it's better for a module to install a bond
   or bridge driver itself
 - dracut kdump module wants to install the needed network drivers by
   itself because it can't add the --hostonly-nics option to dracut when
   itself is a dracut module

This patch distinguishes between an empty --hostonly-nics and --hostonly-nics
not added so a user can pass an empty --hostonly-nics option.
2022-04-24 05:28:16 +00:00
Antonio Alvarez Feijoo
d615934311 fix(nfs): give /run/rpcbind ownership to rpc user
Avoid errors when rpcbind tries to write to the /run/rpcbind directory.
2022-04-21 06:42:27 +00:00
Antonio Alvarez Feijoo
0e4df7a39d fix(nfs): require and install needed binaries
parse-nfsroot.sh requires sed, chmod and chown.
2022-04-21 06:42:27 +00:00
Antonio Alvarez Feijoo
79f9d9e1c2 fix(lvm): add missing grep requirement
Since commit https://github.com/dracutdevs/dracut/commit/7ffc5e38
lvm_scan.sh needs grep.
2022-04-11 07:33:31 +00:00
Antonio Alvarez Feijoo
a7a4b76c4a fix(resume): correct call to block_is_netdevice function
The block_is_netdevice function requires the device in <maj:min>
format, but the swap_devs array is populated with the content of
/proc/swaps, which prints the devices using their paths from /dev.

This causes the check method to never detect if swap is mounted on a
network device.
2022-04-09 08:11:46 +00:00
Antonio Alvarez Feijoo
0afa840e11 fix(dracut-functions.sh): correct wrong comment 2022-04-09 08:11:46 +00:00
наб
27071e9a0e fix(dracut.cmdline.7): {=> must} also be specified 2022-04-09 08:10:35 +00:00
Antonio Alvarez Feijoo
7103c4bce9 fix(ifcfg): avoid calling unavailable dracut-logger functions
The dracut-logger functions are only available during the initrd
generation. For internal initrd scripts that run at boot,
dracut-lib provides warn() and info().
2022-04-09 08:09:24 +00:00
Antonio Alvarez Feijoo
b7059aef59 fix(network-manager): avoid calling unavailable dracut-logger functions
The dracut-logger functions are only available during the initrd
generation. For internal initrd scripts that run at boot,
dracut-lib provides warn() and info().
2022-04-09 08:09:24 +00:00
Nicolas Porcel
65e41b5460 feat(man): add documentation for rd.luks.key.tout 2022-04-09 07:55:11 +00:00
Nicolas Porcel
6c11a8fcee fix(crypt): add missing is_keysource parameter to cryptroot-ask
Without this change, rd.luks.key.tout is used, which is the number of
times cryptroot tries to find the key.
2022-04-09 07:54:06 +00:00
Antonio Alvarez Feijoo
a90dbd958b fix(man): add missing --libdirs section 2022-04-09 07:35:54 +00:00
Antonio Alvarez Feijoo
352e591731 fix(dracut.sh): add missing --libdirs usage 2022-04-09 07:35:54 +00:00
Benjamin Gilbert
25a92885a9 fix(nvmf): set executable bit on nvmf-autoconnect.sh
It's installed in /sbin, and run via initqueue in the special case of FC
transport without a discovery.conf and without kernel arguments.  If the
executable bit is not set, initqueue fails with "Invalid command".

Caught by CI checking for non-executable files in binary directories.
2022-04-09 07:35:13 +00:00
James Morris
90032a4631 feat(url-lib.sh): add --retry-connrefused to default curl arguments
Trigger the existing retry condition on connection refused
to mitigate transient connectivity issues.
2022-04-09 07:34:36 +00:00
Antonio Alvarez Feijoo
9ef73b6ad0 fix(dracut-install): copy files preserving ownership attributes
While the "clone copy" operation changes the ownership of the cloned
files, the "normal copy" using cp does not preserve it.
2022-04-04 18:21:18 +00:00
Pavel Valena
79170aafba docs: do not mention nullglob in cases where it's not needed 2022-04-04 08:00:10 +00:00
Pavel Valena
f3441cc7c5 fix(10i18n): stop leaking shell options
Avoid using shell options in findkeymap, instead of using a wrapper[*]
to restore the previous options. Using mapfile and find to generate the list
of files also has the benefit of being more readable in this case.

[*] Reverted commit 35064768eb
Original issue description from Michal Hecko <mhecko@redhat.com>:

The findkeymap function manipulates the shell options and relies on
restoring them using the trap. However, as the function might be called
recursively, each recursive invocation changes the signal handler to its
own. As the recursion is entered with shell options already modified,
the changed trap handler is replaced with restoration to the modified
shell options, not the original ones.
2022-04-04 08:00:10 +00:00
Pavel Valena
f63faaa68f revert(10i18n): stop leaking shell options
This reverts commit 35064768eb, to replace
the implementation.
2022-04-04 08:00:10 +00:00
Pavel Valena
c7b3ac2bd1 fix(test): nullglob should not be needed 2022-04-04 08:00:10 +00:00
Pavel Valena
bd1a5ca9ae fix(dracut-install): do not fail when SOURCE is optional and missing
When running dracut-install with '-o' (optional source), and nullglob
at the same time, when all of the arguments evaluate <null>, dracut-install
should not fail even when the source is not specified.
2022-04-04 08:00:10 +00:00
Pavel Valena
36aaa74f36 fix(bluetooth): nullglob should not be needed 2022-04-04 08:00:10 +00:00
Pavel Valena
c7cfdf7703 ci: obsolete Dockerfile with Fedora 33 2022-04-04 05:50:52 +00:00
Pavel Valena
92277cc8da ci: add Dockerfile for Fedora 35 2022-04-04 05:50:52 +00:00
Antonio Alvarez Feijoo
4688695621 fix(dracut-initramfs-restore.sh): unpack uncompressed initrd as last option
Attempting to unpack the initrd assuming it is uncompressed when
it is delays the shutdown process by several seconds. This must
be the last check.
2022-03-30 21:25:15 +00:00
Shreenidhi Shedi
0ef40d8812 fix(configure): check for SYS-gettid during configure
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2022-03-30 12:00:58 +00:00
David Teigland
7e03d81fe3 fix(lvm): ignore expected error message from lvm config
The "lvm config" commands that check the filter settings will
often find nothing set and report an error message:
"Configuration node devices/filter not found"
Direct these messages to /dev/null so they do not appear as
noise in system logs.
2022-03-29 02:38:48 +00:00
Zoltán Böszörményi
f6d83f9f5c fix(connman): copy netroot.sh from the network module and install it
As requested by johannbg.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2022-03-28 08:01:46 +00:00
Zoltán Böszörményi
f30d03513f feat(connman): introduce connman support module
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2022-03-28 08:01:46 +00:00
Antonio Alvarez Feijoo
42e9d18892 fix(plymouth): hide dpkg-architecture stderr messages
dpkg-architecture prints warnings and errors to stderr. If the system does
not have gcc installed, it issues a warning:

dpkg-architecture: warning: cannot determine CC system type, falling back to default (native compilation)

This fix checks only the value of the queried variable.
2022-03-27 18:37:39 +00:00
nkraetzschmar
70112297d8 style: remove accidental whitespace in front of comment line 2022-03-27 18:36:55 +00:00
nkraetzschmar
8391a99303 feat: add aarch64 uefi support 2022-03-27 18:36:55 +00:00
Laszlo Gombos
aebeb2ecdf fix(udev-rules): add cdrom udev rules by default
Include cdrom udev rules by default, even if
systemd-udevd or dmsquash-live dracut modules
are not installed.
2022-03-25 20:09:14 +00:00
David Tardon
24d8f35b9c fix(dracut-initramfs-restore.sh): check if SELINUXTYPE is set
It can happen that SELINUXTYPE is not set, e.g., in Fedora/RHEL
installation images /etc/selinux/config is an empty file. That means
that setfiles fails, which makes dracut-initramfs-restore fail too
because it uses "set -x", which means that dracut-shutdown.service
fails. But, after commit 7ab1d00227, a
failure of dracut-shutdown.service means that the final switch back into
initrd is skipped. Let's just add an additional sanity check to
workaround that.
2022-03-18 06:37:23 +00:00
Antonio Alvarez Feijoo
a38d9ec032 fix(bluetooth): make $dbussystem/bluetooth.conf optional
Do not display an error message if $dbussystem/bluetooth.conf file don't exist.
2022-03-17 19:40:23 +00:00
David Tardon
85fdff1212 fix(dracut-systemd): correct service dependencies
dracut-systemd.service is not an early boot service, therefore it should
not use DefaultDependencies=no. This also fixes the service's ordering
dependencies, as in its current state it is missing
Before=shutdown.target umount.target
2022-03-17 05:30:27 +00:00
Michal Hecko
35064768eb fix(10i18n): stop leaking shell options
The findkeymap function manipulates the shell options and relies on
restoring them using the trap. However, as the function might be called
recursively, each recursive invocation changes the signal handler to its
own. As the recursion is entered with shell options already modified,
the changed trap handler is replaced with restoration to the modified
shell options, not the original ones. This patch wraps the findkeymap
function so that the shellopts are manipulated and restored outside the
recursion.
2022-03-09 04:09:53 +00:00
David Tardon
3385989266 fix(dracut.sh): drop restorecon call
AFAICT there is no need for it. cp already applies appropriate label on
the target file (unless --preserve=context is used).
2022-03-09 04:03:32 +00:00
Laszlo Gombos
9a884b3afc fix(dmsquash-live): permanent overlay on the same drive as LiveCD .iso
An example kernel command line arguments for this configuration
iso-scan/filename=distro.iso root=live:CDLABEL=ISO
rd.live.image rd.live.overlay=/dev/sda:/overlay.img

iso-scan would mount /dev/sda first and keep it mounted. The change
allows detecting if the permanent overlay drive is already mounted.
It also ensures that the mount is writable, as permanent overlay
requires writable storage.
2022-03-01 22:37:09 +00:00
Laszlo Gombos
ce55a85ed5 fix(install): restore musl support
__GLIBC_PREREQ is only defined in glibc.
2022-03-01 22:25:53 +00:00
Jóhann B. Guðmundsson
8fd37d20f4 fix(github): remove packit
It's been a year since I initially made the PR to include packit.

Having it has resulted in increasing the project's cost of development
( CoD ) thus defeating the initial purpose of including it, which was an attempt
to do the opposite as in to reduce it, thus removing it.

My take on this after a year in use is that the concept is flawed,
limited to a single distribution and cannot work in practice without
adding to upstreams and it's contributors CoD but other projects milage
may vary.
2022-03-01 21:00:51 +00:00
Savyasachee Jha
9582f02773 feat(dracut): add zfs detection
zfs detection is currently done by the zfs dracut module installed by
downstream, resulting in a lot of duplicated code. This commit puts zfs
detection into the core dracut logic, allowing for detection of zfs
partitions to be done at the same time as all others. It also allows for
dracut to correctly create a `root=` cmdline parameter for zfs.

Signed-off-by: Savyasachee Jha <hi@savyasacheejha.com>
2022-02-28 21:22:38 +00:00
Antonio Alvarez Feijoo
4c355d0558 fix(dracut.sh): error exporting sysctl variables
- Typo assigning depmodd and depmodconfdir.
- Typo exporting a variable called sysctl instead of sysctld.
2022-02-26 09:08:15 +00:00
Lee Duncan
a33a8df43d fix(iscsi): remove unneeded iscsi NOP-disable code
Commit 7374943ae3 ("fix(iscsi): add support for the new iscsiadm
"no-wait" (-W) command") added some code to try to disable iscsi's
NOPs, since they are considered "bad" for an iscsi root disc,
but that code doesn't work because the session is already established
at this point. Open-iscsi will change so that it automatically
disables NOPs for the root disc, so this code can just go away.
2022-02-26 08:13:29 +00:00
Antonio Alvarez Feijoo
d3ab20615e fix(systemd-journald): remove duplicate entry in inst_multiple 2022-02-23 06:21:55 +00:00
Antonio Alvarez Feijoo
28b6adcb27 fix(systemd-timesyncd): add systemd-sysusers dependency
This systemd-timesyncd module depends on systemd-sysusers after the split of
systemd sysuser configs (fec93bb221).
2022-02-23 06:19:34 +00:00
Antonio Alvarez Feijoo
ce82e969f8 fix(systemd-coredump): add systemd-sysusers dependency
The systemd-coredump module depends on systemd-sysusers after the split of
systemd sysuser configs (fec93bb221).
2022-02-23 06:19:34 +00:00
Tao Liu
e2aee2d436 feat(squash): add shell completion for --squash-compressor option
Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-22 17:32:29 +00:00
Tao Liu
3693bfef2f feat(squash): update the manual page for --squash-compressor
Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-22 17:32:29 +00:00
Tao Liu
90d9ae8ca8 feat(squash): decouple the compressor for dracut and dracut-squash
Previously dracut-squash module inherits the compressor
name from dracut, but actually the compressors are totally
different. For dracut, the compressor is zstd/gzip/lzop
cmdline tools, for dracut-squash, the compressor is the
libzstd/libz/liblzo libraries integrated by mksquashfs.

However mksquashfs support less compressors than dracut,
such as bzip2, which is not supported by mksquashfs, so
compressor decoupling seems to be a good idea to handle this.

This patch introduces a new dracut cmdline argument
--squash-compressor, by which the compressor and compressor
specific options can be passed to mksquashfs as
--squash-compressor "lzo -Xalgorithm lzo1x_1_15".

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-02-22 17:32:29 +00:00
Harald Hoyer
631d5f72a2 docs: update NEWS.md and AUTHORS
Signed-off-by: Harald Hoyer <harald@profian.com>
2022-02-18 12:32:53 +01:00
David Disseldorp
acc629abb0 fix(cpio): correct dev_t -> rmajor/rminor mapping
dev_t -> major/minor number mapping is more complicated than the
incorrect major=(dev_t >> 8) minor=(dev_t & 0xff) mapping that we
currently perform. Fix mapping to match Linux / glibc behaviour.

Fixes: https://github.com/dracutdevs/dracut/issues/1695
Reported-by: Ethan Wu <ethanwu10@gmail.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
2022-02-17 19:28:33 +00:00
David Disseldorp
8bd7ddf819 ci(cpio): add test_archive_dev_maj_min
This tests dracut-cpio's handling of rmajor / rminor values compared to
GNU cpio. The test requires root, due to mknod invocation for block
device node creation.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2022-02-17 19:28:33 +00:00
David Disseldorp
80e70f76d9 ci(cpio): add TempWorkDir.create_tmp_mknod helper
This will be used for future device major/minor testing. Convert the
current fifo test to use it.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2022-02-17 19:28:33 +00:00
Thomas Blume
5de6e4d56e fix(dasd_rules): correct udev dasd rules parsing 2022-02-12 08:19:07 +00:00
Thomas Blume
5925266832 fix(zfcp_rules): correct udev zfcp rules parsing 2022-02-12 08:19:07 +00:00
Jóhann B. Guðmundsson
dcaff88ac9 feat(pcsc): introducing the pcsc module 2022-02-08 04:36:00 +00:00
Antonio Alvarez Feijoo
d03fb675d8 fix(bluetooth): make hostonly configuration files optional
Do not fail if any of the expected configuration files don't exist.
2022-02-05 19:52:26 +00:00
Jóhann B. Guðmundsson
34b1dd2e26 fix(bluetooth): dbus configuration path fixes
Add a missing /usr/share path ( fixes #1627 )
Use variable instead of hard path
2022-02-05 19:49:16 +00:00
Henrik Gombos
51ce8893d9 fix(img-lib): install rmdir
rmdir is used in img-lib module.
2022-02-05 13:02:23 +00:00
Jóhann B. Guðmundsson
4753738b62 fix(fido2): add a missing library 2022-02-05 11:49:40 +00:00
Jóhann B. Guðmundsson
c656b612b1 fix(tpm2-tss): add a missing library 2022-02-05 11:49:40 +00:00
Martin Wilck
d754e1c6f0 fix(dracut-functions.sh): ip route parsing
The code for determining local interface and address works
only for peers that are reachable in a single hop.

This is parsed correctly:
192.168.110.1 dev br0 src 192.168.110.160 uid 0 \    cache

But this isn't:
192.168.1.4 via 192.168.110.1 dev br0 src 192.168.110.160 uid 0 \    cache

Fix it.

Fixes: ceca74cc ("dracut-functions: add ip_params_for_remote_addr() helper")
2022-02-04 18:35:33 +00:00
Antonio Alvarez Feijoo
9371dcaba3 fix(fedora.conf.example): rename misspelled variable
There is a typo in the dbussystemconfdir variable.
2022-02-04 13:27:31 +01:00
Renaud Métrich
22a80629b4 fix(dracut): be more robust when using 'set -u'
From bash manpage, FUNCNAME exists only inside functions. When in debug
mode, make sure to use an empty default value as FUNCNAME[0] when
outside of functions.

With bash4 this wasn't an issue, but is with bash5 with hardening option
'set -u' used, as shown in the example below:

Incorrect:

$ bash -u -c 'echo -n ${FUNCNAME[0]}'
bash: line 1: FUNCNAME[0]: unbound variable
$

Correct:

$ bash -u -c 'echo -n ${FUNCNAME[0]-}'
$

This hardening enables sourcing dracut-lib.sh from external utilities
executing in the initramfs such as clevis-luks-askpass, which uses
hardening option 'set -u' internally.
(see Clevis PR https://github.com/latchset/clevis/pull/340)

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2022-02-04 12:24:22 +00:00
Jóhann B. Guðmundsson
c5907f82d8 feat(pkcs11): include the module in the spec file
Adding the module to the spec file
2022-02-02 23:14:00 +00:00
Jóhann B. Guðmundsson
83ea8cf001 feat(pkcs11): introducing the pkcs11 module
This module allows unlocking of an encrypted filesystem using pkcs11.
2022-02-02 23:14:00 +00:00
Jóhann B. Guðmundsson
56f4fb6cb7 feat(crypt): check if pkcs11 module is needed in hostonly mode
In hostonly mode, include the pkcs11 module if any encrypted volumes
are configured to be decrypted using pkcs11.
2022-02-02 23:14:00 +00:00
Antonio Alvarez Feijoo
857b17f090 fix(fips): missing sourcing of dracut-lib
Make sure dracut-lib is sourced inside the fips-noboot script.
2022-02-02 23:02:03 +00:00
Antonio Alvarez Feijoo
e8121bfddd fix(fips): add and remove local variables 2022-02-02 23:02:03 +00:00
Antonio Alvarez Feijoo
7f10c483b6 fix(fips): wrong error message
When /dev/urandom cannot be created, the error message displays /dev/random instead.
2022-02-02 23:02:03 +00:00
Lubomir Rintel
bc4f196f98 fix(dracut-init): unbreak a comment
A dreadful copy & paste or kill-ring-save & yank error, most surely.
2022-02-02 23:00:48 +00:00
Kairui Song
67fc670a88 feat(dracut.sh): add --aggresive-strip option
Dracut currently calls `eu-strip` or `strip` with -g, which only strips
out .debug_* sections. symtab and strtab are kept, but are not required
for runtime, and people will rarely need to do binary level debugging
work in initramfs.

So introduce a --aggresive-strip options, try strip out all sections
that are not required for runtime. This can help reduce the binary size
by a lot.

For example, the size of libc.so is reduced by a lot when stripped
with no option than with -g.

    3014184 libc-2.28.orig.so
    2970920 libc-2.28.strip-g.so
    1460904 libc-2.28.strip.so

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-02-02 22:59:27 +00:00
Antonio Alvarez Feijoo
22e683077a fix(network): wrong test of wicked unit
The test for the wicked service is never met because it
does not have execute permission.
2022-02-02 22:56:23 +00:00
Antonio Alvarez Feijoo
e86397de24 fix(dracut-initramfs-restore.sh): add missing compression options
The unpack fails if the initrd is not compressed or compressed with
bzip2 or LZO.

Fix issue #1463
2022-02-02 22:55:49 +00:00
Renaud Métrich
7ab1d00227 fix(dracut-shutdown): add cleanup handler on failure
It may happen that dracut-shutdown.service fails, for example on timeout
due to very low bandwidth.
In such case, for hardening purposes, a new dracut-shutdown-onfailure.service
unit doing dracut-shutdown.service cleanup needs to execute to make sure
switching root to an incomplete initramfs won't occur later.

See also RHBZ #1924587 (https://bugzilla.redhat.com/show_bug.cgi?id=1924587).
2022-02-02 22:53:31 +00:00
Thomas Blume
d40c49a8df fix(zfcp_rules): remove collect based udev rule creators
The collect binary has been removed, so the rules are broken
2022-02-02 22:52:19 +00:00
Thomas Blume
ebafbd8241 fix(dasd_rules): remove collect based udev rule creators
The collect binary has been removed, so the rules are broken
2022-02-02 22:52:19 +00:00
Kairui Song
35822f3997 fix(memstrack): drop bash runtime requirement
Use nohup instead of disown, and let systemd track the service properly.
This makes the scripts POSIX compatible and bash is no longer needed.

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-02-02 22:51:54 +00:00
Dirk Müller
b3d2dcb71e fix(kernel-modules-extra): handle zstd module extension
The regular expression here is trying to handle various kernel
module compression schemas and was missing the zst extension
which indicates use of zstd.
2022-02-02 22:50:41 +00:00
Adrien Thierry
0e80ff72e0 fix(kernel-modules): add mailbox drivers for arm
Mailbox drivers might be needed by some of the devices used in the
initrd. For example, on the Raspberry Pi 4, the MMC 'sdhci-iproc' driver
depends on 'bcm2835-mailbox'.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
2022-02-02 22:48:59 +00:00
David Teigland
164e5ebb11 fix(lvm): restore setting LVM_MD_PV_ACTIVATED
The 69-dm-lvm-metad.rules udev rule has been removed from
the initrd, because it's been dropped by recent upstream
lvm versions, and it never performed any primary function
within the initrd.  But, it did have the job of setting
LVM_MD_PV_ACTIVATED=1 for active md devices used by PVs.
That step needs to be restored, and is now included in
64-lvm.rules.
2022-02-02 22:48:13 +00:00
David Teigland
1af4674319 feat(lvm): only run lvchange for LV that is seen on devices
Change the command listing LVs from lvscan to lvs, and list
only the LV names that are being activated.  Before attempting
to activate an LV, check that that LV name appears in the
lvs command output.  This avoids wasting time running an
lvchange command that we know will fail.
2022-02-02 22:48:13 +00:00
David Teigland
7ffc5e388b feat(lvm): use generated filter when none is set
Previously, the lvm device filter generated by dracut
would not be used if any lvm.conf file existed in the
initrd.  Change this so that the generated filter will
be used when the included lvm.conf has no filter set.
2022-02-02 22:48:13 +00:00
David Teigland
c0a54f2993 feat(lvm): update lvm command options
Drop checking for options that have been available for
at least ten years.  This simplifies code maintenance.

Add the new --nohints option (when available) to disable
the use of hints which is not useful during startup.
2022-02-02 22:48:13 +00:00
David Teigland
97543cca48 fix(lvm): replace --partial option
The --partial option will activate a linear (or other) LV
without segments for missing devices, which is unlikely to
be useful. The intention was to activate raid LVs in a useful
form while missing devices, which is specified with the option
--activationmode degraded.
2022-02-02 22:48:13 +00:00
David Teigland
50e7466843 revert(lvm): remove 69-dm-lvm-metad.rules
This udev rule runs pvscan to autoactivate VGs, which dracut
does not want to do, and previously disabled by editing the
rule file and commenting out lines.

This also stops /dev/disk/by-id/lvm-pv-uuid-* symlinks from
being created in the initrd.
2022-02-02 22:48:13 +00:00
David Teigland
f6f393f550 revert(lvm): remove lvmetad config changes
Remove support for modifying use_lvmetad and locking_type
settings in lvm.conf for lvm versions 2.2.*.  Recent lvm
versions (2.3.*) do not include lvmetad or locking_type.
This cleanup simplifies code maintenance.

To use the lvm module with older versions (2.2), a user
would need to ensure that lvmetad settings are disabled
in the initrd's lvm.conf rather than relying on the lvm
dracut mode to modify their lvm.conf.
2022-02-02 22:48:13 +00:00
David Teigland
1549d5e898 revert(lvm): remove snapshot feature
The feature of managing lvm snapshots has no known
recent usage.  It is unknown if it works.  The lvm
developers do not wish to maintain or support it.
2022-02-02 22:48:13 +00:00
Martin Wilck
4318533e14 fix(multipath): check if mpathconf is available
Not all distributions utilize and ship the mpathconf utilitiy.
Avoid error messages and systemd complaints about
multipathd-configure.service in this case.
2022-02-02 22:47:25 +00:00
Martin Wilck
6246da400f fix(multipathd.service): drop dependencies on iscsi and iscsid
These dependencies are redundant and will be dropped in upstream
multipath-tools, too.
2022-02-02 22:47:25 +00:00
Martin Wilck
a247d2bc0d fix(multipathd.service): adapt to upstream multipath-tools unit file
In the long run, it's desirable to be able to drop dracut's copy of
multipathd.service and use the upstream one from multipath-tools instead.
This patch makes a step in that direction.

With these changes, the only remaining difference is the support for
rd.multipath=0 and rd_NO_MULTIPATH, which must obviously be ignored in the
upstream unit.

The modifications in this patch are minor and will have no effect in the
initramfs.
2022-02-02 22:47:25 +00:00
Martin Wilck
371b338a5f fix(multipathd.service): remove dependency on systemd-udev-settle
The dependency of multipathd on "udev settle" has recently been removed in
c9689b6 ("multipathd: Remove dependency on systemd-udev-settle.service").

But this dependency has never been necessary in the initramfs environment. It
was only required after switching root, because multipathd would potentially
tear down valid multipath maps after switching from initrd to root FS. This can
happen because dm devices "survive" the root FS switch in the udev data
base (they have the "db_persist" flag set), whereas their component devices
(SCSI etc) do not. But this can only happen after initrd-udevadm-cleanup-db.service
has been run, which happens after initrd processing.

The only dependency that's really needed is that on
systemd-udevd-kernel.socket, because multipathd depends on uevents for
devices being delivered via systemd-udevd.
2022-02-02 22:47:25 +00:00
Martin Wilck
3f2c76bb14 fix(40network): consistent use of "$gw" for gateway
Replace wrong use of $gateway with $gw.

Signed-off-by: Martin Wilck <mwilck@suse.com>
2022-02-02 22:40:07 +00:00
Tony Asleson
fe8df0240a feat(spec): add systemd-integritysetup module
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2022-01-14 14:17:18 +00:00
Tony Asleson
33cf47a608 feat(systemd-integritysetup): introducing the systemd-integritysetup module
Module to allow root FS to be a dm-integrity volume.  Utilizes
functionality added with: https://github.com/systemd/systemd/pull/20902

Information on dm-integrity:
https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/dm-integrity.html

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2022-01-14 14:17:18 +00:00
joshuacov1
4e85874108 fix(base): do not change the provided UUID
During boot dracut parses the provided UUID to lower case and thus starts an
endless loop wating for the devise to appear. The device is actually mapped
correctly by the kernel (which doesn't tweak the UUID) but because we are
waiting for a name with lower charachters the expeted device never appers which
drops us at the emergency shell leaving the system unbootable.
This happens especially on nfts/fat filesystems because technically those don't
have a UUID but searial numbers which are used by the linux tools as UUID.
2022-01-09 18:23:11 +00:00
Laszlo Gombos
813577e2ba fix(dmsquash-live): option to use overlayfs on a block device root
An example kernel command line option for this configuration
root=/dev/sda1 ro rd.live.image rd.live.overlay.overlayfs=1

The change checks if $FSIMG is empty and adds a symlink from
/run/rootfsbase to /run/initramfs/live and changes the place
of the creation of the required mount point directories.
2021-12-11 11:05:02 -05:00
Antonio Alvarez Feijoo
7de9ffc057 fix(dracut.sh): do not ignore invalid config file or dir path
Fix issue #1136
2021-12-11 15:58:50 +00:00
Jóhann B. Guðmundsson
3d8e1ad2ae fix(dracut-initramfs-restore.sh): add missing default paths
Adding missing default paths.
Fixes #1628
2021-12-11 10:58:18 -05:00
Antonio Alvarez Feijoo
d3b5bc17eb fix(network-wicked): multiple path corrections
Since wicked-0.6.67, its dbus configuration files can be installed in /etc or /usr/share.

Also, check if it's using libexec or lib instead of displaying always an error.
2021-12-11 14:32:49 +00:00
David Disseldorp
0af11c5ea5 fix(cpio): write zeros instead of seek for padding and alignment
This is a workaround for GRUB2's Btrfs implementation, which doesn't
correctly handle gaps between extents.

A fix has already been proposed upstream via
https://lists.gnu.org/archive/html/grub-devel/2021-10/msg00206.html

Given that this bug is severe, it makes sense to include this minimal
workaround.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-12-10 08:06:40 -05:00
Laszlo Gombos
3326e4c957 fix(rootfs-block): make the base module dependency explicit
When dracut.sh is called with "--modules rootfs-block",
make sure dracut-lib.sh is installed by making the base module an
explicit dependency.
2021-12-10 08:01:02 -05:00
Cornelius Hoffmann
fec93bb221 fix(systemd-sysusers): use split systemd sysuser configs
Fixes the regression introduced by https://github.com/systemd/systemd/pull/20056
As discussed in #1656 and #1657
2021-12-10 12:59:09 +00:00
Cornelius Hoffmann
dcbe23c14d fix(systemd-sysusers): override systemd-sysusers.service
Fixes a regression with systemd not running units with ConditionNeedsUpdate set in initrds
2021-12-10 12:58:35 +00:00
Antonio Alvarez Feijoo
e3bb1815bb fix(url-lib): improve ca-bundle detection
The current detection routine for openssl-based libcurl assumes that
libcurl has its own hardcoded path to the ca-bundle. Fix the
cases where curl is compiled with:

  --with-ca-fallback --without-ca-path --without-ca-bundle

In this case, we must also grep in OpenSSLs libcrypto.

Other changes:
  - Filter reported but non-existant paths.
  - Strip nul bytes returned by grep.
  - Consider that ca-bundles might use '.pem' instead of '.crt'.

Original-patch-by: Daniel Molkentin <daniel.molkentin@suse.com>
2021-12-10 12:56:14 +00:00
Glenn Morris
d9c3c77437 fix(network-manager): skip non-directories in /sys/class/net
There can be files in this directory, eg "bonding_masters" if a
network bond is in use.
2021-12-10 12:54:32 +00:00
Hans de Goede
14d97a6a28 fix(drm): add privacy screen modules to the initrd
Starting with kernel 5.17 the kernel supports the builtin privacy screens
built into the LCD panel of some new laptop models.

This means that the drm drivers will now return -EPROBE_DEFER from their
probe() method on models with a builtin privacy screen when the privacy
screen provider driver has not been loaded yet.

Make dracut add the privacy screen providing drivers to the initrd
(when necessary for hostmode=yes), so that drm drivers on affected
drivers can probe() successfully.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-12-10 12:40:17 +00:00
Martin Wilck
475497b1bd fix(dracut.sh): check kernel zstd support early
Rather than checking late and falling back to "cat" if the kernel
doesn't support zstd decompression, do this early, and use the
fallback code path.
2021-11-26 17:01:45 +00:00
Martin Wilck
bdac657bf6 fix(dracut.sh): check availability of configured compression
If the configured compression command is unavailable, reset $compress,
and fall back to auto-detection. This allows building an initramfs
even if the configured compression command is not installed. This can
happen e.g. if the distribution uses a preconfigured default, but the
user deinstalled the respective tool.
2021-11-26 17:01:45 +00:00
Martin Wilck
06d47ded67 fix(dracut.sh): inform user about auto-selected compression method
If the compression method is unset, or had to be reset because of
missing dependencies, inform the user what's being used. Also,
replace the printf in the "cat" case with a dwarn.
2021-11-26 17:01:45 +00:00
Martin Wilck
586d3e7664 fix(dracut.sh): drop pointless check for module compression method
There's no need to decompress the kernel modules in dracut, and
"$kcompress" is never referenced. dracut can build the initramfs
just fine if there's no tool for decompressing modules.
2021-11-26 17:01:45 +00:00
Pavel Valena
7938935267 fix(network): add errors and warnings when network interface does not exist
End with error, or show a warning when nonexistent device is specified for network setup like
`ip=10.12.8.12::10.12.255.254:255.255.0.0:xk12:eth0:off`.

I've added the error only for `write-ifcfg.sh`, as I think no such setup should be written.

Resolves: #1712424
2021-11-25 08:58:37 +00:00
Jóhann B. Guðmundsson
5b18b06c7d ci: remove Fedora 33 container
Fedora 33 is scheduled to reach end-of-life (EOL) on 2021-11-30.
No new dracut releases should be ending up in that Fedora release at this point.
2021-11-25 09:23:58 +01:00
José María Fernández
c459373448 fix(resume): resume using /usr/lib64/suspend
Now resume binary is detected in case it is at
/usr/lib64/suspend (like it happens in Gentoo).
2021-11-24 12:17:27 +00:00
José María Fernández
e8c18c9f7f fix(base): add default device choice
when the device is no one of the previous patterns,
substitute the empty default by the input,
to return the same input
2021-11-24 12:17:27 +00:00
Antonio Alvarez Feijoo
d5fd030cc2 feat(crypt): check if fido2 module is needed in hostonly mode
In hostonly mode, include the fido2 module if any encrypted volumes
are configured to be decrypted using a FIDO2 security token.
2021-11-24 12:15:42 +00:00
Antonio Alvarez Feijoo
dc3b976f33 fix(dracut-functions.sh): get block device driver if in a virtual subsystem
dracut does not install the kernel module of the block device that contains
the root filesystem if the following preconditions are met:
- Running in host-only mode.
- Symlinks of all block devices needed to boot the system pointing to virtual
subsystems.

The get_dev_module function uses "udevadm info -a" to get the corresponding
kernel modules of a /sys/class/*/* or /dev/* device. This function is called
in modules.d/90kernel-modules/module-setup.sh to detect if dracut must install
block device drivers in host-only mode. The symlinks in /sys/dev/block/
usually point to "real" devices in /sys/devices/pci*. But, we have come across
some NVMe systems where the kernel creates the symlinks in /sys/dev/block/
pointing to "virtual" devices instead. In this case, udevadm never finds any
"driver" attributes following up the chain of parent devices.
2021-11-24 11:15:25 +01:00
Alexander Wenzel
d364ce8334 fix(mdraid): allow UUID comparison for more than one UUID
If the system provides more than one UUID, the _MD_UUID var
contains a line break after each UUID. Therefore the strstr
function could not find any UUID, caused by the additional
spaces provided to the function.

Furthermore this could lead to a boot interruption, because
the start of a degraded raid1 won't be executed. So, manual
interaction is necessary.
2021-11-24 11:15:11 +01:00
David Disseldorp
8104bf0e83 ci(TEST-63-DRACUT-CPIO): kernel extraction tests for dracut-cpio
dracut-cpio already carries a bunch of unit tests covering compression
and GNU cpio extraction. The purpose of these tests is to exercise the
dracut.sh --enhanced-cpio code-paths as well as kernel cpio archive
extraction.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
afe4a6dbb7 feat(dracut.sh): add "--enhanced-cpio" option for calling dracut-cpio
The new dracut-cpio binary is capable of performing copy-on-write
optimized initramfs archive creation, but due to the rust dependency
isn't built / installed by default.
This change adds a new "--enhanced-cpio" parameter for dracut which
sees dracut-cpio called for archive creation instead of GNU cpio.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
51d21c6b37 feat(Makefile): cargo wrapper for dracut-cpio build
If configured with --enable-dracut-cpio, call cargo to build the
dracut-cpio release binary.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
a9c6704643 feat(cpio): add newc archive creation utility
dracut-cpio is a minimal cpio archive creation utility written in Rust.
It provides support for a minimal set of features needed to create
performant and space-efficient initramfs archives:
- "newc" archive format only
- reproducible; inode numbers, uid/gid and mtime can be explicitly set
- data segment copy-on-write reflinks
  + using Rust io::copy()'s native copy_file_range() support[1]
  + optional archive data segment alignment for optimal reflink use[2]
- hardlink support
- comprehensive tests asserting GNU cpio binary output compatibility

1. Rust io::copy() copy_file_range()
   https://github.com/rust-lang/rust/pull/75272

2. Data segment alignment
   We're bending the newc spec a bit to inject zeros after the file path
   to provide data segment alignment. These zeros are accounted for in
   the namesize, but some applications may only expect a single
   zero-terminator (and 4 byte alignment). GNU cpio and Linux initramfs
   handle this fine as long as PATH_MAX isn't exceeded.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
94fc50262f feat(cpio): add rust argument parsing library from crosvm
Crosvm's rust argument library is very small and simple, while still
providing helpful functionality. It will be consumed by dracut-cpio in a
subsequent commit.

The unmodified, BSD licensed argument.rs source is lifted as-is from
https://chromium.googlesource.com/chromiumos/platform/crosvm
(release-R92-13982.B b6ae6517aeef9ae1e3a39c55b52f9ac6de8edb31).
The one-line crosvm.rs wrapper is needed to ensure that crosvm::argument
imports continue to work.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
3a0f423309 ci(TEST-62-SKIPCPIO): add simple skipcpio test
Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
86bba3d4d4 ci(test): export basedir and testdir as absolute paths
Individual test scripts may change working directory, so relative paths
should be avoided.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
David Disseldorp
1c3f79fb0a ci(TEST-60-BONDBRIDGEVLANIFCFG): use toplevel Makefile
Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-11-24 11:14:54 +01:00
Brandon Sloane
5789abcbe0 fix(fips.sh): repsect rd.fips.skipkernel
Support for this flag was broken in 4257798f8a
2021-11-24 11:14:39 +01:00
Dan Horák
0b97790626 fix(resume): check for presence of /sys/power/resume
On platforms where the kernel is built without suspend/resume support we
see "cat: /sys/power/resume: No such file or directory" message when
creating an initrd image. Check for the presence of /sys/power/resume
first before reading it.

Signed-off-by: Dan Horák <dan@danny.cz>
2021-11-24 09:56:27 +00:00
Alexander Wenzel
4855242ce5 fix(man): default value of rd.retry was increased to 180 seconds
The man page still states the old value of 30 seconds,
which does not reflect the current situation of 180 seconds.
2021-11-24 09:55:51 +00:00
Antonio Alvarez Feijoo
049973b708 feat(fido2): introducing the fido2 module
This module allows to unlock an encrypted filesystem using a FIDO2
security token.
2021-11-24 09:54:44 +00:00
Antonio Alvarez Feijoo
5d990a004b feat(crypt): check if tpm2-tss module is needed in hostonly mode
In hostonly mode, include the tpm2-tss module if any encrypted volumes
are configured to be decrypted using the TPM2 device.
2021-11-24 06:49:39 +00:00
Laszlo Gombos
bf8738d31c fix(dmsquash-live): do not install systemd files when systemd is not enabled
Systemd is an optional module for the dmsquash-live module. This scenario
is properly handled for other modules (for example livenet module) but not
for dmsquash-live module.
2021-11-23 05:53:33 +00:00
Thomas Blume
f905c3a72c fix(s390_rules): drop collect installation
/usr/lib/udev/collect has been removed from udev-v246, so remove it
from the initrd too
2021-11-22 18:09:55 +00:00
Laszlo Gombos
75ad269931 fix(dmsquash-live-ntfs): fuse3 no longer requires ulockmgr_server
fuse3 no longer includes ulockmgr_server.
https://github.com/libfuse/libfuse/blob/master/ChangeLog.rst#libfuse-300-2016-12-08
2021-11-22 09:40:05 +00:00
Renaud Métrich
b9ba3c8bb8 fix(shutdown): be robust against forced shutdown
When a forced shutdown is issued through sending a burst of Ctrl-Alt-Del
keys, systemd sends SIGTERM to all processes. This ends up killing
dracut-initramfs-restore as well, preventing the script from detecting
that the unpack of the initramfs is incomplete, which later causes a
crash to happen when "shutdown" tries to execute from the unpacked
initramfs.

This fix makes sure dracut-initramfs-restore remains alive to detect
the unpack failed (because cpio was killed by systemd too).

Refs:
 * https://bugzilla.redhat.com/show_bug.cgi?id=2023665
2021-11-16 18:29:32 +00:00
Frantisek Sumsal
3f56d481e8 test: don't use -cpu max in GH Actions
There appears to be an issue with newer QEMU versions (spotted with Arch
Linux and C9S containers) which causes the respective GH Action to hang
when booting a QEMU VM in combination with the `-cpu max` parameter.

During (a particularly painful) debugging session I once managed to get
some output from such "frozen" machine (using `earlycon` and
`earlyprintk` kernel cmdline options), and in that particular case the
VM died with a trap caused by an invalid opcode.

I couldn't reproduce this locally, only in GH Actions environment with
Arch Linux and C9S containers. Also, so far I haven't found out which
specific CPUID flag causes this, but using the `IvyBridge-v2` feature
set seems to mitigate the issue.
2021-11-15 11:37:22 +00:00
Andrey Sokolov
5c2f72f152 fix(install): segfault on popen error 2021-11-09 07:01:25 +00:00
Peter Robinson
1539845868 fix(90kernel-modules): add isp1760 USB controller
Like the dwc/chipidea controllers the isp1760 can act in either
host or gadget mode so it ends up in it's own directory. Add this
driver into the initrd as it's part of some arm platforms and
is needed to be able to boot off USB storage.

Fixes issue #1619

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2021-10-28 08:52:03 +02:00
Beniamino Galvani
f6e6be245d fix(network-manager): disable tty output if the console is not usable
The network-manager module also writes logs to the console, so that it's easier
to debug network-related boot issues. If systemd can't open the console, the
service fails and network doesn't get configured.

Add a check to disable tty output when the console is not present or not
usable.

https://github.com/coreos/fedora-coreos-tracker/issues/943
2021-10-21 13:38:41 +00:00
Beniamino Galvani
e07b7ad0e7 fix(network-manager): show output on console only with rd.debug enabled
The module should show the output on console only when initrd debugging is
enabled.
2021-10-21 13:38:41 +00:00
Harald Hoyer
51c06d9fea chore: change my email address
Signed-off-by: Harald Hoyer <harald@profian.com>
2021-10-13 09:07:39 +02:00
Renaud Métrich
d502d2a816 feat(systemd): enable support for systemd compiled with ASAN
When systemd is compiled with ASAN library to troubleshoot memory issues
within systemd code, the libasan library expects to have /proc be
available as soon as systemd starts, which isn't the case currently,
causing an assertion to fail, systemd to crash and kernel to panic:

==1==AddressSanitizer CHECK failed: ../../../../libsanitizer/sanitizer_common/sanitizer_procmaps_common.cc:75 "((data_.proc_self_maps.len)) > ((0))" (0x0, 0x0)
    <empty stack>

X.XXXXXXX Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
[...]
2021-10-12 18:52:06 +02:00
David Disseldorp
96f3177c33 refactor(install): use check_hashmap helper consistently
Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-10-12 13:39:17 +00:00
Peter Robinson
a1287c627f fix(90kernel-modules): add Type-C USB drivers for generic initrd
We need to pull in Type-C USB drivers as they can provide a number of
differnet bits of functionality in early boot including input, display
(altmode DP) and storage so we need to have them available to ensure
functionality attached to those buses/interfaces are available in early
boot.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2021-10-12 13:29:27 +00:00
Laszlo Gombos
e19e38904c fix(dmsquash-live): iso-scan requires rmdir 2021-10-12 13:29:03 +00:00
Harald Hoyer
0c631efb10 fix(dmsquash-live): correct regression introduced with shellcheck changes
`"$opt"` with empty `opt` will give errors for `losetup`.

https://github.com/dracutdevs/dracut/issues/1576

Rename the variable and set the arguments dynamically, if the variable
is set.
2021-10-06 18:08:01 +02:00
David Disseldorp
5c5b73c681 chore(.gitignore): update src and man paths
.gitignore wasn't updated when things were shuffled under src and man
subdirectories.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2021-10-02 06:57:28 +00:00
Luca BRUNO
9491e59928 fix(multipath): drop ExecStop= setting from service unit
This removes the 'ExecStop=' field from `multipathd.service`.
Sometimes CI runs do encounter a failure related to this
service in initrd, which seems to be stemming from a socket
I/O race between the client and the server on shutdown.
It looks like the client (`multipathd shutdown`) can lose the race,
hit an I/O error, and cause the whole unit to fail (even if the server
managed to shutdown properly already).

Notably, the upstream unit does not have such stop command
as the daemon can already perform a graceful exit through
its signal handler.

As such, this commit partially re-aligns the two units,
trying to sidestep any of the existing races.

Refs:
 * https://github.com/coreos/fedora-coreos-tracker/issues/803
 * https://github.com/opensvc/multipath-tools/blob/0.8.7/multipathd/multipathd.service
2021-09-23 09:45:27 +00:00
David Tardon
10ed204f87 fix(install): extend hwcaps library handling to libraries under glibc-hwcaps/ 2021-09-13 12:26:14 +00:00
Antonio Alvarez Feijoo
591118c56d feat(dracut.sh): check if target kernel has zstd support compiled in
If compression option is zstd, check if target kernel supports it.
Otherwise, do not compress the initramfs image.
2021-09-11 06:44:40 +00:00
Antonio Alvarez Feijoo
768dd59ef0 ci(suse.conf.example): change default compression option for SUSE
Due to an internal company decision, SUSE aims to change the default compression
method of the initramfs image to zstd.
2021-09-11 06:44:40 +00:00
Antonio Alvarez Feijoo
acfd97a943 fix(dracut.sh): change misspelled variable name 2021-09-09 10:14:27 +00:00
Antonio Alvarez Feijoo
f1245b5bc1 fix(dracut.sh): remove wrong $ in loop sequence 2021-09-09 06:43:02 +00:00
Shreenidhi Shedi
3fb8723ce0 fix(skipcpio): calculate and use CPIO_MAGIC_LEN
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-27 17:25:35 +00:00
Shreenidhi Shedi
f6d16b6bbd fix(skipcpio): improve error checking
Some other minor tweaks

Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-27 17:25:35 +00:00
Andre Russ
dfbfd33b24 fix(base): tr needs to be installed 2021-08-25 23:58:12 +00:00
Andre Russ
a93fbc4ae0 fix(crypt-gpg): tr needs to be installed 2021-08-25 23:58:12 +00:00
Charles Rose
655c65e6ce fix(nvmf): validate_ip_conn
Fix how ifname for a given local_address is found.
Fix logic to detect presence of ifname and route.

Signed-off-by: Charles Rose <charles.rose@dell.com>
2021-08-23 20:20:11 +00:00
Alexander Tsoy
4afdcba212 fix(usrmount): do not empty _dev variable
Currently $_dev is always overridden with the value returned by
label_uuid_to_dev(). This results in an empty value if $_dev is a
device path. Fix this by calling label_uuid_to_dev() conditionally.

Bug: https://bugs.gentoo.org/807971
Fixes: d3532978de
2021-08-17 07:48:15 +00:00
Thomas Blume
7374943ae3 fix(iscsi): add support for the new iscsiadm "no-wait" (-W) command
remove connection timeout for iscsi firmware targets serving system root
2021-08-17 07:47:20 +00:00
Pingfan Liu
c86f4d2860 fix(kernel-modules): detect block device's hardware driver
On hostonly mode, the platform driver is not copied blindless. There
should be a way to detect the real hardware driver, which probes a block
device.

/sys/dev/block/major:minor is a symbol link, which points to the real
device, recording the hardware stack. And those info can help to
identify the associated drivers for the hardware stack.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
v2 -> v3:
  address shellcheck in dracut-functions.sh
v1 -> v2:
  remove local variable _extra_mod
  shorten subject
2021-08-13 11:36:25 +00:00
Lukas Nykryn
b292ce7295 fix(kernel-modules): add blk_mq_alloc_disk and blk_cleanup_disk to blockfuncs
Since kernel 5-14 those are used by many drivers for example:
xen-blkfront, loop, nbd, pd
2021-08-13 11:27:15 +00:00
Beniamino Galvani
38320fce56 fix(network-manager): write DHCP filename option to dhcpopts file
Anaconda parses the 'filename' variable [1] set in /tmp/net.$netif.dhcpopts to
determine the name of the kickstart file to use.

[1] https://github.com/rhinstaller/anaconda/blob/anaconda-35.21-1/dracut/fetch-kickstart-net.sh#L31-L34
2021-08-10 15:16:48 +00:00
Shreenidhi Shedi
55468a2d40 fix(install): use size_t to avoid -Wsign-compare warning
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi
ef0f848a67 fix(install): improve gettid definition
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi
19537f8943 fix(install): validate return values log.c
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi
b5cf7ec784 fix(install): rectify unused function args in log.c
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Shreenidhi Shedi
e2a61595d2 fix(install): use wrapper for asprintf
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-09 17:11:22 +00:00
Kairui Song
5ab18dee99 fix(squash): apply FIPS and libpthread workaround
There are some workarounds in dracut.sh for FIPS/libpthread covering
some hidden lib dependency issues. These workarounds didn't take effect
for the squash loader since the squash loader is installed
independently. So apply these workarounds again.

Also skip the lib detection code, since these extra installed libs
are small, and squash loader contents are dropped after switch root,
won't be an issue to be always installed. And this makes the code
cleaner.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-08-09 17:08:52 +00:00
Beniamino Galvani
07977ee5c5 fix(cms): reload NetworkManager connections
When NetworkManager is running as systemd service, it's not enough to write
connection files; the module should also tell NetworkManager to reload the
connections from disk so that any new connection can be auto-activated.

https://bugzilla.redhat.com/show_bug.cgi?id=1975929
2021-08-09 17:07:50 +00:00
Beniamino Galvani
5ee7e249b8 fix(network-manager): check for nm-initrd-generator in both /usr/{libexec,lib}
Sice commit 22d6863ef1 ("fix(network-manager): cope with distributions not
using `libexec`") nm-initrd-generator can be installed in either /usr/libexec
or /usr/lib. Change other modules to check for the binary in both locations.
2021-08-09 17:07:50 +00:00
Shreenidhi Shedi
74a4179948 fix(install): use unsigned int instead of unsigned
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-07 20:14:03 +00:00
Shreenidhi Shedi
b0bf8187d5 fix(install): reduce cppcheck warnings
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
2021-08-07 20:14:03 +00:00
Thomas Haller
e509c638e6 fix(network-manager): ensure safe content of /tmp/dhclient."$ifname".dhcpopts
NetworkManager leaves state files behind in "/run/NetworkManager/devices".
These files are in keyfile format (glib's GKeyFile API [1]).

From the statefile, the dracut module writes a .dhcpopts file. And other users
want to parse that file, for example anaconda ([2]). To be fair,
anaconda seems to parse a different file, so I am a bit confused who
uses this file how. In any case, it seems somebody might be tempted to
execute this as a script.

We need to write the .dhcpopts file in a format that is defined and easy
to handle from a shell script. As already previously, this format is
a bash script that sets certain variables. That means, to load the file,
the user could execute it as bash script. But this is dangerous, as the
file contains potentially untrusted data from the network.
Optimally, users still don't trust the .dhcpopts file to be safe for
executing! It would be better if users too try to parse the file
instead of executing it. That is not trivial however because in face
of special characters, as we use bash's `printf '%q'` to escape the values
and parsing bash escaping is not trivial.

Anyway, make sure we properly quote and handle the content so that also
executing is safe. In the best case, there are no special characters
that require escaping, and naive parsing can be done with `sed`.
Otherwise, executing is now also supposed to be safe.

In this case we parse DHCP options from the state file. They are themselves
backslash escaped UTF-8 strings (C escape sequences), which then are stored
via keyfile API. The properly parse them, we would first need to load the file
with GKeyFile (which undoes one level of backslash escaping) and then
use g_str_compress() (to undo the second level). We mimic that with
shell.

[1] b3411d6780/dracut/fetch-kickstart-net.sh (L30)
[2] https://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2021-08-07 19:56:07 +00:00
Beniamino Galvani
c868feb1b1 docs: add a note about other network modules in 'man dracut.cmdline' 2021-08-06 15:59:29 +02:00
Stefan Berger
9da76af8e7 fix(integrity): add support for loading multiple EVM x509 certs
Add support for loading EVM x509 certs from a directory that the user can
specify with the EVMKEYSDIR variable in the evm config file. By default
the additional certs are loaded from /etc/keys/evm.

Support for multiple EVM keys allows the usage in a system of files with
signed metadata from multiple parties.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
2021-08-06 13:58:01 +00:00
Mike Gilbert
f649cd10b2 fix(base): do not quote $initargs for switch_root
We want word splitting to occur so that the arguments are passed
separately, and we don't end up passing an empty string if no arguments
are specified.

Bug: https://bugs.gentoo.org/803548
Fixes: 2fabaaa62d
2021-08-06 13:52:19 +00:00
Kairui Song
cbd85597e3 fix(squash): remove tailing '/' when installing ld.so.conf.d
This tailing '/' will result in following error:

dracut-install: ERROR: installing '/etc/ld.so.conf.d/'
dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.kEFQLs/initramfs -d /etc/ld.so.conf.d/

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-08-06 13:41:23 +00:00
Beniamino Galvani
0e5905315e fix(network-manager): include nm-daemon-helper binary
Since version 1.32, NetworkManager launches a tiny external helper to determine
the hostname via reverse DNS resolution through glibc's nss-dns. Include the
binary.
2021-08-06 13:40:56 +00:00
Zoltán Böszörményi
d7acf107f2 fix(base): repair installing dracut-util
inst_binary uses ${dracutsysrootdir} internally to find the source
file.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2021-07-23 13:11:17 +00:00
Andreas Schwab
3cc9f1c10c fix(kernel-modules): add more modules on RISC-V
Include the same extra modules for ARM also on RISC-V and add drivers/mmc/host
and drivers/spi to the list.
2021-07-21 15:10:00 +00:00
Zbigniew Jędrzejewski-Szmek
a7f5429cb8 fix(dracut-systemd): do not use Requires for vconsole-setup.service
systemd-vconsole-setup.service may fail if the user specifies a missing keymap,
see [1,2,3], or font. This is unfortunate, but the system should not refuse
boot. It is better to continue, possible without the desired font or keymap.
All other systemd services that depend on systemd-vconsole-setup.service do so
without a hard Requires=.

(In particular, systemd-vconsole-setup internally will try to do as much setup
as possible, and will load the font even if it cannot load the keymap and vice
versa.)

[1] https://fedoraproject.org/wiki/Common_F34_bugs#kbd-legacy-media
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1955162
[3] https://bugzilla.redhat.com/show_bug.cgi?id=1955793
2021-07-20 20:53:19 +02:00
Pingfan Liu
dc21638c3f fix(squash): keep ld cache under initdir
When running kdump on PowerPC, the following bug is hit:
[    0.391629] Freeing unused kernel memory: 5568K
[    0.391634] This architecture does not have kernel memory protection.
/bin/sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[    0.392214] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[    0.392214]
[    0.392223] CPU: 6 PID: 1 Comm: init Not tainted 4.18.0-319.el8.ppc64le #1
[    0.392228] Call Trace:
[    0.392234] [c00000000c703c10] [c000000008ecb94c] dump_stack+0xb0/0xf4 (unreliable)
[    0.392243] [c00000000c703c50] [c000000008167324] panic+0x148/0x3c4
[    0.392249] [c00000000c703cf0] [c000000008170474] do_exit+0xcd4/0xd40
[    0.392255] [c00000000c703dc0] [c0000000081705b0] do_group_exit+0x60/0x110
[    0.392261] [c00000000c703e00] [c000000008170684] sys_exit_group+0x24/0x30
[    0.392268] [c00000000c703e20] [c00000000800b408] system_call+0x5c/0x70

This is due to the non-conventional library path:
ldd /bin/bash
        linux-vdso64.so.1 (0x00007fffbdc90000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fffbda80000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fffbda50000)
        libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffbd830000)
                            ^^^
        /lib64/ld64.so.2 (0x00007fffbdcb0000)

ldd finds the path by libc.so.6 -> /usr/lib64/libc.so.6 ->
/usr/lib64/glibc-hwcaps/power9/libc-2.28.so and cache the result. So
when dracut_install, it only saw
'/usr/lib64/glibc-hwcaps/power9/libc-2.28.so' and blind to
'/usr/lib64/libc.so.6'

In the final kdumpimg, the symlink /usr/lib64/libc.so.6 is not created,
hence ld.so can not find the /usr/lib64/glibc-hwcaps/power9/libc-2.28.so

On the other hand, during the process of building kdumpimg, all of dynamic library info
have been cached in ld.so.cache. Hence this bug can be simplely resolved
by keeping ld cache under $initdir/etc.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
v3 -> v4:
  use inst() instead of copy
v2 -> v3:
  fix format by shfmt -s -w modules.d/99squash/module-setup.sh
v1 -> v2:
  cp -r /etc/ld.so* instead of move, since after switch-root, initdir
can not be seen any longer
2021-07-20 12:41:58 +00:00
Zoltán Böszörményi
1beeaf3b71 fix(dracut-install): tweaks to get_real_file()
Fix potential memory leaks in two locations and use
_exit(EXIT_FAILURE) if asprintf(&abspath, ...) fails.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2021-07-19 19:39:57 +00:00
Coiby Xu
6c71ba4121 fix(qeth_rules): check the existence of /sys/devices/qeth/*/online beforehand
On s390x KVM machines, the follow errors occurred,
    $ kdumpctl rebuild
    kdump: Rebuilding /boot/initramfs-4.18.0-321.el8.s390xkdump.img
    /usr/lib/dracut/modules.d/95qeth_rules/module-setup.sh: line 13: /sys/devices/qeth/*/online: No such file or directory
    /usr/lib/dracut/modules.d/95qeth_rules/module-setup.sh: line 13: /sys/devices/qeth/*/online: No such file or directory

because s390x KVM uses virtual devices and /sys/devices/qeth/*/online
doesn't exist. Eliminate this error by checking the existence
beforehand.
2021-07-14 12:46:23 +00:00
Dusty Mabe
a0f12fb6a0 fix(network-manager): don't pull in systemd-udev-settle
We get a nice warning about it being deprecated:

```
systemd-udev-settle.service is deprecated. Please fix nm-initrd.service not to pull it in.
```

The service is deprecated because its purpose was to wait for the
discovery of all hardware, but it didn't guarantee that (see the
systemd-udev-settle man page).

NM now runs as an independent service and can deal with devices showing
up at any point, but it does need udev to be started. For now just
Want/After systemd-udev-trigger.
2021-07-01 10:34:37 +02:00
Masahiro Matsuya
ec50cec3bd fix: SC2046: Quote this to prevent word splitting 2021-06-29 22:03:38 +00:00
Masahiro Matsuya
acb18869e9 fix: SC2086: Double quote to prevent globbing and word splitting 2021-06-29 22:03:38 +00:00
Masahiro Matsuya
2f091b1707 fix(url-lib): make pre-pivot hook separetely per nfs mount 2021-06-29 22:03:38 +00:00
Tomasz Paweł Gajc
f806a628aa fix(mksh): requires printf 2021-06-30 00:01:41 +02:00
LinkTed
6610093698 fix(crypt-gpg): execute --card-status on each try
If the gpg card is not inserted before the --card-status command is
executed then the public key is not linked with the card. Therefore,
the LUKS partition cannot be decrypted. To solve this, the
--card--status command is executed on each try.
2021-06-29 22:00:03 +00:00
Kairui Song
c7fbc0c890 fix(dracut.sh): handle symlinks appropriately while using '-i' option
[[ -d $symlink ]] will return true if the symlink points to a directory.
So the symlink will not be copied, instead a directory is created with
the symlink name and the content is copied.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-29 09:53:19 +02:00
Hari Bathini
f1138012c9 fix(dracut.sh): handle '-i' option to include files beginning with '.'
While including a directory using '--include' option, the file and
subdirectory names that begin with '.' are not included. Also, dracut
throws a warning message when a subdirectory is empty or only has
files or subdirectories that begin with '.'.

For example, while trying to include /tmpdata directory with the
below tree:

  # tree -a /tmpdata
  /tmpdata
  ├── .anothertestdir
  ├── testdir
  │   └── .testsubdir
  └── .testfile

dracut throws the below warning message:

  # dracut --include /tmpdata /root
  cp: cannot stat '/tmpdata/testdir/*': No such file or directory
  #

and this is how the included /tmpdata directory tree looks:

  # tree -a root
  root
  └── testdir

No file or directory beginning with '.' is included & also, copying
/tmpdata/testdir reported "No such file or directory" warning. Using
'.' instead of '*' in the below command will fix the warning whether
the directory being copied is empty or only has files or directories
that begin with dot:

  $DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*

Also, enable 'dotglob' temporarily to include files and directories
beginning with a `.' in the results of pathname expansion of source
directory being included.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
2021-06-29 09:53:19 +02:00
Dusty Mabe
a97d2cedcf fix(network-manager): support teaming under NM+systemd
Previously when NM was run without dbus then teaming would come
up appropriately [1], but now that dbus exists we also need to
include some supporting infrastructure to allow for it to work
again.

[1] d689380cfc
2021-06-28 11:30:34 +00:00
Kairui Song
a2b6be4479 fix(squash): create relative symlinks
Don't use absolute path, or it may resolve to wrong files after unpack
the initramfs to a sub path on a running system.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-28 11:25:58 +00:00
Jonathan Lebon
78557f05a6 fix(fips): handle s390x OSTree systems
On s390x, the `BOOT_IMAGE` karg injected by the bootloader is not a path
to the kernel image, but rather an integer describing the index of the
menu entry selected. Because of the way the s390x bootloader works,
there is no information retained about e.g. the path of the kernel that
was loaded.

This causes issues for the FIPS code which assumes that `BOOT_IMAGE` is
a path to the kernel image to derive the HMAC path. In non-OSTree
systems, this ends up working anyway, because the kernel is located at
the root of the boot partition.  In OSTree systems, this is not the
case. However, OSTree systems use BLS configs, and they are named in
reverse order of precedence (i.e. menu ordering). So from the
`BOOT_IMAGE` integer, we can figure out which BLS entry was selected.

Add some code to do just this on s390x. This isn't completely foolproof,
because it presumes that (1) BLS configs were used to populate the
bootloader (and that they were exactly in the same state they currently
are when `zipl` was run), and (2) there are no other menu entries
originating from outside the BLS configs. However, if these assumptions
are wrong we would simply fail the boot, which is currently what is
happening anyway.

See also:
https://github.com/openshift/os/pull/546
https://github.com/ibm-s390-linux/s390-tools/issues/78

Tested-by: Muhammad Adeel <muhammad.adeel@ibm.com>
2021-06-28 11:25:20 +00:00
David Tardon
2e3c5444d2 fix(multipath): get config. dir from configuration 2021-06-28 13:21:33 +02:00
Frantisek Sumsal
6a44426162 fix(install): add a missing ret value assignment
Spotted when reconfiguring LGTM for RHEL 9 dracut repo.
2021-06-28 11:20:21 +00:00
Dusty Mabe
a97d6e2b13 fix(network-manager): pull in network.target in nm-initrd.service
Otherwise units with `After=network.target` won't have any effect.
2021-06-28 10:58:10 +00:00
Kairui Song
563f543424 feat(squash): install umount util
Also install umount binary, make it possible to cleanup squash overlay
mounts. This is useful for other tools reusing the dracut initramfs built
with squash module enabled.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-06-25 21:11:58 +02:00
Matthias Berndt
8b17105bed fix(tpm2-tss): typo in depends()
There is no systemd-udev module, only systemd-udevd
2021-06-22 15:32:28 +02:00
lapseofreason
e0abf88a15 fix(crypt): remove quotes from cryptsetupopts
Fixes #1528.
2021-06-08 19:28:45 +00:00
Harald Hoyer
86bf2533d7 docs: update NEWS.md and AUTHORS 2021-05-27 14:34:19 +02:00
Tomasz Paweł Gajc
12beeac741 fix(fs-lib): install fsck utilities 2021-05-27 09:13:04 +02:00
Stefan Berger
b12d91c431 fix(integrity): require ALLOW_METADATA_WRITES to come from EVM config file
Upcoming versions of EVM will not require the ALLOW_METADATA_WRITES anymore,
therefore we remove it from the script and require it to be set in the EVM
config file variable EVM_ACTIVATION_BITS for those versions that need it.

Patch 9 in this patch set deprecates the EVM_ALLOW_METADATA_WRITES flag:
https://lore.kernel.org/linux-integrity/20210514152753.982958-1-roberto.sassu@huawei.com/

Suggested-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-05-26 17:11:07 +02:00
Marcos Mello
5eb24aa21d fix(install): configure logging earlier
There are log_error() and log_debug() calls in parse_argv().
2021-05-26 09:22:09 +02:00
Jóhann B. Guðmundsson
7d205598c6 fix(warpclock): minor cleanups
- Removing shell mode lines
- Remove uncessary file requirements
- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section
2021-05-25 14:00:52 +02:00
Jóhann B. Guðmundsson
f4ea5f8734 fix(dash): minor cleanups
- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section
2021-05-25 11:59:08 +00:00
Jóhann B. Guðmundsson
6c673298f3 fix(mksh): minor cleanups
- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section
2021-05-25 11:58:43 +00:00
Marcos Mello
4cb086fa29 feat(install): add default value for --firmwaredirs
If not specified, use /lib/firmware.
2021-05-25 11:48:59 +02:00
Harald Hoyer
a277a5fc7a fix(dracut-functions): get_maj_min without get_maj_min_cache_file set
If `get_maj_min_cache_file` is unset `get_maj_min()` would error out.

Fix it to work without a cache file set.
2021-05-21 14:17:07 +02:00
Harald Hoyer
0a6007bf4f fix(dracut): pipe hardlink output to dinfo
Otherwise the output is cluttered with:
```
Mode:           real
Files:          1364
Linked:         5 files
Compared:       0 xattrs
Compared:       384 files
Saved:          12.84 KiB
Duration:       0.052674 seconds
```
2021-05-21 14:16:43 +02:00
Marcos Mello
c1ab36139d fix(install): sane default --kerneldir
If --kerneldir is not specified, use /lib/modules/$(uname -r).

Fixes #1505
2021-05-20 23:56:40 +00:00
Jóhann B. Guðmundsson
9355cb8ea5 fix(bash): minor cleanups
- Remove hard coded path to binary
- Add missing license header
- Document sections
- refactor install section
2021-05-19 10:29:34 +00:00
Kairui Song
636d6df313 fix(squash): don't mount the mount points if already mounted
It is possible that user setup some early mount in the rootfs even
earlier, so just be more robust and cover that case too.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-19 08:46:34 +00:00
Harald Hoyer
fa63c9be13 ci: add shfmt to Fedora containers 2021-05-18 11:33:27 +02:00
Harald Hoyer
148e420be5 fix(base): add missing str_replace to dracut-dev-lib.sh
```
dracut-dev-lib.sh: line 92: str_replace: command not found
dracut-dev-lib.sh: line 98: /var/tmp/dracut.sabKZg/initramfs/initqueue/finished/devexists-.sh: No such file or directory
dracut-dev-lib.sh: line 83: /var/tmp/dracut.sabKZg/initramfs/emergency/80-.sh: No such file or directory
```
2021-05-18 11:31:16 +02:00
Harald Hoyer
7275c6f6a0 feat(dracut.sh): detect running in a container
Don't try to `mknod` by setting DRACUT_NO_MKNOD.
Don't try to `cp` extended attributrs by setting DRACUT_NO_XATTR.
2021-05-17 16:23:00 +02:00
Harald Hoyer
c08bc8109d fix(base): split out dracut-dev-lib.sh
To share the `wait_for_dev` function and use it without side effects on
install time, split out the needed functions in an extra library.
2021-05-17 16:22:49 +02:00
Lars Wendler
b9b6f0ee5b fix(dracut-util): print error message with trailing newline
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2021-05-14 15:48:32 +00:00
Jóhann B. Guðmundsson
f634448b29 fix(packit): downstream has renamed the master branch to main 2021-05-14 15:50:38 +02:00
Harald Hoyer
53337dfdc3 docs: update NEWS.md and AUTHORS 2021-05-14 15:21:11 +02:00
Harald Hoyer
b2cf61d97f ci: run the integration tests on more distributions
Add OpenSuse and Arch Linux to limited tests.

Only run the full tests against the latest stable Fedora version
to reduce the workload.

Also remove the `hung_task_panic=1` on the kernel command line, as qemu
tends to be really slow in non-kvm mode.
2021-05-14 13:08:07 +02:00
Harald Hoyer
12d0213885 ci: create a fedora rawhide container
Remove Fedora 34 for now, as it is fedora:latest
2021-05-14 12:39:40 +02:00
Jóhann B. Guðmundsson
fc88af5413 feat(systemd-sysext): introducing the systemd-sysext module
Introducing the systemd-sysext module.
2021-05-14 11:35:34 +02:00
Harald Hoyer
5a04bd2dd3 docs: document testing with containers 2021-05-14 08:35:39 +02:00
Harald Hoyer
de0c0872fc fix(dracut): prevent symbolic links containing //
Results in `usr/lib64 -> ..//usr/lib` for Arch Linux otherwise.
2021-05-14 08:35:30 +02:00
Harald Hoyer
22d6863ef1 fix(network-manager): cope with distributions not using libexec 2021-05-14 08:35:22 +02:00
Harald Hoyer
3ad3b3a40d fix: cope with distributions with /usr/etc files 2021-05-14 08:35:09 +02:00
Harald Hoyer
6209edeb5c fix(nbd): assume nbd version >= 3.8
This reduces the quirks.
2021-05-14 08:34:59 +02:00
Harald Hoyer
66b920c651 fix(iscsi): replace sed call with bash internals
This removes a fork/exec and additionally gives more information in debug logs.
2021-05-14 08:34:48 +02:00
Harald Hoyer
8b2afb08ba fix: make testsuite pass on OpenSuse and Arch
This removes some hard assumptions about the file system layout.

It also hardens the tests with network interface renaming rules and
guards.
2021-05-14 08:34:38 +02:00
Harald Hoyer
44fd1c1355 fix(crypt-gpg): cope with different scdaemon location
On Arch things are different for some reason.
2021-05-14 08:34:27 +02:00
Mikhail Novosyolov
5f6be51595 fix(url-lib): fix passing args
Fixes: 8e84fa726 ("fix(url-lib): shellcheck for modules.d/45url-lib")

Behaviour introduced by that commit made the following to be run:
curl "--globoff --location --retry 3 --fail --show-error" http://192.168.1.173:8000/test.ks
instead of:
curl --globoff --location --retry 3 --fail --show-error http://192.168.1.173:8000/test.ks

This broke downloading kickstart file in anaconda-dracut.
2021-05-14 08:33:22 +02:00
Jóhann B. Guðmundsson
61f4564358 fix: adding crc32c for ext3
Noticed that ext3 is still being used in the wild so let's add it to the crc32c list
so downstream does not have to carry a patch for it.
2021-05-14 08:18:40 +02:00
Harald Hoyer
805686930b ci: ensure pigz is installed in the CI containers
pigz speeds up things considerably. Although pigz is already installed
by default, explicitely adding it makes sure, it will not disappear
unnoticed.
2021-05-12 15:48:53 +02:00
Harald Hoyer
e0c0791594 ci: add cpio and pigz to arch container 2021-05-12 15:26:07 +02:00
Harald Hoyer
d24e67e24d ci: really, really cleanup the arch container 2021-05-12 14:59:42 +02:00
Harald Hoyer
886b04abfe ci: cleanup the arch container 2021-05-12 14:34:31 +02:00
Harald Hoyer
c7d8334d26 ci: don't use rpm to determine the kernel version
for `/etc/profile.d/dracut-test.sh`
2021-05-12 14:21:00 +02:00
Harald Hoyer
3c67644fe6 ci: build container images and push to ghcr.io 2021-05-12 13:26:06 +02:00
Jóhann B. Guðmundsson
5c94cf41e8 fix: deprecate gummiboot
Gummiboot was merged into systemd and official became systemd-boot in 2015 ( 6 years ago )
and no longer was being maintained as Gummiboot from that point.

It's safe to say distribution should have migrated to sd-boot by now so let's deprecate
it.
2021-05-11 17:13:09 +02:00
Jaroslav Jindrak
d1a36d3d80 fix(install): handle $LIB in ldd output parsing
The ldd output can contain the variable $LIB, which is a documented feature of
ldd. In a previous commit [0], dracut-install received support for this
variable, but that was later reverted [1] due to issues [2][3] on Gentoo ARM64.

The part before '=>' does not necessarily refer to an existing file (e.g. due
to the usage of $LIB) and thus [1] could be seen as a regression to anyone
that uses this ldd feature. This PR combines both cases together and whenever
it find a '$' character (i.e. a variable) on the left side of the '=>' symbol,
it uses the right hand path (and thus uses evaluation done by ldd), otherwise
falls back to the behavior set by [1].

Reproducer that was presented to me:

$ grep "ibz.so" /etc/ld.so.preload || cat << EOF >> /etc/ld.so.preload
/\$LIB/libz.so.1.2.11
EOF
$ mkdir -p /var/tmp/dracut.xitk6p/initramfs
$ strace /usr/lib/dracut/dracut-install -D /var/tmp/dracut.xitk6p/initramfs -l /bin/bash 2>&1|grep ibz
$ rm -rf /var/tmp/dracut.xitk6p/

[0] 45404a2
[1] 6d886bb
[2] #471
[3] https://bugs.gentoo.org/667752
2021-05-10 15:55:41 +02:00
Jóhann B. Guðmundsson
3697891b75 feat(systemd-journald): introducing the systemd-journald module 2021-05-06 16:59:38 +02:00
Jóhann B. Guðmundsson
0eca191405 chore(tree): move html files to the dosc directory
Moving the html files into the docs directory.
2021-05-06 16:59:14 +02:00
Jóhann B. Guðmundsson
3420a70dee chore(install): move install to src directory
Moving install to the src directory
2021-05-06 16:25:32 +02:00
Jóhann B. Guðmundsson
215365441e feat(systemd-rfkill): introducing the systemd-rfkill module
Introducing the systemd-rfkill module
2021-05-06 15:50:15 +02:00
Jóhann B. Guðmundsson
563c434ecb feat(systemd-ldconfig): introducing the systemd-ldconfig module
Introducing the systemd-ldconfig module
2021-05-06 15:49:48 +02:00
Jóhann B. Guðmundsson
8849dd8d1a fix: add a missing tmpfilesconfdir global variable
Adding a missing tmpfilesconfdir global variable
2021-05-06 15:49:18 +02:00
Jóhann B. Guðmundsson
2b61be32b8 feat(systemd-tmpfiles): introducing the systemd-tmpfiles module
Introducing the systemd-tmpfiles module
2021-05-06 15:49:18 +02:00
Jóhann B. Guðmundsson
9ffe2e4c4b refactor(systemd-networkd): cosmetic move to 01
Moving systemd-networkd to 01 systemd namespace to keep everything in
order.
2021-05-06 15:48:13 +02:00
Harald Hoyer
6feaaabc22 fix(base): suppress calls to getarg in build phase
Setting `DEBUG_MEM_LEVEL` in the build phase prevents
`setmemdebug()` to call `getargnum`, which would use `dracut-getarg`
in the initrd runtime phase.

No more:

```
modules.d/99base/dracut-lib.sh: line 217: dracut-getarg: command not found
```
2021-05-06 10:39:34 +02:00
Renaud Métrich
c3bb9d18dc fix(dracut-functions): implement a cache for get_maj_min
On systems with a large number of devices, usually multipath devices,
dracut can spend a lot of time stat'ing the devices to collect the
major/minor numbers, leading to huge slowness rebuilding the initramfs
when stat'ing devices is slow (seen with oracleasm file systems in
particular).
This commit implements a basic cache stored in a file under
DRACUT_TMPDIR storing the major:minor corresponding to the specified
device.

Reproducer: create N loopback devices used as a LVM extension to volume
group hosting the root file system

  # LVMVG="rhel"
  # NDEVICES=200
  # mkdir devices; for i in $(seq 1 $NDEVICES); do
    truncate -s 10m devices/$i; losetup loop$i devices/$i
  done
  # vgextend $LVMVG $(/bin/ls -1 /dev/loop[0-9]*)

With standard code (tested with RHEL8.3 dracut):

  # dracut -f --debug /tmp/initramfs.img $(uname -r) >/tmp/debug 2>&1
  # grep -c "stat -L -c" /tmp/debug
  2440

With this code:

  # dracut -f --debug /tmp/initramfs.img $(uname -r) >/tmp/debug_optim 2>&1
  # grep -c "stat -L -c" /tmp/debug_optim
  205

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2021-05-06 09:14:10 +02:00
David Tardon
543b8014fc fix(fips): add dh and ecdh ciphers 2021-05-05 16:24:18 +02:00
Harald Hoyer
909961d048 fix: shellcheck 0.7.2
github action `luizm/action-sh-checker@v0.2.2` uses `shellcheck-0.7.2`,
which detects more non-posix shell code and complains accordingly.
2021-05-05 14:55:30 +02:00
Harald Hoyer
0dc87f7b9e docs: install which in Arch container 2021-05-04 18:39:31 +02:00
Mikhail Novosyolov
ce9af251af feat: support ZSTD-compressed kernel modules
Modern Linux kernels support zstd-compressed modules, which was added
by commit 73f3d1b48f50 ("lib: Add zstd modules").

Commit c3d7ef377eb ("kbuild: add support for zstd compressed modules")
added support of compressing modules with zstd to kernel Makefiles.

libkmod >= 28 built with libzstd is also required.
2021-05-04 15:55:19 +00:00
Harald Hoyer
4a76c187d0 docs: document how to run the test suite in podman on Fedora and Arch 2021-05-04 16:34:10 +02:00
Harald Hoyer
373eadaa9c style: make indent and let shfmt fail again
The bump of removed the `-d` option for `shfmt`. Readd it until upstream
is fixed.

See also:
https://github.com/luizm/action-sh-checker/issues/44
2021-05-04 15:39:55 +02:00
Jóhann B. Guðmundsson
0620677238 chore(tree): move package build files in their own directory
Creating pkgbuild directory and move relevant files there.
2021-05-04 15:39:34 +02:00
Harald Hoyer
82e780af25 test(NFS): let it run in an Arch container
`dhclient` on Arch does not understand the `--timeout` parameter.

`/etc/virc` does not need to be installed in tests. This is a debugging
leftover.
2021-05-04 13:47:03 +02:00
Harald Hoyer
7f63374713 fix: include modules.builtin.alias in the initramfs
Let's also resolve the compiled in aliases to builtin modules.
2021-05-04 13:34:16 +02:00
Harald Hoyer
ece67c7e2d test(FULL SYSTEMD): try pacman rather than rpm on Arch
If there is no `rpm`, try `pacman` to get a full list of systemd files
to install into the real test root.
2021-05-04 13:23:56 +02:00
Harald Hoyer
50a01dd4b2 fix: install all depmod relevant configuration files
This is important for running `depmod` in the initrd.
2021-05-04 13:15:49 +02:00
Harald Hoyer
87c4c17850 fix: add modules.builtin.modinfo to the initramfs
This solves all issues, where builtin kernel modules are not recognized
as such.

Fixes: https://github.com/dracutdevs/dracut/issues/1146
Fixes: https://github.com/dracutdevs/dracut/issues/1099
2021-05-04 11:45:53 +02:00
Harald Hoyer
10f9e569c5 fix(crypt): install all crypto modules in the generic initrd
Just install all `=crypto` drivers in the generic initramfs, because who
are we to decide which combinations are allowed in current and future
`cryptsetup`. We only could install blacklist filter in the future, if
there are modules, which are definetely not used and are huge in size.
2021-05-04 11:25:55 +02:00
Harald Hoyer
33e27fab59 feat: also restore the initramfs from /lib/modules
Fallback to /lib/modules/$(uname -r)/initrd, if present and all other
files don't exist.
2021-05-04 11:25:32 +02:00
Harald Hoyer
625f11dca7 chore: skip rpmbuild, if there is no rpmbuild installed
On non-rpm distributions this does not make sense.
2021-05-04 10:39:41 +02:00
Harald Hoyer
44ca04c843 chore: fix indent-c path for src directory 2021-05-04 10:39:28 +02:00
Harald Hoyer
060e1f192e test: use uname -m to determine qemu-system
E.g. `uname -i` does not work in Arch Linux containers.
2021-05-04 10:14:08 +02:00
Jóhann B. Guðmundsson
7359ba8aca fix(systemd-sysusers): misc fixes and cleanup
- module-setup.sh file permission corrected
- comment section cleaned up
- removal of dependency on systemd module
- added inclution of the unit into the sysinit target
- removal of systemctl enablement of type unit
2021-05-04 10:05:25 +02:00
Jóhann B. Guðmundsson
9f9bf8a178 chore(tree): move src into their own src directory
Moving sources into their src directory
2021-05-04 10:02:04 +02:00
Jóhann B. Guðmundsson
a02d17f7af chore(tree): move tools into their own directory
Moving tools into their own directory
2021-05-04 10:01:14 +02:00
Jóhann B. Guðmundsson
a876c27085 chore(tree): move docs into the docs directory
Consolidating all the projects documentation into the docs
directory with the exception of news and readme.
2021-05-04 09:31:11 +02:00
Jóhann B. Guðmundsson
49717458e8 chore(tree): move kernel install files into its own directory
Move kernel install files into it's own directory within the tree.
2021-05-04 09:24:16 +02:00
Jóhann B. Guðmundsson
e5ac28a5be chore(tree): move man pages into a man directory
Moving man pages into it's own man directory within the tree
2021-05-04 09:23:51 +02:00
Jóhann B. Guðmundsson
b544bd6bfa chore(tree): move shell completion into a directory
Moving shell completion into it's own directory for a more organized and
cleaner tree.
2021-05-04 09:22:22 +02:00
Jóhann B. Guðmundsson
86b756346a fix(mdraid): remove dependency statements
mdadm 4.1 was released 2 years ago so it's safe to assume
that everyone are on 4.1.X branch now...
2021-05-03 13:44:29 +02:00
Jóhann B. Guðmundsson
12bef83cda fix(systemd-resolved): remove nss libraries
Removing inclution of nss libraries since they are part of
the systemd module now.
2021-05-03 10:16:48 +02:00
Jóhann B. Guðmundsson
b3bbf5fb6a fix(systemd): include all nss libraries
Include all nss libraries so other modules dont have to.
2021-05-03 10:16:22 +02:00
Jóhann B. Guðmundsson
562cb77b5a fix(systemd-udevd): add udev id program files
Adding missing udev id program files
2021-05-03 10:14:37 +02:00
Stefan Berger
4bdd7eb23a fix(integrity): properly set up EVM when using an x509 cert
The current EVM script does not handle the EVM setup properly when X509
certificates are involved. In this patch we extend the setup and add
the necessary flags for support of EVM activation that include
x509 certificates, possibly in conjunction with an HMAC key. We also
first try activating EVM for x509 certificates using
EVM_ALLOW_METADATA_WRITES for newer kernels, then without it for older
ones that did not support this flag.

We add support for additional EVM activation bits to be set, such
as EVM_SETUP_COMPLETE (0x80000000) via the config file and
EVM_ACTIVATION_BITS variable.

To avoid error messages related to unloading the HMAC key if none is
used, only attempt to unload the HMAC key if one was actually set.

We add documentation about the variables that can be set in the EVM
config file.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Cc: Roberto Sassu <roberto.sassu@huawei.com>
2021-05-03 08:13:48 +00:00
Jóhann B. Guðmundsson
8f99fadabe fix(tpm2-tss): add tpm2 requirement 2021-05-03 10:08:51 +02:00
Jóhann B. Guðmundsson
8743b07356 feat(tpm2-tss): introducing the tpm2-tss module
Introducing the tpm2-tss module
2021-05-03 10:08:51 +02:00
Jóhann B. Guðmundsson
69f4e7cdc3 fix(udev-rules): remove sourcing of network link files
Removing sourcing of network link files from the udev-rules module.
What always should be included should be placed in the systemd-network
module and other modules that provide/require spesific link files
should add them, themselves via their relevant include section.
2021-05-03 10:07:48 +02:00
Jóhann B. Guðmundsson
fd883a58d1 fix(systemd-udev): use global vars instead of fixed path 2021-04-30 10:18:02 +02:00
Harald Hoyer
851a801178 ci: switch to action-sh-checker v0.2.0
See also:
https://github.com/luizm/action-sh-checker/pull/40#issuecomment-829260125
2021-04-29 16:09:02 +02:00
Harald Hoyer
1ffbcadad4 ci: remove label cron job
With the event called pull_request_target added to GitHub Actions, the
cron job can be removed.

See:
https://www.jclem.net/posts/labeling-prs-on-public-github-repositories
2021-04-29 14:57:44 +02:00
Jóhann B. Guðmundsson
f35d479d2b fix(dracut): adding missing globalvars for udev
Adding missing global variables for udev
udevconfdir --> /etc/udev
udevrulesdir --> /usr/lib/udev/rules.d
udevrulesconfdir --> /etc/udev/rules.d
2021-04-29 14:39:51 +02:00
Jóhann B. Guðmundsson
3534789cc4 feat(systemd-udevd): introducing the systemd-udevd module
Introducing the systemd-udevd module
2021-04-29 14:39:21 +02:00
Jóhann B. Guðmundsson
57eefcf705 fix(network): use wicked unit instead of find_binary
dracut-install triggers "ERROR: installing '/usr/lib/wicked/bin/*'"
when find_binary is being used to determine if wicked is installed
so let's just check for the wicked type service unit instead.
2021-04-28 13:21:57 +02:00
Harald Hoyer
3c244c7ca3 fix(multipath): stop multipath before udev db cleanup
All device-mapper based devices, including device-mapper-multipath,
do reuse the udev db from the initramfs after switching to the root fs.

Therefore device-mapper devices have to be correctly initialized before
the udev daemon is stopped, to have the correct entries in the udev db.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1949076
2021-04-28 13:19:33 +02:00
Jóhann B. Guðmundsson
abfd547a85 fix(network-legacy): add missing options to dhclient.conf
Adding the following commonly used options to dhclient.conf
- netbios-name-servers
- netbios-scope
- ntp-servers
- dhcp6.domain-search
- dhcp6.fqdn
- dhcp6.name-servers
- dhcp6.sntp-servers
2021-04-28 09:03:48 +02:00
Jóhann B. Guðmundsson
ba92d1fcad fix(systemd-verity): incorrect reference to cryptsetup target
Incorrect include of remote-cryptsetup.target in hostonly.
Corrected to point to remote-veritysetup.target
2021-04-27 15:05:12 +02:00
Jóhann B. Guðmundsson
0267f3c355 fix(systemd-verity): re-naming module to veritysetup
Renaming the module from systemd-verity to systemd-veritysetup to be inline
with the systemd-cryptsetup module.
2021-04-27 15:05:12 +02:00
Jóhann B. Guðmundsson
3d4dea58f9 feat(systemd-verity): introducing the systemd-verity module
Introducing the systemd-verity module.
2021-04-27 10:32:24 +02:00
Harald Hoyer
ec18a3eb83 ci: reorder the tests 2021-04-26 17:31:54 +02:00
Harald Hoyer
bb6770f1a4 fix(iscsi): add iscsid.service requirements
Since Fedora 34, iscsid.service requires:
- iscsi-init.service
- iscsi-shutdown.service
- a non-empty /var/lib/iscsi/nodes/.dracut
2021-04-26 15:34:24 +02:00
Harald Hoyer
2c5bb67d83 test(ISCSI): fix the watchdog loop
Test for `pidof tgtd` and not the shell background jobs.
2021-04-26 14:13:41 +02:00
Kairui Song
3fdc734a5c fix: search for btrfs devices from actual mount poiont
Currently when dracut search for btrfs device used for initramfs, it
assumes the mount points passed in with "--mount" are all mounted with
given mount path. If user want the device to be mounted to a different
location in initramfs, this will not be true.

eg. with "--mount '/dev/mapper/vol /sysroot btrfs rw,relatime,subvolid=256,subvol=/root'"
and having '/dev/mapper/vol' currently mounted on '/', will raise an
error:
    ERROR: cannot access '/sysroot': No such file or directory

So search for actual mount point of given device.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-04-26 13:41:15 +02:00
Harald Hoyer
b92af86bd5 test: don't fail on modprobe btrfs in create-root.sh 2021-04-26 13:13:59 +02:00
Harald Hoyer
f5721c5921 ci: run all Fedora CI in a matrix
Also automatically cancel it, if the PR is updated
2021-04-26 12:48:27 +02:00
Harald Hoyer
0eb87d7810 fix(iscsi): only rely on socket activiation
Only rely on socket activation. This speeds up in case iscsi isn't used
and also prevents failures, where iscsiuio stopping somehow disables
iscsi.
2021-04-26 11:12:31 +02:00
Jóhann B. Guðmundsson
5eb736103d feat(systemd-initrd): add initrd-usr-fs.target
Adding a new systemd initrd-usr-fs.target to the systemd-initrd module
2021-04-23 11:19:58 +02:00
Jóhann B. Guðmundsson
aaea54c732 fix: quotes in systemd modules
Fixing quotes around *.conf in systemd modules
2021-04-23 10:56:51 +02:00
Jóhann B. Guðmundsson
2f217abdb3 refactor: check() in systemd modules
Refactoring require_binaries in check() for systemd modules
2021-04-23 10:48:54 +02:00
Harald Hoyer
8a51ee1fa6 fix(network-manager): set timeout via command line option
With Fedora 32, only the command line option works for `nm-online`.
2021-04-22 16:17:11 +02:00
Jóhann B. Guðmundsson
e942d86c9d feat(systemd-network-management): introducing systemd-network-management module
Introducing the systemd-network-management meta module which will
allow distribution users and vendors to easily include
systemd + systemd's network management modules by simply include this
module instead of systemd network modules individually.

Obviously if the intent is to glue together somekind of network stack
out of random existing modules such as NetworkManager and or Wicked,
this meta module should not be enabled.
2021-04-22 16:00:16 +02:00
Jóhann B. Guðmundsson
4982e16dd5 fix(network): user variable for sdnetworkd instead of path
Use globalvariable for systemd networkd instead of path
2021-04-22 15:40:58 +02:00
Jóhann B. Guðmundsson
2aa652349c fix(systemd-hostnamed): extra quote 2021-04-22 15:10:15 +02:00
Jóhann B. Guðmundsson
ea779750c3 fix(systemd-networkd): make systemd-networkd a proper network provider
Make systemd-networkd a proper network service provider. Fixes #737
2021-04-22 14:45:23 +02:00
Jóhann B. Guðmundsson
020212534b feat(systemd-timedated): add systemd-timedated module to the spec file 2021-04-22 14:25:36 +02:00
Jóhann B. Guðmundsson
1c41cc90c5 feat(systemd-timedated): introducing the systemd-timedated module
Introducing the systemd-timedated module
2021-04-22 14:25:36 +02:00
Harald Hoyer
4d03404f49 fix(network-manager): run after dracut-cmdline
dracut-cmdline runs `nm-config.sh`, which generates the configurations.

Also remove the now unused `nm-run.service`.
2021-04-22 13:10:19 +02:00
Lev Veyde
85eb96802c fix(img-lib): ignored null byte in input
The system currently throws numerous nasty warning messages during
the boot, about ignored null bytes in input.

This patch adds a filter to the dd command, to filter these null
bytes out, and thus to prevent these warning messages.

Signed-off-by: Lev Veyde <lveyde@redhat.com>
2021-04-22 11:23:22 +02:00
Jóhann B. Guðmundsson
782ac8f1f6 fix(systemd-modules-load): misc repairs
- Removing dependency on the systemd meta module since it causes circular dependency,
  prevents the existance of multiple systemd based meta modules and is redunant.

- Removing directory creation for modules-load since it should not be
  necessary and if it turns out that it is, it will be re-introduced in the
  form of a systemd tmpfile instead of inst_dir.

- Add a missing inclusion of configuration files placed in /usr/lib/modules-load.d
  and /etc/modules-load.d ( hostonly ) directories.

- Fix a spelling error in the systemd type unit file conf directory overwrite
  in the hostonly section.
2021-04-22 10:50:20 +02:00
Jóhann B. Guðmundsson
b7d3caef67 feat(systemd-resolved): introducing the systemd-resolved module
Introducing the systemd-resolved module
2021-04-22 10:48:56 +02:00
Jóhann B. Guðmundsson
bf273e3e86 feat(systemd-hostnamed): introducing the systemd-hostnamed module
Introducing the systemd-hostnamed module.
2021-04-22 10:47:35 +02:00
Jóhann B. Guðmundsson
e740723069 feat(systemd-ac-power): introducing the systemd-ac-power module
Introducing the systemd-ac-power module
2021-04-22 10:44:29 +02:00
Jóhann B. Guðmundsson
afef455718 fix(systemd-modules): remove dependency on systemd meta module
Depending on systemd meta module causes circular dependency,
prevents the existance of multiple systemd based meta modules
and is redunant.
2021-04-22 10:40:48 +02:00
Jóhann B. Guðmundsson
2257d54583 feat(systemd-timesyncd): introducing the systemd-timesyncd module
Introducing the systemd-timesyncd module
2021-04-22 10:39:59 +02:00
Harald Hoyer
49b614961d fix(network-manager): create /run directories
Create the `/run/NetworkManager/initrd` directory before creating
`/run/NetworkManager/initrd/neednet`. Somehow on Fedora 32 this
directory is missing, when the script is running.

This fixes all NetworkManager tests for Fedora 32.
2021-04-22 09:28:35 +02:00
Harald Hoyer
b80ee08093 ci: use /dev/disk/by-id
Due to parallel probing of the linux kernel `/dev/sd*` can't be used to
reliably address a hard disk. This can be seen by the many spurious
failures of the dracut CI, where `mdadm` failed with error 524 or tests
failed due to the success marker message written to the wrong disk.

* don't rely on `/dev/sd*` but use disk ids and `/dev/disk/by-id/ata-disk_<name>`

* specify the exact qemu machine architecture `-M q35` needed for the
  disk ids. A later patch will move this to `run-qemu`, when all tests are converted

* due to `-M q35` the interface names have changed from
  `ens2` -> `enp0s1` and `ens3` -> `enp0s2`
2021-04-22 02:55:31 +02:00
Jóhann B. Guðmundsson
5912f4fbc0 fix(systemd): include hosts and nsswitch.conf in hostonly mode
Adding /etc/hosts and /etc/nsswitch.conf to the hostonly install section.
2021-04-21 15:13:35 +02:00
Peter Robinson
3a60c036db fix(90kernel-modules): add watchdog drivers for generic initrd
The watchdog module pulls in the device specific watchdog if that
module is enabled, but in the case where we need a generic initrd
we don't get all watchdog drivers which means if we have a watchdog
enabled for that usecase it may get kicked too late in the boot
process so we need the drivers in the initrd for the generic case too.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2021-04-21 14:31:30 +02:00
Jóhann B. Guðmundsson
b37c90c8e0 fix(examples): remove the examples directory and reference to it
Let's leave it up to the yocto community to keep and maintain their own
examples.
2021-04-21 09:02:35 +02:00
Jóhann B. Guðmundsson
ec4539c606 fix(dracut.sh): add global vars for modules-load
Adding modulesload modulesloadconfdir global variables
2021-04-20 16:10:12 +02:00
Jóhann B. Guðmundsson
02acedd09e fix(systemd-sysctl): sysctl global variables 2021-04-20 10:52:45 +02:00
Jóhann B. Guðmundsson
3ca9aa1d7b fix(dracut): sysctl global variables 2021-04-20 10:52:45 +02:00
Jóhann B. Guðmundsson
fd15dbad6e fix(nbd): remove old udev version requirements 2021-04-20 10:51:31 +02:00
Jóhann B. Guðmundsson
be30d98751 fix(fips): remove old udev version requirements 2021-04-20 10:51:31 +02:00
Jóhann B. Guðmundsson
fc53987bec fix(systemd): remove old systemd version requirements 2021-04-20 10:51:31 +02:00
Harald Hoyer
7790644362 fix(nbd): make nbd work again with systemd
* Correct the systemd generated sysroot.mount unit with the options
received by the DHCP request and do a `daemon-reload`.

* Inject the `nbd-client -check /dev/nbd0` in the finished initqueue.

* Reactivate the NBD tests and prepare them for NetworkManager tests.
2021-04-19 22:41:01 +02:00
Harald Hoyer
8cd50230d9 ci: use disk ids for TEST 35 ISCSI MULTI
Due to parallel probing of the linux kernel `/dev/sd*` can't be used to
reliably address a hard disk. This can be seen by the many spurious
failures of the dracut CI, where `mdadm` failed with error 524 or tests
failed due to the success marker message written to the wrong disk.

* don't rely on `/dev/sd*` but use disk ids and `/dev/disk/by-id/ata-disk_<name>`

* specify the exact qemu machine architecture `-M q35` needed for the
  disk ids. A later patch will move this to `run-qemu`, when all tests are converted

* due to `-M q35` the interface names have changed from
  `ens2` -> `enp0s1` and `ens3` -> `enp0s2`
2021-04-19 22:32:00 +02:00
Harald Hoyer
2cfd778a45 ci: add function to generate qemu disk arguments
`qemu_add_drive_args` can be used to generate arguments to specify disks
for a qemu machine (`-M q35`).

This is mostly useful to address those raw disks via `/dev/disk/by-id`,
because due to parallel probing in the kernel `/dev/sd*` can point to
anything.
2021-04-19 22:32:00 +02:00
Harald Hoyer
97b86d37f9 fix(bluetooth): shellcheck and hostonly corrections
Don't install files from `/var` in the non-hostonly case.

Use fileglobs, instead of `find`.
2021-04-17 14:07:41 +02:00
Harald Hoyer
ae4fbb3db4 fix(dbus-daemon): only error out in install()
Don't hard exit in `check()`. The transaction logic only checks if it
should/can include the module. Just return `255` and the `dbus` meta
module will pick its dependency.
2021-04-17 13:22:58 +02:00
Adam Alves
64ee2a5386 feat(bluetooth): implement bluetooth support in initrd
- Included a bluetooth module that installs modules, firmware, udev rules and bluetoothd.
- systemd and dbus are required by bluetoothd
- Include bluetooth by default if BT keyboard or combo found
2021-04-16 18:43:31 +00:00
Harald Hoyer
4baedd019b fix(TEST ISCSI): try to debug md error 524
While creating the striped md raid0 sometimes this error occures:

```
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Unknown error 524
  Failed to clear hint file.
  Device /dev/md0 not found.
Powering off.
```

Add debug output with the size of the disks.

Also create disks with multiple of 4096.
2021-04-16 16:27:16 +02:00
Harald Hoyer
31612c7337 ci: remove packit config causing errors
remove the offending parameters, which cause errors described in
https://github.com/dracutdevs/dracut/issues/1346

until we found the correct config to be used.
2021-04-16 16:26:23 +02:00
Beniamino Galvani
112f03f9e2 feat(network-manager): run as daemon with D-Bus
This commit changes how NM is started inside the initrd. Instead of running NM
in the special --configure-and-quit=initrd mode, which sets up network and
quits, start it as a daemon.

This has multiple advantages. First, we no longer need to run NM in a special
mode that requires additional code and maintenance. NetworkManager works
exactly as in the real root.

One problem of the current configure-and-quit approach is that once NM has
quit, dynamic addresses can expire if the initrd setup takes longer than the
DHCP lease interval or than the IPv6 address lifetime. Running NM as a service
solves this problem.

Now NM runs with D-Bus support and therefore its API can be used by other
modules. This open the possibility, for example, to integrate nm-cloud-setup to
automatically configure networking based on cloud metadata.

Use the NetworkManager-wait-online.service, ordered before
dracut-initqueue.service, to delay the initqueue until NM has terminated its
configuration.
2021-04-16 16:15:00 +02:00
Dusty Mabe
6a37c6f630 fix(network-manager): use /run/NetworkManager/initrd/neednet in initqueue
We don't want to start NetworkManager if networking is not needed.
Right now nm-config.sh lays down /usr/lib/dracut/hooks/initqueue/finished/nm.sh
which will cause the initqueue to run. If nothing exists in
/usr/lib/dracut/hooks/initqueue/finished/ then it will short circuit and
the initqueue won't run anything. But what if something else needed
something to run in the initqueue? nm-run.sh would still get started,
even though /usr/lib/dracut/hooks/initqueue/finished/nm.sh didn't exist.
In this case let's just trigger off of /run/NetworkManager/initrd/neednet
like we are doing in the systemd unit (nm-run.service).
2021-04-16 11:12:49 +02:00
Dusty Mabe
ac0e8f7dcc fix(network-manager): only run NetworkManager if rd.neednet=1
Don't run the new systemd unit (nm-run.service) if rd.neednet=1
isn't set. nm-initrd-generator will generate configuration even
without rd.neednet=1 so determining if we should start based on
just if connection profiles exist isn't enough. We need some other
indicator. In this case we lay down a /run/NetworkManager/initrd/neednet
if rd.neednet=1, which is used by nm-run.service to determine the
need to run.
2021-04-16 11:12:49 +02:00
Dusty Mabe
1f21fac646 fix(network-manager): nm-run.service: don't kill forked processes
If teaming is set up via NetworkManager we don't want systemd to take
down the userspace teamd process when NetworkManager quits. `KillMode=process`
will allow it to leave those processes behind.

This is fallout from the change to run NetworkManager via systemd (c17c5b7).

With `KillMode=process` we get something like:

```
sh-5.1# journalctl -u nm-run -o cat | tail
<info>  [1618411262.7030] quitting now that startup is complete
<info>  [1618411262.7030] device (team0): carrier: link connected
<info>  [1618411262.7033] device (team0): team port ens2 was released
<info>  [1618411262.7033] device (team0): team port ens3 was released
<info>  [1618411262.7033] manager: NetworkManager state is now CONNECTED_SITE
<info>  [1618411262.7034] exiting (success)
nm-run.service: Deactivated successfully.
nm-run.service: Unit process 476 (teamd) remains running after unit stopped.
Finished nm-run.service.
```
2021-04-15 13:07:07 +02:00
Dusty Mabe
4fbccde504 fix(dracut-logger.sh): double dash trigger unknown logger warnings during run
There are a bunch of `logger: unknown facility name: --user` errors
during a run. This is because logger is getting passed something like:

```
logger -p --user.info
```

Where it should be something like:

```
logger -p user.info
```
2021-04-15 12:58:49 +02:00
Đoàn Trần Công Danh
651fe01e79 fix(i18n): skip if data is missing
On system that doesn't have either consolefonts, consoletrans, keymaps,
or unimaps, "kbddir" is empty, thus the followed installation will
broken with errors like:

	cp: cannot stat '/consolefonts/*': No such file or directory

Let's report the checks as failure if "kbddir" is empty.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2021-04-13 11:12:37 +02:00
Jóhann B. Guðmundsson
96c313333d fix(dracut.sh): omission is an addition to other omissions in conf files
When omitting a module from the command line via -o or --omit
it's expected that it behaves in the same manner as adding a module from the
command line as in it does not overwrite existing omissions of other modules in
configuration file(s).
2021-04-12 09:18:25 +02:00
Kairui Song
122657b2fe fix(dracut-functions): word splitting issue for sed in get_ucode_file
This unquated regex could be splitted into two arguments and sed will
not work. I've see giving error of wrong arguments being used on my
desktop.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-04-12 09:17:18 +02:00
Harald Hoyer
2d83bce21b fix(nbd): shellcheck regression
`$opts`, `$preopts` and `$nbdport` shouldn't have been quoted as they
can expand to multiple options.

Fixes: https://github.com/dracutdevs/dracut/issues/1270
2021-03-31 21:32:36 +02:00
Harald Hoyer
bb69aff14d docs: clarify netroot=dhcp
`root=dhcp` does not work with systemd, so `netroot=dhcp` should be
used.
2021-03-31 21:32:23 +02:00
Harald Hoyer
7fcc495588 fix(dracut-systemd): regression on root=block:
Commit 3532978de04c7 introduced a regression, where the `root` could be
`root=block:block:/dev/foo`.
2021-03-31 21:31:57 +02:00
Harald Hoyer
8059bcb2c8 fix(base): source hooks without exec
Patch 2fabaaa62d changed the behaviour for `dash`
under the assumption, that dash does not take parameters for `.` aka
`source`. Although this is true, the original positional parameters of
the `source_all` function are still in place, so everything is
fine with the old way of sourcing.
2021-03-31 21:31:00 +02:00
Harald Hoyer
36af0518b3 fix(network): correct regression in iface_has_carrier
Commit e25c536c70 introduced a regression in iface_has_carrier
due to unclear variable naming.
2021-03-31 21:29:52 +02:00
Harald Hoyer
ba4bcf5f4f fix(network-manager): no default deps for nm-run.service
Otherwise nm-run.service will run only in basic.target, which is too
late in the initramfs.
2021-03-31 21:29:33 +02:00
Harald Hoyer
56606b0a1b fix(lunmask): shellcheck regression
`parse-lunmask.sh` is not a bash script
and dash doesn't understand `read -a`.

Revert to the initial code.

Fixes: https://github.com/dracutdevs/dracut/issues/1271
2021-03-31 12:13:31 +02:00
Harald Hoyer
fd4b04da66 fix(lvmmerge): depend on bash 2021-03-31 11:32:48 +02:00
Harald Hoyer
5b965f6308 fix(livenet): fetch-liveupdate.sh does not require bash 2021-03-31 11:32:29 +02:00
Harald Hoyer
fd3698aa42 fix(cms): require bash 2021-03-31 11:32:00 +02:00
Harald Hoyer
3402142e34 fix(network-manager): nm-lib.sh does not require bash 2021-03-31 11:31:47 +02:00
Harald Hoyer
6b499ec14b fix(zipl): don't depend on grub2
There is no grub2 dracut module.
2021-03-31 11:31:30 +02:00
Harald Hoyer
09356085b6 ci: enable shellcheck for everything 2021-03-31 11:31:17 +02:00
Harald Hoyer
1dc61299f7 fix(kernel-modules): shellcheck regression
`$_hostonly_drvs` contained multiple arguments and was quoted.

This patch converts `_hostonly_drvs` into an associative array, which
enables easy deduplication and proper quoting in bash.

Fixes: https://github.com/dracutdevs/dracut/issues/1276
2021-03-31 11:30:49 +02:00
Harald Hoyer
7b8c78ff43 fix(multipath): revise multipathd-stop
A shellcheck regression quoted `HARD` in
```shell
    kill "$HARD" "$pid" > /dev/null 2>&1
```

which would error on an empty "HARD".

Instead of fixing this, use `pkill` instead and also add it to the
non-optional list of binaries to install, which was revised also.

Fixes: https://github.com/dracutdevs/dracut/issues/1275
2021-03-31 11:30:10 +02:00
Harald Hoyer
85378f44af fix(multipath): shellcheck regression
`$_allow` should not have been quoted, because it can be multiple options.

Instead of unquoting it, convert it to an associative array with easy
deduplication and prefix every device with the `--allow` option.

Fixes: https://github.com/dracutdevs/dracut/issues/1274
2021-03-31 11:29:31 +02:00
Harald Hoyer
af3cd22425 fix(nvdimm): shellcheck regression
`_provider_dirs` should not have been quoted, because it should expand
to multiple arguments.

Just remove the whole variable and add those arguments.

Fixes: https://github.com/dracutdevs/dracut/issues/1273
2021-03-31 11:29:07 +02:00
Harald Hoyer
f450ebfdf2 fix(convertfs): require bash 2021-03-31 11:05:29 +02:00
Harald Hoyer
f5046e56bc fix(caps): require bash 2021-03-31 11:04:52 +02:00
Harald Hoyer
007df5adc1 test: mark the whole test subdir as shellcheck'ed 2021-03-31 09:33:03 +02:00
Harald Hoyer
29f335070a fix(dracut-initramfs-restore.sh): shellcheck for dracut-initramfs-restore.sh 2021-03-31 09:32:33 +02:00
Harald Hoyer
7ee8dfca6a fix(examples/yocto): shellcheck again 2021-03-31 09:32:07 +02:00
Harald Hoyer
cd8db54a3d fix(dasd_rules): add bash dependency 2021-03-30 21:10:44 +00:00
Harald Hoyer
23d303f8a0 fix(fcoe-uefi): add bash dependency 2021-03-30 21:04:48 +00:00
Harald Hoyer
c864f8938c fix(TEST MULTINIC): shellcheck 2021-03-30 22:59:46 +02:00
Harald Hoyer
f9b9faf433 fix(fcoe): remove needless bash dependency 2021-03-30 20:04:52 +00:00
Harald Hoyer
f0c606f91d fix(lunmask): remove needless bash dependency 2021-03-30 21:21:01 +02:00
Jóhann B. Guðmundsson
a4cc196467 fix(crypt): include cryptsetups tmpfile 2021-03-30 19:14:38 +00:00
Harald Hoyer
beb3e54ece fix(TEST BASIC): shellcheck 2021-03-30 21:09:06 +02:00
Harald Hoyer
d174e18d2a fix(TEST SYSTEMD): shellcheck 2021-03-30 21:06:09 +02:00
Harald Hoyer
4c4cd24b7c fix(TEST USR-MOUNT): shellcheck 2021-03-30 20:57:04 +02:00
Harald Hoyer
7e140a407b fix(TEST FULL-SYSTEMD): shellcheck 2021-03-30 20:54:26 +02:00
Harald Hoyer
6e7db0467a fix(TEST RAID): shellcheck 2021-03-30 20:48:22 +02:00
Harald Hoyer
34600bbead fix(TEST LVM): shellcheck 2021-03-30 20:38:52 +02:00
Harald Hoyer
cdebbcc684 fix(TEST RAID-DEG): shellcheck 2021-03-30 20:16:02 +02:00
Harald Hoyer
07c944b48c fix(TEST IMSM): shellcheck 2021-03-30 19:56:28 +02:00
Harald Hoyer
92798d7d1b fix(TEST DMSQUASH): shellcheck 2021-03-30 19:33:37 +02:00
Harald Hoyer
d0c9fd6609 fix(TEST LVM-THIN): shellcheck 2021-03-30 19:24:10 +02:00
Harald Hoyer
1c6dd0ddfd fix(TEST NFS): shellcheck 2021-03-30 19:20:45 +02:00
Harald Hoyer
2aa97ff299 fix(TEST ISCSI): shellcheck 2021-03-30 19:06:07 +02:00
Harald Hoyer
7c77835cd6 fix(zfcp_rules): require bash 2021-03-30 17:55:15 +02:00
Harald Hoyer
c2ecc4d131 fix(memstrack): correct dependencies
memstrack does not need to depend on `bash` but does on `systemd`.
2021-03-30 17:51:55 +02:00
Harald Hoyer
e6e78b14dd ci: disable fedora-eln for now
Seems like there is a missing glib2 build in the pipeline, so
fedora-eln only fails, and therefore is of no use for us.
2021-03-30 16:48:48 +02:00
Harald Hoyer
957ab750f0 fix(usrmount): shellcheck for modules.d/98usrmount 2021-03-30 16:35:31 +02:00
Harald Hoyer
f7844c296a fix(TEST ENC-RAID-LVM): shellcheck 2021-03-30 16:34:17 +02:00
Harald Hoyer
79f9b17feb fix(TEST BTRFSRAID): shellcheck 2021-03-30 16:31:54 +02:00
Harald Hoyer
f9f1314acb fix(TEST ISCSI-MULTI): shellcheck 2021-03-30 15:54:54 +02:00
Harald Hoyer
77854c6d2d fix(TEST NBD): shellcheck 2021-03-30 15:53:47 +02:00
Harald Hoyer
6e5878188b fix(TEST BONDBRIDGEVLANIFCFG): shellcheck 2021-03-30 15:53:21 +02:00
Harald Hoyer
90b9c00695 fix(TEST GETARG): shellcheck 2021-03-30 14:57:52 +02:00
Harald Hoyer
718ad799ac fix(TEST RPM): shellcheck 2021-03-30 14:55:29 +02:00
Beniamino Galvani
df1e5f06a5 fix(dbus-broker): enable the service
dbus-broker.service has a 'dbus.service' alias which is installed when the
service gets enabled.

If the alias is not present in the initrd image, services requiring D-Bus in
the initrd fail to start because they depend on dbus.service, which doesn't
exist.

Therefore, enable the service to create the alias.
2021-03-30 14:45:47 +02:00
Harald Hoyer
dd3cac269b fix(examples/yocto): shellcheck 2021-03-30 13:02:21 +02:00
Harald Hoyer
0ce54e8033 fix(lsinitrd.sh): shellcheck for lsinitrd.sh 2021-03-30 12:59:06 +02:00
Harald Hoyer
43df4ee274 feat(mkinitrd): remove mkinitrd
It was not working anyway, so nobody used it for years.
If it is not used, just remove it.
mkinitrd-suse.sh will be maintained by SUSE as it is SUSE specific
anyway.
2021-03-30 12:38:11 +02:00
Harald Hoyer
baa4acd402 fix(test/test-functions): shellcheck for test/test-functions 2021-03-30 12:30:41 +02:00
Harald Hoyer
e010f45524 fix(test/run-qemu): shellcheck for test/run-qemu 2021-03-30 12:26:14 +02:00
Harald Hoyer
51b6784217 fix(fedora-test.sh): shellcheck for fedora-test.sh 2021-03-30 10:47:05 +02:00
Harald Hoyer
f6597b0d51 fix(dm): shellcheck for modules.d/90dm 2021-03-30 10:28:54 +02:00
Harald Hoyer
2536a9eaff fix(install): handle builtin modules
If a `kmod_module` is missing the `path`, it is `builtin`.
2021-03-30 10:27:02 +02:00
Harald Hoyer
8c0fcdd931 fix(network-legacy): shellcheck for modules.d/35network-legacy 2021-03-30 10:14:34 +02:00
Harald Hoyer
6bc9942b41 fix(systemd-modules-load): shellcheck for modules.d/01systemd-modules-load 2021-03-30 10:13:10 +02:00
Harald Hoyer
c94bd1cd82 fix(busybox): shellcheck for modules.d/05busybox 2021-03-30 10:11:24 +02:00
Harald Hoyer
428ef5e471 fix(securityfs): shellcheck for modules.d/96securityfs 2021-03-30 10:07:31 +02:00
Harald Hoyer
a490409702 fix(iscsi): shellcheck for modules.d/95iscsi 2021-03-30 08:56:18 +02:00
Harald Hoyer
77fa33017d fix(mdraid): shellcheck for modules.d/90mdraid 2021-03-30 04:16:57 +02:00
Harald Hoyer
ae9aa8f174 fix(TEST-30-ISCSI): add sync to client root creation 2021-03-30 04:05:34 +02:00
Harald Hoyer
4148f08bd3 fix(cifs): shellcheck for modules.d/95cifs 2021-03-30 03:39:47 +02:00
Harald Hoyer
d97f88f28b test(FULL-SYSTEMD): add fuse kernel module in test root
systemd wants to use it
2021-03-29 16:16:09 +02:00
Harald Hoyer
94b0d89f17 fix(dmsquash-live): shellcheck for modules.d/90dmsquash-live 2021-03-29 15:00:07 +02:00
Harald Hoyer
b130927514 fix(crypt-gpg): shellcheck for modules.d/91crypt-gpg 2021-03-29 14:45:07 +02:00
Harald Hoyer
eb0d3fb9c1 fix(fcoe-uefi): shellcheck for modules.d/95fcoe-uefi 2021-03-29 14:23:02 +02:00
Harald Hoyer
3a04fdff87 fix(fstab-sys): shellcheck for modules.d/95fstab-sys 2021-03-29 13:36:58 +02:00
Harald Hoyer
d8d0b03cb4 fix(lunmask): shellcheck for modules.d/95lunmask 2021-03-29 13:36:38 +02:00
Harald Hoyer
a201be999e fix(nbd): shellcheck for modules.d/95nbd 2021-03-29 13:36:20 +02:00
Harald Hoyer
c5dd11f99f fix(fcoe): shellcheck for modules.d/95fcoe 2021-03-29 13:21:55 +02:00
Harald Hoyer
11e82f3ecc fix(nfs): shellcheck for modules.d/95nfs 2021-03-29 11:40:39 +02:00
Harald Hoyer
c305877c58 fix(nvmf): shellcheck for modules.d/95nvmf 2021-03-29 11:39:52 +02:00
Harald Hoyer
d15441cef4 fix(qeth_rules): shellcheck for modules.d/95qeth_rules 2021-03-29 11:39:07 +02:00
Harald Hoyer
88a83e0db1 fix(resume): shellcheck for modules.d/95resume 2021-03-29 11:37:56 +02:00
Harald Hoyer
4cbe12a31f fix(rootfs-block): shellcheck for modules.d/95rootfs-block 2021-03-29 11:35:08 +02:00
Harald Hoyer
a15a7a1a34 fix(ssh-client): shellcheck for modules.d/95ssh-client 2021-03-29 11:34:46 +02:00
Harald Hoyer
0c4b5cabcf fix(udev-rules): shellcheck for modules.d/95udev-rules 2021-03-29 11:34:31 +02:00
Harald Hoyer
e72c1310fa fix(virtfs): shellcheck for modules.d/95virtfs 2021-03-29 11:34:13 +02:00
Harald Hoyer
2e3e2e0820 fix(zfcp): shellcheck for modules.d/95zfcp 2021-03-29 11:31:55 +02:00
Harald Hoyer
032ecd95c9 fix(zfcp_rules): shellcheck for modules.d/95zfcp_rules 2021-03-29 11:31:31 +02:00
Harald Hoyer
c0efaeca11 fix(znet): shellcheck for modules.d/95znet 2021-03-29 11:30:55 +02:00
Harald Hoyer
f07e695fc5 fix(masterkey): shellcheck for modules.d/97masterkey 2021-03-29 11:30:31 +02:00
Harald Hoyer
7b584edac0 fix(dracut-systemd): shellcheck for modules.d/98dracut-systemd 2021-03-29 11:30:05 +02:00
Harald Hoyer
94157eec8e fix(ecryptfs): shellcheck for modules.d/98ecryptfs 2021-03-29 11:21:35 +02:00
Harald Hoyer
895dd4eb25 fix(integrity): shellcheck for modules.d/98integrity 2021-03-29 11:21:13 +02:00
Harald Hoyer
a2faaf8652 fix(pollcdrom): shellcheck for modules.d/98pollcdrom 2021-03-29 11:20:08 +02:00
Harald Hoyer
cdf927d3ba fix(selinux): shellcheck for modules.d/98selinux 2021-03-29 11:19:47 +02:00
Harald Hoyer
005a7bda8d fix(img-lib): shellcheck for modules.d/99img-lib 2021-03-29 11:19:26 +02:00
Harald Hoyer
f5a14d0f30 fix(memstrack): shellcheck for modules.d/99memstrack 2021-03-29 11:18:14 +02:00
Harald Hoyer
56ea45bd5a fix(shutdown): shellcheck for modules.d/99shutdown 2021-03-29 11:17:11 +02:00
Harald Hoyer
3e1248da7d fix(syslog): shellcheck for modules.d/98syslog 2021-03-29 11:16:05 +02:00
Harald Hoyer
82d9fbf193 fix(fs-lib): shellcheck for modules.d/99fs-lib 2021-03-29 11:15:27 +02:00
Harald Hoyer
4fdc34e503 fix(uefi-lib): shellcheck for modules.d/99uefi-lib 2021-03-29 10:59:40 +02:00
Harald Hoyer
f732667d14 fix(dcssblk): shellcheck for modules.d/95dcssblk 2021-03-29 10:56:39 +02:00
Harald Hoyer
a19ab29197 fix(dasd_rules): shellcheck for modules.d/95dasd_rules 2021-03-29 10:56:21 +02:00
Harald Hoyer
f1c7833a56 fix(dasd_mod): shellcheck for modules.d/95dasd_mod 2021-03-29 10:55:46 +02:00
Harald Hoyer
9dd4d42265 fix(dasd): shellcheck for modules.d/95dasd 2021-03-29 10:55:34 +02:00
Harald Hoyer
d75b029a8c fix(zipl): shellcheck for modules.d/91zipl 2021-03-29 10:54:23 +02:00
Harald Hoyer
2d98cb6f63 fix(crypt-loop): shellcheck for modules.d/91crypt-loop 2021-03-29 10:53:56 +02:00
Harald Hoyer
ad4f8d13f1 fix(qemu): shellcheck for modules.d/90qemu 2021-03-29 10:53:27 +02:00
Harald Hoyer
e601a1ee46 fix(ppcmac): shellcheck for modules.d/90ppcmac 2021-03-29 10:53:07 +02:00
Harald Hoyer
352d6110d0 fix(nvdimm): shellcheck for modules.d/90nvdimm 2021-03-29 10:52:44 +02:00
Harald Hoyer
80f5e83ed5 fix(multipath): shellcheck for modules.d/90multipath 2021-03-29 10:52:28 +02:00
Harald Hoyer
37b1f66f00 fix(lvm): shellcheck for modules.d/90lvm 2021-03-29 10:51:34 +02:00
Harald Hoyer
0315e16955 fix(livenet): shellcheck for modules.d/90livenet 2021-03-29 10:50:51 +02:00
Harald Hoyer
f0ad24623a fix(kernel-network-modules): shellcheck for modules.d/90kernel-network-modules 2021-03-29 10:50:16 +02:00
Harald Hoyer
27f5e75893 fix(kernel-modules-extra): shellcheck for modules.d/90kernel-modules-extra 2021-03-29 10:49:52 +02:00
Harald Hoyer
a26e12cefc fix(kernel-modules): shellcheck for modules.d/90kernel-modules 2021-03-29 10:46:46 +02:00
Harald Hoyer
1b3b55894e fix(dmraid): shellcheck for modules.d/90dmraid 2021-03-29 10:45:33 +02:00
Harald Hoyer
e08c644ee6 fix(cms): shellcheck for modules.d/80cms 2021-03-29 10:43:55 +02:00
Harald Hoyer
a4cdc25210 fix(plymouth): shellcheck for modules.d/50plymouth 2021-03-29 10:42:20 +02:00
Harald Hoyer
91f49acd1c fix(gensplash): shellcheck for modules.d/50gensplash 2021-03-29 10:41:38 +02:00
Harald Hoyer
0ba7a48695 fix(drm): shellcheck for modules.d/50drm 2021-03-29 10:12:46 +02:00
Harald Hoyer
8e84fa7262 fix(url-lib): shellcheck for modules.d/45url-lib 2021-03-29 10:12:19 +02:00
Harald Hoyer
8df14af245 fix(ifcfg): shellcheck for modules.d/45ifcfg 2021-03-29 10:11:15 +02:00
Harald Hoyer
e8857c59b1 fix(lvmmerge): shellcheck for modules.d/80lvmmerge 2021-03-29 10:10:06 +02:00
Harald Hoyer
abc9879c9d fix(cio_ignore): shellcheck for modules.d/81cio_ignore 2021-03-29 10:09:51 +02:00
Harald Hoyer
640458bbf6 fix(btrfs): shellcheck for modules.d/90btrfs 2021-03-29 10:09:26 +02:00
Harald Hoyer
682b297207 fix(crypt): shellcheck for modules.d/90crypt 2021-03-29 10:08:59 +02:00
Harald Hoyer
e25c536c70 fix(network): shellcheck for modules.d/40network 2021-03-29 09:57:50 +02:00
Harald Hoyer
d76a2cfe21 fix(network-wicked): shellcheck for modules.d/35network-wicked 2021-03-29 09:57:23 +02:00
Harald Hoyer
00ca6bed37 fix(i18n): shellcheck for modules.d/10i18n 2021-03-29 09:56:49 +02:00
Harald Hoyer
2b5ddc7722 fix: shellcheck for dracut*.sh 2021-03-29 09:54:52 +02:00
Harald Hoyer
0342a7d11c docs: add docs/BASH.md
Add a little document providing help in common bash problems.
2021-03-26 16:08:49 +01:00
Harald Hoyer
10616019de fix(systemd): shellcheck for modules.d/00systemd 2021-03-26 15:16:07 +01:00
Harald Hoyer
25f6841344 fix(network-manager): shellcheck for modules.d/35network-manager 2021-03-26 15:02:59 +01:00
Harald Hoyer
ec12017055 fix(convertfs): shellcheck for modules.d/30convertfs 2021-03-26 13:44:20 +01:00
Harald Hoyer
4042816955 fix(dbus-daemon): shellcheck for modules.d/06dbus-daemon 2021-03-26 13:24:45 +01:00
Harald Hoyer
5a420e6183 fix(watchdog): shellcheck for modules.d/04watchdog 2021-03-26 13:24:17 +01:00
Harald Hoyer
7193b6f0cb fix(dbus-broker): shellcheck for modules.d/06dbus-broker 2021-03-26 13:23:59 +01:00
Harald Hoyer
95729721cc fix(watchdog-modules): shellcheck for modules.d/04watchdog-modules 2021-03-26 13:22:53 +01:00
Harald Hoyer
fac7505b69 fix(modsign): shellcheck for modules.d/03modsign 2021-03-26 13:14:16 +01:00
Harald Hoyer
231917e9b5 fix(systemd-networkd): shellcheck for modules.d/02systemd-networkd 2021-03-26 13:02:57 +01:00
Harald Hoyer
3dbc6c3d44 fix(caps): shellcheck for modules.d/02caps 2021-03-26 13:01:34 +01:00
Harald Hoyer
8bf6861b58 fix(systemd-sysusers): shellcheck for modules.d/01systemd-sysusers 2021-03-26 13:01:17 +01:00
Harald Hoyer
8e10fa7d27 fix(systemd-sysctl): shellcheck for modules.d/01systemd-sysctl 2021-03-26 12:59:52 +01:00
Harald Hoyer
ddc7bf456a fix(systemd-repart): shellcheck for modules.d/01systemd-repart 2021-03-26 12:59:20 +01:00
Harald Hoyer
c3a9a8cf3d fix(systemd-initrd): shellcheck for modules.d/01systemd-initrd 2021-03-26 12:27:24 +01:00
Harald Hoyer
b8ca67280f fix(systemd-coredump): shellcheck for modules.d/01systemd-coredump 2021-03-26 12:24:22 +01:00
Harald Hoyer
3f114d3e31 fix(systemd-ask-password): shellcheck for modules.d/01systemd-ask-password 2021-03-26 12:21:09 +01:00
Harald Hoyer
6aa59dd8ab fix(fips): shellcheck for modules.d/01fips 2021-03-26 12:20:15 +01:00
Harald Hoyer
f8e90c8f70 fix(warpclock): shellcheck for modules.d/00warpclock 2021-03-26 12:17:19 +01:00
Harald Hoyer
2fabaaa62d fix(base): shellcheck for modules.d/99base
Also remove some functions, which are not used and broken anyway.
2021-03-26 12:17:00 +01:00
Harald Hoyer
cbef7cf3da fix(squash): shellcheck for modules.d/99squash 2021-03-26 11:26:02 +01:00
Harald Hoyer
f274cf4c81 fix(biosdevname): shellcheck for modules.d/97biosdevname 2021-03-26 11:23:23 +01:00
Harald Hoyer
2097e38490 fix(terminfo): shellcheck for modules.d/95terminfo 2021-03-26 11:22:09 +01:00
Harald Hoyer
3736ed7ca4 fix(debug): shellcheck for modules.d/95debug 2021-03-26 11:19:13 +01:00
Harald Hoyer
fb3a30efbf fix(qemu-net): shellcheck for modules.d/90qemu-net 2021-03-26 11:17:07 +01:00
Harald Hoyer
8109b6c0d4 fix(dmsquash-live-ntfs): shellcheck for modules.d/90dmsquash-live-ntfs 2021-03-26 11:13:04 +01:00
Harald Hoyer
1ce0eeffab fix(dbus): shellcheck for modules.d/09dbus 2021-03-26 11:07:59 +01:00
Harald Hoyer
74668e212d fix(rngd): shellcheck for modules.d/06rngd 2021-03-26 11:07:45 +01:00
Harald Hoyer
f32b5e582e fix(rescue): shellcheck for modules.d/03rescue 2021-03-26 11:06:05 +01:00
Harald Hoyer
f506c4268b fix(mksh): shellcheck for modules.d/00mksh 2021-03-26 10:56:54 +01:00
Harald Hoyer
b470a79c18 fix(dash): shellcheck for modules.d/00dash 2021-03-26 10:55:53 +01:00
Harald Hoyer
dafdf37268 fix(bash): shellcheck for modules.d/00bash 2021-03-26 10:55:36 +01:00
Harald Hoyer
90c679e753 ci: shellcheck all directories with .sh 2021-03-26 09:35:30 +01:00
Harald Hoyer
d376b98537 test: add shellcheck to Makefile 2021-03-26 09:35:30 +01:00
Harald Hoyer
cc914eaa8b style: use shfmt 3.2.4 2021-03-19 11:34:05 +01:00
David Hildenbrand
f3dcb60619 feat(qemu): include the virtio_mem kernel module
This adds support for virtio-mem devices, which provide a dynamic
amount of memory in a VM. Right now, the driver gets loaded and any
memory gets added to the system when loading the kernel module from disk.

While not strictly required to boot, we want to be able to
1) add virito-mem provided memory to the system early while booting up
2) add virtio-mem provided memory even when booting without a disk
3) add virtio-mem devices without adding actual memory in kdump
   environments such that we can query things like:
 a) is a certain PFN currently plugged in the hypervisor and, therefore,
    should actually be read when creating a system dump. (kexec-tools
    prepares the vmcore header, like on x86-64)
 b) which ranges of a virtio-mem device are currently plugged in the
    hypervisor and, therefore, should be added to the dump. (vmcore header
    gets prepared by the crashkernel, like on s390x)
 Note that loading virtio-mem in kdump environments currently fails with
 -EBUSY -- but there are plans to install proper hooks instead to support
  especially a) in the near future.

1) and 2) are only really effective when memory hotplug is configured to
automatically online all added system RAM in the kernel (and not late,
via udev rules): e.g., via "mhp_default_state=online" on the kernel
cmdline or via CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE in the kernel.

Especially 2) and 3) require the module to be present inside the initial
ramdisk. The primary use case for including it in the initial ramdisk
is 3).

Signed-off-by: David Hildenbrand <david@redhat.com>
2021-03-18 15:04:10 +01:00
Harald Hoyer
2ec7fa190e style(install): astyle post correction 2021-03-15 15:37:08 +01:00
Harald Hoyer
b7b8eedab5 docs: document astyle in HACKING.md 2021-03-15 15:37:08 +01:00
Harald Hoyer
f1ed92c348 style: use astyle for C formatting 2021-03-15 15:37:08 +01:00
Harald Hoyer
5667978e7b style: use astyle instead of indent 2021-03-15 15:37:08 +01:00
Harald Hoyer
0850cf532d style(install): use block for the FOREACH macros 2021-03-15 15:37:08 +01:00
Harald Hoyer
9e587f0008 ci: splitout indent-c from indent
... to be able to call it from CI
2021-03-15 15:37:08 +01:00
Harald Hoyer
07b65603ff test: check for shfmt in Makefile 2021-03-15 15:37:08 +01:00
Jóhann B. Guðmundsson
01126a209a chore(.packit.yml): adding all fedora release + centos to packit
With this config change,copr builds will happen on pull requests
for all fedora development branches and the next major RHEL release
( fedora-eln ) and on commits, copr builds will happen on all fedora
release and the next major RHEL release.
2021-03-15 10:20:08 +01:00
Harald Hoyer
567c455753 fix(udev-rules): add btrfs udev rules by default
Install `64-btrfs.rules` unconditionally to mark btrfs devices ready or
not.

In case no `btrfs` kernel module is available in the initramfs, the
device should not be ready.

Depends on: https://github.com/systemd/systemd/pull/18802

Fixes: https://github.com/dracutdevs/dracut/issues/947
2021-03-13 20:13:13 +01:00
Harald Hoyer
d4caa86aba feat(btrfs): add 64-btrfs-dm.rules rules 2021-03-13 19:12:54 +00:00
Harald Hoyer
d85b7e4edd ci: add lint for C and shell format 2021-03-13 20:10:43 +01:00
Harald Hoyer
0561f953c4 docs: document code formatting in HACKING.md 2021-03-13 20:10:43 +01:00
Harald Hoyer
9bc5282e30 style: make indent for C 2021-03-13 20:10:43 +01:00
Harald Hoyer
2b50b67c50 style: shfmt post reformat 2021-03-13 20:10:43 +01:00
Harald Hoyer
75d758e8f1 style: shfmt -s reformat
reproducible with:

```
$ shfmt_version=3.0.1
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```
2021-03-13 20:10:43 +01:00
Harald Hoyer
9a52c3fdb0 style: shfmt reformat
reproducible with:

```
$ shfmt_version=3.0.1
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w .
```
2021-03-13 20:10:43 +01:00
Harald Hoyer
560402c3dc style: shfmt pre correction 2021-03-13 20:10:43 +01:00
Harald Hoyer
e0a0fa6174 feat: extend Makefile indent target
- extend the C indent file pattern
- add shfmt, if installed
2021-03-13 20:10:43 +01:00
Harald Hoyer
eddca44221 chore: add .shellcheckrc 2021-03-13 20:10:43 +01:00
Harald Hoyer
9012f3996b fix: set vimrc and emacs indention according to .editorconfig 2021-03-13 20:10:43 +01:00
Harald Hoyer
1f621aba37 feat: customize .editorconfig according to shfmt 2021-03-13 20:10:43 +01:00
Harald Hoyer
5d99b4d0eb test: fix test 98 getarg
Fix a mis-replaced comparison.
2021-03-12 09:20:32 +01:00
Harald Hoyer
60a34d8b11 fix(network-legacy): silence getargs 2021-03-10 19:31:19 +01:00
Harald Hoyer
72cba8aecd test: sync and poweroff in create-root.sh 2021-03-10 19:31:19 +01:00
Harald Hoyer
1b61cfdbec fix: use getargs with _cryptgetargsname 2021-03-10 19:31:19 +01:00
Harald Hoyer
455329cf71 test: change the LABEL to include spaces
Test for root device with a LABEL, which includes spaces.
2021-03-10 19:31:19 +01:00
Harald Hoyer
b800edd698 fix(base): wait_for_dev quote shell variables 2021-03-10 19:31:19 +01:00
Harald Hoyer
d3532978de refactor: factor out label_uuid_to_dev 2021-03-10 19:31:19 +01:00
Harald Hoyer
40fc0ad40d chore: update .gitignore 2021-03-10 19:31:19 +01:00
Harald Hoyer
501d82f796 fix: correctly handle kernel parameters
The kernel has an odd way to handle `"` surrounded parameters.
To handle the parameters as the kernel would do, no simple shell script
suffices, so a new utility `dracut-util` is introduced. Written in "C"
it handles `dracut-getarg` and `dracut-getargs` as the old shell script
functions `_dogetarg` and `_dogetargs` would.
2021-03-10 19:31:19 +01:00
Harald Hoyer
d643156d56 fix: remove dracut.pc on make clean 2021-03-10 17:58:37 +01:00
Harald Hoyer
d8a454a537 fix: honor KVERSION environment in the Makefile 2021-03-10 17:58:08 +01:00
Jonas Jelten
b12f8188a4 feat(nbd): support ipv6 link local nbds 2021-03-09 13:58:10 +00:00
Kairui Song
7c0bc0b2fd perf: disable initrd compression when squash module is enabled
With squash module, the initramfs is double compressed, which slow down
the build progress and doesn't shrink the size much.
2021-03-09 13:40:35 +00:00
Kairui Song
5d05ffbd87 feat: squash module follow --compress option
Try to make mksquashfs follow --compress option if squash module is
included, if not specified or invalid, fall back to use mksquashfs's
default compressor.
2021-03-09 13:40:35 +00:00
Kairui Song
a9345f6800 refactor: delay compressor detection
No function change, decide which compressor to use right before
compressing the initramfs.

This may delay the print of this message:
"dracut: no compression tool available. Initramfs image is going to be big."
but should be OK, this message is not an error.
2021-03-09 13:40:35 +00:00
Kairui Song
90f269f6af feat(squash): use busybox for early setup if available
Use busybox can help reduce the size of early setup environment.

With this change, everything is packed in the squash image, and
the setup files will be dropped once squash image setup is done,
so initramfs stage memory usage is reduced to the minimun,
and initramfs decompress is also faster.

File layout of a squash initramfs looks like this:

========================================================================
drwxr-xr-x   1 root     root            0 Feb 15 14:07 .
-rwxr-xr-x   1 root     root          946 Feb 15 14:07 init
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 lib -> usr/lib
drwxr-xr-x   1 root     root            0 Feb 15 14:07 squash
-rw-r--r--   1 root     root     91000832 Feb 15 14:07 squash-root.img
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/bin
-rwxr-xr-x   1 root     root      1293688 Jul 27  2020 usr/bin/busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/echo -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/mkdir -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/modprobe -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/mount -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/sh -> busybox
lrwxrwxrwx   1 root     root            7 Feb 15 14:07 usr/bin/switch_root -> busybox
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/dracut
-rw-r--r--   1 root     root           23 Feb 15 14:07 usr/lib/dracut/build-parameter.txt
-rw-r--r--   1 root     root           31 Feb 15 14:07 usr/lib/dracut/dracut-051-93.git20210215.fc33
-rw-r--r--   1 root     root          358 Feb 15 14:07 usr/lib/dracut/modules.txt
-rw-r--r--   1 root     root            0 Feb 15 14:07 usr/lib/dracut/need-initqueue
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/modules
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/modules/5.10.11-200.fc33.x86_64
drwxr-xr-x   1 root     root            0 Feb 15 14:07 usr/lib/modules/5.10.11-200.fc33.x86_64/kernel
<... kernel module misc files skipped ... >
========================================================================
2021-03-09 13:40:35 +00:00
Kairui Song
8f7c332e48 refactor(squash): structure in a cleaner way
Simplify the squash mount layout. Instead of overlay on each top
directory (/etc, /usr), just mount and switch_root into the squash
image, with a overlay on top of it.

Also install the binaries and setup scripts separately, so the squash
setup code and the squash image content is independent of each other,
all squash setup script and binaries can be deleted safely upon
switch_root.

With this change, previous squash clean up service and other tricky
implementations are all gone.

This commit depends on systemd commits from:
https://github.com/systemd/systemd/pull/18124

Previouly systemd doesn't recognize non-ramfs initramfs, now this is
doable with SYSTEMD_IN_INITRD=lenient

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-03-09 13:40:35 +00:00
Kairui Song
bdd194bb8c refactor(squash): don't record mount points in text file
The squasn mount points are recorded in text file so later clean up
script can umount them, this is not needed, the mount points are fixed
so just detect the umount by hardcoded pattern.
2021-03-09 13:40:35 +00:00
Kairui Song
5a18b24a8b feat(squash): install and depmod modules seperately
Separately install the modules required for squash image setup.
These modules can be deleted after squash image setup to save
memory.

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-03-09 13:40:35 +00:00
Kairui Song
f9f4264d03 refactor(squash): move all setup code to init-squash.sh
Seperate of init.sh and setup-squash.sh is pointless, merge them into one.
2021-03-09 13:40:35 +00:00
Kairui Song
8c8aecdc63 fix(squash): post install should be the last step before stripping
Ensure dracut squash module doesn't effect other steps, and stripping
can cover the new binaries installed by it.
2021-03-09 13:40:35 +00:00
Kairui Song
95ea16aa60 refactor(squash): move the post install scripts into the module-setup.sh
No function change, just move the post install code to 99squash to clean
up dracut.sh.
2021-03-09 13:40:35 +00:00
Kairui Song
c552c99ef8 fix(squash): this module shouldn't depend on bash
Any other shell should just work.
2021-03-09 13:40:35 +00:00
Jóhann B. Guðmundsson
28545cda45 chore(labeler): remove the needs review label
There is no longer need to have pull requests labeled with the needs
review label since reviews are now mandatory on pull request.
2021-03-03 13:23:15 +00:00
Jóhann B. Guðmundsson
9cf7b1c529 fix: always use mkdir -p
Ensuring that directory creations dont trigger error if directory
previously existed as well as create parent directories if needed.
2021-03-03 13:06:02 +01:00
Daniel Molkentin
92e6a8f879 fix(kernel-modules): optionally add /usr/lib/modules.d to initramfs
On SUSE, there is no /lib/modules.d, only /usr/lib/modules.d.

Upstream-Bug: http://bugzilla.opensuse.org/show_bug.cgi?id=1180822

Reference: bsc#1180822
2021-03-03 11:42:09 +01:00
Lennart Poettering
a96900a82c fix(dracut-systemd): don't refuse root=tmpfs when systemd is used
A match for systemd PR#18847
2021-03-02 21:23:03 +00:00
Renaud Métrich
d8e47e201a fix(dracut.sh): harden dracut against GZIP environment variable
When a GZIP environment variable is set, this leads to various breakage:

In case 'pigz' is installed and GZIP is defined as a path, e.g.
/usr/local/bin/gzip, then dracut will fail with the following message:

   "
   pigz: abort: cannot provide files in GZIP environment variable
   "

In case 'pigz' isn't installed and regular 'gzip' is used and GZIP is
defined as a path, e.g. /usr/local/bin/gzip, then the path will be
zipped and dracut will fail for no obvious reason.  Trying again, dracut
will then fail with following message:

   "
   gzip: /usr/local/bin/gzip.gz already exists;	not overwritten
   "

In any case, GZIP environment should be unset to avoid breakage or
unwanted behaviour. This variable is anyway obsolescent, from gzip(1)
manpage.

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2021-03-02 11:05:52 +01:00
Harald Hoyer
630334950c feat(skipcpio): speed up and harden skipcpio
Before:
```
Benchmark #1: ./skipcpio/skipcpio test-5.10.15-200.fc33.x86_64.img >/dev/null
  Time (mean ± σ):     125.5 ms ±   0.9 ms    [User: 97.4 ms, System: 27.9 ms]
  Range (min … max):   124.8 ms … 129.4 ms    23 runs
```

After:
```
Benchmark #1: ./skipcpio/skipcpio test-5.10.15-200.fc33.x86_64.img >/dev/null
  Time (mean ± σ):      12.2 ms ±   0.3 ms    [User: 2.7 ms, System: 9.5 ms]
  Range (min … max):    11.7 ms …  13.6 ms    212 runs
```

Besides the speedup, skipcpio now parses the cpio header and is not
falsely ending when the early cpio payload contains `TRAILER!!!`.

Fixes: https://github.com/dracutdevs/dracut/issues/1123
2021-02-25 14:48:22 +01:00
Harald Hoyer
c67b624637 docs: update NEWS.md and AUTHORS 2021-02-23 16:11:01 +01:00
Harald Hoyer
62f3a10d5d docs: update RELEASE.md
* clog from last tag
* push commits to kernelorg also
2021-02-23 16:11:01 +01:00
Jóhann B. Guðmundsson
1edf54e275 feat(github): adding packit support for fedora maintenance
Adding initial packit [1] support for fedora maintenance which
should automate the release process from upstream release to fedora.

1. https://packit.dev
2021-02-23 16:04:23 +01:00
Harald Hoyer
c8ebb80590 fix(dracut.sh): remove unneeded variables
There is no `fstab_lines_l` variable used before.

The `--include` option was turned into `++include` and therefore the
switch option is not reachable anymore.
2021-02-23 16:03:44 +01:00
Sergei Iudin
d87ae13721 fix(dracut.sh): unfreeze /boot on exit
If SIGWHATEVER will be processed after fsfreeze -f, but before fsfreeze
-u we will end up with /boot/ never unfrozen, let's try to minimize risk of this.
2021-02-23 09:25:08 +01:00
Evgeni Golov
c3f241849d fix: skip empty modalias files in drm module setup
on my system (ThinkPad X201s) I have several modalias entries that are
empty:

    /sys/bus/platform/devices/dock.0/modalias
    /sys/bus/platform/devices/dock.1/modalias
    /sys/bus/platform/devices/dock.2/modalias

executing the drm module setup thus results in the following errors

    dracut-install: No SOURCE argument given

when calling dracut_instmods and hostonly mode is enabled.

Skip those entries, as there are no modules to load in this case
anyways.

Note: it is not sufficient to use [['s -s test (file size is greater
than zero), as all those files are 4096B if you stat them.
2021-02-22 14:55:44 +01:00
Lukas Nykryn
c17c5b7604 fix(network-manager): run as a service if systemd module is present
In the current state, services that depend on network need to
use dracut hooks, since nothing with pull in the network
targets into the transaction.

In the future, it would be nice to provide developers on systemd-only
systems the possibility to not use dracut hooks at all, but simply put
normal systemd services into the initrd.

Also, some modules even right now depend on systemd ordering, like
cryptsetup, so let's make sure, that the ordering inside systemd work
properly as well.
2021-02-19 11:20:59 +01:00
Lukas Nykryn
34c73b339b fix(network-manager): rework how NM is started in debug mode
Instead of running directly NM with --debug, create a drop-in in
nm-config.sh. This will make sure, that we can get the debug output
regardless the way how NM will be started.
2021-02-19 11:20:59 +01:00
Lukas Nykryn
6f7823bce6 fix(fcoe): rename rd.nofcoe to rd.fcoe
The current name of this bool is kinda stupid. Based on the manpage
setting it to 0 turns off fcoe, which means that nofcoe=1 should mean
that it is on.

Let's just do the same thing as with rd.lvm=0, rd.luks=0,....
2021-02-19 09:28:57 +00:00
Lukas Nykryn
805b46c2a8 fix(fcoe): rd.nofcoe=0 should disable fcoe
8446c8f9 Changed the default behavior, but also flipped meaning of 0/1.
Right now rd.nofcoe=0 enables fcoe, which is the opposite what manpage
says.
2021-02-19 09:28:57 +00:00
Andrew J. Hesford
d437970c01 fix: proper return code for inst_multiple in dracut-init.sh
A test of the form

    if ! command; then
        _ret=$?
        ...
        return _ret
    fi

does not capture the return code of `command`, but the negation of the
return code, leaving _ret == 0. The test of this form in inst_multiple
has been refactored to capture and return the right value.
2021-02-19 09:03:53 +01:00
Tomasz Paweł Gajc
f8b38ecd7c chore: update authors in .mailmap 2021-02-18 14:10:23 +00:00
Harald Hoyer
5387ed24c8 fix(i18n): get rid of eval calls
By changing KBDSUBDIRS to a bash array, all kinds of `eval` quirks are
avoided.
2021-02-16 15:49:02 +01:00
Harald Hoyer
9e1c7f3dea fix(i18n): create the keyboard symlinks again
Invalid space broke the creation of the keyboard subdirectories,
leading to a symbolic link

usr/share/consolefonts,consoletrans,keymaps,unimaps ->
/usr/lib/kbd/consolefonts,consoletrans,keymaps,unimaps

in the created initramfs.

With this fix the correct symlinks are created again:

usr/share/consolefonts -> /usr/lib/kbd/consolefonts
usr/share/consoletrans -> /usr/lib/kbd/consoletrans
usr/share/keymaps -> /usr/lib/kbd/keymaps
usr/share/unimaps -> /usr/lib/kbd/unimaps
2021-02-16 15:49:02 +01:00
Jóhann B. Guðmundsson
2c9debec02 fix(github): exempt issues with the label bug
Let's exempt issues with the label bugs being processed by stalebot.
2021-02-16 10:16:10 +01:00
Harald Hoyer
895c2f65d4 docs: update docs/RELEASE.md 2021-02-16 10:15:39 +01:00
Harald Hoyer
3fce68bd1d docs: update NEWS.md and AUTHORS 2021-02-15 17:30:54 +01:00
Harald Hoyer
1a604e2a4a chore: add CONTRIBUTORS target to Makefile 2021-02-15 16:54:44 +01:00
Harald Hoyer
0b86c0607f docs: update docs/RELEASE.md 2021-02-15 16:53:51 +01:00
Harald Hoyer
095b77bee8 docs: move NEWS to NEWS.md 2021-02-15 15:33:41 +01:00
Harald Hoyer
d85c71fb69 ci: force binary files for grep on disk images
Because some of the CI tests fail randomly while grepping for the
test success marker, let's be specific of the file format grep will
search to eleminate all failure sources.
2021-02-15 15:05:15 +01:00
Jóhann B. Guðmundsson
ebac18baad docs: RELEASE.md
Creating the /docs directory which will contain all project related
documentation and will also host the projects github based website
in the future.

Adding RELEASE.md which is a document that outlines the release process.
2021-02-15 12:48:16 +01:00
Harald Hoyer
ad64c6864c fix: shellcheck for dracut-init.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
cdb714c539 fix: shellcheck for dracut-init.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
994d003540 fix: shellcheck for dracut-init.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
63356d544b fix: shellcheck for dracut-init.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
2d4344bca9 fix: shellcheck for dracut-init.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
41cfdfc4d3 fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
510a22116b fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
2c10b29999 fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
7b59d15d96 fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
dd8ff5311f fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
6dc1cd052b fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
7310a8484e fix: shellcheck for dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
3483509ef6 fix: shellcheck for dracut-functions.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
aa225ca3b0 fix: shellcheck for dracut-logger.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
6510ab3f9d fix: shellcheck for modules.d/99squash/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
73f5cc7c37 fix: shellcheck for modules.d/99squash/clear-squash.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
119bb1b81d fix: shellcheck for modules.d/99fs-lib/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
18ff79021c fix: shellcheck for modules.d/99base/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
060732d927 fix: shellcheck for modules.d/99base/dracut-lib.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
9ea66e5682 fix: shellcheck for modules.d/95zfcp_rules/parse-zfcp.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
9eb77ff864 fix: shellcheck for modules.d/95udev-rules/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
10d01cc45d fix: shellcheck for modules.d/95terminfo/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
a1b3c13e3a fix: shellcheck for modules.d/95ssh-client/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
dbdd7ad4c1 fix: shellcheck for modules.d/95rootfs-block/block-genrules.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
9fb16311a4 fix: shellcheck for modules.d/95resume/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
748293ff56 fix: shellcheck for modules.d/95nfs/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
d18e808358 fix: shellcheck for modules.d/95iscsi/cleanup-iscsi.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
865390c7ca fix: shellcheck for modules.d/95fstab-sys/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
d4b1d669d7 fix: shellcheck for modules.d/95fcoe/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
9c0deb9f68 fix: shellcheck for modules.d/95fcoe/cleanup-fcoe.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
ce15ca57a2 fix: shellcheck for modules.d/95debug/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
cfac3a5675 fix: shellcheck for modules.d/95dcssblk/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
48cc484a4b fix: shellcheck for modules.d/95dasd_rules/parse-dasd.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
e4b1460433 fix: shellcheck for modules.d/95cifs/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
760a4370f0 fix: shellcheck for modules.d/95cifs/cifsroot.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
33e9727ee7 fix: shellcheck for modules.d/91crypt-gpg/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
87ea36797f fix: shellcheck for modules.d/90mdraid/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
b29b9e9627 fix: shellcheck for modules.d/90mdraid/mdraid_start.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
819b24fe2e fix: shellcheck for modules.d/90lvm/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
d586ff7001 fix: shellcheck for modules.d/90lvm/lvm_scan.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
6e70e9f1b1 fix: shellcheck for modules.d/90kernel-network-modules/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
8eef563f71 fix: shellcheck for modules.d/90kernel-modules-extra/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
7b1d342e60 fix: shellcheck for modules.d/90dmsquash-live/apply-live-updates.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
9c4662d02b fix: shellcheck for modules.d/90dm/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
0b920b83f2 fix: shellcheck for modules.d/90crypt/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
891ca19c49 fix: shellcheck for modules.d/90btrfs/btrfs_finished.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
7bfe7daa51 fix: shellcheck for modules.d/90btrfs/btrfs_device_ready.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
0412f42771 fix: shellcheck for modules.d/50plymouth/plymouth-populate-initrd.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
5feb62872e fix: shellcheck for modules.d/50gensplash/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
cdf03476d1 fix: shellcheck for modules.d/45url-lib/url-lib.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
10f3b19606 fix: shellcheck for modules.d/40network/net-lib.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
e7b4442cfc fix: shellcheck for modules.d/40network/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
6d2574d509 fix: shellcheck for modules.d/10i18n/parse-i18n.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
aa05b741e3 fix: shellcheck for modules.d/10i18n/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
f9cbd928ce fix: shellcheck for modules.d/06dbus-daemon/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
47f3a3d56d fix: shellcheck for modules.d/03modsign/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
e9053b1886 fix: shellcheck for modules.d/02systemd-networkd/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
4e3133e622 fix: shellcheck for modules.d/02caps/caps.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
4e3332ffa8 fix: shellcheck for modules.d/00systemd/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
e770ad31a6 fix: shellcheck for mkinitrd-suse.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
802f8b6218 fix: shellcheck for mkinitrd-dracut.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
ecf7e74f4a fix: shellcheck for lsinitrd-bash-completion.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
785d1a1ede fix: shellcheck for fedora-test-github.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
22fceeac80 fix: shellcheck for dracut-catimages.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
fb7b8be883 fix: shellcheck for dracut-bash-completion.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
f4053eb0c8 fix: shellcheck for configure 2021-02-15 11:00:37 +01:00
Harald Hoyer
7356c828b0 fix: shellcheck for 51-dracut-rescue.install 2021-02-15 11:00:37 +01:00
Harald Hoyer
95013ffce9 fix: shellcheck for 50-dracut.install 2021-02-15 11:00:37 +01:00
Harald Hoyer
836e2ffac6 fix: shellcheck for modules.d/99squash/setup-squash.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer
67bcc49304 docs: fix dracut.cmdline.7
```
asciidoc: WARNING: dracut.cmdline.7.asc: line 1115: nested inline passthrough
```
2021-02-15 09:31:57 +01:00
Harald Hoyer
dbb8a98b29 ci: wait for udev before doing sfdisk
might be responsible for some flakiness
2021-02-15 09:31:01 +01:00
Harald Hoyer
0f807f49cf ci: more disk space for test 30 iscsi
```
mke2fs 1.45.6 (20-Mar-2020)

Filesystem too small for a journal
Discarding device blocks:          done
Creating filesystem with 1024 1k blocks and 128 inodes

Allocating group tables: 0/1   done
Writing inode tables: 0/1   done
Writing superblocks and filesystem accounting information: 0/1   done

cp: error writing '/sysroot/usr/bin/bash': No space left on device
cp: error writing '/sysroot/usr/bin/grep': No space left on device
cp: error writing '/sysroot/usr/bin/ping': No space left on device
[…]
```
2021-02-15 09:30:29 +01:00
Beniamino Galvani
79ed45e021 fix: update dbus module directory in spec file
The directory name was changed in 16efdfa25c.
2021-02-15 08:07:33 +00:00
Jóhann B. Guðmundsson
9edabfa600 fix: add sdaskpw and sdsyctl to spec file
Adding systemd-ask-password and systemd-sysctl to the spec file

Alphabeticaly order the newly introduced systemd based module
in the spec file.
2021-02-10 21:26:56 +01:00
Jóhann B. Guðmundsson
5cd1a9fb13 fix: cosmetic comment fixes
This rephrases a comment in the check() as requested on another PR
and generalizes the install() section comments on par with other recent
module changes.
2021-02-10 21:26:35 +01:00
Jóhann B. Guðmundsson
dc00256e12 feat(systemd-ask-password): introducing systemd-ask-password module
Introducing systemd-ask-password module which is used to query a
system password or passphrase from the user.

This module can be used standalone ( systemd-ask-password )
( which is without plymouth & wall support )
With plymouth module ( systemd-ask-password + plymouth )
With wall module ( systemd-ask-password + wall ), which is currently
commented out since there is no forceable usecase for it or even exiting
wall module.

This is a standalone systemd module which means it depends on no other module than systemd.
2021-02-10 15:10:56 +01:00
Luiz Angelo Daros de Luca
ba3f4cdadc Revert "nbd: use systemd-run to start nbd-client"
systemd-run runs nbd-client in parallel. This introduces a possible
race condition when /dev/nbd0 is not directly used by /sysroot mount
but used by another dracut module as in:

  netroot=nbd:ip:port:fstype root=live:/dev/nbd0

Before nbd0 usages are synchronized, it is better to keep it serial.

This reverts commit 9fd0461b7d.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2021-02-10 15:02:41 +01:00
Luiz Angelo Daros de Luca
51b36f56d8 dmsquash-live-root: squashfs in bare device
Check if dev in root=live:<dev> might be already the squashfs image.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2021-02-10 15:02:41 +01:00
Jóhann B. Guðmundsson
dff9baf3b4 feat(systemd-sysctl): introducing systemd-sysctl module
Introducing systemd-sysctl module which is an early boot
service that configures sysctl.

The systemd-sysctl module has dependency's on systemd and
systemd-modules-load module.
2021-02-10 15:00:45 +01:00
Jóhann B. Guðmundsson
ba2e760b91 fix: adding missing efi paths 2021-02-10 14:39:54 +01:00
Harald Hoyer
b56448ba09 docs: fix CI badges in README 2021-02-10 14:39:11 +01:00
Harald Hoyer
1ebf454884 fix: correct the squash quirk
Previously with `no_kernel` the `for` loop errored on the modules
wildcard. By checking, if the file exists, this is mitigated.

"mv" asked interactively, if aliased in the user session, so a "--force"
was added.
2021-02-10 14:14:39 +01:00
Jóhann B. Guðmundsson
fdbe7f9fbf feat(systemd-modules-load): introducing systemd-modules-load module
Introducing systemd-modules-load which is an early boot service
that loads kernel modules from a static list, which is required for
kernel modules that do for example not support automatic module loading
( like key type parsers ).
2021-02-10 13:13:18 +00:00
Petr Pavlu
38ef319390 fix(shutdown): add timeout to umount calls
When terminating a system, the shutdown module attempts to unmount all
file systems from under /oldroot. This reaps remaining file systems that
systemd cannot unmount and detaches /oldroot itself.

In case that running umount for some file system repeatedly fails, the
module reports this error and continues the processing in order to
shutdown the system. This handles a condition when the umount command
actually terminates but it can happen in some cases that it waits
indefinitely.

An example with NFS mounts:
# mount -t nfs 192.168.0.1:/srv/nfs/dir /mnt/nfs
# mkdir /mnt/nfs/dir2
# mount -t nfs 192.168.0.1:/srv/nfs/dir2 /mnt/nfs/dir2
# touch /mnt/nfs/dir2/file
# systemd-run -pKillMode=none -pSendSIGKILL=no tail -f /mnt/nfs/dir2/file
Running as unit: run-r367825c967ca4d88a793ae4793c02f8b.service
# systemctl poweroff

The invoked tail command escapes normal termination by systemd and
prevents stopping mnt-nfs.mount and mnt-nfs-dir2.mount as it makes the
mounts busy. Systemd then again attempts to unmount these file systems
in systemd-shutdown but this fails as well. The utility tries to unmount
/mnt/nfs/dir2 but the kernel waits indefinitely doing a path lookup for
/mnt/nfs because network is no longer available at that point. The
systemd-shutdown gives up after 90 seconds. Finally, the control is
transferred to dracut which tries to unmount the file systems in the
same way and ends up indefinitely waiting on umount to finish.

This situation causes that the system hangs during shutdown. The patch
improves the shutdown module to add a timeout of 90 seconds for the
umount operation and continue with the shutdown if it gets reached,
similarly to what systemd-shutdown does.
2021-02-10 14:06:37 +01:00
Harald Hoyer
45907c1d4d ci: disable tests with NFS kernel crashes
Tests 50, 51, 60, 61 all suffer from kernel crashes in the kernel nfsd.

Until this is resolved, disable these tests.
2021-02-10 13:56:40 +01:00
Harald Hoyer
35bd0b4ac1 ci: only bind /dev/kvm into the container
dracut is only interested to use `/dev/kvm` if available.
2021-02-10 13:56:40 +01:00
Harald Hoyer
a6faf453a8 ci: reduce CI workload
Only run `fedora-latest` and `fedora-32` on actual merge.
2021-02-10 13:56:40 +01:00
Harald Hoyer
16efdfa25c fix: revise all module checks
1. no module checks for modules which are in depends()
2. no `derror` for optional (255) modules checking for dependencies
3. fix dbus meta module
2021-02-10 13:29:17 +01:00
Harald Hoyer
1914a2eba1 fix: add missing line continuation 2021-02-10 12:05:24 +01:00
Daniel Molkentin
786ca932e8 fix: BuildRequiring git-core is enough in dracut.spec 2021-02-10 11:12:02 +01:00
Nicolas Saenz Julienne
b28e4b20f0 fix(kernel-modules): add reset controllers for arm
Reset controllers might be needed by some of the devices used in the
initrd. Particularly on the Raspberry Pi 4, 'xhci-pci' depends on a
platform specific reset controller.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
2021-02-09 20:35:11 +00:00
David Tardon
c46ed697a2 35network-legacy: discard pointless RTNETLINK message
This command prints

    RTNETLINK answers: Network is unreachable

to stderr if IP is not assigned yet, but that's the thing we are
checking for, so there's no point in showing the message.
2021-02-09 21:04:23 +01:00
Zoltán Böszörményi
fa06924239 fix(plymouth): install binaries with dependencies
If plymouth is used then its own installation script is preferred.
While plymouth's own variant of inst_binary resolves the library
dependencies properly, its inst_library shell function doesn't
actually install them in some cases properly.

Make sure to install both the required binaries and their
dependencies. In the worst case, it's a NOP.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 18:17:12 +01:00
Harald Hoyer
d1c8083b3a fix: correct the line continuation
Comments will break bash line continuation.
Also added some missing line continuation here and there.
2021-02-09 15:33:34 +01:00
Zoltán Böszörményi
702e7e83ed fix(dbus-daemon): use uid/gid from sysroot is dracutsysrootdir is set
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Zoltán Böszörményi
767fbf81b6 fix(network-manager): allow override network manager version
With dracutsysrootdir set and foreign binaries in sysroot,
running NetworkManager --version is not possible and it may be
different than the one installed on the host.
NM_VERSION can be used to override it.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Zoltán Böszörményi
18d36fabf5 feat(dracut.sh): allow overriding the systemctl command for sysroot
Allow overriding the systemctl command for sysroot with $SYSTEMCTL
Modified every modules' module-setup.sh to use the envvar instead
of the hardcoded command name.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Zoltán Böszörményi
433a9ec014 fix: use find_binary
Use find_binary instead of type -P because the former works if
dracutsysrootdir is set.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Zoltán Böszörményi
bbe1434fca fix(dracut.sh): don't override path with foreign sysroot
Don't override PATH with foreign sysroot and
trim the sysroot prefix from NPATH elements.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Zoltán Böszörményi
03d132a76c fix: quote globbing in module-setup.sh for inst_multiple
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Zoltán Böszörményi
ddcdee9147 fix(dracut-install): allow globbing for multiple sources
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
foopub
c409108b04 Fix bad ls parsing
This used to cause some echo write/invalid argument errors. Simplest fix is to use readlink with -f for absolute path and -n to remove trailing newline. 
See previous discussion here:
https://github.com/void-linux/void-packages/issues/13024
2021-02-08 23:12:15 +01:00
Alexander Tsoy
6eff0ebcf8 fix: move ldconfig after library workaround
Commit de3cb0e321 moved libpthread workaround after the code that runs
ldconfig. As a result, if installed in a non-default path, libgcc_s.so.1
could not be found by dynamic linker.
2021-02-08 22:44:32 +01:00
Nicolas Chauvet
07c671cc51 feat(kernel-modules): add driver memory
External Memory Controller (EMC) drivers can be built as a module.

On Tegra, this allows tegra_drm to load faster and without deferred
probes, instead of waiting for the rootfs for the tegra*_emc dependencies.

Tested on jetson-tk1 and ac100.

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2021-02-08 21:15:48 +00:00
Jóhann B. Guðmundsson
c3446a7ce0 feat(systemd-repart): introducing systemd-repart module
This modules introduces systemd-repart which can be used
to generate partition(s), via a simple systemd-repart
drop-in(s), which can be useful in wide varity of usecase.

feat(systemd-repart): adding module to spec file

feat(systemd-repart): removing unessary requirement on type unit

fix: spelling error
2021-02-08 20:32:16 +00:00
Jóhann B. Guðmundsson
7135c81931 feat(dbus-daemon): introducing the dbus-daemon module
Introdusing dbus-daemon which is based on but superseeds
the previous 06dbus implementation with various enhancements and fixes.

fix: adding new modules to rpm spec file

fix: missed an echo
2021-02-08 20:18:25 +01:00
Jóhann B. Guðmundsson
38cd8125f6 feat(dbus-broker): introducing the dbus-broker module
Introducing the dbus-broker module.
2021-02-08 20:18:25 +01:00
Jóhann B. Guðmundsson
791f392ca6 feat(dbus): introducing a meta module for dbus
We require a meta module to handle multiple modules
2021-02-08 20:18:25 +01:00
Harald Hoyer
6032ade3cc fix(network-legacy): silent check for leaseinfo
Reroute negative checks for leaseinfo to /dev/null to suppress:
```
ls: cannot access '/tmp/leaseinfo.ens2*': No such file or directory
```
2021-02-08 17:18:02 +01:00
Harald Hoyer
0ce79d4c72 ci: mount host /dev into container
might pickup /dev/kvm if we are lucky?
2021-02-08 16:07:37 +01:00
Harald Hoyer
860b64b92d ci: remove --privileged option from docker containers
This option should not be needed anymore with "mount -o loop" removed.
2021-02-08 16:07:37 +01:00
Harald Hoyer
0f62da0405 ci: get rid of "mount -o loop"
This finally allows running the test suite completely in a rootless container:
```
❯ podman run \
         --user 0 \
         -v /dev:/dev \
         -v ./:/dracut \
         -it \
         quay.io/haraldh/dracut-fedora:33 \
         bash -c 'cd /dracut; make DRACUT_NO_XATTR=1 check'
```
2021-02-08 16:07:37 +01:00
Harald Hoyer
1211d6a3fb ci: disable TEST 99
1. people got annoyed by merge conflicts
2. spec file can be update per release
3. uses "mount" preventing container testing
2021-02-08 16:07:37 +01:00
Harald Hoyer
457e7b7a4a docs: remove TODO file
TODO file copied to https://github.com/dracutdevs/dracut/issues/1068
and also filed as individual issues on
https://github.com/dracutdevs/dracut/issues
2021-02-08 14:17:13 +01:00
Kairui Song
e918f337b6 95nfs: fix rpc.statd installation
commit 5840c466d tried to make it create the right directory according
to the directory layout on current host, but added "$initdir" prefix
to the if statement by accident, so the installation code have no
effect now. Just fix it.
2021-02-08 12:20:48 +01:00
Matthew Thode
8a2edb1e4d fix: do not set cmdline for uefi images unless asked
The kernel does not allow the cmdline to be overridden if one is defined
in the uefi image.  This means that bootloaders like systemd-boot or
grub cannot manage boot options (editing at boot for debug being a use
case).  This patchset allows for no cmdline to be set (instead of force
setting one if none is provided).

Fixes: https://github.com/dracutdevs/dracut/issues/1012
Signed-off-by: Matthew Thode <mthode@mthode.org>
2021-02-08 10:37:22 +01:00
Anjali Kulkarni
4026cd3b01 feat(network-legacy): send dhcp in parallel on all devices
We can drastically improve boot times on some machines, or BM or VM
shapes, if we send DHCP requests in parallel on all interfaces
Add ip=single-dhcp as a kernel boot parameter, to send DHCP requests in
parallel on all interfaces. Thus, DHCP on each interface is overlapped
thereby reducing boot times for multiple interface machines.
This can help reduce the boot time by 1 minute per interface.
In addition, we may also save another 40 secs delay per interface, if
the link on which we try to send DHCP is in DOWN state. This can be
reduced by giving the following kernel command line parameter while
booting - rd.net.timeout.carrier=<timeout>.
Added manpage for ip=single-dhcp with the caveat that it does not
apply to Network Manager or SUSE wicked.

Signed-off-by: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
2021-02-05 11:11:22 +01:00
Mariusz Tkaczyk
30e49d5175 fix(mdraid): remove offroot
offroot is deprecated and can be safety removed.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2021-02-05 10:59:50 +01:00
Mariusz Tkaczyk
29e269a522 fix(mdraid): add grow continue service
During raid assembly mdadm will call mdadm-grow-continue.service if
reshape is in progress.
If service doesn't exist then it is done via fork and systemd will kill
it unconditionally after processing all events.

Add proper service to allow systemd to manage reshape correctly.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
2021-02-05 10:59:50 +01:00
Lukas Nykryn
62d52ad2be fix(spec): add new systemd-coredump module to spec 2021-02-04 13:19:09 +01:00
Peter Levine
c35cbd2e56 fix(watchdog): replace return with echo 2021-02-03 12:23:57 +00:00
Jóhann B. Guðmundsson
939b7e11d5 feat(systemd-coredump): introducing systemd-coredump module
This pull request introduces systemd-coredump as a seperated
module and adds the systemdutilconfdir global variable.
2021-02-02 18:01:06 +00:00
Harald Hoyer
9553a679f6 ci: remove Travis and include Fedora-latest
Also remove Fedora 31.

Github CI should suffice. The only missing piece was Fedora-latest.

Signed-off-by: Harald Hoyer <harald@redhat.com>
2021-01-27 16:58:58 +01:00
Harald Hoyer
1149ed2a3e test: incr. disk size for TEST 35 ISCSI-MULTI 2021-01-27 13:15:37 +01:00
realtime-neil
68dd8af21d fix(skipcpio): edit skipcpio.c: strstr -> memmem
because CPIO_END might follow a NULL byte in buf
2021-01-26 21:06:15 +00:00
Jóhann B. Guðmundsson
bf1a2262ea fix(1007): adding shared keyring mode to type unit
Fixes: https://github.com/dracutdevs/dracut/issues/1007
2021-01-26 18:05:18 +00:00
Harald Hoyer
be30c816d4 ci: use our own version of commisery
This should hopefully fix:
* not checking the PR github title
* not error on the auto merge commit message
2021-01-26 17:57:25 +01:00
Jóhann B. Guðmundsson
a2472e6e60 feat(systemd-sysusers): introducing systemd-sysuser module 2021-01-26 00:00:28 +00:00
Jóhann B. Guðmundsson
24ea839079 feat(systemd-sysusers): introducing systemd-sysuser module 2021-01-26 00:00:28 +00:00
Daniel Molkentin
f824f52675 fix(1001): use efivars fs over the deprecated sysfs entries
sysfs efi vars has been dropped for non-x86 systems since kernel 5.10.
2021-01-25 14:58:11 +00:00
Javier Martinez Canillas
3c8ca29650 fix(kernel-network-modules): also install modules from mdio subdirectory
A recent change in Linux kernel v5.10 split the MDIO drivers from the PHY
subdirectory into a new MDIO subdirectory [0]. This caused MDIO drivers
to not be included in the initramfs.

Also include the modules of this new subdirectory to prevent this issue.

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a9770eac511

Suggested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2021-01-22 15:58:58 +01:00
Alexey Shabalin
21ee81bfbd fix(06dbus): do not hardcode path to dbus utils 2021-01-21 16:53:30 +00:00
Alexey Shabalin
7b3c6e1bb0 fix(06dbus): do not hardcode path to systemd unit
Use $systemdsystemunitdir instead /usr/lib/systemd/system.
2021-01-21 16:53:30 +00:00
Zoltán Böszörményi
b955dbf4a9 fix(dracut-init.sh): make inst_libdir_file work with dracutsysrootdir set
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-01-21 16:33:18 +00:00
Zoltán Böszörményi
911c2de9c3 fix(99squash): use kernel config instead of modprobe to check modules
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-01-21 16:33:18 +00:00
Zoltán Böszörményi
560f45b15f fix(dracut-functions.sh): check kernel config from $dracutsysrootdir
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-01-21 16:33:18 +00:00
Ondrej Mosnacek
951c6655f1 fix(90kernel-modules): install generic crypto modules with hostonly unset
Otherwise e.g. the xts(aes) implementation provided by the vmx_crypto
module (which does usually get included on ppc64le) fails to initialize
when xts is built as a module (CONFIG_CRYPTO_XTS=m), because it can't
instantiate the fallback generic xts(aes) implementation (needs the
generic xts module).

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-21 12:20:22 +01:00
Jóhann B. Guðmundsson
a47c3f50b6 feat: add addional global variables 2021-01-20 12:40:04 +00:00
Jóhann B. Guðmundsson
db36338053 feat: add addional global variables 2021-01-20 12:40:04 +00:00
Jóhann B. Guðmundsson
093bc9b5cf fix: add a missing efi support 2021-01-19 00:44:17 +00:00
Jóhann B. Guðmundsson
8b5a6b91be chore(removal): eliminate bootchart module 2021-01-19 00:44:30 +01:00
Jóhann B. Guðmundsson
dd9288bb62 chore(removal): eliminate bootchart module 2021-01-19 00:44:30 +01:00
Jóhann B. Guðmundsson
66c27a6d85 chore(removal): eliminate bootchart module 2021-01-19 00:44:30 +01:00
Jóhann B. Guðmundsson
1acf52b60e feat: add addional global variables 2021-01-18 14:45:18 +00:00
Vladius25
f3cbff1113 feat(cli): add --no-uefi option
To be able to turn off UEFI mode, when it's enabled in config.
2021-01-18 08:30:00 +00:00
Harald Hoyer
c93df5e0ea chore(github): add CODEOWNERS file
All CODEOWNERS are automatically added as reviewers.
2021-01-16 03:14:03 +00:00
Jóhann B. Guðmundsson
58d57fc977 chore(cleanup): remove logrotate file 2021-01-16 03:00:50 +00:00
Yang Liu
77630365ae fix(35network-manager): avoid restarting NetworkManager
On EL8.3 the NetworkManager keep restarting even if it exits successfully while waiting for Clevis to unlock. This patch ensures NetworkManager runs only once in initrd.
2021-01-15 11:18:24 +01:00
Jóhann B. Guðmundsson
f1739d4236 chore: Add configuration for vim 2021-01-14 09:20:34 +00:00
Jóhann B. Guðmundsson
33920ee6b0 chore: Add editorconfig 2021-01-14 09:20:34 +00:00
Jóhann B. Guðmundsson
08ff88f234 chore: Editors 2021-01-14 09:20:34 +00:00
Harald Hoyer
28d0fc9347 ci: add testing with Fedora 33
To test a more recent version of Fedora, add Fedora 33.
2020-12-16 15:34:29 +01:00
Harald Hoyer
7c50ed83a3 test(conventional): add Conventional Commits PR github action
To ease the creation of the release notes, enforce some style on the git
commit message titles with `Commisery`.

https://github.com/marketplace/actions/commisery

Using https://github.com/clog-tool/clog-cli later on these commits will
generate a pretty nice base for the release notes.
2020-12-16 15:10:18 +01:00
Harald Hoyer
1ed4b9f100 docs(development): add HACKING.md
Merge HACKING, README.modules, README.testsuite into HACKING.md.

Provide a new paragraph about git commit messages.
2020-12-16 14:59:35 +01:00
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
Harald Hoyer
00efe708ca NEWS, AUTHORS: update 2020-03-04 11:43:22 +01:00
Harald Hoyer
0c983cdc49 TEST-14-IMSM: clear marker disk 2020-03-04 11:06:04 +01:00
Harald Hoyer
821e08da03 fedora-test-github.sh: only fetch tags, if building rpm 2020-03-04 11:06:04 +01:00
Marek Marczykowski-Górecki
ebeed55c07 Consider also drm_dev_register when looking for gpu driver
DRM drivers are filtered for drm_crtc_init symbol,
but not all drivers use it. Especially, cirrus driver
doesn't use it since Linux 5.2.

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

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

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

Fixes #602
2020-03-04 09:22:09 +01:00
Daniel Molkentin
286f2a04a1 Merge branch 'regenerate_all' 2020-03-03 20:09:45 +01:00
nabijaczleweli
38c8fed48a Enable resume module if hibernation's enabled on the host
Ref: 34b56de12a
Fixes https://github.com/dracutdevs/dracut/issues/496
2020-03-03 19:51:08 +01:00
Daniel Molkentin
5b1d8bcc58 Merge branch 'master' into regenerate_all 2020-03-03 19:25:16 +01:00
Harald Hoyer
c7403700df TEST-04-FULL-SYSTEMD: use seperate marker disk for root creation 2020-03-03 16:56:43 +01:00
Topi Miettinen
ce62465caf Make lsinitrd usable for images made with Debian mkinitramfs
Debian mkinitramfs does not create the file 'early_cpio', so detection
of additional cpio images fails and only the first cpio is listed.

I checked some Arch and Gentoo initramfs files and these didn't have
'early_cpio' either, but they also have only one cpio part.

Fix this so that if check for 'early_cpio' fails, check if firmware
files ('/kernel/*/microcode/*.bin') exist.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2020-03-03 12:48:58 +01:00
Harald Hoyer
b3d40a4390 TEST-04-FULL-SYSTEMD: change error reporting 2020-03-02 14:55:51 +01:00
Lucas C. Villa Real
3d2a6d29d4 dracut_mkdir(): create parent directories as needed. 2020-03-02 14:48:11 +01:00
Harald Hoyer
1edee0c4a1 test/TEST-0[34] remove qemu return check
remove check of qemu return code $?

seems like it randomly returns with != 0
2020-03-02 14:42:27 +01:00
Topi Miettinen
ecbdff68af Don't resolve libraries lazily if tmpdir is mounted with 'noexec'
If the temporary directory for images is mounted with 'noexec', dracut
would construct unbootable images because most dynamic libraries
aren't installed. Avoid this by not resolving library dependencies
lazily if the temporary directory is mounted with 'noexec'.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2020-03-02 09:56:26 +01:00
Alexander Miroshnichenko
3ea80545d6 stratis module: fix start order
Change start script order to pre-mount as stratis require fully initialized udev.
2020-02-28 20:43:01 +01:00
Frantisek Sumsal
ef8915d7af fcoe/fcoe-genrules.sh: use $name instead of $env{INTERFACE}
Followup to a8ba1c4e25 and
11a5501d0f
2020-02-28 20:41:37 +01:00
Frantisek Sumsal
7261a0540a github: fetch git tags before testing
GitHub workflows fetch a clone of the dracut repository which doesn't
contain git tags, thus "breaking" the RPM build in certain situations
i.e.:
DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`,
which in full git clone returns a tag with a numeric version. However,
without tags it returns SHA of the last commit, which later propagates into
`Provides:` attribute of the built RPM and can break dependency tree when
installed
2020-02-28 20:39:35 +01:00
Frantisek Sumsal
11a5501d0f cms/cmssetup.sh: use $name instead of $env{INTERFACE}
Followup to a8ba1c4e25
2020-02-28 16:32:11 +01:00
Frantisek Sumsal
355df861da test: build docs when running TEST-99-RPM 2020-02-28 16:31:43 +01:00
Frantisek Sumsal
8cba0ff833 github: add TEST-99 to the workflow 2020-02-28 16:31:43 +01:00
Frantisek Sumsal
f1dc2180d4 TEST-99-RPM: ignore weak dependencies in dnf
Weak dependencies are useless for this test and pollute the chroot,
causing unexpected fails.
2020-02-28 16:31:43 +01:00
Frantisek Sumsal
3f4ffebf33 Makefile: fix RPM build
`make rpm` usually chose `/tmp` as the `$rpmbuild` dir, which breaks the
dracut build, since it needs to execute `./configure`, but `/tmp` is
mounted with `-o noexec`, leading to:

```
/var/tmp/rpm-tmp.SwEhJO: line 46: ./configure: Permission denied
error: Bad exit status from /var/tmp/rpm-tmp.SwEhJO (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.SwEhJO (%build)
```

Switching to `/var/tmp` helps in this case.
2020-02-28 16:31:43 +01:00
Harald Hoyer
d5088b1703 TEST-12-RAID-DEG: harden test
use whole sda as marker disk and clear it completly between test runs
2020-02-28 14:41:15 +01:00
Harald Hoyer
9ca53063ee test: use dd to write status to marker disk 2020-02-28 14:41:15 +01:00
Harald Hoyer
69341c9572 fedora-test.sh: set logtee timeout to 5 minutes 2020-02-28 14:41:15 +01:00
Harald Hoyer
55a974bae6 fedora-test.sh / fedora-test-github.sh: don't build the documentation
don't build the documentation, if running a test
2020-02-28 13:02:50 +01:00
Harald Hoyer
3703ec8672 Disable NetworkManager tests for Fedora 30 2020-02-28 12:53:48 +01:00
Harald Hoyer
74ba8f9e1d .travis.yml: add note about test container 2020-02-28 12:53:42 +01:00
Harald Hoyer
a3f73298f2 testsuite: refactor qemu options
- refactor common qemu options
- fix the ens[0-9] interface shift
- add split network-[legacy|network] tests
2020-02-28 12:53:42 +01:00
Harald Hoyer
4b60a34715 Revert "test: run-qemu refactor common qemu parameters"
This reverts commit 77537bf2d7.

Sorry, for the noise!
2020-02-28 08:51:44 +01:00
Harald Hoyer
7374391434 Revert "test/run-qemu: add "-serial stdio""
This reverts commit c6c588d648.
2020-02-28 08:51:31 +01:00
Harald Hoyer
c6c588d648 test/run-qemu: add "-serial stdio" 2020-02-28 08:47:52 +01:00
Harald Hoyer
77537bf2d7 test: run-qemu refactor common qemu parameters 2020-02-28 08:39:31 +01:00
Harald Hoyer
7c51256eb2 TEST-40-NBD: disable again
NBD is still too flaky and hangs hard sometimes
2020-02-27 16:44:28 +01:00
Harald Hoyer
ba66cb2789 TEST-04-FULL-SYSTEMD: more info on failure 2020-02-27 16:42:21 +01:00
Harald Hoyer
2d75433cd7 test/test-functions: colorize startup 2020-02-27 16:17:23 +01:00
Harald Hoyer
58ee6dc7f9 .travis.yml: fix docker pull 2020-02-27 15:51:12 +01:00
Harald Hoyer
0d33ba030b test/TEST-40-NBD/test.sh: bail out early if mount fails 2020-02-27 15:27:30 +01:00
Harald Hoyer
63b67a48f9 nbd/parse-nbdroot.sh: don't create mount unit
let the generator do its thing
2020-02-27 15:27:30 +01:00
Harald Hoyer
4bd0ab61b2 test: remove "sudo" calls in test scripts 2020-02-27 15:27:30 +01:00
Harald Hoyer
b4de4f287f test: do btrfs filesystem sync in create-root.sh 2020-02-27 15:27:30 +01:00
Harald Hoyer
eb8856a58c TEST-40-NBD: run the working tests 2020-02-27 15:27:30 +01:00
Harald Hoyer
3c5036a62f TEST-03-USR-MOUNT: more debugging 2020-02-27 15:27:30 +01:00
Harald Hoyer
074ac62576 TEST-04-FULL-SYSTEMD: report failure on rootfs creation 2020-02-27 15:27:30 +01:00
Harald Hoyer
53e299e6f4 TEST-20-NFS/test.sh TEST-30-ISCSI/test.sh reduce debug output 2020-02-27 15:27:30 +01:00
Harald Hoyer
2996d9e56f test/TEST-60-IFCFG/test.sh: fixed qemu hubport netifs
netifs are offset by one if qemu hubport is used
2020-02-27 15:27:30 +01:00
Harald Hoyer
2f78bafa4b tests: untabify, reformat 2020-02-27 15:27:30 +01:00
Harald Hoyer
f7b9356c9e test: fix server init scripts for network 2020-02-27 15:27:30 +01:00
Harald Hoyer
3aae122c4b Add github workflow 2020-02-27 15:27:30 +01:00
Harald Hoyer
93be2bc6ab add DRACUT_NO_XATTR global environment variable
Useful, if you know, that those can't be copied anyway.
2020-02-27 13:49:21 +01:00
Harald Hoyer
a8ba1c4e25 network-legacy/net-genrules.sh: use $name instead of $env{INTERFACE}
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

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

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

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

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

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

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

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1803926
2020-02-25 14:34:58 +01:00
Jonathan Lebon
7795fde44c network-legacy/ifup: drop redundant if-statement
No need to check that `$ret` is 0, we're already running inside an
if-statement block which checks this.
2020-02-25 14:34:58 +01:00
Harald Hoyer
2dc0cb50e3 Revert "github workflow"
This reverts commit 150cea0336.
2020-02-25 14:06:36 +01:00
Harald Hoyer
150cea0336 github workflow 2020-02-25 14:01:13 +01:00
Donovan Tremura
4237aeb040 Support the EFI Stub loader's splash image feature.
Checks if `uefi_splash_image` exists in `dracutsysroot` if not unset
`uefi_splash_image`. Alternate Value parameter expansion adds section-vma
for splash image to EFI stub loader when the path to image is valid and
not an empty file.

I did not test on other distributions, but on Arch Linux the `systemd`
package includes a splash image at the path
`/usr/share/systemd/bootctl/splash-arch.bmp`. Perhaps, if this is a
common practice, a default image could be gathered from that directory.

It is required that the image be in bitmap (`.bmp`) format according to
`splash.c`.

The code for `stub.c` and `splash.c` can be found at:
https://github.com/systemd/systemd/blob/master/src/boot/efi/stub.c
https://github.com/systemd/systemd/blob/master/src/boot/efi/splash.c
2020-02-20 11:03:30 +01:00
Harald Hoyer
16abea2592 systemd: install systemd-tty-ask-password-agent systemd-ask-password
fixes https://github.com/dracutdevs/dracut/issues/726
2020-02-18 15:33:23 +01:00
Eugene S. Sobolev
c7ee6b3dbb network/net-lib.sh: Configure all iBFT interfaces
Added boolean command line option rd.iscsi.mp
2020-02-14 10:42:34 +01:00
Renaud Métrich
cdc9cd0e41 dracut.sh: added help for --regenerate-all 2020-02-13 11:37:13 +01:00
Lukas Nykryn
76f6566fd7 Revert "wait for IPv6 RA if using none/static IPv6 assignment"
This reverts commit c603419030.

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

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

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

See also https://bugzilla.redhat.com/show_bug.cgi?id=1772010
2020-02-10 14:37:15 +01:00
Daniel Cordero
f668e7174e dracut.sh: check kmoddir is properly formed
Due to the way dracut-install handles modules from custom kmoddirs, add
a test that ensures the kmoddir argument seems sane.

In addition to erroring out, provide some guidance on how to proceed, as
well as a method of skipping the test via environment variable.
2020-01-27 09:02:46 +01:00
Daniel Cordero
1bef2934d7 dracut-install: fetch kernel modules from kmoddir
dracut, when passing --kmoddir, would only install modules that exist at
the same location as it will appear in the initramfs.

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

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

Note: This means that the argument to --kmoddir (and the modules filetree)
should be a directory that ends in 'lib/modules/$kernelversion'.
2020-01-27 09:02:46 +01:00
Harald Hoyer
350ec5d9dd uefi-lib/uefi-lib.sh: fixed script for bash version 5
bash 5 `read` behaves differently and returns != 0 for 0 bytes read

fix it with the best effort
2020-01-24 13:42:46 +01:00
Jonas Witschel
d613d88dd2 ucode: use microcode found in packed cpio images
Some distributions (Arch, Gentoo) ship prepacked microcode images. These
are cpio images that follow the structure specified in the Linux kernel
documentation (x86/microcode.rst, "Early load microcode"), the same
structure dracut uses for its early microcode images.

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

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

The list of possible file names for the packed microcode image is taken
from GRUB (cf. GRUB_EARLY_INITRD_LINUX_STOCK), but can be adapted by
setting "early_microcode_image_name" (and "early_microcode_image_dir")
in a dracut configuration file.
2020-01-24 09:06:32 +01:00
Harald Hoyer
2ee69a40c8 add missing crypto modules for aarch64
Fixes https://github.com/dracutdevs/dracut/issues/711
2020-01-23 13:47:53 +01:00
Jonathan Lebon
d0de58f232 network-legacy/ifup: nuke pid and lease files if dhclient failed
Otherwise we won't retry dhclient again on that interface. In
FCOS/RHCOS, we want to bake in `ip=dhcp,dhcp6` so we automatically try
getting a DHCPv6 lease if DHCPv4 failed.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1793591
2020-01-23 09:32:25 +01:00
Kairui Song
f4ad2e5c89 90kernel-modules: don't install any block driver if not needed
If hostonly mode is in use, and there isn't any block device included
as hostonly device, then the initramfs won't need any block driver.

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

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

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-01-17 07:26:24 +01:00
Jan Macku
cb86c560b0 Write dns values passed by ip argument to ifcfg-* files 2020-01-14 09:33:38 +01:00
Jan Macku
70b19acf94 Replace ln with systemctl 2020-01-14 09:29:51 +01:00
Jacob Wen
d5e818f349 35network-legacy: using 'replace' instead of 'add' to add route
This is a simple trick to honor RFC 3442:
If the DHCP server returns both a Classless Static Routes option and
a Router option, the DHCP client MUST ignore the Router option.

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
2020-01-14 09:26:12 +01:00
Kairui Song
4598b5540e 95iscsi: Fix /etc/iscsi installation
Previous all files are installed with inst_dir, which will not install
the files under /etc/iscsi/, and it create folders with the same of the
files which is wrong.

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

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-01-14 09:25:29 +01:00
Lubomir Rintel
5965710e01 network-manager: don't run NetworkManager when there are no connections
NetworkManager would unnecessarily bring up the devices, colliding with
further attempts to rename the devices.

This is arguably a NetworkManager bug and should eventually be fixed there.
Running NetworkManager without the connection is unnecessary regardless.
2020-01-14 09:24:42 +01:00
Brian C. Lane
05b75703b0 Check .hmac of boot.iso in fips mode
Instead of carrying the kernel and hmac in the install.img (which takes
up more space) use the vmlinuz installed under /images/pxeboot/ and the
.hmac in the install.img /boot.

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

Related: rhbz#1782737
2020-01-14 09:23:21 +01:00
Colin Walters
7fea85ce5f modules/network-manager: Install ip
We don't need `ip` but having it is *really* useful for people debugging
in an emergency shell.
2020-01-14 09:17:22 +01:00
Lukas Nykryn
2181c80c91 network-legacy/ifup: dhclient should be started in oneshot mode
since we handle the retries explicitly via rd.net.dhcp.retry

Without -1 if user sets ip=dhcp6 and there is no dhcp on the network,
dhclient seems to wait indefinitely, ignoring rd.net.timeout.dhcp
2020-01-14 09:16:48 +01:00
Lukas Nykryn
212043f94d network-legacy/ifup: fix typo when calling dhclient --timeout 2020-01-14 09:16:23 +01:00
Alexey Kodanev
958ca9e912 fips: add 'ofb' and 'cts' block cipher modes
Add cts, Linux-5.0 commit:
* 196ad6043e9f ("crypto: testmgr - mark cts(cbc(aes)) as FIPS allowed")

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

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
2019-11-29 18:56:56 +01:00
Petr Tesarik
7d47d1c423 95ssh-client: improve nsswitch.conf parser
The actual syntax of nsswitch.conf is slightly different from the
current regular expression:

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

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2019-11-22 17:54:00 +01:00
Lubomir Rintel
ff2043fb42 Revert "travis: run TEST-14-IMSM on Fedora 29"
We're on Fedora 31 that should be good enough for this test.

This reverts commit 7a2503ab8c.
2019-11-13 10:08:32 +01:00
Daniel Molkentin
8996d3dfcd test: use hosts randomness, not rngd 2019-11-13 09:07:45 +01:00
Daniel Molkentin
c226bfdda7 test: Provide host's randomness via virtio 2019-11-13 09:07:45 +01:00
Lubomir Rintel
9a752007b3 TEST-30-ISCSI: test iBFT boot as well
Setting up the machinery to boot with the aid of real networked boot loader
(such as iPXE) would involve much hassle, including possibly serving the kernel
and initrd via TFTP, etc.

Let us generate the iBFT table ourselves, with a Perl script. Include the
pregenerated table as well so that the test run won't depend on Perl. In the
end it's just reproducibly built static data, totally independent of the host
system.
2019-11-12 13:27:59 +01:00
Lubomir Rintel
80238086ab git2spec: include contents of binaries in patches
The patches don't include the binary files, such as the iBFT table for testing,
which makes %autosetup sad.
2019-11-12 13:27:59 +01:00
Daniel Molkentin
50057af19c Documentation: dynamically set current version
Fixes #369
2019-11-12 13:24:41 +01:00
Lubomir Rintel
e863807685 spec: dracut-network is happy with either NM or dhclient 2019-11-12 13:11:40 +01:00
Lubomir Rintel
f3f081e542 TEST-{20,50,60,70): set MACAddressPolicy=keep
New systemd defaults to generating MAC addresses for software devices (whereas
previously they would inherit them from the first enslaved slave).

Sadly, among the things this breaks is our test fixture, where the dhcp servers
are configured to expect a particular MAC address. Disable this for the
affected tests, which are essentially the ones that use bridges and bonds.
2019-11-11 21:17:31 +01:00
Lubomir Rintel
c9391e8f6a TEST-{20,30,31,40,50,60,70): wait for server interfaces to come up
The network interfaces appear asynchronously and sometimes just too late,
after we're already halfway throught server-init.sh:

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

Whoopsie. Let's ensure all the interfaces are there before we proceed
fiddling around with them.
2019-11-11 21:16:47 +01:00
Lubomir Rintel
031e949c62 TEST-50-MULTINIC: fix how a basename is determined
Analogous to what commit 687e17aa7f ("network-manager: fix getting of
ifname from the sysfs path") fixes.
2019-11-11 21:15:52 +01:00
Lubomir Rintel
10f8438c1e logtee: time out after a period of no output
Travis cuts us short after 10 minutes of slience, giving us no chance to puke
out the output. Be faster.
2019-11-11 20:30:45 +01:00
Lubomir Rintel
f5d48a31db Revert "travis: run TEST-13-ENC-RAID-LVM on Fedora 29"
We're on Fedora 31 that should be good enough for this test.

This reverts commit 8238f41b34.
2019-11-11 20:04:58 +01:00
Lubomir Rintel
fe54c9b7a9 TEST-13-ENC-RAID-LVM: increase memory
In Fedora 31 it ooms until it has, uh, twice the memory.
2019-11-11 20:04:58 +01:00
Doan Tran Cong Danh
41a37bc626 dmraid: require kpartx binary
dmraid requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh
cf31ed2ae6 multipath: require kpartx binary
multipath requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh
62f27ee6f1 configure: find cflags and libs for fts on musl
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Mikhail Novosyolov
718aefda13 Ensure that udevadm --version reported an integer
If it is not an integer, further script will fail unexepectedly.
2019-11-05 14:26:14 +01:00
Mikhail Novosyolov
6e761674ad Fail if udevadm could not be run
Fixes: #668
2019-11-05 14:26:14 +01:00
Lubomir Rintel
687e17aa7f network-manager: fix getting of ifname from the sysfs path
commit 5e0f8c8a4c ('network-manager: remove useless use of basename')
somewhat carelessly didn't take into account that $_i has a slash at
the end which made the result of the ## substitution be just an empty
string.

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

This fixes the TEST-30-ISCSI test.
2019-11-05 14:18:01 +01:00
Thomas Blume
3f4bbca751 keep network device naming scheme on upgrade 2019-11-05 11:37:22 +01:00
Jonathan Lebon
cc6792a01e 01fips: trim off GRUB boot device from BOOT_IMAGE
E.g. in RHCOS, the `BOOT_IMAGE` from the cmdline is:

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

Which of course is a GRUB thing, not an actual pathname we'll be able to
resolve. In fact, we can simply scrap it off from the variable. Our code
is already able to handle both cases: whether the device refers to a
separate boot partition, or just the root filesystem with a regular
`/boot` directory.
2019-10-31 11:12:36 +01:00
Jonathan Lebon
ca4aa84851 01fips: add / in BOOT_IMAGE_HMAC filename for clarity
It's already the case the `BOOT_IMAGE_PATH` today, in the non-empty
case, includes a trailing `/`, but let's add it to the path we build
here too to make it more obvious.
2019-10-31 11:12:36 +01:00
Jonathan Lebon
ba813779bf 01fips: run sha512hmac from directory HMAC file directory
That way, the HMAC file can contain a relative path instead of an
absolute one. The issue is that right now the kernel RPM bakes the
`/boot/vmlinuz-${kver}` path into the HMAC file which poses an issue for
rpm-ostree systems (and any other system where the kernel isn't simply
in the top-level `/boot`.

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

Though I'd like to propose the same change in the kernel spec file.
2019-10-31 11:12:36 +01:00
Jonathan Lebon
9e759aa969 01fips: fix HMAC file path resolution
There is a small regression in #343: when handling the 'separate boot
partition' case, we're checking for the kernel image in the wrong
location: `BOOT_IMAGE` is the `/boot`-relative path to the kernel image,
so `/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}` expands to e.g.
`/boot/mysubdir1/mysubdir2/mysubdir1/mysubdir2/vmlinuz...`.

We should be using `BOOT_IMAGE_NAME` here instead (and in fact, the next
if-statement does this correctly, so it might've just been accidentally
left out of #343).
2019-10-31 11:12:36 +01:00
Harald Hoyer
27f758e12c iscsi: remove bashisms 2019-10-25 14:29:17 +02:00
Böszörményi Zoltán
4efcd19a4e Add documentation and Yocto examples
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
0595a79b19 Fix version reported by dracut --help
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
9d88e89350 Set systemdutildir correctly
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
b552d364a3 Handle -r / --sysroot option in dracut.sh
It was documented but not implemented.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
a01204202b Allow running on a cross-compiled rootfs
For the shell scripts, new environment variables were introduced.

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

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

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

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

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

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

DRACUT_ARCH overrides "uname -m".

SYSTEMD_VERSION overrides "systemd --version".

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

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

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

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

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Kairui Song
89bc1aa324 Fine tune mksquashfs options for squash module
Drop some unneeded metadata in the squash image, and print the error
message if something went wrong.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-10-25 11:52:05 +02:00
Jiri Konecny
0d609ae274 Support only fips=1 not fips
It looks like only the 'fips=1' is really supported and it is working
correctly. So instead of failing on 'fips' not clear way give user
information why we are failing.
2019-10-25 11:47:04 +02:00
Jiri Konecny
7ff0fcb723 Fix boot with fips without a value
If you boot system with `fips` and not `fips=1` then you will get unary
operator expected error. This will fix this problem.
2019-10-25 11:47:04 +02:00
Daniel Molkentin
feebf17187 ucode: properly include early only ucode
Intel has notified us that some microcode updates are not safe
to be applied during runtime. To accomodate for that, microcode
files shipped by SUSE and openSUSE have an '.early' postfix such
that triggering

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

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

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

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

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

Reference: osc#1098915
2019-10-25 11:39:16 +02:00
Daniel Molkentin
e3edd247ce 95iscsi: handle qedi like bnx2i
The new qedi driver needs to be handled just like
the bnx2i driver, so update 95iscsi scripts to do this.

References: bsc#1113712

Signed-off-by: Lee Duncan <lduncan@suse.com>
2019-10-25 11:38:17 +02:00
Nathan Rini
916ac45cbe swap for loop to POSIX shell compat 2019-10-25 11:37:43 +02:00
Nathan Rini
0bac59ee5e typo bugfix 2019-10-25 11:37:43 +02:00
Nathan Rini
fb3d292800 fix off by one 2019-10-25 11:37:43 +02:00
Nathan Rini
1b38fa412c bugfix for initialization
exit with error if all retries fail
2019-10-25 11:37:43 +02:00
Nathan Rini
66bfa66add add sleep and max number of retries 2019-10-25 11:37:43 +02:00
Nathan Rini
678627f349 retry image download forever 2019-10-25 11:37:43 +02:00
Frederick Grose
3c8c807db1 iso-scan: Release resources on iso-scan boots with rd.live.ram
Unmounting the image iso, detaching its loop device, and unmounting
its parent partition can simplify installation to the parent disk.

Note that programs or scripts using the /run/initramfs/live mount
point will fail.
2019-10-25 11:35:15 +02:00
Martin Wilck
78efd6988e iscsi: fix error messages with iSCSI root
Fixes these error messages during intird build:

cat: '/sys/devices/platform/host2/flashnode_sess-*/is_boot_target': No such file or directory
/usr/lib/dracut/modules.d/95iscsi/module-setup.sh: line 91: [: -eq: unary operator expected
cat: '/sys/devices/platform/host3/flashnode_sess-*/is_boot_target': No such file or directory
/usr/lib/dracut/modules.d/95iscsi/module-setup.sh: line 91: [: -eq: unary operator expected
2019-10-25 11:34:24 +02:00
Norbert Lange
1aa2d1eddf fix check whether the rootfs init is usable
this now correctly handles:
-   plain files
-   relative symlinks
-   absolute symlinks
2019-10-25 11:30:43 +02:00
tpgxyz
519186e9e6 add mksh support 2019-10-25 11:29:30 +02:00
Harald Hoyer
64082786b2 dracut.spec: add 90ppcmac 2019-10-25 09:23:30 +02:00
q66
159175d525 modules.d: add a module for early fan control on PowerPC Macs
The goal of this module is to enable automatic loading of the
thermal/fan control modules on PowerPC based Macs, as on some
modular kernel configurations this will not happen automatically
which will result in the fans spinning up to 100% until they are
manually loaded.

This is especially a problem in live systems where it takes some
time to boot up and the spin-up happens before the system even
leaves initramfs.
2019-10-25 09:20:04 +02:00
Martin Wilck
9b9dd9993e 35network-legacy: only skip waiting for interfaces if netroot is set
Commmit 8a33e52e2f94 assumes that dracut's work is done if a root device
is found. This holds usually for booting computers, but it may be wrong
for other environments.

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

Fixes: 8a33e52e2f94 ("network: stop waiting for interfaces if root device is present")
References: bsc#1152006
2019-10-25 09:18:12 +02:00
Martin Wilck
c0e5e48aab fixup "Dracut: only login to one target at a time"
On SLE15-SP1 at least, iscsiadm doesn't support combining --op and --login":

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

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

Fix it by not coalescing everything into a single iscsiadm command.
Fixes: a59b776bc215 ("Dracut: only login to one target at a time")
References: bsc#1152650
2019-10-25 09:18:12 +02:00
Martin Wilck
28749d9973 iscsiroot: remove bashisms
According to the dracut README, module code to be run in
the initrd must be POSIX-compliant. Replace remaining
bashisms (as reported by checkbashisms) with POSIX compliant
code.

The use of "type" is not strictly POSIX compliant, but it's
all over the place in dracut code. dash supports it, anyway.
2019-10-25 09:18:12 +02:00
Martin Wilck
ac7582af48 iscsiroot: try targets only once
In multipath scenarios, "iscsiadm -m node" may contain
several records with the same target.
There's no point in trying "iscsiadm --login" multiple
time for the same target, through the same portal.

Moreover, warn if the desired target is not on the node
list.
2019-10-25 09:18:12 +02:00
Martin Wilck
0d5597044f iscsiroot: there's never more than one target per call
iscsi_target_name is set by iscsi_root, and thus can't have
more than one member. This allows us to get rid of one bashism
in iscsiroot.sh.
2019-10-25 09:18:12 +02:00
Martin Wilck
5fbe772b44 iscsiroot: parse_iscsi_root overwrites command line args
iscsi_target_name, iscsi_target_ip, iscsi_target_port are
unconditionally overwritten by parse_iscsi_root. Don't set
them here, for code clarity.
2019-10-25 09:18:12 +02:00
Martin Wilck
906896e220 network: stop waiting for interfaces if root device is present 2019-10-25 09:18:12 +02:00
Martin Wilck
f551886f5c iscsi: don't continue waiting if the root device is present
dracut waits for every iscsiroot connection to be established
before switching root. This is not necessary in multipath scenarios,
where a single path is usually sufficient to set up the root device,
and where users expect booting to succeed unless all paths are down.

Don't wait for the iscsi portal to start if the root device has
already been found.
2019-10-25 09:18:12 +02:00
Lee Duncan
1ab6778ee4 Dracut: only login to one target at a time
For handling the configuration where there are two
paths to an iscsi root target, each using a different
NIC. In such a case, the initramfs was trying to configure
the first NIC, then call iscsiroot to login to both targets,
which would fail for the 2nd target, since the path to the
2nd target was not yet configured. This would eventually
work after a timeout. But it's better to login to just
one target at a time.
This change makes the initramfs handle multiple paths to an
iscsi target better by logging into only one target at a time,
rather than trying to login to all targets when only one of
several NICs is up.

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

If the script is called again via the timeout initqueue,
we try "iscsiadm -L onboot" again, hoping that some targets
may now have become reachable.
2019-10-25 09:18:12 +02:00
jbash aka John Bashinski
7f0b48627a Documentation: add systemd warning for rd.luks.key, clean up related text
Harald Hoyer <harald@redhat.com>: Squashed commit of the following:

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

    Documentation: add systemd warning for rd.luks.key, clean up related text
2019-10-23 14:48:04 +02:00
Kairui Song
5d88809319 99squash: Only start the cleaner on switch-root
Currently it starts the cleaner early and do the clean up job if switch
root is called. It's better to just start the service only on switch
root to avoid any risk of service dependency failure and make is
simpler.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-10-23 14:40:24 +02:00
gaoyi
da36b76ab0 dracut: check_vol_slaves_all must return 1 when lvm vgs failed
reason:when filter/global_filter is set in lvm.conf, lvm vgs may be
failed

Signed-off-by: gaoyi <ymuemc@163.com>
2019-10-23 14:38:11 +02:00
Kairui Song
a69e6c4eae Only generate hostonly-kernel-modules list in strict mode
Fixes #617.
2019-10-23 14:33:36 +02:00
Lukas Nykryn
daa49cc221 net-lib: check if addr exists before checking for dad state
Before we check if dad is done we should first make sure,
that there is a link local address where we do the check.

Due to this issue, on ipv6 only setups sometimes dhclient started
asking for ip address, before the link local address was present
and failed immediately.
2019-10-23 10:44:26 +02:00
Daniel Molkentin
224175d8bc dracut-functions.sh: remove declared unused variables 2019-10-22 13:50:36 +02:00
Daniel Molkentin
b4769b332d dracut-init.sh: remove obsolete for_each_kmod_dep() 2019-10-22 13:50:36 +02:00
Colin Walters
72ae1c4fe7 99base: Rework /etc/initrd-release to derive from real os-release
I'd like to rework CoreOS Ignition (which runs in the initramfs)
to include some values from the *real* `/etc/os-release` in
HTTP headers.

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

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

I changed it so that we keep extending the VERSION/PRETTY_NAME
with the dracut version, but otherwise "pass through" the
rest of the real `/etc/os-release` we were built from unchanged.
2019-10-22 13:49:03 +02:00
Daniel Molkentin
8e9b094b21 99base: Do not hardcode ANSI_COLOR
Take it from /etc/os-release instead, as distributions
usually customize this setting, but keep it as default value.
2019-10-22 13:49:03 +02:00
Daniel Molkentin
8a063c50a3 01systemd-initrd: remove redundant code from 99base 2019-10-22 13:49:03 +02:00
Böszörményi Zoltán
c9b3c89f94 Make TEST-16-DMSQUASH Python 3 compatible
This change still supports Python 2.6 and 2.7 but loses support
for Python 2.5.

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

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-22 12:42:10 +02:00
Harald Hoyer
1fcc70fe57 Merge branch 'nolange-fix_ipv2_for_busybox' 2019-10-21 14:43:44 +02:00
Harald Hoyer
5e7ef0ab3d Merge branch 'fix_ipv2_for_busybox' of https://github.com/nolange/dracut into nolange-fix_ipv2_for_busybox 2019-10-21 14:41:12 +02:00
Marko Myllynen
42d93d3482 Use eurlatgr as default console font
Fedora and others have used eurlatgr as the default console font
for some time now, or suggested using it:

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

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

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

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

https://bugzilla.redhat.com/show_bug.cgi?id=1209460
2019-10-21 13:07:07 +02:00
Harald Hoyer
22c8a5c73f Do not sort the resulting /run/initramfs/state/etc/resolv.conf
nameserver priorities should be preserved

Resolves: https://github.com/dracutdevs/dracut/issues/652
2019-10-21 11:50:20 +02:00
Colin Walters
ce0344d325 Move README to README.md
The `README.md` was nearly empty.  Move the travis bits into
`README`, then rename `README` to `README.md`.

This matches the Github standard.  A major compelling feature
of Github is how prominently it displays a project's `README.md`,
so let's ensure ours has content.
2019-10-19 15:16:50 +02:00
Frantisek Sumsal
920048ff50 travis: switch to Bionic 2019-09-25 12:19:00 +02:00
Lubomir Rintel
31e18286fc test: fix preserving server.log with V=1
This is essentially equivalent to what commit 712f471ebf
('test/test-functions: correctly move server.log') does for V=2.
2019-09-15 17:54:08 +00:00
logan
4a8ad28808 added additional useful filesystem tools 2019-09-15 17:51:06 +00:00
Benjamin Marzinski
9dd9329f7a modules.d: fix udev rules detection of multipath devices
Starting with the 0.7.7 release of the multipath tools, the multipath
udev rules always set a value in ENV{DM_MULTIPATH_DEVICE_PATH} for any
device that multipath scans. A value of 0 means that the device is not
claimed by multipath, and a value of 1 means that it is. Because of
this, udev rules that check ENV{DM_MULTIPATH_DEVICE_PATH}=="?*" will
always return True, and act as if every scanned device is claimed by
multipath. Checking ENV{DM_MULTIPATH_DEVICE_PATH}=="1" will work
correctly for both the old and new versions of the multipath tools.
2019-09-04 13:43:20 +02:00
Jonas Witschel
3436067663 rootfs-block: suppress spurious printing of rootflags
getarg prints the value so it inadvertently shows up in the dracut
output.
2019-09-03 16:49:05 +02:00
Jonas Witschel
f39aa529c5 crypt: create locking directory /run/cryptsetup
For LUKS2 partitions cryptsetup needs a locking directory. If it does
not exist, cryptsetup will create it, but produce a warning

WARNING: Locking directory /run/cryptsetup is missing!

in the process that we do not want to see in the dracut output.
2019-09-03 16:49:05 +02:00
Jonas Witschel
0a01086456 dracut.sh: suppress "ignored null byte in input" warning
Since Bash 4.4, command substitutions containing null bytes produce a
warning of the form

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

Remove the trailing null byte from the UEFI kernel command line file
before printing it to suppress this warning.
2019-09-03 11:28:56 +00:00
Ondrej Dubaj
707d4e79fe added debug-shell to initrd in systemd version >= 240 2019-08-29 15:06:59 +00:00
Renaud Métrich
7a3d661971 Print an error if included item ('-i' option) doesn't exist or is neither a directory nor a regular file
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2019-08-29 13:46:34 +00:00
Tomasz Paweł Gajc
04ff0a1bae Check /usr/sbin for fsck programs 2019-08-29 13:25:57 +00:00
Lubomir Rintel
4d573e3be0 dracut.spec: fix build on openSUSE
When testing the previous commit on openSUSE it turned out that it
didn't really work in the first place, without a few tweaks.
2019-08-29 13:16:00 +00:00
Lubomir Rintel
4e2cc49d75 dracut.spec: fix build with %fedora, %rhel and %suse_version undefined
The RPM build failed on due to missing and unpackaged files on my Fedora
machine that happened to have %fedora set to %nil for reasons long
forgotten.

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

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

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

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

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

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

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

(Notice the missing 'e')

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

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

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

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

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

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

This commit fixes that.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

- Make bootproto a local variable

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

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

  The shell does not exit if the command that fails is [...] part of any
  command executed in a && or || list except the command following the
  final && or || [...]
2019-07-19 16:10:15 +02:00
Max Resch
5a962b5939 add support for creating secureboot signed UEFI images 2019-07-19 16:09:41 +02:00
Max Resch
705eb4eeb2 ask for a password on readkey failure
continue asking for a password if readkey for cryptsetup input failed,
e.g. wrong password in the password file
2019-07-19 16:09:01 +02:00
Max Resch
cbf3200885 lsinitrd handle UEFI created with dracut --uefi 2019-07-19 16:08:28 +02:00
Renaud Métrich
adee5b97bc rngd: new module running early during boot to help generating entropy
when system's default entropy sources are poor (e.g. use of SSD disks or
UEFI RNG not available)

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

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

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2019-07-19 16:05:45 +02:00
Michal Koutný
42e004feb9 debug: Add dd into debug module
When at it also deduplicate the list of installed utilities.
2019-07-19 16:02:47 +02:00
Lubomir Rintel
91c15babdf test/TEST-17-LVM-THIN: fail setup if we run out of space in the thin pool
This condition is rather difficult to detect -- the writes will just remain
queued and get lost on shutdown, resulting in a corrupt filesystem.
2019-07-19 16:02:25 +02:00
Harald Hoyer
4996e53ed3 mkinitrd-suse.sh: remove trailing "|"
caused by commit d10f6f836
2019-07-19 15:57:29 +02:00
Lianbo Jiang
84c862d8f3 99base: enable the initqueue in both 'dracut --add-device' and 'dracut --mount' cases.
The commit 9f3c31cd8d ("99base: enable initqueue if extra devices are added")
only covers 'dracut --add-device' case, but it did not cover 'dracut --mount'
case, which causes the kdump failure in the Amazon virtual machine.

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

Reported-by: Xiao Liang <xiliang@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2019-07-19 15:51:21 +02:00
Harald Hoyer
3e67623ab5 Merge branch 'ryncsn-optimization' 2019-07-19 15:48:37 +02:00
Harald Hoyer
86f4dd0273 Merge branch 'optimization' of https://github.com/ryncsn/dracut into ryncsn-optimization 2019-07-19 15:48:22 +02:00
Kairui Song
19e5758590 squash: also squash systemctl if switch-root is not needed
systemctl need to be accessible on switch-root, but we unmount the
squash image on switch-root, so it will fail. systemctl depends on a lot
of libraries, squash them can save more RAM. So allow modules
(eg. kdump) to tell dracut that switch-root will be intercepted,
then we don't need to take care of that.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-07-19 15:38:54 +02:00
Kairui Song
f6bbd024d9 squash: fix and simplify required_in_root
If required target is a symbol link, create the link then following the
link. If it's a directory, create new directory, else just move it.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-07-19 15:38:54 +02:00
Kairui Song
ab703f44b4 squash: squash systemd binary and udevadm
systemd binary and udevadm are not needed to be outside the squash
image. Some binaries are kept outside because they are required before
mounting the image, or after umounting the image (when switching root),
or they may block umounting the image. But we are using lazy umounting,
so actually nothing will block the umount.

Keep more binaries outside the squash image won't hurt but cost extra
memories, the idea of squash image is to save memory usage.

So, there is no reason to keep udevadm outside, that should be a debug
left over. For systemd binary, it's running when switch root happens,
But we have lazy umounted the image and overlay, once systemd process
exec the new systemd in new root, everything will be cleared by kernel.

Also tidy up the comment make it less confussing.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-07-19 15:38:54 +02:00
Kairui Song
a0d9ad6f70 dracut.sh: record the actual hostonly modules for hostonly mode
Previous in commit 7047294, dracut will include the loaded kernel module
list in initramfs, so other tools could check if the loaded kernel
module is changed and rebuild the host only initramfs in case some
module required to boot the machine is missing due to host only install.

It's better to use modalias list generated by dracut-install, that
list includes the device modalias list combined with current loaded
kernel module list. In this way, if any kernel module is yet to be
loaded when the initramfs is built, or got unloaded by accident the
module list will not change. This make the list more stable over
initramfs builds.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-07-19 15:38:13 +02:00
Kairui Song
90ac0a2d77 99squash: fail early if can't install require modules in initramfs
insmods will consider all arguments as optional modules by default, but
for squash module, all listed modules are required, if any of them is
missing the initramfs won't boot. So pass the '-c' argument to let instmos
know all those modules are mandatory, it will fail and give an error if
it failed to install any of those modules.
2019-07-19 15:37:25 +02:00
Hongxu Jia
dddcb80945 dracut.sh: Fix udevdir detection
In commit [9d1b81c dracut.sh: improve udevdir and systemdutildir
fallback logic] , it checked a common binary `collect' to location
udevdir.

But upstream systemd drop binary `collect' since systemd v240
[a168792c2d]

So check binary `ata_id' to instead.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2019-07-19 11:01:32 +02:00
Daniel Molkentin
d10f6f8367 mkinitrd-suse.sh: simplify get_kernel_version
This generalizes the naming and provides a workaround for compressed
kernels on s390.

Reference: bsc#1139939
2019-07-19 00:25:51 +02:00
Daniel Molkentin
9f561c54c7 tests: Ignore .testdir 2019-07-19 00:25:29 +02:00
Daniel Molkentin
4f19427641 95fcoe: Fix startup when fcoe module is included
The parse-fcoe.sh hook is sourced, and hence must not contain
exit 0 calls. Otherwise, the cmdline sequence will be interupted,
and no error will be reported to systemd. Use return instead.

Reference: boo#1136977
2019-07-19 00:25:06 +02:00
Thomas Blume
8c6ab479ab call netroot on wicked dhcp setup 2019-07-19 00:24:15 +02:00
Thomas Blume
9cc1b76087 nfsroot follow ifcfg settings for boot protocol 2019-07-19 00:23:34 +02:00
Takashi Iwai
dc86c12c45 dracut-install: Add support for compressed firmware files
The upcoming kernel will have a support for loading compressed
firmware files, and this patch corresponds to that kernel change.
When a firmware file with the extra .xz extension is found, dracut
copies to initrd as fallback.  Since initrd itself is compressed, the
file is uncompressed in initrd beforehand.
2019-07-18 18:39:56 +02:00
Lukas Nykryn
9f96bb4c73 01fips: add cfb cipher
Required by FIPS standard
2019-07-16 14:31:32 +02:00
Andreas Schwab
62f939b857 Add support for riscv64 2019-07-15 16:00:59 +02:00
Lubomir Rintel
8238f41b34 travis: run TEST-13-ENC-RAID-LVM on Fedora 29
Systemd in Fedora 30 is broken at the moment.
Fix: https://github.com/systemd/systemd/pull/12897
2019-07-09 14:39:54 +02:00
Lubomir Rintel
7a2503ab8c travis: run TEST-14-IMSM on Fedora 29
Systemd in Fedora 30 is broken at the moment.
Fix: https://github.com/systemd/systemd/pull/12872/
2019-07-09 14:39:54 +02:00
Kairui Song
8365177644 fips: ensure fs module for /boot is installed
When using dracut with  --hostonly and --no-hostonly-default-device,
/boot will be inaccessible as dracut will most fs modules unless
specified. But FIPS require /boot to be accessible, and it will try
to mount it on boot. It will fail if corresponding fs module is missing.

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

Suggested-by: Kenneth Dsouza <kdsouza@redhat.com>
Signed-off-by: Kairui Song <kasong@redhat.com>
2019-03-22 12:58:09 +01:00
Renaud Métrich
33cfad0b8f iscsi: always popd, even if there is no iscsi device 2019-03-04 10:43:21 +01:00
Kairui Song
5916d31b24 dracut: let module handling function accept optional path option
Let the caller pass in the module path instead of try to find the module
path everytime. This helps optimize the overall runtime.

Test results (3 rounds) on Fedora 30 in KVM VM with 8 CPUs, 2G memory, HDD:

    $ time ./dracut.sh --local --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode 'strict' -o 'plymouth dash resume ifcfg' --mount '/dev/mapper/fedora-root /sysroot xfs defaults' --no-hostonly-default-device -f initramfs.img
    Before the commit:
    real    0m11.782s  |  real    0m11.505s  |  real    0m11.958s
    user    0m9.169s   |  user    0m9.218s   |  user    0m9.327s
    sys     0m10.839s  |  sys     0m10.829s  |  sys     0m10.925s

    After this commit:
    real    0m9.866s  |  real    0m9.580s  |  real    0m9.638s
    user    0m9.048s  |  user    0m9.142s  |  user    0m9.120s
    sys     0m7.411s  |  sys     0m7.775s  |  sys     0m7.745s

Test result of building a ordinary image:

    $ time ./dracut.sh --local --quiet -f initramfs.img
    Before the commit:
    real    0m34.697s  |  real    0m34.371s  |  real    0m35.122s
    user    0m27.608s  |  user    0m27.524s  |  user    0m27.705s
    sys     0m22.341s  |  sys     0m22.032s  |  sys     0m22.246s

    After the commit:
    real    0m31.914s  |  real    0m31.006  |  real    0m31.289ss
    user    0m27.315s  |  user    0m27.324  |  user    0m27.290ss
    sys     0m19.051s  |  sys     0m18.916  |  sys     0m19.022ss

This will have an ~2s speed up.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-02-22 15:51:40 +08:00
Lukas Nykryn
fc141f2286 install: string_hash_func should not be fed with NULL
If kmod_module_get_path returns NULL, we should skip that entry,
the hash function does not like NULL pointers.
2019-02-15 08:52:58 +01:00
Böszörményi Zoltán
0d08f43d71 Fix 98dracut-systemd/dracut-emergency.sh
/dev/consoles does not exist. It's /proc/consoles.

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

To prevent this from happening in the future, let's at least check if
the version parsed from the `systemd --version` output is a comparable
number.
2019-01-31 13:52:41 +01:00
Jens Heise
44f2fe5170 10i18n: Fix keymaps not getting included sometimes
Eliminate erroneous substring matches when looking up already processed keymaps to prevent necessary keymaps not getting added to the initramfs sometimes e.g. if there are the files 'compose.latin1' and 'compose.latin1.add' the unfixed version would skip processing 'compose.latin1' if find returned 'compose.latin1.add' first due to the directory listing not being in sorted order.
2019-01-26 16:12:14 +01:00
Daniel Molkentin
58e0d2d5b5 Fix a missing space in example configs
It has

omit_drivers+=" i2o_scsi"

which would break the next omit_drivers+="foo " if it's
missing a space at the beginning.

Reference: boo#1121251
2019-01-21 13:35:04 +01:00
Patrick Talbert
7c6d2ad916 95fcoe: Add the rd.nofcoe option to disable the FCoE module from the command line
Images built with the fcoe module will always run the lldpad
service as part of their pre-trigger scripts if the network
is active. This prevents network installations in
environments where, for security reasons, LLDPDU frames
cause a switchport shutdown.

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

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
2019-01-18 14:10:19 +01:00
Lukas Nykryn
fca93eac19 95iscsi: decouple iscsi from sysinit.target 2019-01-15 14:14:27 +01:00
Lukas Nykryn
88820dc781 Revert "95iscsi: drop systemd dracut service dependencies for iscsid"
This reverts commit 765b20333d.
2019-01-15 14:14:27 +01:00
Kairui Song
1ff306a396 lsinitrd: list squash content as well
When the initramfs is built with squash module enabled, the content
inside squash image will be invisible from the lsinitrd tool. This
commit make lsinitrd detect and list the content of the squash image as
well to avoid possible confusion.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-01-10 10:16:44 +01:00
Daniel Molkentin
32f68c1f9a emergency mode: use sulogin
- allow emergency login on every console
  specified in the kernel cmdline
- require password for hostonly images
- emergency mode: Manually multiplex emergency infos

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

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

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

Rev 2:
*   rebased on master
*   addressed open points from review
2018-12-12 16:13:50 +01:00
Harald Hoyer
ebe1821635 95iscsi/module-setup.sh: do not require 'hostname' anymore 2018-12-04 10:27:17 +01:00
Harald Hoyer
b8a8d7a64e fedora-test.sh: install tcpdump 2018-12-04 10:22:28 +01:00
Harald Hoyer
712f471ebf test/test-functions: correctly move server.log 2018-12-04 10:06:12 +01:00
Harald Hoyer
c38f9e980c install/dracut-install.c: install module dependencies of dependencies 2018-12-04 10:03:31 +01:00
Harald Hoyer
f6e3b59e5e network: skip already enslaved interfaces 2018-12-04 08:50:42 +01:00
Bruno E. O. Meneguele
fb280834d7 dracut.modules.7.asc: typo correction
Correct simple typo in .7 manpage for dracut.

Signed-off-by: Bruno E. O. Meneguele <bmeneg@redhat.com>
2018-11-30 16:06:29 +01:00
Thierry Vignaud
a6bc200c28 kill bogus comment
should have been killed in commit 4a855e6beb
2018-11-30 16:06:14 +01:00
Lubomir Rintel
79a17b0112 network-manager: call the online hook for connected devices
Look for "connection-uuid" instead of "managed" to determine the devices
that are actually activated with a connection and call the online hook.

This fixes the anaconda-net root mount, which utilizes the online hook.
2018-11-30 15:26:18 +01:00
Lukas Nykryn
76522d58c3 dracut-initramfs-restore: set selinux labels 2018-11-27 16:05:48 +01:00
Renaud Métrich
01ffcf342a fips: removed false-positive 'FATAL: Module xxx not found' error message when kernel provides a generic algo for module
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2018-11-15 10:46:24 +01:00
masem
05dc158e3c Delay argument "-d" requires number
Arguments "-f -d -n" fails with "invalid number -n", because -d delay expects number of seconds.
2018-11-15 10:44:37 +01:00
Kairui Song
a60af53413 squash: unsquash the root image instead of mounting it on shutdown
When building squash image, squash module forgot to install the new
shutdown.sh, and the shutdown hooks are always skipped on ordinary
shutdown if squash module is enabled.

The new shutdown.sh will remount the squash image and then everything
will just work, but currently re-mounting the squash image on shutdown
may have selinux problem and make the system hang, and there is no
easy way to fix it.

So skip fixing the shutdown.sh not being install problem, instead
just drop the new shutdown.sh, and unsquash the image on ordinary
shutdown, which is safer and should always work.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-11-12 09:04:14 +01:00
Pedro Monreal
f18d069d46 Fixed some SUSE specific typos and outputs 2018-11-08 14:43:08 +01:00
Lukas Nykryn
48c283a296 dracut.install: call dracut with --force
The kernel-install is called even if you run make install.
Since we don't call dracut with -f a second make install will fail
because initrd with same version is already there.
This makes kernel developers feel miserable.

https://bugzilla.redhat.com/show_bug.cgi?id=1642402
2018-10-25 16:14:05 +02:00
Harald Hoyer
0eef73ea43 Makefile: add srpm target 2018-10-24 15:14:03 +02:00
Dusty Mabe
765b20333d 95iscsi: drop systemd dracut service dependencies for iscsid
These dependencies cause an odd issue where swap devices specified
by resume= on the kernel command line will cause systemd device
timeouts to occur on boot. According to @haraldh these lines aren't
needed because the socket activiation will take care of it for us.
Removing these lines now as it fixes the resume= device timeout issue.

Fixes #480
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1641268
2018-10-24 08:57:24 +02:00
Daniel Molkentin
b38b7fef36 95dasd_rules: mark dasd rules host_only
Reference: bsc#1090884
2018-10-22 09:36:26 +02:00
Daniel Molkentin
7117bf6270 99base: Allow files with backslashes in hostonly files
Files with blackslashes are routinely by systemd.

Reference: bsc#1090884
2018-10-22 09:36:26 +02:00
Renaud Métrich
e54ab383f7 fips: check fips integrity just before mounting local filesystems in /sysroot
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2018-10-19 15:08:53 +02:00
Kairui Song
b9af0fcdfb 99squash: Don't clean up squahfs on isolate
The only time we need to cleanup squahfs manually is on switch root, to
release resource and memory. We've covered that by setting
"Conflicts=initrd-switch-root.target" for squash cleanup service.
On shutdown systemd will take care of squahfs mounts. But for other
isolate, files in initramfs are most likely still required, so don't
clean up squahfs. For example, kdump's emergency handler will isolate
into its own target, if squahfs is cleaned up it will fail.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-10-18 11:55:50 +02:00
Kairui Song
83cbc06ab9 40network: Don't include 40network by default
commit 7347391 ('network-legacy: split off from network module')
splitted network function to network-legacy and removed check() function
of 40network. This caused 40network to be included even if network is
not needed.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-10-12 13:17:58 +02:00
Pedro Monreal
db4d6bb42c Added space in Resolving executable dependencies done as in the rest of the messages 2018-10-09 13:41:55 +02:00
Kairui Song
f51ab4a81f dracut.spec: Fix error introduced by 70291ed
70291e0 ('dracut.spec: Add dracut-squash package') introduced a new
dracut-squash package, but by accident it overrided some other package
spec and the dependency name is wrong. This patch will fix it.
2018-10-09 13:39:32 +02:00
Mike Gilbert
6d886bb74d dracut-install: simplify ldd parsing logic
The previous logic would not handle absolute paths on the left side of
the "=>" properly. For example, on Gentoo ARM64, ldd outputs this:

	/lib/ld-linux-aarch64.so.1 => /lib64/ld-linux-aarch64.so.1

At runtime, the kernel tries to load the file from /lib, and fails if we
only provide it in /lib64.

Instead of looking for the first slash after the "=>", just look for the
first slash, period. This would fail if we somehow had a relative path
on the left side (foo/libbar.so), but I'm not aware of any binaries that
would contain such an entry in DT_NEEDED.

Bug: https://bugs.gentoo.org/667752
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
2018-10-09 13:38:47 +02:00
659 changed files with 28688 additions and 17735 deletions

9
.astylerc Normal file
View File

@@ -0,0 +1,9 @@
lineend=linux
style=linux
indent=spaces=8
convert-tabs
min-conditional-indent=0
max-instatement-indent=120
align-pointer=name
max-code-length=120

View File

@@ -1,7 +1,25 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((sh-mode
(indent-tabs-mode)
(sh-basic-offset . 4)))
; Directory Local Variables
; For more information see (info "(emacs) Directory Variables")
; Sets emacs variables based on mode.
; A list of (major-mode . ((var1 . value1) (var2 . value2)))
; Mode can be nil, which gives default values.
; Characters width is set to 109 for .c and XML but for everything else 79.
; If you update this file make sure to update .vimrc and .editorconfig too.
((c-mode . ((fill-column . 109)
(c-basic-offset . 8)
(eval . (c-set-offset 'substatement-open 0))
(eval . (c-set-offset 'statement-case-open 0))
(eval . (c-set-offset 'case-label 0))
(eval . (c-set-offset 'arglist-intro '++))
(eval . (c-set-offset 'arglist-close 0))
(eval . (c-set-offset 'arglist-cont-nonempty '(c-lineup-gcc-asm-reg c-lineup-arglist)))))
(nxml-mode . ((nxml-child-indent . 2)
(fill-column . 109)))
(meson-mode . ((meson-indent-basic . 8)))
(sh-mode . ((sh-basic-offset . 4)
(sh-indentation . 4)))
(awk-mode . ((c-basic-offset . 8)))
(nil . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 79))) )

39
.editorconfig Normal file
View File

@@ -0,0 +1,39 @@
# EditorConfig configuration for dracut
# http://EditorConfig.org
# If you update this file make sure to update .dir-locals.el and .vimrc too.
# Top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file, utf-8 charset
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
switch_case_indent = true
function_next_line = false
binary_next_line = true
space_redirects = true
# Match config files, set indent to spaces with width of eight.
[*.{c,h}]
indent_style = space
indent_size = 8
# Match config files, set indent to spaces with width of four.
[*.sh]
indent_style = space
indent_size = 4
switch_case_indent = true
function_next_line = false
binary_next_line = true
space_redirects = true
# Match xml man pages, set indent to spaces with width of two.
[man/*.xml]
indent_style = space
indent_size = 2

9
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,9 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @haraldh @danimo @johannbg

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.

14
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
version: 2
# Maintain dependencies for GitHub Actions
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "tuesday"
commit-message:
prefix: "chore"
include: "scope"
ignore:
- dependency-name: "Manual test"

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

@@ -0,0 +1,292 @@
repository:
- ./*
github:
- .github/*
- .github/**/*
dracut-install:
- install/*
- install/**/*
example:
- examples/*
- examples/**/*
- examples/**/**/*
modules:
- modules.d/*
- modules.d/**/*
bash:
- modules.d/00bash/*
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/*
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/*
overlayfs:
- modules.d/90overlayfs/*
ppcmac:
- modules.d/90ppcmac/*
qemu:
- modules.d/90qemu/*
qemu-net:
- modules.d/90qemu-net/*
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/*
virtiofs:
- modules.d/95virtiofs/*
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/**/*
- modules.d/80test*
- modules.d/80test*/*

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 #

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

@@ -0,0 +1,23 @@
# 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
# Ignore if in a milestone
exemptMilestones: true
# Issues with these labels will never be considered stale
exemptLabels:
- documents
- enhancement
- regression
- wiki
- bug
# 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

53
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
---
# vi: ts=2 sw=2 et:
# SPDX-License-Identifier: LGPL-2.1-or-later
#
name: "CodeQL"
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
jobs:
analyze:
name: Analyze
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ matrix.language }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ['cpp', 'python']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-extended,security-and-quality
- name: Install dependencies
run: |
sudo apt -y update
sudo apt -y install asciidoc gcc libkmod-dev libsystemd-dev pkg-config
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

54
.github/workflows/container.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: Container
on:
schedule:
- cron: '30 11 * * *' # every day at 4:40
push:
branches: [ master ]
paths:
- 'test/container/**'
- '.github/workflows/container.yml'
pull_request:
branches: [ master ]
paths:
- 'test/container/**'
- '.github/workflows/container.yml'
permissions:
packages: write
contents: read
jobs:
push_to_registry:
name: Build and push containers image to GitHub Packages
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
config:
- { dockerfile: 'Dockerfile-Fedora-latest', tag: 'fedora:latest' }
- { dockerfile: 'Dockerfile-OpenSuse-latest', tag: 'opensuse:latest' }
- { dockerfile: 'Dockerfile-Arch', tag: 'arch:latest' }
- { dockerfile: 'Dockerfile-Debian', tag: 'debian:latest' }
- { dockerfile: 'Dockerfile-Gentoo', tag: 'gentoo:latest' }
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up env
run: echo "repository_owner=${GITHUB_REPOSITORY_OWNER,,}" >>${GITHUB_ENV}
- name: Build and Push Container
uses: docker/build-push-action@v4
with:
file: test/container/${{ matrix.config.dockerfile }}
tags: ghcr.io/${{env.repository_owner}}/${{ matrix.config.tag }}
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}

116
.github/workflows/integration.yml vendored Normal file
View File

@@ -0,0 +1,116 @@
name: Integration Test
on:
pull_request:
branches: [ master ]
env:
DEBUGFAIL: "${{ secrets.ACTIONS_STEP_DEBUG && 'rd.debug' }}"
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
cancel-in-progress: true
strategy:
matrix:
container: [
"arch:latest",
"debian:latest",
"fedora:latest",
"opensuse:latest",
]
test: [
"01",
"02",
"03",
"04",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"62",
"98",
]
fail-fast: false
container:
image: ghcr.io/dracutdevs/${{ matrix.container }}
options: "--privileged -v /dev:/dev"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "${{ matrix.container }} TEST-${{ matrix.test }}"
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
network:
runs-on: ubuntu-latest
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}-${{ matrix.network }}
cancel-in-progress: true
strategy:
matrix:
container: [
"fedora:latest",
]
network: [
"network-manager",
"network-legacy",
#"systemd-networkd",
#"connman",
]
test: [
"20",
"30",
"35",
"40",
"60",
# "50", # times out
]
fail-fast: false
container:
image: ghcr.io/dracutdevs/${{ matrix.container }}
options: "--privileged -v /dev:/dev"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "${{ matrix.container }} TEST-${{ matrix.test }}"
run: USE_NETWORK=${{ matrix.network }} ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
openrc-musl:
runs-on: ubuntu-latest
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
cancel-in-progress: true
strategy:
matrix:
container: [
"gentoo:latest",
]
test: [
"18",
]
fail-fast: false
container:
image: ghcr.io/dracutdevs/${{ matrix.container }}
options: "--privileged -v /dev:/dev"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: "${{ matrix.container }} TEST-${{ matrix.test }}"
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

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

@@ -0,0 +1,11 @@
name: "Pull Request Labeler"
on: pull_request_target
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

38
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Lint
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
lint-c:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install tools
run: sudo apt-get install astyle
- name: indent
run: make indent-c
- name: check formatting
run: git diff --exit-code
lint-shell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: shfmt
uses: luizm/action-sh-checker@v0.6.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHFMT_OPTS: -s # arguments to shfmt.
with:
sh_checker_shellcheck_disable: false
sh_checker_comment: true

37
.github/workflows/manualtest.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Manual test
on:
workflow_dispatch:
inputs:
test:
description: "Array of tests to run, such as [11,12]"
default: "['04']"
required: true
container:
type: choice
description: 'distro'
default: 'fedora'
options:
- "fedora"
- "arch"
- "debian"
- "opensuse"
- "gentoo"
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
matrix:
test: ${{ fromJSON(inputs.test) }}
container:
image: ghcr.io/dracutdevs/${{ inputs.container }}
options: "--privileged -v /dev:/dev"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: "${{ inputs.container }} ${{ matrix.test }}"
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

19
.github/workflows/pr.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Commisery
on:
pull_request:
types: [edited, opened, synchronize, reopened]
jobs:
commit-message:
name: Conventional Commit Message Checker (Commisery)
runs-on: ubuntu-latest
steps:
- name: Check-out the repo under $GITHUB_WORKSPACE
uses: actions/checkout@v3
- name: Run Commisery
uses: dracutdevs/commisery-action@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull_request: ${{ github.event.number }}

21
.gitignore vendored
View File

@@ -1,23 +1,30 @@
/Makefile.inc
/dracut.8
/dracut-catimages.8
/dracut.conf.5
/man/dracut.8
/man/dracut-catimages.8
/man/dracut.conf.5
/dracut.conf.d/*.conf
/dracut-gencmdline.8
/man/dracut.cmdline.7
/dracut.html
/dracut.kernel.7
/man/dracut.kernel.7
/man/dracut.bootup.7
/man/dracut.modules.7
/man/lsinitrd.1
/dracut.pc
/dracut-install
/modules.d/99base/switch_root
/test/*/test.log
/test/*/.testdir
test*.img
/.buildpath
/.project
/dracut-version.sh
/install/dracut-install
/src/install/dracut-install
/*.rpm
/*.[0-9]
/modules.d/98dracut-systemd/*.service.8
/*.sign
*.o
skipcpio/skipcpio
/src/skipcpio/skipcpio
/src/util/util
/dracut-util
.idea/

View File

@@ -1 +1,2 @@
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
kate-mimetype(text/x-c): tab-width 8; indent-width 8;

View File

@@ -2,9 +2,10 @@ Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer-omB+W0Dpw2o@public.gm
Seewer Philippe <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
Harald Hoyer <harald@redhat.com> <harald@hoyer.xyz>
Harald Hoyer <harald@profian.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Harald Hoyer <harald@profian.com> <harald@eeepc.(none)>
Harald Hoyer <harald@profian.com> <harald@hoyer.xyz>
Harald Hoyer <harald@profian.com> <harald@redhat.com>
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
@@ -31,3 +32,7 @@ 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>
Tomasz Paweł Gajc <tpgxyz@gmail.com> <tpgxyz@gmail.com>

34
.shellcheckrc Normal file
View File

@@ -0,0 +1,34 @@
# SC2039: In POSIX sh, 'local' is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC2039
disable=SC2039
# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
# https://github.com/koalaman/shellcheck/wiki/SC2166
disable=SC2166
# SC2154: Variable is referenced but not assigned
# https://github.com/koalaman/shellcheck/wiki/SC2154
disable=SC2154
# SC1091: Not following <file>
# https://github.com/koalaman/shellcheck/wiki/SC1091
disable=SC1091
# SC2174: When used with -p, -m only applies to the deepest directory.
# https://github.com/koalaman/shellcheck/wiki/SC2174
disable=SC2174
# SC3043: In POSIX sh, 'local' is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC3043
# ... but dash supports it
disable=SC3043
# SC3013: In POSIX sh, -ef is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC3013
# ... but dash supports it
disable=SC3013
# SC3045: In POSIX sh, read -p is undefined.
# https://github.com/koalaman/shellcheck/wiki/SC3045
# ... but dash supports it
disable=SC3045

View File

@@ -1,47 +0,0 @@
language: generic
sudo: required
services:
- docker
env:
matrix:
- IMAGE=latest
- IMAGE=latest TESTS=01
- IMAGE=latest TESTS=12
- IMAGE=latest TESTS=20
- IMAGE=latest TESTS=50
- IMAGE=latest TESTS=30
- IMAGE=latest TESTS=31
- IMAGE=latest TESTS=70
- IMAGE=latest TESTS=99
- IMAGE=latest TESTS=02
- IMAGE=latest TESTS=03
- IMAGE=latest TESTS=04
- IMAGE=latest TESTS=10
- IMAGE=latest TESTS=11
- IMAGE=latest TESTS=13
- IMAGE=latest TESTS=14
- IMAGE=latest TESTS=15
- IMAGE=latest TESTS=17
before_script:
- docker pull fedora:$IMAGE
- |
sudo modprobe kvm-intel nested=1 || :
sudo modprobe kvm-amd nested=1 || :
dmesg | tail || :
- git pull --depth=100
- |
git describe --abbrev=0 --tags || :
git describe --tags || :
script:
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/effa917ca3e0ed5fd00e
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always

15
.vimrc Normal file
View File

@@ -0,0 +1,15 @@
" Vim can use per directory configuration files like this.
" To enable that feature two lines are needed in your ~/.vimrc
" set exrc " enables per-directory .vimrc files
" set secure " disable unsafe commands in local .vimrc files
" Characters width is set to 109 for .c and XML but for everything else 79.
" If you update this file make sure to update .dir-locals.el & .editorconfig
set tabstop=4
set shiftwidth=4
set expandtab
set makeprg=GCC_COLORS=\ make
set tw=79
au BufRead,BufNewFile *.xml set tw=109 shiftwidth=2 smarttab
au FileType sh set tw=80 shiftwidth=4 smarttab
au FileType c set tw=109 shiftwidth=8 tabstop=8 smarttab expandtab

View File

@@ -1,60 +0,0 @@
#!/bin/bash
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
# So, let's skip to create initrd.
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
if [[ -d "$BOOT_DIR_ABS" ]]; then
INITRD="initrd"
else
BOOT_DIR_ABS="/boot"
INITRD="initramfs-${KERNEL_VERSION}.img"
fi
ret=0
case "$COMMAND" in
add)
INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
# we found an initrd at the same place as the kernel
# use this and don't generate a new one
cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
&& chown root:root "$BOOT_DIR_ABS/$INITRD" \
&& chmod 0600 "$BOOT_DIR_ABS/$INITRD" \
&& exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
fi
unset noimageifnotneeded
for ((i=0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
noimageifnotneeded="yes"
break
fi
done
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
ret=$?
;;
remove)
rm -f -- "$BOOT_DIR_ABS/$INITRD"
ret=$?
;;
esac
exit $ret

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

@@ -1,131 +0,0 @@
#!/bin/bash
export LANG=C
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="${3%/*}/0-rescue"
KERNEL_IMAGE="$4"
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
}
[[ -f /etc/os-release ]] && . /etc/os-release
if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
elif [[ -f /etc/machine-id ]] ; then
read MACHINE_ID < /etc/machine-id
fi
if ! [[ $MACHINE_ID ]]; then
exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
fi
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
echo "Could not determine the kernel command line parameters." >&2
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
exit 1
fi
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
KERNEL="linux"
INITRD="initrd"
else
BLS_DIR="/boot/loader/entries"
BOOT_DIR_ABS="/boot"
LOADER_ENTRY="$BLS_DIR/${MACHINE_ID}-0-rescue.conf"
KERNEL="vmlinuz-0-rescue-${MACHINE_ID}"
INITRD="initramfs-0-rescue-${MACHINE_ID}.img"
fi
ret=0
case "$COMMAND" in
add)
[[ -f "$LOADER_ENTRY" ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
&& [[ -f "$BOOT_DIR_ABS/$INITRD" ]] && exit 0
# 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
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
fi
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
((ret+=$?))
fi
if [[ "${BOOT_DIR_ABS}" != "/boot" ]]; then
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"
echo "machine-id $MACHINE_ID"
echo "options ${BOOT_OPTIONS[@]} rd.auto=1"
echo "linux $BOOT_DIR/linux"
echo "initrd $BOOT_DIR/initrd"
} > $LOADER_ENTRY
else
cp -aT "${KERNEL_IMAGE%/*}/bls.conf" $LOADER_ENTRY
sed -i 's/'$KERNEL_VERSION'/0-rescue-'${MACHINE_ID}'/' $LOADER_ENTRY
fi
((ret+=$?))
;;
remove)
exit 0
;;
*)
usage
ret=1;;
esac
exit $ret

210
AUTHORS
View File

@@ -1,228 +1,372 @@
Harald Hoyer <harald@redhat.com>
Harald Hoyer <harald@profian.com>
Victor Lowther <victor.lowther@gmail.com>
Jóhann B. Guðmundsson <johannbg@gmail.com>
Laszlo Gombos <laszlo.gombos@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Antonio Alvarez Feijoo <antonio.feijoo@suse.com>
Daniel Molkentin <daniel.molkentin@suse.com>
Hannes Reinecke <hare@suse.com>
Kairui Song <kasong@redhat.com>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Dave Young <dyoung@redhat.com>
Jeremy Katz <katzj@redhat.com>
Lukas Nykryn <lnykryn@redhat.com>
David Dillow <dave@thedillows.org>
Martin Wilck <mwilck@suse.de>
Lubomir Rintel <lkundrak@v3.sk>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Daniel Molkentin <dmolkentin@suse.com>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.com>
Lukas Nykryn <lnykryn@redhat.com>
Alexander Tsoy <alexander@tsoy.me>
Frederick Grose <fgrose@sugarlabs.org>
WANG Chao <chaowang@redhat.com>
Beniamino Galvani <bgalvani@redhat.com>
Jonathan Lebon <jonathan@jlebon.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
Andreas Thienemann <andreas@bawue.net>
David Tardon <dtardon@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
David Disseldorp <ddiss@suse.de>
Hans de Goede <hdegoede@redhat.com>
Frantisek Sumsal <frantisek@sumsal.cz>
Peter Jones <pjones@redhat.com>
Thomas Blume <thomas.blume@suse.com>
Andreas Thienemann <andreas@bawue.net>
Marcos Mello <marcosfrm@gmail.com>
Renaud Métrich <rmetrich@redhat.com>
наб <nabijaczleweli@nabijaczleweli.xyz>
Pavel Valena <pvalena@redhat.com>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Brian C. Lane <bcl@redhat.com>
Fabian Vogt <fvogt@suse.com>
Kairui Song <kasong@redhat.com>
Nicolas Chauvet <kwizart@gmail.com>
Zoltán Böszörményi <zboszor@pr.hu>
Colin Walters <walters@verbum.org>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Shreenidhi Shedi <sshedi@vmware.com>
Xunlei Pang <xlpang@redhat.com>
Daniel Drake <drake@endlessm.com>
Lubomir Rintel <lkundrak@v3.sk>
David Teigland <teigland@redhat.com>
Dusty Mabe <dusty@dustymabe.com>
Kairui Song <kasong@tencent.com>
Angelo "pallotron" Failla <pallotron@fb.com>
Brian C. Lane <bcl@redhat.com>
Ville Skyttä <ville.skytta@iki.fi>
Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Ville Skyttä <ville.skytta@iki.fi>
Böszörményi Zoltán <zboszor@pr.hu>
Cristian Rodríguez <crrodriguez@opensuse.org>
Javier Martinez Canillas <javierm@redhat.com>
Mike Gilbert <floppym@gentoo.org>
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Ondrej Mosnacek <omosnace@redhat.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
Colin Walters <walters@verbum.org>
Jonas Witschel <diabonas@gmx.de>
Leho Kraav <leho@kraav.com>
Moritz Maxeiner <moritz@ucworks.org>
Nicolas Chauvet <kwizart@gmail.com>
Ondrej Mosnacek <omosnace@redhat.com>
Nathan Rini <nate@ucar.edu>
Radek Vykydal <rvykydal@redhat.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Đoàn Trần Công Danh <congdanhqx@gmail.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>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Tao Liu <ltao@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
q66 <daniel@octaforge.org>
Adam Williamson <awilliam@redhat.com>
Chao Wang <chaowang@redhat.com>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Martin Wilck <mwilck@suse.de>
Mike Gilbert <floppym@gentoo.org>
Masahiro Matsuya <mmatsuya@redhat.com>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Norbert Lange <norbert.lange@andritz.com>
Pingfan Liu <piliu@redhat.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Adam Williamson <awilliam@redhat.com>
Takashi Iwai <tiwai@suse.de>
Tony Asleson <tasleson@redhat.com>
Zoltán Böszörményi <zboszor@gmail.com>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
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>
Marcos Mello <marcosfrm@gmail.com>
Marian Ganisin <mganisin@redhat.com>
Matt Coleman <matt@datto.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Max Resch <resch.max@gmail.com>
Michael Ploujnikov <plouj@somanetworks.com>
Nicolas Porcel <nicolasporcel06@gmail.com>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Stefan Berger <stefanb@linux.ibm.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>
tpgxyz <tpgxyz@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alberto Planas <aplanas@suse.com>
Alex Harpin <development@landsofshadow.co.uk>
Alexander Wenzel <alexander.wenzel@qbeyond.de>
Alexey Shabalin <shaba@altlinux.org>
Andre Russ <andre.russ@sap.com>
Andreas Schwab <schwab@suse.de>
Ankit Kumar <ankit@linux.vnet.ibm.com>
Antony Messerli <amesserl@rackspace.com>
Chao Fan <cfan@redhat.com>
Coiby Xu <coxu@redhat.com>
Cornelius Hoffmann <coding@hoffmn.de>
Daniel Cordero <dracut@0xdc.io>
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Daniel Schaal <farbing@web.de>
Denis Silakov <dsilakov@virtuozzo.com>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Erwan Velu <erwan.velu@enovance.com>
Evgeny Vereshchagin <evvers@ya.ru>
German Maglione <gmaglione@redhat.com>
Guido Trentalancia <guido@trentalancia.net>
Hari Bathini <hbathini@linux.ibm.com>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Henrik Gombos <henrik99999@gmail.com>
Ian Dall <ian@beware.dropbear.id.au>
Imran Haider <imran1008@gmail.com>
James Buren <ryuo@frugalware.org>
Jan Macku <jamacku@redhat.com>
Joey Boggs <jboggs@redhat.com>
José María Fernández <josemariafg@gmail.com>
Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Lee Duncan <lduncan@suse.com>
Luiz Angelo Daros de Luca <luizluca@gmail.com>
Lukas Wunner <lukas@wunner.de>
Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Marko Myllynen <myllynen@redhat.com>
Matthew Thode <mthode@mthode.org>
Michal Koutný <mkoutny@suse.com>
Mike Snitzer <snitzer@redhat.com>
Minfei Huang <mhuang@redhat.com>
Nikoli <nikoli@gmx.us>
Pingfan Liu <piliu@redhat.com>
Patrick Talbert <ptalbert@redhat.com>
Pedro Monreal <pmgdeb@gmail.com>
Petr Pavlu <petr.pavlu@suse.com>
Przemysław Rudy <prudy1@o2.pl>
Robert LeBlanc <robert@leblancnet.us>
Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@us.ibm.com>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Tony Asleson <tasleson@redhat.com>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
keentux <valentin.lefebvre@suse.com>
nkraetzschmar <nkraetzschmar@users.noreply.github.com>
Érico Rolim <erico.erc@gmail.com>
A. Wilcox <AWilcox@Wilcox-Tech.com>
Adam Alves <adamoa@gmail.com>
Adrien Thierry <athierry@redhat.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 Stieger <astieger@suse.com>
Andrew J. Hesford <ajh@sideband.org>
Andrey Sokolov <keremet@altlinux.org>
Andy Lutomirski <luto@mit.edu>
Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
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 Gilbert <bgilbert@redhat.com>
Benjamin Marzinski <bmarzins@redhat.com>
Brandon Philips <brandon@ifup.co>
Brandon Sloane <btsloane@verizon.net>
Bruno E. O. Meneguele <bmeneg@redhat.com>
Bryn M. Reeves <bmr@redhat.com>
Canek Peláez Valdés <caneko@gmail.com>
Carlo Caione <carlo@endlessm.com>
Chad Dupuis <chad.dupuis@cavium.com>
Charles Rose <charles.rose@dell.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Cole Robinson <crobinso@redhat.com>
Cong Wang <amwang@redhat.com>
Conrad Hoffmann <ch@bitfehler.net>
Daan De Meyer <daan.j.demeyer@gmail.com>
Dan Fuhry <dfuhry@datto.com>
Dave Jones <davej@redhat.com>
David Disseldorp <ddiss@suse.de>
David Hildenbrand <david@redhat.com>
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>
Dirk Müller <dirk@dmllr.de>
Donovan Tremura <neurognostic@protonmail.ch>
Duane Griffin <duaneg@dghda.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>
Evgeni Golov <evgeni@golov.de>
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>
Frederick Grose <4335897+FGrose@users.noreply.github.com>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
Glenn Morris <rgm@stanford.edu>
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>
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
Hongxu Jia <hongxu.jia@windriver.com>
Hui Wang <john.wanghui@huawei.com>
Ignaz Forster <iforster@suse.com>
Jacob Wen <jian.w.wen@oracle.com>
James Laska <jlaska@redhat.com>
James Morris <morisja@gmail.com>
Jan Stodola <jstodola@redhat.com>
Jaroslav Jindrak <dzejrou@gmail.com>
Jason Dana <jasondana@quarksecurity.com>
Jens Heise <46450477+heisej@users.noreply.github.com>
Jeremy Linton <jlinton@redhat.com>
Jeremy Linton <lintonrjeremy@gmail.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Johannes Thumshirn <jthumshirn@suse.com>
Jonas Jelten <jj@sft.lol>
Jonas Jonsson <jonas@websystem.se>
Jonas Witschel <diabonas@archlinux.org>
Kenneth D'souza <kennethdsouza94@gmail.com>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lars Wendler <polynomial-c@gentoo.org>
Laura Hild <lsh@jlab.org>
Lennart Poettering <lennart@poettering.net>
Lennert Buytenhek <buytenh@wantstofly.org>
Lev Veyde <lveyde@redhat.com>
Lianbo Jiang <lijiang@redhat.com>
LinkTed <link.ted@mailbox.org>
Luca BRUNO <luca.bruno@coreos.com>
Lucas C. Villa Real <lucasvr@gmail.com>
Major Hayden <major@mhtx.net>
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Marian Csontos <mcsontos@redhat.com>
Mark Fasheh <mfasheh@suse.de>
Marko Myllynen <myllynen@redhat.com>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Matthew Thode <mthode@mthode.org>
Matthias Berndt <matthias_berndt@gmx.de>
Mei Liu <liumbj@linux.vnet.ibm.com>
Michael Chapman <mike@very.puzzling.org>
Michael McCracken <michael.mccracken@gmail.com>
Michal Koutný <mkoutny@suse.com>
Michal Hecko <mhecko@redhat.com>
Michal Schmidt <mschmidt@redhat.com>
Michal Sekletar <msekleta@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Morten Linderud <morten@linderud.pw>
Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Porcel <nicolasporcel06@gmail.com>
Neal Gompa <neal@gompa.dev>
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Olivier Blin <dev@blino.org>
Ondrej Dubaj <odubaj@redhat.com>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@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>
Peter Levine <plevine457@gmail.com>
Petr Tesarik <ptesarik@suse.com>
Petr Vorel <pvorel@suse.cz>
Prarit Bhargava <prarit@redhat.com>
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Renaud Métrich <rmetrich@redhat.com>
Robert Buchholz <rbu@goodpoint.de>
Ruben Kerkhof <ruben@rubenkerkhof.com>
Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
Rusty Bird <rustybird@openmailbox.org>
Savyasachee Jha <genghizkhan91@hawkradius.com>
Scott Moser <smoser@brickies.net>
Sebastian Mitterle <smitterl@redhat.com>
Sergei Iudin <tsipa740@gmail.com>
Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Stijn Hoop <stijn@sandcat.nl>
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
Thierry Vignaud <thierry.vignaud@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Blume <thomas.blume@suse.com>
Thomas Abraham <tabraham@suse.com>
Thomas Haller <thaller@redhat.com>
Tianhao Chai <cth451@gmail.com>
Tobias Geerinckx <tobias.geerinckx@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Tom Gundersen <teg@jklm.no>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Tomasz Torcz <tomek@pipebreaker.pl>
Tong Li <tonli@redhat.com>
Vadim Kuznetsov <vadimk@gentoo.org>
Vaughan Cao <vaughan.cao@oracle.com>
Vladius25 <vkorol2509@icloud.com>
Vratislav Podzimek <vpodzime@redhat.com>
Wenchao Hao <haowenchao@huawei.com>
Yang Liu <50459973+ly4096x@users.noreply.github.com>
Yanko Kaneti <yaneti@declera.com>
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
Ziyue Yang <ziyang@redhat.com>
foopub <45460217+foopub@users.noreply.github.com>
gaoyi <ymuemc@163.com>
gombi <gombi@>
honza801 <honza801@gmail.com>
jbash aka John Bashinski <jbash@velvet.com>
jloeser <jloeser@suse.de>
joamonwx <unknown>
johannes <johannes.brechtmann@gmail.com>
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
joshuacov1 <joshuacov@gmail.com>
lapseofreason <lapseofreason0@gmail.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>
tpg <tpgxyz@gmail.com>
realtime-neil <neil@rtr.ai>
runsisi <runsisi@hust.edu.cn>
tupper <tupper.bob@gmail.com>
xtraeme <xtraeme@voidlinux.eu>
Дамјан Георгиевски <gdamjan@gmail.com>

22
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,22 @@
We welcome contributions from everyone. However, please follow the following guidelines when posting a GitHub Pull Request or filing a GitHub Issue on the dracut project:
By participating in this project, you agree to abide by the [code of conduct](docs/CODE_OF_CONDUCT.md).
# Filing Issues
We use GitHub Issues exclusively for tracking bugs and feature requests of dracut.
We only track bugs in the two most recently released versions of dracut in the GitHub Issue tracker.
If you are using an older version of dracut, please contact your distribution's bug tracker instead (see below). See GitHub Release Page for the list of most recent releases.
When filing an issue, specify the dracut version you are experiencing the issue with. Also, indicate which distribution you are using.
Please include an explanation how to reproduce the issue you are pointing out.
For more information on Coding Style and Commit messages see [Dracut Developer Guidelines](docs/HACKING.md).
# Older or downstream versions
For older or downstream versions that are still supported by your distribution please use respective downstream tracker:
[Debian](https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=dracut)
[Fedora](https://bugzilla.redhat.com/buglist.cgi?quicksearch=dracut)
[Gentoo](https://bugs.gentoo.org/buglist.cgi?quicksearch=dracut)
[openSUSE](https://bugzilla.opensuse.org/buglist.cgi?quicksearch=dracut)

23
HACKING
View File

@@ -1,23 +0,0 @@
Right now, most of the testing is done using a qemu/kvm guest and
generating the initramfs on another box but the support is all present
to build for the "running" machine. For the former, you can boot the guest
using qemu's -kernel and -initrd options.
dracut exists and will build an image. It is command-line equivalent
to most mkinitrd implementations and should be pretty straight-forward
to use.
To use, just run dracut with an output file name and, optionally, a
kernel version (it defaults to using the current). The appropriate
modules will be copied over and things should be good to go. If you'd
like to customize the list of modules copied in, edit /etc/dracut.conf
and set
dracutmodules="foo bar baz"
Note that dracut calls functional components in modules.d "modules"
while kernel modules are called "drivers".
Requirements:
* udev
* nfs module: nfs daemon and rpc helper
* iscsi: iscsi

234
Makefile
View File

@@ -1,10 +1,21 @@
-include dracut-version.sh
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(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=$(CURDIR)/.. 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=$(CURDIR)/.. git describe --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_FULL_VERSION),)
DRACUT_FULL_VERSION = $(DRACUT_VERSION)
endif
HAVE_SHELLCHECK ?= $(shell command -v shellcheck >/dev/null 2>&1 && echo yes)
HAVE_SHFMT ?= $(shell command -v shfmt >/dev/null 2>&1 && echo yes)
-include Makefile.inc
KVERSION ?= $(shell uname -r)
prefix ?= /usr
libdir ?= ${prefix}/lib
datadir ?= ${prefix}/share
@@ -12,23 +23,20 @@ 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
man1pages = lsinitrd.1
man1pages = man/lsinitrd.1
man5pages = dracut.conf.5
man5pages = man/dracut.conf.5
man7pages = dracut.cmdline.7 \
dracut.bootup.7 \
dracut.modules.7
man7pages = man/dracut.cmdline.7 \
man/dracut.bootup.7 \
man/dracut.modules.7
man8pages = dracut.8 \
dracut-catimages.8 \
mkinitrd.8 \
mkinitrd-suse.8 \
man8pages = man/dracut.8 \
man/dracut-catimages.8 \
modules.d/98dracut-systemd/dracut-cmdline.service.8 \
modules.d/98dracut-systemd/dracut-initqueue.service.8 \
modules.d/98dracut-systemd/dracut-mount.service.8 \
@@ -40,44 +48,68 @@ man8pages = dracut.8 \
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
.PHONY: install clean archive testimage test all check AUTHORS CONTRIBUTORS doc dracut-version.sh
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
all: dracut-version.sh dracut.pc dracut-install src/skipcpio/skipcpio dracut-util
%.o : %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(KMOD_CFLAGS) $< -o $@
DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
install/hashmap.o\
install/log.o \
install/strv.o \
install/util.o
src/install/dracut-install.o \
src/install/hashmap.o\
src/install/log.o \
src/install/strv.o \
src/install/util.o
# deps generated with gcc -MM
install/dracut-install.o: install/dracut-install.c install/log.h install/macro.h \
install/hashmap.h install/util.h
install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.h \
install/hashmap.h
install/log.o: install/log.c install/log.h install/macro.h install/util.h
install/util.o: install/util.c install/util.h install/macro.h install/log.h
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
src/install/dracut-install.o: src/install/dracut-install.c src/install/log.h src/install/macro.h \
src/install/hashmap.h src/install/util.h
src/install/hashmap.o: src/install/hashmap.c src/install/util.h src/install/macro.h src/install/log.h \
src/install/hashmap.h
src/install/log.o: src/install/log.c src/install/log.h src/install/macro.h src/install/util.h
src/install/util.o: src/install/util.c src/install/util.h src/install/macro.h src/install/log.h
src/install/strv.o: src/install/strv.c src/install/strv.h src/install/util.h src/install/macro.h src/install/log.h
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
src/install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
logtee: logtee.c
logtee: src/logtee/logtee.c
$(CC) $(LDFLAGS) -o $@ $<
dracut-install: install/dracut-install
dracut-install: src/install/dracut-install
ln -fs $< $@
SKIPCPIO_OBJECTS= \
skipcpio/skipcpio.o
SKIPCPIO_OBJECTS = src/skipcpio/skipcpio.o
skipcpio/skipcpio.o: src/skipcpio/skipcpio.c
skipcpio/skipcpio: $(SKIPCPIO_OBJECTS)
skipcpio/skipcpio.o: skipcpio/skipcpio.c
skipcpio/skipcpio: skipcpio/skipcpio.o
UTIL_OBJECTS = src/util/util.o
util/util.o: src/util/util.c
util/util: $(UTIL_OBJECTS)
indent:
indent -i8 -nut -br -linux -l120 install/dracut-install.c
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
dracut-util: src/util/util
cp -a $< $@
.PHONY: indent-c
indent-c:
astyle -n --quiet --options=.astylerc $(wildcard *.[ch] */*.[ch] src/*/*.[ch])
.PHONY: indent
indent: indent-c
ifeq ($(HAVE_SHFMT),yes)
shfmt -w -s .
endif
src/dracut-cpio/target/release/dracut-cpio: src/dracut-cpio/src/main.rs
cargo --offline build --release --manifest-path src/dracut-cpio/Cargo.toml
dracut-cpio: src/dracut-cpio/target/release/dracut-cpio
ln -fs $< $@
ifeq ($(enable_dracut_cpio),yes)
all: dracut-cpio
endif
doc: $(manpages) dracut.html
@@ -91,16 +123,20 @@ endif
%.xml: %.asc
@rm -f -- "$@"
asciidoc -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.8: man/dracut.8.asc \
man/dracut.usage.asc
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
dracut.html: man/dracut.asc $(manpages) docs/dracut.css man/dracut.usage.asc
@rm -f -- dracut.xml
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
-a "version=$(DRACUT_FULL_VERSION)" \
-a numbered \
-d book -b docbook -o dracut.xml man/dracut.asc
@rm -f -- dracut.html
xsltproc -o dracut.html --xinclude -nonet \
--stringparam custom.css.source dracut.css \
--stringparam custom.css.source docs/dracut.css \
--stringparam generate.css.header 1 \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
@rm -f -- dracut.xml
@@ -108,7 +144,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: $(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
@@ -121,7 +157,6 @@ install: all
mkdir -p $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
@@ -142,6 +177,7 @@ ifneq ($(enable_documentation),no)
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown-onfailure.service; \
ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
ln -s ../dracut-shutdown.service \
@@ -161,24 +197,30 @@ endif
$(DESTDIR)$(systemdsystemunitdir)/initrd.target.wants/$$i; \
done \
fi
if [ -f install/dracut-install ]; then \
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
if [ -f src/install/dracut-install ]; then \
install -m 0755 src/install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
fi
if [ -f skipcpio/skipcpio ]; then \
install -m 0755 skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
if [ -f src/skipcpio/skipcpio ]; then \
install -m 0755 src/skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
fi
if [ -f dracut-util ]; then \
install -m 0755 dracut-util $(DESTDIR)$(pkglibdir)/dracut-util; \
fi
ifeq ($(enable_dracut_cpio),yes)
install -m 0755 dracut-cpio $(DESTDIR)$(pkglibdir)/dracut-cpio
endif
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
install -m 0755 install.d/50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
install -m 0755 install.d/51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
mkdir -p $(DESTDIR)${bashcompletiondir}
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd
install -m 0644 shell-completion/bash/dracut $(DESTDIR)${bashcompletiondir}/dracut
install -m 0644 shell-completion/bash/lsinitrd $(DESTDIR)${bashcompletiondir}/lsinitrd
mkdir -p $(DESTDIR)${pkgconfigdatadir}
install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc
dracut-version.sh:
@rm -f dracut-version.sh
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
@printf "#!/bin/sh\n# shellcheck disable=SC2034\nDRACUT_VERSION=%s\n" "$(DRACUT_FULL_VERSION)" > dracut-version.sh
clean:
$(RM) *~
@@ -186,35 +228,27 @@ clean:
$(RM) */*/*~
$(RM) $(manpages:%=%.xml) dracut.xml
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
$(RM) dracut-*.tar.bz2 dracut-*.tar.xz
$(RM) dracut-version.sh
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
$(RM) dracut-install src/install/dracut-install $(DRACUT_INSTALL_OBJECTS)
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
$(RM) dracut-util util/util $(UTIL_OBJECTS)
$(RM) $(manpages) dracut.html
$(RM) dracut.pc
$(RM) dracut-cpio src/dracut-cpio/target/release/dracut-cpio*
$(MAKE) -C test clean
dist: dracut-$(VERSION).tar.xz
dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz
dracut-$(VERSION).tar.xz: doc syncheck
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
mkdir -p dracut-$(VERSION)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
xz -9 dracut-$(VERSION).tar
rm -f -- dracut-$(VERSION).tar
rpm: dracut-$(VERSION).tar.xz syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; \
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)" > dracut-version.sh
git archive --format=tar $(DRACUT_MAIN_VERSION) --prefix=dracut-$(DRACUT_MAIN_VERSION)/ > dracut-$(DRACUT_MAIN_VERSION).tar
mkdir -p dracut-$(DRACUT_MAIN_VERSION)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(DRACUT_MAIN_VERSION)/$${i%/*}"; cp "$$i" "dracut-$(DRACUT_MAIN_VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(DRACUT_MAIN_VERSION).tar $$(find dracut-$(DRACUT_MAIN_VERSION) -type f)
rm -fr -- dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION)
xz -9 dracut-$(DRACUT_MAIN_VERSION).tar
rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
@@ -224,47 +258,49 @@ syncheck:
[ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \
[ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \
done;exit $$ret
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
modules.d/*/module-setup.sh; do \
@ret=0;for i in *.sh modules.d/*/*.sh modules.d/*/module-setup.sh; do \
[ $$V ] && echo "bash syntax check: $$i"; bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
ifeq ($(HAVE_SHELLCHECK),yes)
ifeq ($(HAVE_SHFMT),yes)
shellcheck $$(shfmt -f .)
else
find . -name '*.sh' -print0 | xargs -0 shellcheck
endif
endif
check: all syncheck rpm
check: all syncheck
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
@$(MAKE) -C test check
testimage: all
./dracut.sh -N -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh -N -l -a debug -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
debugtestimage: all
./dracut.sh --debug -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh --debug -l -a debug -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
testimages: all
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(KVERSION)
@echo wrote test-dracut.img
debughostimage: all
./dracut.sh --debug -H -l -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh --debug -H -l -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
hostimage: all
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh -H -l -f test-$(KVERSION).img $(KVERSION)
@echo wrote test-$(KVERSION).img
efi: all
./dracut.sh --uefi -H -l -f linux-$(shell uname -r).efi $(shell uname -r)
@echo wrote linux-$(shell uname -r).efi
./dracut.sh --uefi -H -l -f linux-$(KVERSION).efi $(KVERSION)
@echo wrote linux-$(KVERSION).efi
AUTHORS:
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
upload: dracut.html.sign
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
CONTRIBUTORS:
@git shortlog $(DRACUT_MAIN_VERSION).. --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo "- $$rest";done

1618
NEWS

File diff suppressed because it is too large Load Diff

2862
NEWS.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +0,0 @@
pkgname=dracut-git
pkgver=1
pkgrel=1
pkgdesc="Initramfs generation utility"
arch=('i686' 'x86_64')
url="https://dracut.wiki.kernel.org/"
license=('GPL')
conflicts=('dracut' 'mkinitcpio')
provides=('dracut=9999' 'mkinitcpio=9999')
depends=('bash')
optdepends=('cryptsetup' 'lvm2')
makedepends=('libxslt')
backup=(etc/dracut.conf)
source=()
md5sums=()
# out of tree builds disallowed for this PKGFILE
BUILDDIR="${PWD}"
PKGDEST="${PWD}"
SRCDEST=""
SRCPKGDEST=""
LOGDEST=""
pkgver() {
cd ..
desc="$(git describe)"
printf "%s.%s.%s" ${desc//-/ }
}
build() {
cd ..
make sysconfdir=/etc || return 1
}
package() {
cd ..
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
}

86
README
View File

@@ -1,86 +0,0 @@
dracut
------
dracut is an event driven initramfs infrastructure.
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
(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
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.
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
specific functionality into the initramfs. They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
work.
Some general rules for writing modules:
* Use one of the inst family of functions to actually install files
on to the initramfs. They handle mangling the pathnames and (for binaries,
scripts, and kernel modules) installing dependencies as appropriate so
you do not have to.
* Scripts that end up on the initramfs should be POSIX compliant. dracut
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
so you should install it on your system -- dash aims for strict POSIX
compliance to the extent possible.
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
and having a bashism break your user's ability to boot really sucks.
* Generator modules should have a two digit numeric prefix -- they run in
ascending sort order. Anything in the 90-99 range is stuff that dracut
relies on, so try not to break those hooks.
* Hooks must have a .sh extension.
* Generator modules are described in more detail in README.modules.
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
as a kernel parameter, the initramfs will drop to a shell just before
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
will break just before hooks in that hookpoint run.
Also, there is an attempt to keep things as distribution-agnostic as
possible. Every distribution has their own tool here and it's not
something which is really interesting to have separate across them.
So contributions to help decrease the distro-dependencies are welcome.
Currently dracut lives on github.com and kernel.org.
The tarballs can be found here:
http://www.kernel.org/pub/linux/utils/boot/dracut/
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
Git:
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
git@github.com:dracutdevs/dracut.git
Git Web:
https://github.com/dracutdevs/dracut.git
http://git.kernel.org/?p=boot/dracut/dracut.git
Project Documentation:
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
Project Wiki:
http://dracut.wiki.kernel.org
See the TODO file for things which still need to be done and HACKING for
some instructions on how to get started. There is also a mailing list
that is being used for the discussion -- initramfs@vger.kernel.org.
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
of 'subscribe initramfs email@host.com'
Licensed under the GPLv2

View File

@@ -1,30 +1,50 @@
# dracut - master branch
dracut
====
dracut is an initramfs infrastructure.
dracut is an event driven initramfs infrastructure.
## Travis
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](docs/CODE_OF_CONDUCT.md)
[![Build Status](https://travis-ci.org/dracutdevs/dracut.svg?branch=master)](https://travis-ci.org/dracutdevs/dracut)
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.
## CentOS CI
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
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.
[![Build Status](https://ci.centos.org/job/dracut-push-master/badge/icon)](https://ci.centos.org/job/dracut-push-master/)
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
specific functionality into the initramfs. They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
work.
- Test 01: [![Test 01](https://ci.centos.org/job/dracut-matrix-master/TESTS=01,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=01,label=dracut-ci-slave01/)
- Test 02: [![Test 02](https://ci.centos.org/job/dracut-matrix-master/TESTS=02,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=02,label=dracut-ci-slave01/)
- Test 03: [![Test 03](https://ci.centos.org/job/dracut-matrix-master/TESTS=03,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=03,label=dracut-ci-slave01/)
- Test 04: [![Test 04](https://ci.centos.org/job/dracut-matrix-master/TESTS=04,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=04,label=dracut-ci-slave01/)
- Test 10: [![Test 10](https://ci.centos.org/job/dracut-matrix-master/TESTS=10,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=10,label=dracut-ci-slave01/)
- Test 11: [![Test 11](https://ci.centos.org/job/dracut-matrix-master/TESTS=11,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=11,label=dracut-ci-slave01/)
- Test 12: [![Test 12](https://ci.centos.org/job/dracut-matrix-master/TESTS=12,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=12,label=dracut-ci-slave01/)
- Test 13: [![Test 13](https://ci.centos.org/job/dracut-matrix-master/TESTS=13,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=13,label=dracut-ci-slave01/)
- Test 14: [![Test 14](https://ci.centos.org/job/dracut-matrix-master/TESTS=14,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=14,label=dracut-ci-slave01/)
- Test 15: [![Test 15](https://ci.centos.org/job/dracut-matrix-master/TESTS=15,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=15,label=dracut-ci-slave01/)
- Test 16: [![Test 16](https://ci.centos.org/job/dracut-matrix-master/TESTS=16,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=16,label=dracut-ci-slave01/)
- Test 17: [![Test 17](https://ci.centos.org/job/dracut-matrix-master/TESTS=17,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=17,label=dracut-ci-slave01/)
- Test 20: [![Test 20](https://ci.centos.org/job/dracut-matrix-master/TESTS=20,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=20,label=dracut-ci-slave01/)
- Test 30: [![Test 30](https://ci.centos.org/job/dracut-matrix-master/TESTS=30,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=30,label=dracut-ci-slave01/)
- Test 31: [![Test 31](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/)
- Test 40: [![Test 40](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/)
- Test 50: [![Test 50](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/)
- Test 70: [![Test 70](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/badge/icon)](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/)
Documentation:
- [Introduction](man/dracut.asc)
- [User Manual](man/dracut.usage.asc)
Currently dracut is developed on [github.com](https://github.com/dracutdevs/dracut).
The release tarballs are [here](https://github.com/dracutdevs/dracut/releases).
Gitter (chat):
- https://gitter.im/dracutdevs/Lobby
See [News](NEWS.md) for information about changes in the releases and
the [Wiki](https://github.com/dracutdevs/dracut/wiki) to share information.
See the github issue tracker for things which still need to be done and [Hacking](docs/HACKING.md)
for some instructions on how to get started. There is also a mailing list
that is being used for the discussion -- initramfs@vger.kernel.org.
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
of 'subscribe initramfs email@host.com'
Licensed under the GPLv2

View File

@@ -1,112 +0,0 @@
Most of the functionality that dracut implements are actually implemented
by dracut modules. dracut modules live in modules.d, and have the following
structure:
dracut_install_dir/modules.d/
00modname/
module-setup.sh
check
<other files as needed by the hook>
00modname: The name of the module prefixed by a two-digit numeric sort code.
The numeric code must be present and in the range of 00 - 99.
Modules with lower numbers are installed first. This is important
because the dracut install functions (which install files onto
the initrd) refuse to overwrite already installed files. This makes
it easy for an earlier module to override the functionality of a
later module, so that you can have a distro or system specific
module override or modify the functionality of a generic module
without having to patch the more generic module.
module-setup.sh:
dracut sources this script to install the functionality that a
module implements onto the initrd. For the most part, this amounts
to copying files from the host system onto the initrd in a controlled
manner.
install():
This function of module-setup.sh is called to install all
non-kernel files. dracut supplies several install functions that are
specialized for different file types. Browse through dracut-functions
fore more details. dracut also provides a $moddir variable if you
need to install a file from the module directory, such as an initrd
hook, a udev rule, or a specialized executable.
installkernel():
This function of module-setup.sh is called to install all
kernel related files.
check():
dracut calls this function to check and see if a module can be installed
on the initrd.
When called without options, check should check to make sure that
any files it needs to install into the initrd from the host system
are present. It should exit with a 0 if they are, and a 1 if they are
not.
When called with $hostonly set, it should perform the same check
that it would without it set, and it should also check to see if the
functionality the module implements is being used on the host system.
For example, if this module handles installing support for LUKS
encrypted volumes, it should return 0 if all the tools to handle
encrpted volumes are available and the host system has the root
partition on an encrypted volume, 1 otherwise.
depends():
This function should output a list of dracut modules
that it relies upon. An example would be the nfs and iscsi modules,
which rely on the network module to detect and configure network
interfaces.
Any other files in the module will not be touched by dracut directly.
You are encouraged to provide a README that describes what the module is for.
HOOKS
=====
init has the following hook points to inject scripts:
/lib/dracut/hooks/cmdline/*.sh
scripts for command line parsing
/lib/dracut/hooks/pre-udev/*.sh
scripts to run before udev is started
/lib/dracut/hooks/pre-trigger/*.sh
scripts to run before the main udev trigger is pulled
/lib/dracut/hooks/initqueue/*.sh
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
this loop can process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
/lib/dracut/hooks/pre-mount/*.sh
scripts to run before the root filesystem is mounted
Network filesystems like NFS that do not use device files are an
exception. Root can be mounted already at this point.
/lib/dracut/hooks/mount/*.sh
scripts to mount the root filesystem
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
/lib/dracut/hooks/pre-pivot/*.sh
scripts to run before latter initramfs cleanups
/lib/dracut/hooks/cleanup/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.

View File

@@ -1,45 +0,0 @@
For the testsuite to work, you will have to install at least the following software packages:
dash \
asciidoc \
mdadm \
lvm2 \
dmraid \
cryptsetup \
nfs-utils \
nbd \
dhcp-server \
scsi-target-utils \
iscsi-initiator-utils \
strace \
syslinux \
python-imgcreate \
genisoimage \
btrfs-progs \
kmod-devel \
gcc \
bzip2 \
xz \
tar \
wget \
rpm-build \
${NULL}
TEST-04-FULL-SYSTEMD: systemd >= 187
How to run the testsuite:
$ sudo make clean check
in verbose mode:
$ sudo make V=1 clean check
only specific test:
$ sudo make TESTS="01 20 40" clean check
only runs the 01, 20 and 40 tests.
debug a specific test case:
$ cd TEST-01-BASIC
$ sudo make clean setup run
... change some kernel parameters ...
$ sudo make run
to run the test without doing the setup

51
TODO
View File

@@ -1,51 +0,0 @@
Current TODO list, broken into things which are relevant for the
initramfs itself (/init et al) vs the generator.
A lot of things are/should be marked with "FIXME" in the code.
Items are ordered in priority.
INITRAMFS TODO
- search domain string
- allow dual stack configuration (IPv4, IPv6) for the same interface
- "bind-mount" kernel drivers in real root for the rescue image,
if the real root does not have any kernel modules for this kernel
https://bugzilla.redhat.com/show_bug.cgi?id=1046510
- use info and warn prefix
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
- put "root=" parsing hooks in separate hook dir
- call "root=" parsing hooks after getting new rootpath from dhcp
- put mount hook in main initqueue loop / careful about resume!
- the hard-coded list of udev rules that we care about is kind of lame.
- panic fallback
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
GENERATOR TODO
- report errors on missing files in check()
- remove wait for swap devs, if no "resume=" is given on the kernel command line
- remove wait for swap devs, if the "resume" dracut module is not included (omitted)
- add presets (predefined set of modules)
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
- add mechanism for module specific command line options
- pkg-config integration, to make it easy for other packages to use us.
- default module specification could use some work
- udev rule copying, as mentioned above, is a bit too hard-coded
- dracut-install parse LD_SHOW_AUXV="" AT_PLATFORM for lib install
CODE TODO
- document more functions
- make function vars local, and prefix with "_"
Future Enhancement Requests
- run ssh server to enter crypto password or perform debugging (supported by debian)
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking
- lsinitrd --print-cmdline
- dracut --print-cmdline error if additional arguments
- library for cmdline

128
configure vendored
View File

@@ -1,12 +1,14 @@
#!/bin/bash
# We don't support srcdir != builddir
echo \#buildapi-variable-no-builddir >/dev/null
echo \#buildapi-variable-no-builddir > /dev/null
prefix=/usr
enable_documentation=yes
enable_dracut_cpio=no
CC="${CC:-cc}"
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
# Little helper function for reading args from the commandline.
@@ -18,9 +20,9 @@ read_arg() {
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
read -r "$1" <<< "${BASH_REMATCH[1]}"
else
read "$1" <<< "$3"
read -r "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
@@ -30,24 +32,25 @@ read_arg() {
while (($# > 0)); do
case "${1%%=*}" in
--prefix) read_arg prefix "$@" || shift;;
--libdir) read_arg libdir "$@" || shift;;
--datadir) read_arg datadir "$@" || shift;;
--sysconfdir) read_arg sysconfdir "$@" || shift;;
--sbindir) read_arg sbindir "$@" || shift;;
--mandir) read_arg mandir "$@" || shift;;
--disable-documentation) enable_documentation=no;;
--program-prefix) read_arg programprefix "$@" || shift;;
--exec-prefix) read_arg execprefix "$@" || shift;;
--bindir) read_arg bindir "$@" || shift;;
--includedir) read_arg includedir "$@" || shift;;
--libexecdir) read_arg libexecdir "$@" || shift;;
--localstatedir) read_arg localstatedir "$@" || shift;;
--sharedstatedir) read_arg sharedstatedir "$@" || shift;;
--infodir) read_arg infodir "$@" || shift;;
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;;
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift;;
*) echo "Ignoring unknown option '$1'";;
--prefix) read_arg prefix "$@" || shift ;;
--libdir) read_arg libdir "$@" || shift ;;
--datadir) read_arg datadir "$@" || shift ;;
--sysconfdir) read_arg sysconfdir "$@" || shift ;;
--sbindir) read_arg sbindir "$@" || shift ;;
--mandir) read_arg mandir "$@" || shift ;;
--disable-documentation) enable_documentation=no ;;
--program-prefix) read_arg programprefix "$@" || shift ;;
--exec-prefix) read_arg execprefix "$@" || shift ;;
--bindir) read_arg bindir "$@" || shift ;;
--includedir) read_arg includedir "$@" || shift ;;
--libexecdir) read_arg libexecdir "$@" || shift ;;
--localstatedir) read_arg localstatedir "$@" || shift ;;
--sharedstatedir) read_arg sharedstatedir "$@" || shift ;;
--infodir) read_arg infodir "$@" || shift ;;
--systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift ;;
--bashcompletiondir) read_arg bashcompletiondir "$@" || shift ;;
--enable-dracut-cpio) enable_dracut_cpio=yes ;;
*) echo "Ignoring unknown option '$1'" ;;
esac
shift
done
@@ -57,7 +60,86 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
exit 1
fi
cat > Makefile.inc.$$ <<EOF
cat << EOF > conftest.c
#include <fts.h>
int main() {
return 0;
}
EOF
# shellcheck disable=SC2086
${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
ret=$?
rm -f conftest.c a.out
# musl doesn't have fts.h included
if test $ret -ne 0; then
echo "dracut needs fts development files." >&2
exit 1
fi
cat << EOF > conftest.c
#include <fts.h>
int main(void) {
fts_open(0, 0, 0);
return 0;
}
EOF
found=no
for lib in "-lc" "-lfts"; do
# shellcheck disable=SC2086
${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib > /dev/null 2>&1
ret=$?
if test $ret -eq 0; then
FTS_LIBS="$lib"
found=yes
break
fi
done
rm -f conftest.c a.out
if test $found = no; then
echo "dracut couldn't find usable fts library" >&2
exit 1
fi
cat << EOF > conftest.c
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>
#ifndef SYS_gettid
#error "SYS_gettid unavailable on this system"
#endif
#define gettid() ((pid_t) syscall(SYS_gettid))
int main(void) {
return getpid() == gettid() ? 0 : -1;
}
EOF
# shellcheck disable=SC2086
${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
ret=$?
rm -f conftest.c a.out
if test $ret -ne 0; then
echo "dracut needs SYS_gettid support." >&2
exit 1
fi
if test "$enable_dracut_cpio" = "yes"; then
cargo --version > /dev/null
ret=$?
if test $ret -ne 0; then
echo "dracut couldn't find cargo for dracut-cpio build"
exit 1
fi
fi
cat > Makefile.inc.$$ << EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
datadir ?= ${datadir:-${prefix}/share}
@@ -65,9 +147,11 @@ sysconfdir ?= ${sysconfdir:-${prefix}/etc}
sbindir ?= ${sbindir:-${prefix}/sbin}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation:-yes}
enable_dracut_cpio ?= ${enable_dracut_cpio}
bindir ?= ${bindir:-${prefix}/bin}
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
FTS_LIBS ?= ${FTS_LIBS}
EOF
{

213
docs/BASH.md Normal file
View File

@@ -0,0 +1,213 @@
# BASH Notes
## basename
Don't use `basename`, use:
```shell
file=${path##*/}
```
## dirname
Don't use `dirname`, use:
```shell
dir=${path%/*}
```
## shopt
If you set `shopt` in a function, reset to its default state with `trap`:
```shell
func() {
trap "$(shopt -p globstar)" RETURN
shopt -q -s globstar
}
```
## find, grep, print0, -0, -z
Don't use `find` in `for` loops, because filenames can contain spaces.
Try to use `globstar` and `nullglob` or null byte terminated strings.
Instead of:
```shell
func() {
for file in $(find /usr/lib* -type f -name 'lib*.a' -print0 ); do
echo $file
done
}
```
use:
```shell
func() {
trap "$(shopt -p nullglob globstar)" RETURN
shopt -q -s nullglob globstar
for file in /usr/lib*/**/lib*.a; do
[[ -f $file ]] || continue
echo "$file"
done
}
```
Or collect the filenames in an array, if you need them more than once:
```shell
func() {
trap "$(shopt -p globstar)" RETURN
shopt -q -s globstar
filenames=( /usr/lib*/**/lib*.a )
for file in "${filenames[@]}"; do
[[ -f $file ]] || continue
echo "$file"
done
}
```
Or, if you really want to use `find`, use `-print0` and an array:
```shell
func() {
mapfile -t -d '' filenames < <(find /usr/lib* -type f -name 'lib*.a' -print0)
for file in "${filenames[@]}"; do
echo "$file"
done
}
```
Note: `-d ''` is the same as `-d $'\0'` and sets the null byte as the delimiter.
or:
```shell
func() {
find /usr/lib* -type f -name 'lib*.a' -print0 | while read -r -d '' file; do
echo "$file"
done
}
```
or
```shell
func() {
while read -r -d '' file; do
echo "$file"
done < <(find /usr/lib* -type f -name 'lib*.a' -print0)
}
```
Use the tool options for null terminated strings, like `-print0`, `-0`, `-z`, etc.
## prefix or suffix array elements
Instead of:
```shell
func() {
other-cmd $(for k in "$@"; do echo "prefix-$k"; done)
}
```
do
```shell
func() {
other-cmd "${@/#/prefix-}"
}
```
or suffix:
```shell
func() {
other-cmd "${@/%/-suffix}"
}
```
## Join array elements with a separator char
Here we have an associate array `_drivers`, where we want to print the keys separated by ',':
```shell
if [[ ${!_drivers[*]} ]]; then
echo "rd.driver.pre=$(IFS=, ;echo "${!_drivers[*]}")" > "${initdir}"/etc/cmdline.d/00-watchdog.conf
fi
```
## Optional parameters to commands
If you want to call a command `cmd` with an option, if a variable is set, rather than doing:
```shell
func() {
local param="$1"
if [[ $param ]]; then
param="--this-special-option $param"
fi
cmd $param
}
```
do it like this:
```shell
func() {
local param="$1"
cmd ${param:+--this-special-option "$param"}
}
# cmd --this-special-option 'abc'
func 'abc'
# cmd
func ''
# cmd
func
```
If you want to specify the option even with an empty string do this:
```shell
func() {
local -a special_params
if [[ ${1+_} ]]; then
# only declare `param` if $1 is set (even as null string)
local param="$1"
fi
# check if `param` is set (even as null string)
if [[ ${param+_} ]]; then
special_params=( --this-special-option "${param}" )
fi
cmd ${param+"${special_params[@]}"}
}
# cmd --this-special-option 'abc'
func 'abc'
# cmd --this-special-option ''
func ''
# cmd
func
```
Or more simple, if you only have to set an option:
```shell
func() {
if [[ ${1+_} ]]; then
# only declare `param` if $1 is set (even as null string)
local param="$1"
fi
cmd ${param+--this-special-option}
}
# cmd --this-special-option
func 'abc'
# cmd --this-special-option
func ''
# cmd
func
```

56
docs/CODE_OF_CONDUCT.md 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@profian.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.

279
docs/HACKING.md Normal file
View File

@@ -0,0 +1,279 @@
# Dracut Developer Guidelines
Please make sure to follow our [Contribution Guidelines](../CONTRIBUTING.md).
## git
Currently dracut lives on github.com.
* https://github.com/dracutdevs/dracut.git
Pull requests should be filed preferably on github nowadays.
### Code Format
It is recommended, that you install a plugin for your editor, which reads in `.editorconfig`.
Additionally `emacs` and `vim` config files are provided for convenience.
To reformat C files use `astyle`:
```console
$ astyle --options=.astylerc <FILE>
```
For convenience there is also a Makefile `indent-c` target `make indent-c`.
To reformat shell files use `shfmt`:
```console
$ shfmt_version=3.2.4
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```
or
```console
$ GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
$ $GOPATH/bin/shfmt -w -s .
```
or if `shfmt` is already in your `PATH`, use `make indent`.
Some IDEs already have support for shfmt.
For convenience the `make indent` Makefile target also calls shfmt, if it is in `$PATH`.
### Commit Messages
Commit messages should answer these questions:
* What?: a short summary of what you changed in the subject line.
* Why?: what the intended outcome of the change is (arguably the most important piece of information that should go into a message).
* How?: if multiple approaches for achieving your goal were available, you also want to explain why you chose the used implementation strategy.
Note that you should not explain how your change achieves your goal in your commit message.
That should be obvious from the code itself.
If you cannot achieve that clarity with the used programming language, use comments within the code instead.
The commit message is primarily the place for documenting the why.
Commit message titles should follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
Format is `<type>[optional scope]: <description>`, where `type` is one of:
* fix: A bug fix
* feat: A new feature
* perf: A code change that improves performance
* refactor: A code change that neither fixes a bug nor adds a feature
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* test: Adding missing tests or correcting existing tests
* docs: Documentation only changes
* revert: Reverts a previous commit
* chore: Other changes that don't modify src or test files
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
`scope` should be the module name (without numbers) or:
* cli: for the dracut command line interface
* rt: for the dracut initramfs runtime logic
* functions: for general purpose dracut functions
Commit messages are checked with [Commisery](https://github.com/tomtom-international/commisery).
## Writing modules
Some general rules for writing modules:
* Use one of the inst family of functions to actually install files
on to the initramfs. They handle mangling the pathnames and (for binaries,
scripts, and kernel modules) installing dependencies as appropriate so
you do not have to.
* Scripts that end up on the initramfs should be POSIX compliant. dracut
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
so you should install it on your system -- dash aims for strict POSIX
compliance to the extent possible.
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
and having a bashism break your user's ability to boot really sucks.
* Generator modules should have a two digit numeric prefix -- they run in
ascending sort order. Anything in the 90-99 range is stuff that dracut
relies on, so try not to break those hooks.
* Hooks must have a .sh extension.
* Generator modules are described in more detail later on.
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
as a kernel parameter, the initramfs will drop to a shell just before
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
will break just before hooks in that hookpoint run.
Also, there is an attempt to keep things as distribution-agnostic as
possible. Every distribution has their own tool here and it's not
something which is really interesting to have separate across them.
So contributions to help decrease the distro-dependencies are welcome.
Most of the functionality that dracut implements are actually implemented
by dracut modules. dracut modules live in modules.d, and have the following
structure:
```
dracut_install_dir/modules.d/
00modname/
module-setup.sh
check
<other files as needed by the hook>
```
`00modname`: The name of the module prefixed by a two-digit numeric sort code.
The numeric code must be present and in the range of 00 - 99.
Modules with lower numbers are installed first. This is important
because the dracut install functions (which install files onto
the initrd) refuse to overwrite already installed files. This makes
it easy for an earlier module to override the functionality of a
later module, so that you can have a distro or system specific
module override or modify the functionality of a generic module
without having to patch the more generic module.
`module-setup.sh`:
dracut sources this script to install the functionality that a
module implements onto the initrd. For the most part, this amounts
to copying files from the host system onto the initrd in a controlled
manner.
`install()`:
This function of module-setup.sh is called to install all
non-kernel files. dracut supplies several install functions that are
specialized for different file types. Browse through dracut-functions
for more details. dracut also provides a $moddir variable if you
need to install a file from the module directory, such as an initrd
hook, a udev rule, or a specialized executable.
`installkernel()`:
This function of module-setup.sh is called to install all
kernel related files.
`check()`:
dracut calls this function to check and see if a module can be installed
on the initrd.
When called without options, check should check to make sure that
any files it needs to install into the initrd from the host system
are present. It should exit with a 0 if they are, and a 1 if they are
not.
When called with $hostonly set, it should perform the same check
that it would without it set, and it should also check to see if the
functionality the module implements is being used on the host system.
For example, if this module handles installing support for LUKS
encrypted volumes, it should return 0 if all the tools to handle
encrpted volumes are available and the host system has the root
partition on an encrypted volume, 1 otherwise.
`depends()`:
This function should output a list of dracut modules
that it relies upon. An example would be the nfs and iscsi modules,
which rely on the network module to detect and configure network
interfaces.
Any other files in the module will not be touched by dracut directly.
You are encouraged to provide a README that describes what the module is for.
### Hooks
init has the following hook points to inject scripts:
`/lib/dracut/hooks/cmdline/*.sh`
scripts for command line parsing
`/lib/dracut/hooks/pre-udev/*.sh`
scripts to run before udev is started
`/lib/dracut/hooks/pre-trigger/*.sh`
scripts to run before the main udev trigger is pulled
`/lib/dracut/hooks/initqueue/*.sh`
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
this loop can process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
`/lib/dracut/hooks/pre-mount/*.sh`
scripts to run before the root filesystem is mounted
Network filesystems like NFS that do not use device files are an
exception. Root can be mounted already at this point.
`/lib/dracut/hooks/mount/*.sh`
scripts to mount the root filesystem
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
`/lib/dracut/hooks/pre-pivot/*.sh`
scripts to run before latter initramfs cleanups
`/lib/dracut/hooks/cleanup/*.sh`
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
## Testsuite
### Rootless in a container with podman
```console
$ cd <DRACUT_SOURCE>
$ podman pull [CONTAINER]
$ podman run --rm -it \
--cap-add=SYS_PTRACE --user 0 \
-v /dev:/dev -v ./:/dracut:z \
[CONTAINER] \
bash -l
# cd /dracut
# ./configure
# make -j $(getconf _NPROCESSORS_ONLN)
# cd test
# make V=1 SKIP="16 60 61" clean check
```
with `[CONTAINER]` being one of the
[github `dracutdevs` containers](https://github.com/orgs/dracutdevs/packages),
e.g. `ghcr.io/dracutdevs/fedora:latest`.
### On bare metal
For the testsuite to pass, you will have to install at least the software packages
mentioned in the `test/container` Dockerfiles.
```
$ sudo make clean check
```
in verbose mode:
```
$ sudo make V=1 clean check
```
only specific test:
```
$ sudo make TESTS="01 20 40" clean check
```
only runs the 01, 20 and 40 tests.
debug a specific test case:
```
$ cd TEST-01-BASIC
$ sudo make clean setup run
```
... change some kernel parameters in `test.sh` ...
```
$ sudo make run
```
to run the test without doing the setup.

48
docs/README.cross Normal file
View File

@@ -0,0 +1,48 @@
Dracut supports running against a sysroot directory that is different
from the actual root (/) directory of the running system. It is most
useful for creating/bootstrapping a new system that may or may not be
using the same CPU architecture as the host system, i.e. building a
whole Linux system with a cross-compiler framework like Yocto.
The user-visible frontend change is the introduction of a new option
called "-r" or "--sysroot". It expects a directory that contains the
complete Linux system that has all the files (kernel drivers, firmware,
executables, libraries and others) necessary to construct the initramfs.
E.g: dracut --sysroot /path/to/sysroot initramfs.img kernelversion
To support this, a new global variable was introduced inside dracut.
This variable is called "dracutsysrootdir" and all the files installed
into the initramfs image is searched relative to the sysroot directory.
This variable can also be set externally to dracut without using option
-r/--sysroot.
There are other details that are necessary to tweak to be able to
run on cross-compiled (a.k.a. foreign) binaries.
dracut uses these crucial utilities during its operation:
ldd
===
It lists dynamic library dependencies for executables or libraries
ldconfig
========
It creates /etc/ld.so.cache, i.e. the cached information about libraries
known to the system.
These utilities the way they exist on the host system only work on
the host system.
To support cross-compiled binaries, a different ldd variant is needed that
works on those binaries. One such ldd script is found at
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f
ldconfig in GLIBC as is does support a sysroot with its -r option.
Extra environment variables needed to run dracut on the sysroot are
documented in the dracut(8) man page.
For the Plymouth boot splash to be added to the initramfs image,
this gitlab PR is needed for Plymouth:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72

48
docs/RELEASE.md Normal file
View File

@@ -0,0 +1,48 @@
# Conducting A Successful Release
This documents contains the necessary steps to conduct a successful release.
1. Add all items to `NEWS.md`
Get a first template with [`clog`](https://github.com/clog-tool/clog-cli)
```console
$ clog -F -r https://github.com/dracutdevs/dracut
```
2. Update the contributors list in NEWS.md
Produce the list with:
```console
$ make CONTRIBUTORS
```
Append the list to the section in `NEWS.md`
3. Update AUTHORS
```console
$ make AUTHORS
```
4. Check in AUTHORS and NEWS.md
```console
$ git commit -m "docs: update NEWS.md and AUTHORS" NEWS.md AUTHORS
$ git push origin master
```
5. Tag the release, validate the tag and push
```console
$ git tag -s 060
$ git tag -v 060
$ git push --tags
```
Add the section from `NEWS.md` to the git tag message excluding the Rendered
view entry.
6. Create a new release on github (https://github.com/dracutdevs/dracut/releases/new)
- Add the section from `NEWS.md` to the release.
7. Open a new milestone, move all unfinished issue from the previous milestone to the new one and close the released milestone (https://github.com/dracutdevs/dracut/milestones)

3
docs/SECURITY.md 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@profian.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.

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -1,78 +0,0 @@
#
# Copyright 2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__contains_word () {
local word=$1; shift
for w in $*; do [[ $w = $word ]] && return 0; done
return 1
}
_dracut() {
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-f -v -q -l -H -h -M -N
--ro-mnt --force --kernel-only --no-kernel --strip --nostrip
--hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
--lvmconf --nolvmconf --debug --profile --verbose --quiet
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --zstd --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --reproducible --uefi'
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
--omit-drivers --modules --omit --drivers --filesystems --install
--fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
--kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
--kernel-cmdline --sshkey --persistent-policy --install-optional
--loginstall --uefi-stub --kernel-image
'
)
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--kmoddir|-k|--fwdir|--confdir|--tmpdir)
comps=$(compgen -d -- "$cur")
compopt -o filenames
;;
-c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional)
comps=$(compgen -f -- "$cur")
compopt -o filenames
;;
-a|-m|-o|--add|--modules|--omit)
comps=$(dracut --list-modules 2>/dev/null)
;;
--persistent-policy)
comps=$(cd /dev/disk/; echo *)
;;
--kver)
comps=$(cd /lib/modules; echo [0-9]*)
;;
*)
return 0
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
if [[ $cur = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
fi
}
complete -F _dracut dracut

View File

@@ -16,9 +16,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
dwarning() {
echo "Warning: $@" >&2
echo "Warning: $*" >&2
}
dinfo() {
@@ -26,11 +25,11 @@ dinfo() {
}
derror() {
echo "Error: $@" >&2
echo "Error: $*" >&2
}
usage() {
# 80x25 linebreak here ^
# 80x25 linebreak here ^
cat << EOF
Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
Creates initial ramdisk image by concatenating several images from the command
@@ -49,27 +48,46 @@ line and /boot/dracut/
EOF
}
imagedir=/boot/dracut/
overlay=/var/lib/dracut/overlay
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
-f | --force) force=yes ;;
-i | --imagedir)
imagedir=$2
shift
;;
-o | --overlaydir)
overlay=$2
shift
;;
--nooverlay)
no_overlay=yes
shift
;;
--noimagedir)
no_imagedir=yes
shift
;;
-h | --help)
usage
exit 1
;;
--debug) export debug="yes" ;;
-v | --verbose) beverbose="yes" ;;
-*)
printf "\nUnknown option: %s\n\n" "$1" >&2
usage
exit 1
;;
*) break ;;
esac
shift
done
outfile=$1; shift
outfile=$1
shift
if [[ -z $outfile ]]; then
derror "No output file specified."
@@ -77,7 +95,8 @@ if [[ -z $outfile ]]; then
exit 1
fi
baseimage=$1; shift
baseimage=$1
shift
if [[ -z $baseimage ]]; then
derror "No base image specified."
@@ -103,8 +122,11 @@ fi
if [[ ! $no_overlay ]]; then
ofile="$imagedir/90-overlay.img"
dinfo "Creating image $ofile from directory $overlay"
type pigz &>/dev/null && gzip=pigz || gzip=gzip
( cd "$overlay"; find . |cpio --quiet -H newc -o |$gzip -9 > "$ofile"; )
type pigz &> /dev/null && gzip=pigz || gzip=gzip
(
cd "$overlay" || return 1
find . | cpio --quiet -H newc -o | $gzip -9 > "$ofile"
)
fi
if [[ ! $no_imagedir ]]; then
@@ -113,7 +135,7 @@ if [[ ! $no_imagedir ]]; then
done
fi
images+=($@)
images+=("$@")
dinfo "Using base image $baseimage"
cat -- "$baseimage" > "$outfile"

File diff suppressed because it is too large Load Diff

726
dracut-init.sh Normal file → Executable file

File diff suppressed because it is too large Load Diff

74
dracut-initramfs-restore.sh Normal file → Executable file
View File

@@ -6,32 +6,59 @@ set -e
[ -e /run/initramfs/bin/sh ] && exit 0
[ -e /run/initramfs/.need_shutdown ] || exit 0
# SIGTERM signal is received upon forced shutdown: ignore the signal
# We want to remain alive to be able to trap unpacking errors to avoid
# switching root to an incompletely unpacked initramfs
trap 'echo "Received SIGTERM signal, ignoring!" >&2' TERM
KERNEL_VERSION="$(uname -r)"
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
SKIP="$dracutbasedir/skipcpio"
[[ -x $SKIP ]] || SKIP=cat
[[ -x $SKIP ]] || SKIP="cat"
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
mount -o ro /boot &>/dev/null || true
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
MACHINE_ID="Default"
elif [[ -s /etc/machine-id ]]; then
read -r MACHINE_ID < /etc/machine-id
[[ $MACHINE_ID == "uninitialized" ]] && MACHINE_ID="Default"
else
MACHINE_ID="Default"
fi
mount -o ro /boot &> /dev/null || true
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
&& [[ -d /efi/$MACHINE_ID || -L /efi/$MACHINE_ID ]]; then
IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
&& [[ -d /boot/$MACHINE_ID || -L /boot/$MACHINE_ID ]]; then
IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/efi/loader/entries || -L /boot/efi/loader/entries ]] \
&& [[ -d /boot/efi/$MACHINE_ID || -L /boot/efi/$MACHINE_ID ]]; then
IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
IMG="/lib/modules/${KERNEL_VERSION}/initrd"
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
IMG="/boot/initramfs-${KERNEL_VERSION}.img"
elif mountpoint -q /efi; then
IMG="/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
elif mountpoint -q /boot/efi; then
IMG="/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd"
else
echo "No initramfs image found to restore!"
exit 1
fi
[[ -f $IMG ]] || IMG="/boot/initramfs-${KERNEL_VERSION}.img"
cd /run/initramfs
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
if (command -v zcat > /dev/null && $SKIP "$IMG" 2> /dev/null | zcat 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1) \
|| (command -v bzcat > /dev/null && $SKIP "$IMG" 2> /dev/null | bzcat 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1) \
|| (command -v xzcat > /dev/null && $SKIP "$IMG" 2> /dev/null | xzcat 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1) \
|| (command -v lz4 > /dev/null && $SKIP "$IMG" 2> /dev/null | lz4 -d -c 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1) \
|| (command -v lzop > /dev/null && $SKIP "$IMG" 2> /dev/null | lzop -d -c 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1) \
|| (command -v zstd > /dev/null && $SKIP "$IMG" 2> /dev/null | zstd -d -c 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1) \
|| ($SKIP "$IMG" 2> /dev/null | cpio -id --no-absolute-filenames --quiet > /dev/null 2>&1); then
rm -f -- .need_shutdown
else
# something failed, so we clean up
@@ -40,4 +67,17 @@ else
exit 1
fi
if [[ -d squash ]]; then
if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then
echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
rm -f -- /run/initramfs/shutdown
exit 1
fi
fi
if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ]; then
. /etc/selinux/config
[ -n "${SELINUXTYPE}" ] && /usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/"${SELINUXTYPE}"/contexts/files/file_contexts /run/initramfs > /dev/null
fi
exit 0

View File

@@ -17,9 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__DRACUT_LOGGER__=1
export __DRACUT_LOGGER__=1
## @brief Logging facility module for dracut both at build- and boot-time.
#
@@ -86,7 +84,6 @@ __DRACUT_LOGGER__=1
#
# @see dlog_init()
## @brief Initializes dracut Logger.
#
# @retval 1 if something has gone wrong
@@ -105,7 +102,8 @@ __DRACUT_LOGGER__=1
# See file doc comment for details.
dlog_init() {
local __oldumask
local ret=0; local errmsg
local ret=0
local errmsg
[ -z "$stdloglvl" ] && stdloglvl=4
[ -z "$sysloglvl" ] && sysloglvl=0
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
@@ -114,23 +112,23 @@ dlog_init() {
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif (( $fileloglvl > 0 )); then
elif ((fileloglvl > 0)); then
if [[ $logfile ]]; then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
# Mark new run in the log file
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
! [ -e "$logfile" ] && : > "$logfile"
umask "$__oldumask"
if [[ -w $logfile ]] && [[ -f $logfile ]]; then
# Mark new run in the log file
echo >> "$logfile"
if command -v date > /dev/null; then
echo "=== $(date) ===" >> "$logfile"
else
echo "===============================================" >>"$logfile"
echo "===============================================" >> "$logfile"
fi
echo >>"$logfile"
echo >> "$logfile"
else
# We cannot log to file, so turn this facility off.
# We cannot log to file, so turn this facility off.
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
@@ -138,22 +136,22 @@ dlog_init() {
fi
fi
if (( $UID != 0 )); then
if ((UID != 0)); then
kmsgloglvl=0
sysloglvl=0
fi
if (( $sysloglvl > 0 )); then
if ((sysloglvl > 0)); then
if [[ -d /run/systemd/journal ]] \
&& type -P systemd-cat &>/dev/null \
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
&& type -P systemd-cat &> /dev/null \
&& systemctl --quiet is-active systemd-journald.socket &> /dev/null \
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &> /dev/null; }; then
readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
mkfifo "$_systemdcatfile"
readonly _dlogfd=15
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
exec 15>"$_systemdcatfile"
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
systemd-cat -t 'dracut' --level-prefix=true < "$_systemdcatfile" &
exec 15> "$_systemdcatfile"
elif ! ([[ -S /dev/log ]] && [[ -w /dev/log ]] && command -v logger > /dev/null); then
# We cannot log to syslog, so turn this facility off.
kmsgloglvl=$sysloglvl
sysloglvl=0
@@ -162,7 +160,7 @@ dlog_init() {
fi
fi
if (($sysloglvl > 0)) || (($kmsgloglvl > 0 )); then
if ((sysloglvl > 0)) || ((kmsgloglvl > 0)); then
if [ -n "$dracutbasedir" ]; then
readonly syslogfacility=user
else
@@ -171,44 +169,44 @@ dlog_init() {
export syslogfacility
fi
local lvl; local maxloglvl_l=0
local lvl
local maxloglvl_l=0
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
(( $lvl > $maxloglvl_l )) && maxloglvl_l=$lvl
((lvl > maxloglvl_l)) && maxloglvl_l=$lvl
done
readonly maxloglvl=$maxloglvl_l
export maxloglvl
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)) && (($sysloglvl < 6)); then
if ((stdloglvl < 6)) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
unset dtrace
dtrace() { :; };
dtrace() { :; }
fi
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)) && (($sysloglvl < 5)); then
if ((stdloglvl < 5)) && ((kmsgloglvl < 5)) && ((fileloglvl < 5)) && ((sysloglvl < 5)); then
unset ddebug
ddebug() { :; };
ddebug() { :; }
fi
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)) && (($sysloglvl < 4)); then
if ((stdloglvl < 4)) && ((kmsgloglvl < 4)) && ((fileloglvl < 4)) && ((sysloglvl < 4)); then
unset dinfo
dinfo() { :; };
dinfo() { :; }
fi
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)) && (($sysloglvl < 3)); then
if ((stdloglvl < 3)) && ((kmsgloglvl < 3)) && ((fileloglvl < 3)) && ((sysloglvl < 3)); then
unset dwarn
dwarn() { :; };
dwarn() { :; }
unset dwarning
dwarning() { :; };
dwarning() { :; }
fi
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)) && (($sysloglvl < 2)); then
if ((stdloglvl < 2)) && ((kmsgloglvl < 2)) && ((fileloglvl < 2)) && ((sysloglvl < 2)); then
unset derror
derror() { :; };
derror() { :; }
fi
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)) && (($sysloglvl < 1)); then
if ((stdloglvl < 1)) && ((kmsgloglvl < 1)) && ((fileloglvl < 1)) && ((sysloglvl < 1)); then
unset dfatal
dfatal() { :; };
dfatal() { :; }
fi
[ -n "$errmsg" ] && derror "$errmsg"
@@ -224,13 +222,13 @@ dlog_init() {
# @result Echoes first letter of level name.
_lvl2char() {
case "$1" in
1) echo F;;
2) echo E;;
3) echo W;;
4) echo I;;
5) echo D;;
6) echo T;;
*) return 1;;
1) echo F ;;
2) echo E ;;
3) echo W ;;
4) echo I ;;
5) echo D ;;
6) echo T ;;
*) return 1 ;;
esac
}
@@ -241,15 +239,15 @@ _lvl2char() {
# @retval 0 if @a lvl is correct.
# @result Echoes logger priority.
_lvl2syspri() {
printf $syslogfacility.
printf -- "%s" "$syslogfacility."
case "$1" in
1) echo crit;;
2) echo error;;
3) echo warning;;
4) echo info;;
5) echo debug;;
6) echo debug;;
*) return 1;;
1) echo crit ;;
2) echo error ;;
3) echo warning ;;
4) echo info ;;
5) echo debug ;;
6) echo debug ;;
*) return 1 ;;
esac
}
@@ -279,16 +277,16 @@ _dlvl2syslvl() {
local lvl
case "$1" in
1) lvl=2;;
2) lvl=3;;
3) lvl=4;;
4) lvl=6;;
5) lvl=7;;
6) lvl=7;;
*) return 1;;
1) lvl=2 ;;
2) lvl=3 ;;
3) lvl=4 ;;
4) lvl=6 ;;
5) lvl=7 ;;
6) lvl=7 ;;
*) return 1 ;;
esac
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
[ "$syslogfacility" = user ] && echo $((8 + lvl)) || echo $((24 + lvl))
}
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
@@ -318,27 +316,29 @@ _dlvl2syslvl() {
# - @c INFO to @c info
# - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
local lvlc
local lvl="$1"
shift
lvlc=$(_lvl2char "$lvl") || return 0
local msg="$*"
local lmsg="$lvlc: $*"
(( $lvl <= $stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2
((lvl <= stdloglvl)) && printf -- 'dracut[%s]: %s\n' "$lvlc" "$msg" >&2
if (( $lvl <= $sysloglvl )); then
if ((lvl <= sysloglvl)); then
if [[ "$_dlogfd" ]]; then
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$lvl") & 7))" "$msg" >&$_dlogfd
else
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
logger -t "dracut[$$]" -p "$(_lvl2syspri "$lvl")" -- "$msg"
fi
fi
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
echo "$lmsg" >>"$logfile"
if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
echo "$lmsg" >> "$logfile"
fi
(( $lvl <= $kmsgloglvl )) && \
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
((lvl <= kmsgloglvl)) \
&& echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" > /dev/kmsg
}
## @brief Internal helper function for _do_dlog()
@@ -359,12 +359,12 @@ _do_dlog() {
# echo "This is a warning" | dwarn
dlog() {
[ -z "$maxloglvl" ] && return 0
(( $1 <= $maxloglvl )) || return 0
(($1 <= maxloglvl)) || return 0
if (( $# > 1 )); then
if (($# > 1)); then
_do_dlog "$@"
else
while read line || [ -n "$line" ]; do
while read -r line || [ -n "$line" ]; do
_do_dlog "$1" "$line"
done
fi
@@ -377,7 +377,9 @@ dlog() {
dtrace() {
set +x
dlog 6 "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at DEBUG level (5)
@@ -387,7 +389,9 @@ dtrace() {
ddebug() {
set +x
dlog 5 "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at INFO level (4)
@@ -397,7 +401,9 @@ ddebug() {
dinfo() {
set +x
dlog 4 "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at WARN level (3)
@@ -407,7 +413,9 @@ dinfo() {
dwarn() {
set +x
dlog 3 "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}
## @brief It's an alias to dwarn() function.
@@ -417,7 +425,9 @@ dwarn() {
dwarning() {
set +x
dwarn "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at ERROR level (2)
@@ -427,7 +437,9 @@ dwarning() {
derror() {
set +x
dlog 2 "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}
## @brief Logs message at FATAL level (1)
@@ -437,5 +449,7 @@ derror() {
dfatal() {
set +x
dlog 1 "$@"
[ -n "$debug" ] && set -x || :
if [ -n "$debug" ]; then
set -x
fi
}

View File

@@ -8,11 +8,37 @@ i18n_install_all="yes"
stdloglvl=3
sysloglvl=5
install_optional_items+=" vi /etc/virc ps grep cat rm "
install_optional_items+=" vi /usr/libexec/vi /etc/virc ps grep cat rm "
prefix="/"
environment=/usr/lib/environment.d
environmentconfdir=/etc/environment.d
dbus=/usr/share/dbus-1
dbusinterfaces=/usr/share/dbus-1/interfaces
dbusservices=/usr/share/dbus-1/services
dbussession=/usr/share/dbus-1/session.d
dbussystem=/usr/share/dbus-1/system.d
dbussystemservices=/usr/share/dbus-1/system-services
dbusconfdir=/etc/dbus-1
dbusinterfacesconfdir=/etc/dbus-1/interfaces
dbusservicesconfdir=/etc/dbus-1/services
dbussessionconfdir=/etc/dbus-1/session.d
dbussystemconfdir=/etc/dbus-1/system.d
dbussystemservicesconfdir=/etc/dbus-1/system-services
sysctld=/usr/lib/sysctl.d
sysctlconfdir=/etc/sysctl.d
systemdutildir=/usr/lib/systemd
systemdutilconfdir=/etc/systemd
systemdcatalog=/usr/lib/systemd/catalog
systemdntpunits=/usr/lib/systemd/ntp-units.d
systemdntpunitsconfdir=/etc/systemd/ntp-units.d
systemdportable=/usr/lib/systemd/portable
systemdportableconfdir=/etc/systemd/portable
systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system
systemduser=/usr/lib/systemd/user
systemduserconfdir=/etc/systemd/user
sysusers=/usr/lib/sysusers.d
sysusersconfdir=/etc/sysusers.d
udevdir=/usr/lib/udev
hostonly="yes"
hostonly_cmdline="no"

View File

@@ -1,5 +0,0 @@
# /etc/dracut.conf.d/gentoo-systemd.conf
# Paths of systemd dirs on Gentoo
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system

View File

@@ -1,15 +0,0 @@
# /etc/dracut.conf.d/gentoo.conf
# dracut config file customized for Gentoo Base System release 2
udevdir=/lib/udev
ro_mnt=yes
#
# Modules
#
# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
i18n_default_font="LatArCyrHeb-16"
omit_drivers+=" i2o_scsi"

View File

@@ -1,24 +1,14 @@
# SUSE specifc dracut settings
# SUSE specific dracut settings
#
# SUSE by default always builds a as small as possible initrd for performance
# SUSE by default always builds as small as possible initrd for performance
# and resource reasons.
# If you like to build a generic initrd which works on other platforms than
# on the one dracut/mkinitrd got called comment out below setting(s).
# on the one dracut got called comment out below setting(s).
hostonly="yes"
hostonly_cmdline="yes"
compress="xz -0 --check=crc32 --memlimit-compress=50%"
compress="zstd -3 -T0 -q"
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
omit_drivers+=" i2o_scsi"
omit_drivers+=" i2o_scsi "
# Below adds additional tools to the initrd which are not urgently necessary to
# bring up the system, but help to debug problems.
# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
# are installed and add more if you need them. This specifically helps if you
# use:
# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
# mount|pre-pivot|cleanup]
# boot parameter or if you are forced to enter the dracut emergency shell.
# add_dracutmodules+=debug

View File

@@ -1,6 +0,0 @@
/var/log/dracut.log {
missingok
notifempty
size 30k
create 0600 root root
}

2406
dracut.sh

File diff suppressed because it is too large Load Diff

View File

@@ -1,474 +0,0 @@
%define dracutlibdir %{_prefix}/lib/dracut
%bcond_without doc
# We ship a .pc file but don't want to have a dep on pkg-config. We
# strip the automatically generated dep here and instead co-own the
# directory.
%global __requires_exclude pkg-config
%define dist_free_release xxx
Name: dracut
Version: xxx
Release: %{dist_free_release}%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
Group: System Environment/Base
%endif
%if 0%{?suse_version}
Group: System/Base
%endif
# The entire source code is GPLv2+
# except install/* which is LGPLv2+
License: GPLv2+ and LGPLv2+
URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
BuildRequires: bash
BuildRequires: git
BuildRequires: kmod-devel >= 23
BuildRequires: gcc
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: pkgconfig
BuildRequires: systemd
%endif
%if 0%{?fedora}
BuildRequires: bash-completion
%endif
%if %{with doc}
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
%if 0%{?suse_version}
BuildRequires: docbook-xsl-stylesheets libxslt
%endif
BuildRequires: asciidoc
%endif
%if 0%{?suse_version} > 9999
Obsoletes: mkinitrd < 2.6.1
Provides: mkinitrd = 2.6.1
%endif
Obsoletes: dracut-fips <= 047
Provides: dracut-fips = %{version}-%{release}
Obsoletes: dracut-fips-aesni <= 047
Provides: dracut-fips-aesni = %{version}-%{release}
Requires: bash >= 4
Requires: coreutils
Requires: cpio
Requires: filesystem >= 2.1.0
Requires: findutils
Requires: grep
Requires: kmod
Requires: sed
Requires: xz
Requires: gzip
%if 0%{?fedora} || 0%{?rhel}
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
Requires: util-linux >= 2.21
Requires: systemd >= 219
Requires: systemd-udev >= 219
Requires: procps-ng
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
Requires: libkcapi-hmaccalc
%endif
%description
dracut contains tools to create bootable initramfses for the Linux
kernel. Unlike previous 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
package.
%package network
Summary: dracut modules to build a dracut initramfs with network support
%if 0%{?_module_build}
# In the module-build-service, we have pieces of dracut provided by different
# modules ("base-runtime" provides most functionality, but we need
# dracut-network in "installer". Since these two modules build with separate
# dist-tags, we need to reduce this strict requirement to ignore the dist-tag.
Requires: %{name} >= %{version}-%{dist_free_release}
%else
Requires: %{name} = %{version}-%{release}
%endif
Requires: iputils
Requires: iproute
Requires: dhclient
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
%description network
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%package caps
Summary: dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
Requires: libcap
%description caps
This package requires everything which is needed to build an
initramfs with dracut, which drops capabilities.
%package live
Summary: dracut modules to build a dracut initramfs with live image capabilities
%if 0%{?_module_build}
# See the network subpackage comment.
Requires: %{name} >= %{version}-%{dist_free_release}
%else
Requires: %{name} = %{version}-%{release}
%endif
Requires: %{name}-network = %{version}-%{release}
Requires: tar gzip coreutils bash device-mapper curl
%if 0%{?fedora}
Requires: fuse ntfs-3g
%endif
%description live
This package requires everything which is needed to build an
initramfs with dracut, with live image capabilities, like Live CDs.
%package config-generic
Summary: dracut configuration to turn off hostonly image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut-nohostonly < 030
Provides: dracut-nohostonly = %{version}-%{release}
%description config-generic
This package provides the configuration to turn off the host specific initramfs
generation with dracut and generates a generic image by default.
%package config-rescue
Summary: dracut configuration to turn on rescue image generation
Requires: %{name} = %{version}-%{release}
Obsoletes: dracut < 030
%description config-rescue
This package provides the configuration to turn on the rescue initramfs
generation with dracut.
%package tools
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
%description tools
This package contains tools to assemble the local initrd and host configuration.
%package squash
Summary: dracut module to build an initramfs with most files in a squashfs image
Requires: %{name} = %{version}-%{release}
Requires: squash-tools
%description squash
This package provides a dracut module to build an initramfs, but store most files
in a squashfs image, result in a smaller initramfs size and reduce runtime memory
usage.
%prep
%autosetup -n %{name}-%{version} -S git_am
cp %{SOURCE1} .
%build
%configure --systemdsystemunitdir=%{_unitdir} \
--bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \
--libdir=%{_prefix}/lib \
%if %{without doc}
--disable-documentation \
%endif
${NULL}
make %{?_smp_mflags}
%install
make %{?_smp_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
%endif
%if %{defined _unitdir}
# for systemd, better use systemd-bootchart
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
%endif
# we do not support dash in the initramfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
# remove gentoo specific modules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
%if %{defined _unitdir}
# with systemd IMA and selinux modules do not make sense
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
%endif
%ifnarch s390 s390x
# remove architecture specific modules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/80cms
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/81cio_ignore
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/91zipl
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_mod
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dasd_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95dcssblk
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95qeth_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95zfcp_rules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/95znet
%else
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00warpclock
%endif
mkdir -p $RPM_BUILD_ROOT/boot/dracut
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora} || 0%{?rhel}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
%endif
%if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
%if 0%{?fedora} || 0%{?rhel}
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
# 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 HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
%endif
%{!?_licensedir:%global license %%doc}
%license COPYING lgpl-2.1.txt
%{_bindir}/dracut
%{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
%endif
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-init.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
%{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore
%{dracutlibdir}/dracut-install
%{dracutlibdir}/skipcpio
%config(noreplace) %{_sysconfdir}/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
%dir %{_datadir}/pkgconfig
%{_datadir}/pkgconfig/dracut.pc
%if %{with doc}
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_mandir}/man8/mkinitrd.8*
%{_mandir}/man1/lsinitrd.1*
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.modules.7*
%{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5*
%endif
%if %{undefined _unitdir}
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/00bash
%{dracutlibdir}/modules.d/00systemd
%ifnarch s390 s390x
%{dracutlibdir}/modules.d/00warpclock
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%{dracutlibdir}/modules.d/01fips
%endif
%{dracutlibdir}/modules.d/01systemd-initrd
%{dracutlibdir}/modules.d/03modsign
%{dracutlibdir}/modules.d/03rescue
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80lvmmerge
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
%{dracutlibdir}/modules.d/90dmraid
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90kernel-modules-extra
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90stratis
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95lunmask
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/95virtfs
%ifarch s390 s390x
%{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/81cio_ignore
%{dracutlibdir}/modules.d/91zipl
%{dracutlibdir}/modules.d/95dasd
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95dcssblk
%{dracutlibdir}/modules.d/95qeth_rules
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules
%endif
%if %{undefined _unitdir}
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97masterkey
%{dracutlibdir}/modules.d/98integrity
%endif
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/98dracut-systemd
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99shutdown
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if %{defined _unitdir}
%{_unitdir}/dracut-shutdown.service
%{_unitdir}/sysinit.target.wants/dracut-shutdown.service
%{_unitdir}/dracut-cmdline.service
%{_unitdir}/dracut-initqueue.service
%{_unitdir}/dracut-mount.service
%{_unitdir}/dracut-pre-mount.service
%{_unitdir}/dracut-pre-pivot.service
%{_unitdir}/dracut-pre-trigger.service
%{_unitdir}/dracut-pre-udev.service
%{_unitdir}/initrd.target.wants/dracut-cmdline.service
%{_unitdir}/initrd.target.wants/dracut-initqueue.service
%{_unitdir}/initrd.target.wants/dracut-mount.service
%{_unitdir}/initrd.target.wants/dracut-pre-mount.service
%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
%endif
%if 0%{?fedora} || 0%{?rhel}
%{_prefix}/lib/kernel/install.d/50-dracut.install
%endif
%files network
%{dracutlibdir}/modules.d/02systemd-networkd
%{dracutlibdir}/modules.d/35network-manager
%{dracutlibdir}/modules.d/35network-legacy
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/90kernel-network-modules
%{dracutlibdir}/modules.d/90qemu-net
%{dracutlibdir}/modules.d/95cifs
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95fcoe-uefi
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95ssh-client
%ifarch s390 s390x
%{dracutlibdir}/modules.d/95znet
%endif
%{dracutlibdir}/modules.d/99uefi-lib
%files caps
%{dracutlibdir}/modules.d/02caps
%files live
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
%{dracutlibdir}/modules.d/90livenet
%files tools
%if %{with doc}
%doc %{_mandir}/man8/dracut-catimages.8*
%endif
%files squash
%{dracutlibdir}/modules.d/99squash
%{_bindir}/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay
%files config-generic
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
%files config-rescue
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel}
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
# FIXME: remove after F30
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%changelog

View File

@@ -1,61 +0,0 @@
#!/bin/bash
set -ex
[[ -d ${0%/*} ]] && cd ${0%/*}
RUN_ID="$1"
TESTS=$2
dnf -y update --best --allowerasing &>/dev/null
dnf -y install --best --allowerasing \
dash \
asciidoc \
mdadm \
lvm2 \
dmraid \
cryptsetup \
nfs-utils \
nbd \
dhcp-server \
scsi-target-utils \
iscsi-initiator-utils \
strace \
btrfs-progs \
kmod-devel \
gcc \
bzip2 \
xz \
tar \
wget \
rpm-build \
make \
git \
bash-completion \
sudo \
kernel \
dhcp-client \
/usr/bin/qemu-kvm \
/usr/bin/qemu-system-$(uname -i) \
e2fsprogs \
$NULL &>/dev/null
./configure
NCPU=$(getconf _NPROCESSORS_ONLN)
if ! [[ $TESTS ]]; then
make -j$NCPU all syncheck rpm logtee
else
make -j$NCPU all logtee
cd test
time sudo make \
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
TEST_RUN_ID=$RUN_ID \
${TESTS:+TESTS="$TESTS"} \
-k V=2 \
check
fi

View File

@@ -1,64 +0,0 @@
#!/usr/bin/perl
sub create_patches {
my $tag=shift;
my $pdir=shift;
my $n=1;
my @lines;
my $fname;
my $f=0;
mkdir $pdir, 0755;
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse '.$tag.'..HEAD |');
while (<GIT>) {
if (/^From [a-z0-9]{40} .*$/) {
$fname = sprintf("%04d", $n++).".patch";
open FH, ">".$pdir."/".$fname;
$f=1;
}
if (/^---$/ && $f == 1) {
push @lines, $fname;
$f=0;
}
print FH;
}
return @lines;
};
use POSIX qw(strftime);
my $datestr = strftime "%Y%m%d", gmtime;
my $tag=shift;
my $pdir=shift;
$tag=`git describe --abbrev=0 --tags` if not defined $tag;
chomp($tag);
my @patches=&create_patches($tag, $pdir);
my $num=$#patches + 2;
$tag=~s/[^0-9]+?([0-9]+)/$1/;
my $release="$num.git$datestr";
$release="1" if $num == 1;
while(<>) {
if (/^Version:/) {
print "Version: $tag\n";
}
elsif (/^%define dist_free_release/) {
print "%define dist_free_release $release\n";
}
elsif ((/^Source0:/) || (/^Source:/)) {
print $_;
$num=1;
for(@patches) {
s/.*\///g;
print "Patch$num: $_\n";
$num++;
}
print "\n";
}
else {
print $_;
}
}

99
install.d/50-dracut.install Executable file
View File

@@ -0,0 +1,99 @@
#!/bin/bash
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
# So, let's skip to create initrd.
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
# Mismatching the install layout and the --uefi/--no-uefi opts just creates a mess.
if [[ $KERNEL_INSTALL_LAYOUT == "uki" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
IMAGE="uki.efi"
UEFI_OPTS="--uefi"
elif [[ $KERNEL_INSTALL_LAYOUT == "bls" && -n $KERNEL_INSTALL_STAGING_AREA ]]; then
BOOT_DIR_ABS="$KERNEL_INSTALL_STAGING_AREA"
IMAGE="initrd"
UEFI_OPTS="--no-uefi"
else
# No layout information, use users --uefi/--no-uefi preference
UEFI_OPTS=""
if [[ -d $BOOT_DIR_ABS ]]; then
IMAGE="initrd"
else
BOOT_DIR_ABS="/boot"
IMAGE="initramfs-${KERNEL_VERSION}.img"
fi
fi
ret=0
case "$COMMAND" in
add)
if [[ $IMAGE == "uki.efi" ]]; then
IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/uki.efi
else
IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
fi
if [[ -f ${IMAGE_PREGENERATED} ]]; then
# we found an initrd or uki.efi at the same place as the kernel
# use this and don't generate a new one
[[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo \
"There is an ${IMAGE} image at the same place as the kernel, skipping generating a new one"
cp --reflink=auto "$IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$IMAGE" \
&& chown root:root "$BOOT_DIR_ABS/$IMAGE" \
&& chmod 0600 "$BOOT_DIR_ABS/$IMAGE" \
&& exit 0
fi
if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then
if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then
read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline"
fi
elif [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
else
declare -a BOOT_OPTIONS
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ ${i#initrd=*} != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
unset noimageifnotneeded
for ((i = 0; i < "${#BOOT_OPTIONS[@]}"; i++)); do
# shellcheck disable=SC1001
if [[ ${BOOT_OPTIONS[$i]} == root\=PARTUUID\=* ]]; then
noimageifnotneeded="yes"
break
fi
done
# shellcheck disable=SC2046
dracut -f \
${noimageifnotneeded:+--noimageifnotneeded} \
$([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \
$([[ -n $KERNEL_IMAGE ]] && echo --kernel-image "$KERNEL_IMAGE") \
"$UEFI_OPTS" \
--kver "$KERNEL_VERSION" \
"$BOOT_DIR_ABS/$IMAGE"
ret=$?
;;
remove)
rm -f -- "$BOOT_DIR_ABS/$IMAGE"
ret=$?
;;
esac
exit $ret

View File

@@ -0,0 +1,153 @@
#!/bin/bash
export LANG=C
COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="${3%/*}/0-rescue"
KERNEL_IMAGE="$4"
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
}
if [[ -f /etc/os-release ]]; then
. /etc/os-release
elif [[ -f /usr/lib/os-release ]]; then
. /usr/lib/os-release
fi
[[ -n $PRETTY_NAME ]] || PRETTY_NAME="Linux $KERNEL_VERSION"
if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
elif [[ -f /etc/machine-id ]]; then
read -r MACHINE_ID < /etc/machine-id
fi
if ! [[ $MACHINE_ID ]]; then
exit 0
fi
if [ -n "$KERNEL_INSTALL_CONF_ROOT" ]; then
if [ -f "$KERNEL_INSTALL_CONF_ROOT/cmdline" ]; then
read -r -d '' -a BOOT_OPTIONS < "$KERNEL_INSTALL_CONF_ROOT/cmdline"
fi
elif [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
else
declare -a BOOT_OPTIONS
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ ${i#initrd=*} != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
if [[ -d ${BOOT_DIR_ABS%/*} ]]; then
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%"$BOOT_DIR"}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
KERNEL="linux"
INITRD="initrd"
else
BLS_DIR="/boot/loader/entries"
BOOT_DIR_ABS="/boot"
LOADER_ENTRY="$BLS_DIR/${MACHINE_ID}-0-rescue.conf"
KERNEL="vmlinuz-0-rescue-${MACHINE_ID}"
INITRD="initramfs-0-rescue-${MACHINE_ID}.img"
fi
ret=0
case "$COMMAND" in
add)
if [[ -f $LOADER_ENTRY ]] && [[ -f "$BOOT_DIR_ABS/$KERNEL" ]] \
&& [[ -f "$BOOT_DIR_ABS/$INITRD" ]]; then
[[ $KERNEL_INSTALL_VERBOSE == 1 ]] \
&& echo "Skipping, there is already a rescue image generated with the same input parameters"
exit 0
fi
# source our config dir
for f in $(dropindirs_sort ".conf" "/etc/dracut.conf.d" "/usr/lib/dracut/dracut.conf.d"); do
if [[ -e $f ]]; then
# shellcheck disable=SC1090
. "$f"
fi
done
# shellcheck disable=SC2154
if [[ $dracut_rescue_image != "yes" ]]; then
[[ $KERNEL_INSTALL_VERBOSE == 1 ]] \
&& echo "Skipping, 'dracut_rescue_image' not set to 'yes' in any dracut configuration file"
exit 0
fi
[[ -d $BOOT_DIR_ABS ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
fi
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
# shellcheck disable=SC2046
dracut -f --no-hostonly --no-uefi \
-a "rescue" \
$([[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo --verbose) \
--kver "$KERNEL_VERSION" \
"$BOOT_DIR_ABS/$INITRD"
((ret += $?))
fi
[[ $KERNEL_INSTALL_VERBOSE == 1 ]] && echo "Creating $LOADER_ENTRY"
if [[ ${BOOT_DIR_ABS} != "/boot" ]]; then
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"
echo "machine-id $MACHINE_ID"
echo "options ${BOOT_OPTIONS[*]} rd.auto=1"
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
((ret += $?))
;;
remove)
exit 0
;;
esac
exit $ret

View File

@@ -1 +0,0 @@
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;

View File

@@ -1,12 +0,0 @@
# src/shared/hashmap.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.4.2
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/hashmap.o'
# Name of the non-PIC object
non_pic_object='hashmap.o'

View File

@@ -1,54 +0,0 @@
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <limits.h>
#define BUFLEN 4096
int
main(int argc, char *argv[])
{
int fd;
int len, slen;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
exit(EXIT_FAILURE);
}
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
perror("open");
exit(EXIT_FAILURE);
}
fprintf(stderr, "Logging to %s: ", argv[1]);
slen = 0;
do {
len = splice(STDIN_FILENO, NULL, fd, NULL,
BUFLEN, SPLICE_F_MOVE);
if (len < 0) {
if (errno == EAGAIN)
continue;
perror("tee");
exit(EXIT_FAILURE);
} else
if (len == 0)
break;
slen += len;
if ((slen/BUFLEN) > 0) {
fprintf(stderr, ".");
}
slen = slen % BUFLEN;
} while (1);
close(fd);
fprintf(stderr, "\n");
exit(EXIT_SUCCESS);
}

View File

@@ -1,60 +0,0 @@
#
# Copyright 2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__contains_word () {
local word=$1; shift
for w in $*; do [[ $w = $word ]] && return 0; done
return 1
}
_lsinitrd() {
local field_vals= cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-s --size -h --help'
[ARG]='-f --file -k --kver'
)
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--file|-f)
comps=$(compgen -f -- "$cur")
compopt -o filenames
;;
--kver|-k)
comps=$(cd /lib/modules; echo [0-9]*)
;;
*)
return 0
;;
esac
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
fi
if [[ $cur = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
fi
comps=$(compgen -f -- "$cur")
compopt -o filenames
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
return 0
}
complete -F _lsinitrd lsinitrd

View File

@@ -17,8 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
usage()
{
usage() {
{
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
echo "Usage: ${0##*/} [options] -k <kernel version>"
@@ -38,7 +37,6 @@ usage()
} >&2
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
sorted=0
@@ -59,7 +57,8 @@ TEMP=$(getopt \
--long verbose \
-- "$@")
if (( $? != 0 )); then
# shellcheck disable=SC2181
if (($? != 0)); then
usage
exit 1
fi
@@ -68,16 +67,31 @@ eval set -- "$TEMP"
while (($# > 0)); do
case $1 in
-k|--kver) KERNEL_VERSION="$2"; shift;;
-f|--file) filenames[${2#/}]=1; shift;;
-s|--size) sorted=1;;
-h|--help) usage; exit 0;;
-m|--mod) modules=1;;
-v|--verbose) verbose="--verbose";;
--unpack) unpack=1;;
--unpackearly) unpackearly=1;;
--) shift;break;;
*) usage; exit 1;;
-k | --kver)
KERNEL_VERSION="$2"
shift
;;
-f | --file)
filenames[${2#/}]=1
shift
;;
-s | --size) sorted=1 ;;
-h | --help)
usage
exit 0
;;
-m | --mod) modules=1 ;;
-v | --verbose) verbose="--verbose" ;;
--unpack) unpack=1 ;;
--unpackearly) unpackearly=1 ;;
--)
shift
break
;;
*)
usage
exit 1
;;
esac
shift
done
@@ -86,7 +100,7 @@ done
if [[ $1 ]]; then
image="$1"
if ! [[ -f "$image" ]]; then
if ! [[ -f $image ]]; then
{
echo "$image does not exist"
echo
@@ -95,24 +109,51 @@ if [[ $1 ]]; then
exit 1
fi
else
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
MACHINE_ID="Default"
elif [[ -s /etc/machine-id ]]; then
read -r MACHINE_ID < /etc/machine-id
[[ $MACHINE_ID == "uninitialized" ]] && MACHINE_ID="Default"
else
MACHINE_ID="Default"
fi
if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -d /boot/efi/loader/entries || -L /boot/efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d /boot/efi/${MACHINE_ID} || -L /boot/efi/${MACHINE_ID} ]]; then
image="/boot/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ -f /lib/modules/${KERNEL_VERSION}/initrd ]]; then
image="/lib/modules/${KERNEL_VERSION}/initrd"
elif [[ -f /lib/modules/${KERNEL_VERSION}/initramfs.img ]]; then
image="/lib/modules/${KERNEL_VERSION}/initramfs.img"
elif [[ -f /boot/initramfs-${KERNEL_VERSION}.img ]]; then
image="/boot/initramfs-${KERNEL_VERSION}.img"
elif [[ $MACHINE_ID ]] \
&& mountpoint -q /efi; then
image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
elif [[ $MACHINE_ID ]] \
&& mountpoint -q /boot/efi; then
image="/boot/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
else
image=""
fi
fi
shift
while (($# > 0)); do
filenames[${1#/}]=1;
filenames[${1#/}]=1
shift
done
if ! [[ -f "$image" ]]; then
if ! [[ -f $image ]]; then
{
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
echo
@@ -121,83 +162,141 @@ if ! [[ -f "$image" ]]; then
exit 1
fi
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
# shellcheck disable=SC2064
trap "rm -rf '$TMPDIR'" EXIT
dracutlibdirs() {
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
echo "$d/$1"
done
}
extract_files()
{
(( ${#filenames[@]} == 1 )) && nofileinfo=1
extract_files() {
((${#filenames[@]} == 1)) && nofileinfo=1
for f in "${!filenames[@]}"; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2>/dev/null
((ret+=$?))
# shellcheck disable=SC2001
[[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g')
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
((ret += $?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
done
}
list_modules()
{
list_modules() {
echo "dracut modules:"
# shellcheck disable=SC2046
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs modules.txt) 2>/dev/null
((ret+=$?))
$(dracutlibdirs modules.txt) 2> /dev/null
((ret += $?))
}
list_files()
{
list_files() {
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret+=$?))
((ret += $?))
echo "========================================================================"
}
unpack_files()
{
if (( ${#filenames[@]} > 0 )); then
for f in "${!filenames[@]}"; do
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
((ret+=$?))
done
else
$CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
((ret+=$?))
list_squash_content() {
SQUASH_IMG="squash-root.img"
SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
$CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
$SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
if [[ -s $SQUASH_TMPFILE ]]; then
echo "Squashed content ($SQUASH_IMG):"
echo "========================================================================"
unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
echo "========================================================================"
fi
}
unpack_files() {
if ((${#filenames[@]} > 0)); then
for f in "${!filenames[@]}"; do
# shellcheck disable=SC2001
[[ $f == *"\\x"* ]] && f=$(echo "$f" | sed 's/\\x.\{2\}/????/g')
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose "$f"
((ret += $?))
done
else
$CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
((ret += $?))
fi
}
read -r -N 2 bin < "$image"
if [ "$bin" = "MZ" ]; then
command -v objcopy > /dev/null || {
echo "Need 'objcopy' to unpack an UEFI executable."
exit 1
}
objcopy \
--dump-section .linux="$TMPDIR/vmlinuz" \
--dump-section .initrd="$TMPDIR/initrd.img" \
--dump-section .cmdline="$TMPDIR/cmdline.txt" \
--dump-section .osrel="$TMPDIR/osrel.txt" \
"$image" /dev/null
uefi="$image"
image="$TMPDIR/initrd.img"
[ -f "$image" ] || exit 1
fi
if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
if [ -n "$uefi" ]; then
echo -n "initrd in UEFI: $uefi: "
du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
if [ -f "$TMPDIR/osrel.txt" ]; then
name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
build=$(sed -En '/^BUILD_ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
echo "OS Release: $name (${id}-${build})"
fi
if [ -f "$TMPDIR/vmlinuz" ]; then
version=$(strings -n 20 "$TMPDIR/vmlinuz" | sed -En '/[0-9]+\.[0-9]+\.[0-9]+/ { p; q 0 }')
echo "Kernel Version: $version"
fi
if [ -f "$TMPDIR/cmdline.txt" ]; then
echo "Command line:"
sed -En 's/\s+/\n/g; s/\x00/\n/; p' "$TMPDIR/cmdline.txt"
fi
else
echo -n "Image: $image: "
du -h "$image" | while read -r a _ || [ -n "$a" ]; do echo "$a"; done
fi
if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
echo "========================================================================"
fi
read -N 6 bin < "$image"
read -r -N 6 bin < "$image"
case $bin in
$'\x71\xc7'*|070701)
$'\x71\xc7'* | 070701)
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2> /dev/null)
# Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2> /dev/null)
if [[ "$is_early" ]]; then
if [[ -n "$unpack" ]]; then
if [[ -n $unpack ]]; then
# should use --unpackearly for early CPIO
:
elif [[ -n "$unpackearly" ]]; then
elif [[ -n $unpackearly ]]; then
unpack_files
elif (( ${#filenames[@]} > 0 )); then
elif ((${#filenames[@]} > 0)); then
extract_files
else
echo "Early CPIO image"
list_files
fi
if [[ -d "$dracutbasedir/skipcpio" ]]; then
SKIP="$dracutbasedir/skipcpio/skipcpio"
if [[ -d "$dracutbasedir/src/skipcpio" ]]; then
SKIP="$dracutbasedir/src/skipcpio/skipcpio"
else
SKIP="$dracutbasedir/skipcpio"
fi
@@ -211,10 +310,10 @@ case $bin in
;;
esac
if [[ $SKIP ]] ; then
bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
if [[ $SKIP ]]; then
bin="$($SKIP "$image" | { read -r -N 6 bin && echo "$bin"; })"
else
read -N 6 bin < "$image"
read -r -N 6 bin < "$image"
fi
case $bin in
$'\x1f\x8b'*)
@@ -223,7 +322,7 @@ case $bin in
BZh*)
CAT="bzcat --"
;;
$'\x71\xc7'*|070701)
$'\x71\xc7'* | 070701)
CAT="cat --"
;;
$'\x02\x21'*)
@@ -236,7 +335,7 @@ case $bin in
CAT="zstd -d -c"
;;
*)
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
if echo "test" | xz | xzcat --single-stream > /dev/null 2>&1; then
CAT="xzcat --single-stream --"
else
CAT="xzcat --"
@@ -244,8 +343,12 @@ case $bin in
;;
esac
skipcpio()
{
type "${CAT%% *}" > /dev/null 2>&1 || {
echo "Need '${CAT%% *}' to unpack the initramfs."
exit 1
}
skipcpio() {
$SKIP "$@" | $ORIG_CAT
}
@@ -254,27 +357,26 @@ if [[ $SKIP ]]; then
CAT=skipcpio
fi
if (( ${#filenames[@]} > 1 )); then
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
$CAT "$image" 2>/dev/null > $TMPFILE
trap "rm -f '$TMPFILE'" EXIT
pre_decompress()
{
cat $TMPFILE
if ((${#filenames[@]} > 1)); then
TMPFILE="$TMPDIR/initrd.cpio"
$CAT "$image" 2> /dev/null > "$TMPFILE"
pre_decompress() {
cat "$TMPFILE"
}
CAT=pre_decompress
fi
ret=0
if [[ -n "$unpack" ]]; then
if [[ -n $unpack ]]; then
unpack_files
elif (( ${#filenames[@]} > 0 )); then
elif ((${#filenames[@]} > 0)); then
extract_files
else
# shellcheck disable=SC2046
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs 'dracut-*') 2>/dev/null)
((ret+=$?))
$(dracutlibdirs 'dracut-*') 2> /dev/null)
((ret += $?))
echo "Version: $version"
echo
if [ "$modules" -eq 1 ]; then
@@ -282,12 +384,14 @@ else
echo "========================================================================"
else
echo -n "Arguments: "
# shellcheck disable=SC2046
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
$(dracutlibdirs build-parameter.txt) 2>/dev/null
$(dracutlibdirs build-parameter.txt) 2> /dev/null
echo
list_modules
list_files
list_squash_content
fi
fi
exit $ret
exit "$ret"

View File

@@ -51,7 +51,7 @@ Harald Hoyer
AVAILABILITY
------------
The dracut-catimages command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
link:$$https://github.com/dracutdevs/dracut$$[https://github.com/dracutdevs/dracut]
SEE ALSO
--------

View File

@@ -3,6 +3,7 @@ DRACUT(8)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -17,8 +18,13 @@ DESCRIPTION
Create an initramfs <image> for the kernel with the version <kernel version>.
If <kernel version> is omitted, then the version of the actual running
kernel is used. If <image> is omitted or empty, then the default location
/boot/initramfs-<kernel version>.img is used.
kernel is used. If <image> is omitted or empty, depending on bootloader
specification, the default location can be
_/efi/<machine-id>/<kernel-version>/initrd_,
_/boot/<machine-id>/<kernel-version>/initrd_,
_/boot/efi/<machine-id>/<kernel-version>/initrd_,
_/lib/modules/<kernel-version>/initrd_ or
_/boot/initramfs-<kernel-version>.img_.
dracut creates an initial image used by the kernel for preloading the block
device modules (such as IDE, SCSI or RAID) which are needed to access the root
@@ -47,22 +53,28 @@ include::dracut.usage.asc[]
OPTIONS
-------
**--kver** _<kernel version>_::
set the kernel version. This enables to specify the kernel version, without
Set the kernel version. This enables to specify the kernel version, without
specifying the location of the initramfs image. For example:
----
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
----
**-f, --force**::
overwrite existing initramfs file.
Overwrite existing initramfs file.
_<output file>_ **--rebuild**::
Append the current arguments to those with which the input initramfs image
was built. This option helps in incrementally building the initramfs for
testing. If optional _<output file>_ is not provided, the input initramfs
provided to rebuild will be used as output file.
**-a, --add** _<list of dracut modules>_::
add a space-separated list of dracut modules to the default set of modules.
Add a space-separated list of dracut modules to the default set of modules.
This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add "module1 module2" ...
@@ -70,13 +82,13 @@ example:
===============================
**--force-add** _<list of dracut modules>_::
force to add a space-separated list of dracut modules to the default set of
Force to add a space-separated list of dracut modules to the default set of
modules, when -H is specified. This parameter can be specified multiple
times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-add "module1 module2" ...
@@ -84,12 +96,12 @@ example:
===============================
**-o, --omit** _<list of dracut modules>_::
omit a space-separated list of dracut modules. This parameter can be
Omit a space-separated list of dracut modules. This parameter can be
specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit "module1 module2" ...
@@ -97,7 +109,7 @@ example:
===============================
**-m, --modules** _<list of dracut modules>_::
specify a space-separated list of dracut modules to call when building the
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_. This
parameter can be specified multiple times.
This option forces dracut to only include the specified dracut modules.
@@ -105,7 +117,7 @@ example:
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --modules "module1 module2" ...
@@ -113,13 +125,13 @@ example:
===============================
**-d, --drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules to exclusively include
Specify a space-separated list of kernel modules to exclusively include
in the initramfs. The kernel modules have to be specified without the ".ko"
suffix. This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --drivers "kmodule1 kmodule2" ...
@@ -127,13 +139,13 @@ example:
===============================
**--add-drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules to add to the initramfs.
Specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add-drivers "kmodule1 kmodule2" ...
@@ -146,7 +158,7 @@ example:
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-drivers "kmodule1 kmodule2" ...
@@ -154,14 +166,14 @@ example:
===============================
**--omit-drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules not to add to the
Specify a space-separated list of kernel modules not to add to the
initramfs.
The kernel modules have to be specified without the ".ko" suffix. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit-drivers "kmodule1 kmodule2" ...
@@ -169,13 +181,13 @@ example:
===============================
**--filesystems** _<list of filesystems>_::
specify a space-separated list of kernel filesystem modules to exclusively
Specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs. This parameter can be specified multiple
times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --filesystems "filesystem1 filesystem2" ...
@@ -183,51 +195,64 @@ example:
===============================
**-k, --kmoddir** _<kernel directory>_::
specify the directory, where to look for kernel modules
Specify the directory, where to look for kernel modules.
**--fwdir** _<dir>[:<dir>...]++_::
specify additional directories, where to look for firmwares. This parameter
Specify additional directories, where to look for firmwares. This parameter
can be specified multiple times.
**--kernel-cmdline <parameters>**::
specify default kernel command line parameters
**--kernel-only**::
only install kernel drivers and firmware files
**--no-kernel**::
do not install kernel drivers and firmware files
**--early-microcode**::
Combine early microcode with ramdisk
**--no-early-microcode**::
Do not combine early microcode with ramdisk
**--print-cmdline**::
print the kernel command line for the current disk layout
**--mdadmconf**::
include local _/etc/mdadm.conf_
**--nomdadmconf**::
do not include local _/etc/mdadm.conf_
**--lvmconf**::
include local _/etc/lvm/lvm.conf_
**--nolvmconf**::
do not include local _/etc/lvm/lvm.conf_
**--fscks** [LIST]::
add a space-separated list of fsck tools, in addition to _dracut.conf_'s
specification; the installation is opportunistic (non-existing tools are
ignored)
**--libdirs** _<list of directories>_::
Specify a space-separated list of directories to look for libraries to
include in the generic initramfs. This parameter can be specified multiple
times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --libdirs "dir1 dir2" ...
----
===============================
**--kernel-cmdline <parameters>**::
Specify default kernel command line parameters.
**--kernel-only**::
Only install kernel drivers and firmware files.
**--no-kernel**::
Do not install kernel drivers and firmware files.
**--early-microcode**::
Combine early microcode with ramdisk.
**--no-early-microcode**::
Do not combine early microcode with ramdisk.
**--print-cmdline**::
Print the kernel command line for the current disk layout.
**--mdadmconf**::
Include local _/etc/mdadm.conf_ file.
**--nomdadmconf**::
Do not include local _/etc/mdadm.conf_ file.
**--lvmconf**::
Include local _/etc/lvm/lvm.conf_ file.
**--nolvmconf**::
Do not include local _/etc/lvm/lvm.conf_ file.
**--fscks** _<list of fsck tools>_::
Add a space-separated list of fsck tools, in addition to _dracut.conf_'s
specification; the installation is opportunistic (non-existing tools are
ignored).
+
[NOTE]
===============================
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --fscks "fsck.foo barfsck" ...
@@ -235,71 +260,89 @@ example:
===============================
**--nofscks**::
inhibit installation of any fsck tools
Inhibit installation of any fsck tools.
**--strip**::
strip binaries in the initramfs (default)
Strip binaries in the initramfs (default).
**--aggressive-strip**::
Strip more than just debug symbol and sections, for a smaller initramfs
build. The --strip option must also be specified.
**--nostrip**::
do not strip binaries in the initramfs
Do not strip binaries in the initramfs.
**--hardlink**::
hardlink files in the initramfs (default)
Hardlink files in the initramfs (default).
**--nohardlink**::
do not hardlink files in the initramfs
Do not hardlink files in the initramfs.
**--prefix** _<dir>_::
prefix initramfs files with the specified directory
Prefix initramfs files with the specified directory.
**--noprefix**::
do not prefix initramfs files (default)
Do not prefix initramfs files (default).
**-h, --help**::
display help text and exit.
Display help text and exit.
**--debug**::
output debug information of the build process
Output debug information of the build process.
**-v, --verbose**::
increase verbosity level (default is info(4))
Increase verbosity level (default is info(4)).
**-q, --quiet**:: decrease 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>_::
specify configuration file to use.
Specify configuration file to use.
+
Default:
_/etc/dracut.conf_
**--confdir** _<configuration directory>_::
specify configuration directory to use.
Specify configuration directory to use.
+
Default:
_/etc/dracut.conf.d_
**--tmpdir** _<temporary directory>_::
specify temporary directory to use.
Specify temporary directory to use.
+
Default:
_/var/tmp_
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
**-r, --sysroot** _<sysroot directory>_::
Specify the sysroot directory to collect files from.
This is useful to create the initramfs image from
a cross-compiled sysroot directory. For the extra helper
variables, see *ENVIRONMENT* below.
+
Default:
_empty_
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
the configuration files.
**--sshkey** _<sshkey file>_::
SSH key file used with ssh-client module.
**--logfile** _<logfile>_::
Logfile to use; overrides any setting from the configuration files.
+
Default:
_/var/log/dracut.log_
**-l, --local**::
activates the local mode. dracut will use modules from the current working
Activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in
_/usr/lib/dracut/modules.d_.
This is useful when running dracut from a git checkout.
**-H, --hostonly**::
Host-Only mode: Install only what is needed for booting the local host
Host-only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
+
[WARNING]
@@ -309,28 +352,47 @@ provide a valid _/etc/fstab_.
====
**-N, --no-hostonly**::
Disable Host-Only mode
Disable host-only mode.
**--hostonly-cmdline**:
Store kernel command line arguments needed in the initramfs
**--hostonly-mode _<mode>_**::
Specify the host-only mode to use. _<mode>_ could be one of "sloppy" or
"strict".
In "sloppy" host-only mode, extra drivers and modules will be installed, so
minor hardware change won't make the image unbootable (e.g. changed
keyboard), and the image is still portable among similar hosts.
With "strict" mode enabled, anything not necessary for booting the local
host in its current state will not be included, and modules may do some
extra job to save more space. Minor change of hardware or environment could
make the image unbootable.
+
Default:
_sloppy_
**--no-hostonly-cmdline**:
Do not store kernel command line arguments needed in the initramfs
**--hostonly-cmdline**::
Store kernel command line arguments needed in the initramfs.
**--no-hostonly-default-device**:
**--no-hostonly-cmdline**::
Do not store kernel command line arguments needed in the initramfs.
**--no-hostonly-default-device**::
Do not generate implicit host devices like root, swap, fstab, etc.
Use "--mount" or "--add-device" to explicitly add devices as needed.
**--hostonly-i18n**:
Install only needed keyboard and font files according to the host configuration (default).
**--hostonly-i18n**::
Install only needed keyboard and font files according to the host
configuration (default).
**--no-hostonly-i18n**:
**--no-hostonly-i18n**::
Install all keyboard and font files available.
**--hostonly-nics** _<list of nics>_::
Only enable listed NICs in the initramfs. The list can be empty, so other
modules can install only the necessary network drivers.
**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
_<policy>_ can be any directory name found in /dev/disk (e.g. "by-uuid",
"by-label"), or "mapper" to use /dev/mapper device names (default).
**--fstab**::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
@@ -344,7 +406,7 @@ provide a valid _/etc/fstab_.
be specified, see fstab manpage for the details.
The default _<filesystem options>_ is "defaults".
The default _<dump frequency>_ is "0".
the default _<fsck order>_ is "2".
The default _<fsck order>_ is "2".
**--mount** "_<mountpoint>_"::
Like above, but _<device>_, _<filesystem type>_ and _<filesystem options>_
@@ -352,22 +414,22 @@ provide a valid _/etc/fstab_.
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
This can be useful in host-only mode for resume support when your swap is on
LVM or an encrypted partition.
[NB --device can be used for compatibility with earlier releases]
**-i, --include** _<SOURCE>_ _<TARGET>_::
include the files in the SOURCE directory into the
Include the files in the SOURCE directory into the
TARGET directory in the final initramfs. If SOURCE is a file, it will be
installed to TARGET in the final initramfs. This parameter can be specified
multiple times.
**-I, --install** _<file list>_::
install the space separated list of files into the initramfs.
Install the space separated list of files into the initramfs.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
If the list has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --install "/bin/foo /sbin/bar" ...
@@ -375,12 +437,12 @@ example:
===============================
**--install-optional** _<file list>_::
install the space separated list of files into the initramfs, if they exist.
Install the space separated list of files into the initramfs, if they exist.
**--gzip**::
Compress the generated initramfs using gzip. This will be done by default,
unless another compression option or --no-compress is passed. Equivalent to
"--compress=gzip -9"
"--compress=gzip -9".
**--bzip2**::
Compress the generated initramfs using bzip2.
@@ -388,7 +450,7 @@ example:
[WARNING]
====
Make sure your kernel has bzip2 decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=bzip2"
will not be able to boot. Equivalent to "--compress=bzip2 -9".
====
**--lzma**::
@@ -397,7 +459,7 @@ will not be able to boot. Equivalent to "--compress=bzip2"
[WARNING]
====
Make sure your kernel has lzma decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "lzma --compress=lzma -9"
will not be able to boot. Equivalent to "--compress=lzma -9 -T0".
====
**--xz**::
@@ -407,31 +469,34 @@ will not be able to boot. Equivalent to "lzma --compress=lzma -9"
====
Make sure your kernel has xz decompression support compiled in, otherwise you
will not be able to boot. Equivalent to
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
"--compress=xz --check=crc32 --lzma2=dict=1MiB -T0".
====
**--lzo**::
Compress the generated initramfs using lzop.
+
[WARNING]
====
Make sure your kernel has lzo decompression support compiled in, otherwise you
will not be able to boot.
will not be able to boot. Equivalent to "--compress=lzop -9".
====
**--lz4**::
Compress the generated initramfs using lz4.
+
[WARNING]
====
Make sure your kernel has lz4 decompression support compiled in, otherwise you
will not be able to boot.
will not be able to boot. Equivalent to "--compress=lz4 -l -9".
====
**--zstd**::
Compress the generated initramfs using Zstandard.
+
[WARNING]
====
Make sure your kernel has zstd decompression support compiled in, otherwise you
will not be able to boot.
will not be able to boot. Equivalent to "--compress=zstd -15 -q -T0".
====
**--compress** _<compressor>_::
@@ -440,7 +505,14 @@ will not be able to boot.
program with known-working arguments. If you pass a quoted string with
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.
The default value can also be set via the _INITRD_COMPRESS_ environment variable.
The default value can also be set via the _INITRD_COMPRESS_ environment
variable.
**--squash-compressor** _<compressor>_::
Compress the squashfs image using the passed compressor and compressor
specific options for mksquashfs. You can refer to mksquashfs manual for
supported compressors and compressor specific options. If squash module is
not called when building the initramfs, this option will not take effect.
**--no-compress**::
Do not compress the generated initramfs. This will override any other
@@ -462,16 +534,16 @@ will not be able to boot.
Keep the initramfs temporary directory for debugging purposes.
**--printsize**::
Print out the module install size
Print out the module install size.
**--profile**:
Output profile information of the build process
**--profile**::
Output profile information of the build process.
**--ro-mnt**:
**--ro-mnt**::
Mount / and /usr read-only by default.
**-L, --stdlog** _<level>_::
[0-6] Specify logging level (to standard error)
[0-6] Specify logging level (to standard error).
----
0 - suppress any messages
1 - only fatal errors
@@ -486,30 +558,57 @@ will not be able to boot.
Regenerate all initramfs images at the default location with the kernel
versions found on the system. Additional parameters are passed through.
**--loginstall _<DIR>_**::
Log all files installed from the host to _<DIR>_.
**-p, --parallel**::
Try to execute tasks in parallel. Currently only supported with
**--regenerate-all** (build initramfs images for all kernel
versions simultaneously).
**--noimageifnotneeded**::
Do not create an image in host-only mode, if no kernel driver is needed
and no /etc/cmdline/*.conf will be generated into the initramfs.
**--loginstall _<directory>_**::
Log all files installed from the host to _<directory>_.
**--uefi**::
Instead of creating an initramfs image, dracut will create an UEFI executable,
which can be executed by an UEFI BIOS. The default output filename is
_<EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi_. <EFI> might be
_/efi_, _/boot_ or _/boot/efi_ depending on where the ESP partition is mounted.
The <BUILD_ID> is taken from BUILD_ID in _/usr/lib/os-release_ or if it exists
_/etc/os-release_ and is left out, if BUILD_ID is non-existant or empty.
Instead of creating an initramfs image, dracut will create an UEFI
executable, which can be executed by an UEFI BIOS. The default output
filename is _<EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi_.
<EFI> might be _/efi_, _/boot_ or _/boot/efi_ depending on where the ESP
partition is mounted. The <BUILD_ID> is taken from BUILD_ID in
_/usr/lib/os-release_ or if it exists _/etc/os-release_ and is left out,
if BUILD_ID is non-existant or empty.
**--no-uefi**::
Disables UEFI mode.
**--no-machineid**::
affects the default output filename of **--uefi** and will discard the <MACHINE_ID>
part.
Affects the default output filename of **--uefi** and will discard the
<MACHINE_ID> part.
**--uefi-stub _<FILE>_**::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _$prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
**--uefi-stub _<file>_**::
Specifies the UEFI stub loader, which will load the attached kernel,
initramfs and kernel command line and boots the kernel. The default is
_$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_.
**--kernel-image _<FILE>_**::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
**--uefi-splash-image _<file>_**::
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**)
image format.
**--kernel-image _<file>_**::
Specifies the kernel image, which to include in the UEFI executable. The
default is _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or
_/boot/vmlinuz-<KERNEL-VERSION>_.
**--enhanced-cpio**::
Attempt to use the dracut-cpio binary, which optimizes archive creation for
copy-on-write filesystems by using the copy_file_range(2) syscall via Rust's
io::copy(). When specified, initramfs archives are also padded to ensure
optimal data alignment for extent sharing. To retain reflink data
deduplication benefits, this should be used alongside the **--no-compress**
and **--nostrip** parameters, with initramfs source files, **--tmpdir**
staging area and destination all on the same copy-on-write capable
filesystem.
ENVIRONMENT
-----------
@@ -517,6 +616,97 @@ ENVIRONMENT
_INITRD_COMPRESS_::
sets the default compression program. See **--compress**.
_DRACUT_LDCONFIG_::
sets the _ldconfig_ program path and options. Optional.
Used for **--sysroot**.
+
Default:
_ldconfig_
_DRACUT_LDD_::
sets the _ldd_ program path and options. Optional.
Used for **--sysroot**.
+
Default:
_ldd_
_DRACUT_TESTBIN_::
sets the initially tested binary for detecting library paths.
Optional. Used for **--sysroot**. In the cross-compiled sysroot,
the default value (_/bin/sh_) is unusable, as it is an absolute
symlink and points outside the sysroot directory.
+
Default:
_/bin/sh_
_DRACUT_INSTALL_::
overrides path and options for executing _dracut-install_ internally.
Optional. Can be used to debug _dracut-install_ while running the
main dracut script.
+
Default:
_dracut-install_
+
Example:
DRACUT_INSTALL="valgrind dracut-install"
_DRACUT_COMPRESS_BZIP2_::
_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_::
overrides for compression utilities to support using them from
non-standard paths.
+
Default values are the default compression utility names to be found in **PATH**.
_DRACUT_ARCH_::
overrides the value of **uname -m**. Used for **--sysroot**.
+
Default:
_empty_ (the value of **uname -m** on the host system)
_SYSTEMD_VERSION_::
overrides systemd version. Used for **--sysroot**.
_SYSTEMCTL_::
overrides the systemctl binary. Used for **--sysroot**.
_NM_VERSION_::
overrides the NetworkManager version. Used for **--sysroot**.
_DRACUT_INSTALL_PATH_::
overrides **PATH** environment for **dracut-install** to look for
binaries relative to **--sysroot**. 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.
+
Default:
_PATH_
_DRACUT_INSTALL_LOG_TARGET_::
overrides **DRACUT_LOG_TARGET** for **dracut-install**. It allows
running **dracut-install* to run with different log target that
**dracut** runs with.
+
Default:
_DRACUT_LOG_TARGET_
_DRACUT_INSTALL_LOG_LEVEL_::
overrides **DRACUT_LOG_LEVEL** for **dracut-install**. It allows
running **dracut-install* to run with different log level that
**dracut** runs with.
+
Default:
_DRACUT_LOG_LEVEL_
FILES
-----
_/var/log/dracut.log_::
@@ -552,7 +742,7 @@ _/etc/cmdline.d/*.conf_::
AVAILABILITY
------------
The dracut command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
link:$$https://github.com/dracutdevs/dracut$$[https://github.com/dracutdevs/dracut]
AUTHORS
-------
@@ -560,18 +750,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

@@ -1,8 +1,8 @@
dracut
======
Harald Hoyer <harald@redhat.com>
v3.0, October 2013
dracut {mainversion}
====================
:author: Harald Hoyer
:email: harald@profian.com
:revnumber: {version}
:language: bash
= Introduction
@@ -50,7 +50,7 @@ computer. This can be:
* The root file system itself
* A boot image on an optical disc
* A small ext2/ext3 or FAT-formatted partition on a local disk
* A small ext2/ext3/ext4 or FAT-formatted partition on a local disk
(a _boot partition_)
* A TFTP server (on systems that can boot from Ethernet)
@@ -61,7 +61,7 @@ Depending on which algorithms were compiled statically into it, the kernel can
currently unpack initrd/initramfs images compressed with gzip, bzip2 and LZMA.
== Mount preparations
dracut can generate a customized initrams image which contains only whatever is
dracut can generate a customized initramfs image which contains only whatever is
necessary to boot some particular computer, such as ATA, SCSI and filesystem
kernel modules (host-only mode).
@@ -142,7 +142,7 @@ The following steps are executed during a shutdown:
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
The old root is then mounted on /oldroot.
/usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to umount every /oldroot mount and calls the various
* shutdown will try to unmount every /oldroot mount and calls the various
shutdown hooks from the dracut modules
This ensures, that all devices are disassembled and unmounted cleanly.
@@ -162,9 +162,6 @@ include::dracut.cmdline.7.asc[]
[[lsinitrd1]]
include::lsinitrd.1.asc[]
[[mkinitrd8]]
include::mkinitrd.8.asc[]
= Developer Manual
:leveloffset: 1

View File

@@ -3,6 +3,7 @@ DRACUT.BOOTUP(7)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----

View File

@@ -3,6 +3,7 @@ DRACUT.CMDLINE(7)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -55,7 +56,7 @@ root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
[listing]
.Example
--
rootfstype=ext3
rootfstype=ext4
--
**rootflags=**__<mount options>__::
@@ -112,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.
@@ -130,7 +134,7 @@ menuentry 'Live Fedora 20' --class fedora --class gnu-linux --class gnu --class
Misc
~~~~
**rd.emergency=**__[reboot|poweroff|halt]__::
specify, what action to execute in case of a critical failure. rd.shell=0 also
specify, what action to execute in case of a critical failure. rd.shell=0 must also
be specified.
**rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
@@ -147,7 +151,7 @@ Misc
**rd.retry=**__<seconds>__::
specify how long dracut should retry the initqueue to configure devices.
The default is 30 seconds. After 2/3 of the time, degraded raids are force
The default is 180 seconds. After 2/3 of the time, degraded raids are force
started. If you have hardware, which takes a very long time to announce its
drives, you might want to extend this value.
@@ -163,10 +167,16 @@ Misc
specify the controlling terminal for the console.
This is useful, if you have multiple "console=" arguments.
**rd.shutdown.timeout.umount=**__<seconds>__::
specify how long dracut should wait for an individual umount to finish
during shutdown. This avoids the system from blocking when unmounting a file
system cannot complete and waits indefinitely. Value '0' means to wait
'forever'. The default is 90 seconds.
[[dracutkerneldebug]]
Debug
~~~~~
If you are dropped to an emergency shell, the file
If you are dropped to an emergency shell, the file
_/run/initramfs/rdsosreport.txt_ is created, which can be saved to a (to be
mounted by hand) partition (usually /boot) or a USB stick. Additional debugging
info can be produced by adding **rd.debug** to the kernel command line.
@@ -187,9 +197,9 @@ 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:
+
----
@@ -197,17 +207,21 @@ 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**::
drop to a shell at the end
**rd.break=**__{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}__::
drop to a shell on defined breakpoint
drop to a shell before the defined breakpoint starts
**rd.udev.info**::
set udev to loglevel info
@@ -242,7 +256,7 @@ rd.vconsole.keymap=de-latin1-nodeadkeys
[listing]
.Example
--
rd.vconsole.font=LatArCyrHeb-16
rd.vconsole.font=eurlatgr
--
**rd.vconsole.font.map=**__<console map base file name>__::
@@ -276,12 +290,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
@@ -297,6 +311,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
@@ -318,22 +334,37 @@ crypto LUKS
crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_
ends with '.gpg' it's considered to be key encrypted symmetrically with GPG.
You will be prompted for password on boot. GPG support comes with
'crypt-gpg' module which needs to be added explicitly.
NB: If systemd is included in the dracut initrd, dracut's built in
removable device keying support won't work. systemd will prompt for
a password from the console even if you've supplied **rd.luks.key**.
You may be able to use standard systemd *fstab*(5) syntax to
get the same effect. If you do need **rd.luks.key** to work,
you will have to exclude the "systemd" dracut module and any modules
that depend on it. See *dracut.conf*(5) and
https://bugzilla.redhat.com/show_bug.cgi?id=905683 for more
information.
**rd.luks.key=**_<keypath>[:<keydev>[:<luksdev>]]_::
_<keypath>_ is the pathname of a key file, relative to the root
of the filesystem on some device. It's REQUIRED. When
_<keypath>_ ends with '.gpg' it's considered to be key encrypted
symmetrically with GPG. You will be prompted for the GPG password on
boot. GPG support comes with the 'crypt-gpg' module, which needs to be
added explicitly.
+
_keydev_ is a device on which key file resides. It might be kernel name of
devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label
(prefix with "LABEL="). You don't have to specify full UUID. Just its beginning
will suffice, even if its ambiguous. All matching devices will be probed.
This parameter is recommended, but not required. If not present, all block
devices will be probed, which may significantly increase boot time.
_<keydev>_ identifies the device on which the key file resides. It may
be the kernel name of the device (should start with "/dev/"), a UUID
(prefixed with "UUID=") or a label (prefix with "LABEL="). You don't
have to specify a full UUID. Just its beginning will suffice, even if
its ambiguous. All matching devices will be probed. This parameter is
recommended, but not required. If it's not present, all block devices will
be probed, which may significantly increase boot time.
+
If _luksdev_ is given, the specified key will only be applied for that LUKS
device. Possible values are the same as for _keydev_. Unless you have several
LUKS devices, you don't have to specify this parameter. The simplest usage is:
If _<luksdev>_ is given, the specified key will only be used for
the specified LUKS device. Possible values are the same as for
_<keydev>_. Unless you have several LUKS devices, you don't have to
specify this parameter. The simplest usage is:
+
[listing]
.Example
@@ -342,30 +373,91 @@ rd.luks.key=/foo/bar.key
--
+
As you see, you can skip colons in such a case.
+
[NOTE]
===============================
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
to crypsetup luksFormat with _-d -_, too!
Your LUKS partition must match your key file.
Here follows example for key encrypted with GPG:
dracut provides keys to cryptsetup with _-d_ (an older alias for
_--key-file_). This uses the entire binary
content of the key file as part of the secret. If
you pipe a password into cryptsetup *without* _-d_ or _--key-file_,
it will be treated as text user input, and only characters before
the first newline will be used. Therefore, when you're creating
an encrypted partition for dracut to mount, and you pipe a key into
_cryptsetup luksFormat_,you must use _-d -_.
Here is an example for a key encrypted with GPG (warning:
_--batch-mode_ will overwrite the device without asking for
confirmation):
[listing]
--
gpg --quiet --decrypt rootkey.gpg | \
cryptsetup -d - -v --cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3
cryptsetup --batch-mode --key-file - \
luksFormat /dev/sda47
--
If you use plain keys, just add path to _-d_ option:
If you use unencrypted key files, just use the key file pathname
instead of the standard input. For a random key with 256 bits of
entropy, you might use:
[listing]
--
cryptsetup -d rootkey.key -v --cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3
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.
===============================
**rd.luks.key.tout=0**::
specify how many times dracut will try to read the keys specified in in
rd.luk.key. This gives a chance to the removable device containing the key
to initialise.
MD RAID
~~~~~~~
**rd.md=0**::
@@ -402,6 +494,9 @@ MULTIPATH
**rd.multipath=0**::
disable multipath detection
**rd.multipath=default**::
use default multipath settings
FIPS
~~~~
**rd.fips**::
@@ -485,23 +580,37 @@ USB Android phone::
* enp0s29u1u2
=====================
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
The following options are supported by the 'network-legacy' dracut
module. Other network modules might support a slightly different set of
options; refer to the documentation of the specific network module in use. For
NetworkManager, see *nm-initrd-generator*(8).
**ip=**__{dhcp|on|any|dhcp6|auto6|either6|link6|single-dhcp}__::
dhcp|on|any::: get ip from dhcp server from all interfaces. If netroot=dhcp,
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
with a valid DHCP root-path.
single-dhcp::: Send DHCP on all available interfaces in parallel, as
opposed to one after another. After the first DHCP response is received,
stop DHCP on all other interfaces. This gives the fastest boot time by
using the IP on interface for which DHCP succeeded first during early boot.
Caveat: Does not apply to Network Manager.
auto6::: IPv6 autoconfiguration
dhcp6::: IPv6 DHCP
either6::: if auto6 fails, then dhcp6
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
link6::: bring up interface for IPv6 link-local addressing
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6|link6}__[:[__<mtu>__][:__<macaddr>__]]::
This parameter can be specified multiple times.
+
=====================
dhcp|on|any|dhcp6::: get ip from dhcp server on a specific interface
auto6::: do IPv6 autoconfiguration
link6::: bring up interface for IPv6 link local address
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
cannot be used in conjunction with the **ifname** argument for the
same <interface>.
@@ -528,7 +637,7 @@ same <interface>.
number, encoding the network prefix length.
**ifname=**__<interface>__:__<MAC>__::
Assign network device name <interface> (ie "bootnet") to the NIC with
Assign network device name <interface> (i.e. "bootnet") to the NIC with
MAC <MAC>.
+
WARNING: Do **not** use the default kernel naming scheme for the interface name,
@@ -571,7 +680,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)
@@ -586,9 +695,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
@@ -604,7 +717,7 @@ NFS
":" or "," and are separated by ",".
**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
netroot=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified.
+
[listing]
@@ -627,7 +740,7 @@ NFS
Default is 1.
**rd.net.timeout.dhcp=**__<arg>__::
If this option is set, dhclient is called with "-timeout <arg>".
If this option is set, dhclient is called with "--timeout <arg>".
**rd.net.timeout.iflink=**__<seconds>__::
Wait <seconds> until link shows up. Default is 60 seconds.
@@ -645,7 +758,7 @@ NFS
Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.
**rd.net.timeout.carrier=**__<seconds>__::
Wait <seconds> until carrier is recognized. Default is 5 seconds.
Wait <seconds> until carrier is recognized. Default is 10 seconds.
CIFS
~~~
@@ -757,6 +870,9 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
Turn on iBFT autoconfiguration for the interfaces
**rd.iscsi.mp** **rd.iscsi.mp=1**:
Configure all iBFT interfaces, not only used for booting (multipath)
**rd.iscsi.waitnet=0**:
Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.
@@ -765,6 +881,9 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
FCoE
~~~~
**rd.fcoe=0**::
disable FCoE and lldpad
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
_<MAC>_ or EDD settings. The second argument specifies if DCB
@@ -774,6 +893,45 @@ FCoE
+
NOTE: letters in the MAC-address must be lowercase!
NVMf
~~~~
**rd.nonvmf**::
Disable NVMf
**rd.nvmf.nonbft**::
Disable connecting to targets from the NVMe Boot Firmware Table. Without
this parameter, NBFT connections will take precedence over _rd.nvmf.discover_.
**rd.nvmf.nostatic**::
Disable connecting to targets that have been statically configured when
the initramfs was built. Targets specified with rd.nvmf.discover on the
kernel command line will still be tried.
**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.
This parameter can be specified multiple times.
+
[listing]
.Examples
--
rd.nvmf.discover=tcp,192.168.10.10,,4420
rd.nvmf.discover=fc,nn-0x201700a05634f5bf:pn-0x201900a05634f5bf,nn-0x200000109b579ef3:pn-0x100000109b579ef3
--
**rd.nvmf.discover=fc,auto**::
This special syntax determines that Fibre Channel autodiscovery
is to be used rather than regular NVMe discovery. It takes precedence
over all other _rd.nvmf.discover=_ arguments.
NBD
~~~
**root=**??? **netroot=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
@@ -783,8 +941,8 @@ NOTE:
If "exportname" instead of "port" is given the standard port is used.
Newer versions of nbd are only supported with "exportname".
**root=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
**root=/dev/root netroot=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port/exportname>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
netroot=dhcp alone directs initrd to look at the DHCP root-path where NBD
options can be specified. This syntax is only usable in cases where you are
directly mounting the volume as the rootfs.
+
@@ -792,6 +950,25 @@ NOTE:
If "exportname" instead of "port" is given the standard port is used.
Newer versions of nbd are only supported with "exportname".
VIRTIOFS
~~~~~~~~
**root=**virtiofs:__<mount-tag>__::
mount virtiofs share using the tag <mount-tag>.
The tag name is arbitrary and must match the tag given in the qemu '-device' command.
**rootfstype=**virtiofs **root=**__<mount-tag>__::
mount virtiofs share using the tag <mount-tag>.
The tag name is arbitrary and must match the tag given in the qemu '-device' command.
Both formats are supported by the 'virtiofs' dracut module.
See https://gitlab.com/virtio-fs/virtiofsd for more information.
[listing]
.Example
--
root=virtiofs:host rw
--
DASD
~~~~
**rd.dasd=**....::
@@ -825,6 +1002,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
@@ -944,6 +1126,13 @@ NOTE: There must be enough free RAM available to hold the complete image.
+
This method is very suitable for diskless boots.
**rd.minmem=**__<megabyte>__::
Specify minimum free RAM in MB after copying a live disk image into memory.
The default is 1024.
+
This parameter only applies together with the parameters rd.writable.fsimg
or rd.live.ram.
**root=**live:__<url>__::
Boots a live image retrieved from __<url>__. Requires the dracut 'livenet'
module. Valid handlers: __http, https, ftp, torrent, tftp__.
@@ -981,7 +1170,7 @@ used to persist the changes made to the device specified by the
**root=live:__<url>__** option.
+
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
`/<+++<b>rd.live.dir</b>+++>/overlay-<label>-<uuid>`, where _<label>_ is the
`/<rd.live.dir>/overlay-<label>-<uuid>`, where _<label>_ is the
device LABEL, and _<uuid>_ is the device UUID.
* _none_ (the word itself) specifies that no overlay will be used, such as when
an uncompressed, writable live root filesystem is available.
@@ -998,6 +1187,10 @@ rd.live.overlay=/dev/sdb1:persistent-overlay.img
rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
--
**rd.live.overlay.cowfs=**__[btrfs|ext4|xfs]__::
Specifies the filesystem to use when formatting the overlay partition.
The default is ext4.
**rd.live.overlay.size=**__<size_MiB>__::
Specifies a non-persistent Device-mapper overlay size in MiB. The default is
_32768_.
@@ -1104,8 +1297,8 @@ masterkey=/etc/keys/kmk-trusted.blob
masterkeytype=trusted
--
**evmkey=**__<EVM key path name>__::
Set the path name of the EVM key.
**evmkey=**__<EVM HMAC key path name>__::
Set the path name of the EVM HMAC key.
+
[listing]
.Example
@@ -1113,6 +1306,15 @@ masterkeytype=trusted
evmkey=/etc/keys/evm-trusted.blob
--
**evmx509=**__<EVM X.509 cert path name>__::
Set the path name of the EVM X.509 certificate.
+
[listing]
.Example
--
evmx509=/etc/keys/x509_evm.der
--
**ecryptfskey=**__<eCryptfs key path name>__::
Set the path name of the eCryptfs key.
+
@@ -1184,10 +1386,6 @@ rd_LVM_LV:: rd.lvm.lv
rd_NO_LVM:: rd.lvm=0
rd_LVM_SNAPSHOT:: rd.lvm.snapshot
rd_LVM_SNAPSIZE:: rd.lvm.snapsize
rd_LVM_VG:: rd.lvm.vg
rd_NO_MDADMCONF:: rd.md.conf=0

View File

@@ -3,6 +3,7 @@ DRACUT.CONF(5)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -35,20 +36,20 @@ Configuration files must have the extension .conf; other extensions are ignored.
Add a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
*dracutmodules+=*" __<dracut modules>__ "::
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
This option forces dracut to only include the specified dracut modules.
In most cases the "add_dracutmodules" option is what you want to use.
*force_add_dracutmodules+=*" __<dracut modules>__ "::
Force to add a space-separated list of dracut modules to the default set of
modules, when host-only mode is specified. This parameter can be specified
multiple times.
*omit_dracutmodules+=*" __<dracut modules>__ "::
Omit a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
*drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to exclusively include in
the initramfs. The kernel modules have to be specified without the ".ko"
suffix.
*dracutmodules+=*" __<dracut modules>__ "::
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
This option forces dracut to only include the specified dracut modules.
In most cases the "add_dracutmodules" option is what you want to use.
*add_drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to add to the initramfs.
@@ -62,15 +63,24 @@ Configuration files must have the extension .conf; other extensions are ignored.
Specify a space-separated list of kernel modules not to add to the
initramfs. The kernel modules have to be specified without the ".ko" suffix.
*drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to exclusively include in
the initramfs. The kernel modules have to be specified without the ".ko"
suffix.
*filesystems+=*" __<filesystem names>__ "::
Specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs.
*drivers_dir=*"__<kernel modules directory>__"::
Specify the directory, where to look for kernel modules
Specify the directory where to look for kernel modules.
*fw_dir+=*" :__<dir>__[:__<dir>__ ...] "::
Specify additional directories, where to look for firmwares, separated by :
Specify additional colon-separated list of directories where to look for
firmware files.
*libdirs+=*" __<dir>__[ __<dir>__ ...] "::
Specify a space-separated list of directories where to look for libraries.
*install_items+=*" __<file>__[ __<file>__ ...] "::
Specify additional files to include in the initramfs, separated by spaces.
@@ -79,27 +89,61 @@ 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|lzop|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.
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".
*squash_compress=*"__{<compressor [args ...]>}__"::
Compress the squashfs image using the passed compressor and compressor
specific options for mksquashfs. You can refer to mksquashfs manual for
supported compressors and compressor specific options. If squash module is
not called when building the initramfs, this option will not take effect.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
Strip binaries in the initramfs (default=yes).
*aggressive_strip=*"__{yes|no}__"::
Strip more than just debug symbol and sections, for a smaller initramfs
build. The "do_strip=yes" option must also be specified (default=no).
*do_hardlink=*"__{yes|no}__"::
Hardlink files in the initramfs (default=yes).
*prefix=*" __<directory>__ "::
Prefix initramfs files with __<directory>__.
*hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
Host-only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration
(default=no).
*hostonly_mode=*"__{sloppy|strict}__"::
Specify the host-only mode to use (default=sloppy).
In "sloppy" host-only mode, extra drivers and modules will be installed, so
minor hardware change won't make the image unbootable (e.g. changed
keyboard), and the image is still portable among similar hosts.
With "strict" mode enabled, anything not necessary for booting the local
host in its current state will not be included, and modules may do some
extra job to save more space. Minor change of hardware or environment could
make the image unbootable.
*hostonly_cmdline=*"__{yes|no}__"::
If set to "yes", store the kernel command line arguments needed in the initramfs
If set to "yes", store the kernel command line arguments needed in the
initramfs. If **hostonly="yes"** and this option is not configured, it's
automatically set to "yes".
*hostonly_nics+=*" [__<nic>__[ __<nic>__ ...]] "::
Only enable listed NICs in the initramfs. The list can be empty, so other
modules can install only the necessary network drivers.
*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label"
_<policy>_ can be any directory name found in /dev/disk (e.g. "by-uuid",
"by-label"), or "mapper" to use /dev/mapper device names (default=mapper).
*tmpdir=*"__<temporary directory>__"::
Specify temporary directory to use.
@@ -111,21 +155,21 @@ provide a valid _/etc/fstab_.
====
*use_fstab=*"__{yes|no}__"::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
Use _/etc/fstab_ instead of _/proc/self/mountinfo_ (default=no).
*add_fstab+=*" __<filename>__ "::
Add entries of __<filename>__ to the initramfs /etc/fstab.
*add_device+=*" __<device>__ "::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
This can be useful in host-only mode for resume support when your swap is on
LVM an encrypted partition.
*mdadmconf=*"__{yes|no}__"::
Include local _/etc/mdadm.conf_ (default=yes)
Include local _/etc/mdadm.conf_ (default=no).
*lvmconf=*"__{yes|no}__"::
Include local _/etc/lvm/lvm.conf_ (default=yes)
Include local _/etc/lvm/lvm.conf_ (default=no).
*fscks=*" __<fsck tools>__ "::
Add a space-separated list of fsck tools. If nothing is specified, the
@@ -134,19 +178,19 @@ provide a valid _/etc/fstab_.
(non-existing tools are ignored).
*nofscks=*"__{yes|no}__"::
If specified, inhibit installation of any fsck tools.
If specified, inhibit installation of any fsck tools (default=no).
*ro_mnt=*"__{yes|no}__"::
Mount _/_ and _/usr_ read-only by default.
Mount _/_ and _/usr_ read-only by default (default=no).
*kernel_cmdline=*"__parameters__"::
Specify default kernel command line parameters
Specify default kernel command line parameters.
*kernel_only=*"__{yes|no}__"::
Only install kernel drivers and firmware files. (default=no)
Only install kernel drivers and firmware files (default=no).
*no_kernel=*"__{yes|no}__"::
Do not install kernel drivers and firmware files (default=no)
Do not install kernel drivers and firmware files (default=no).
*acpi_override=*"__{yes|no}__"::
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
@@ -157,29 +201,47 @@ provide a valid _/etc/fstab_.
archive. This cpio archive gets glued (concatenated, uncompressed one
must be the first one) to the compressed cpio archive. The first,
uncompressed cpio archive is for data which the kernel must be able
to access very early (and cannot make use of uncompress alogrithms yet)
to access very early (and cannot make use of uncompress algorithms yet)
like microcode or ACPI tables (default=no).
*acpi_table_dir=*"__<dir>__"::
Directory to search for ACPI tables if acpi_override= is set to yes.
*early_microcode=*"{yes|no}"::
Combine early microcode with ramdisk (default=yes)
Combine early microcode with ramdisk (default=yes).
*stdloglvl*="__\{0-6\}__"::
Set logging to standard error level.
Specify logging level for standard error (default=4).
[NOTE]
===============================
Logging levels:
----
0 - suppress any messages
1 - only fatal errors
2 - all errors
3 - warnings
4 - info
5 - debug info (here starts lots of output)
6 - trace info (and even more)
----
===============================
*sysloglvl*="__\{0-6\}__"::
Set logging to syslog level.
Specify logging level for syslog (default=0).
*fileloglvl=*"__\{0-6\}__"::
Set logging to file level.
Specify logging level for logfile (default=4).
*logfile=*"__<file>__"::
Path to log file.
Path to logfile.
*sshkey=*"__<file>__"::
SSH key file used with ssh-client module.
*show_modules=*"__{yes|no}__"::
Print the name of the included modules to standard output during build.
Print the name of the included modules to standard output during build
(default=no).
*i18n_vars=*"__<variable mapping>__"::
Distribution specific variable mapping.
@@ -187,26 +249,71 @@ provide a valid _/etc/fstab_.
*i18n_default_font=*"__<fontname>__"::
The font <fontname> to install, if not specified otherwise.
Default is "LatArCyrHeb-16".
Default is "eurlatgr".
*i18n_install_all=*"__{yes|no}__"::
Install everything regardless of generic or hostonly mode.
Install everything regardless of generic or host-only mode (default=no).
*reproducible=*"__{yes|no}__"::
Create reproducible images.
Create reproducible images (default=no).
*loginstall=*"__<DIR>__"::
Log all files installed from the host to _<DIR>_.
*noimageifnotneeded=*"__{yes|no}__"::
Do not create an image in host-only mode, if no kernel driver is needed
and no /etc/cmdline/*.conf will be generated into the initramfs
(default=no).
*uefi_stub=*"_<FILE>_"::
Specifies the UEFI stub loader, which will load the attached kernel, initramfs and
kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
*loginstall=*"__<directory>__"::
Log all files installed from the host to _<directory>_.
*kernel_image=*"_<FILE>_"::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
*uefi=*"__{yes|no}__"::
Instead of creating an initramfs image, dracut will create an UEFI
executable, which can be executed by an UEFI BIOS (default=no).
The default output filename is
_<EFI>/EFI/Linux/linux-$kernel$-<MACHINE_ID>-<BUILD_ID>.efi_.
<EFI> might be _/efi_, _/boot_ or _/boot/efi_ depending on where the ESP
partition is mounted. The <BUILD_ID> is taken from BUILD_ID in
_/usr/lib/os-release_ or if it exists _/etc/os-release_ and is left out,
if BUILD_ID is non-existant or empty.
*machine_id=*"__{yes|no}__"::
Affects the default output filename of the UEFI executable, including the
<MACHINE_ID> part (default=yes).
*uefi_stub=*"_<file>_"::
Specifies the UEFI stub loader, which will load the attached kernel,
initramfs and kernel command line and boots the kernel. The default is
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_.
*uefi_splash_image=*"_<file>_"::
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**)
image format.
*uefi_secureboot_cert=*"_<file>_", *uefi_secureboot_key=*"_<file>_"::
Specifies a certificate and corresponding key, which are used to sign the
created UEFI executable.
Requires both certificate and key need to be specified and _sbsign_ to be
installed.
*uefi_secureboot_engine=*"_parameter_"::
Specifies an engine to use when signing the created UEFI executable. E.g. "pkcs11"
*kernel_image=*"_<file>_"::
Specifies the kernel image, which to include in the UEFI executable. The
default is _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or
_/boot/vmlinuz-<KERNEL-VERSION>_.
*enhanced_cpio=*"__{yes|no}__"::
Attempt to use the dracut-cpio binary, which optimizes archive creation for
copy-on-write filesystems (default=no).
When specified, initramfs archives are also padded to ensure optimal data
alignment for extent sharing. To retain reflink data deduplication benefits,
this should be used alongside the **compress="cat"** and **do_strip="no"**
parameters, with initramfs source files, **tmpdir** staging area and
destination all on the same copy-on-write capable filesystem.
*parallel=*"__{yes|no}__"::
If set to _yes_, try to execute tasks in parallel (currently only supported
for _--regenerate-all_).
Files
-----

View File

@@ -3,6 +3,7 @@ DRACUT.MODULES(7)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -92,18 +93,23 @@ 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
if all scripts herein return 0 the main loop will be ended.
Abritary scripts can be added here, to loop in the
Arbitrary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
@@ -145,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.
@@ -158,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_.
@@ -266,7 +272,7 @@ installs an executable/script <src> in the dracut hook <hookdir> with priority
==== inst_rules <udevrule> [ <udevrule> ...]
installs one ore more udev rules. Non-existant udev rules are reported, but do
installs one or more udev rules. Non-existant udev rules are reported, but do
not let dracut fail.
==== instmods <kernelmodule> [ <kernelmodule> ... ]

View File

@@ -5,9 +5,13 @@ To create a initramfs image, the most simple command is:
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
system tools. The image, depending on bootloader specification, can be
_/efi/_++<machine-id>++_/_++<kernel-version>++_/initrd_,
_/boot/_++<machine-id>++_/_++<kernel-version>++_/initrd_,
_/boot/efi/_++<machine-id>++_/_++<kernel-version>++_/initrd_,
_/lib/modules/_++<kernel-version>++_/initrd_ or
_/boot/initramfs-_++<kernel-version>++_.img_ and contains the kernel modules of
the currently active kernel with version _++<kernel-version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
@@ -62,7 +66,7 @@ _/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add bootchart initramfs-bootchart.img
# dracut --add module initramfs-module.img
----
To see a list of available dracut modules, use the --list-modules option:
@@ -83,7 +87,7 @@ on the command line:
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or the drivers vaiable in the _/etc/dracut.conf_
on the command line or the drivers variable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
@@ -94,7 +98,7 @@ An initramfs generated without the "hostonly" mode, does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completly change your root partition (move it inside a md
image. So, you could completely change your root partition (move it inside a md
raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.
@@ -103,7 +107,7 @@ The kernel command line can also be provided by the dhcp server with the
root-path option. See <<NetworkBoot>>.
For a full reference of all kernel command line parameters,
see *dracut.cmdline*(5).
see *dracut.cmdline*(7).
To get a quick start for the suitable kernel command line on your system,
use the __--print-cmdline__ option:
@@ -151,9 +155,9 @@ If your root partition is on the network see <<NetworkBoot>>.
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.
A typical german kernel command would contain:
A typical german kernel command line would contain:
----
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
----
Setting these options can override the setting stored on your system, if you use
@@ -161,8 +165,8 @@ a modern init system, like systemd.
==== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
specific kernel module. To do this, just add rd.driver.blacklist=_++<kernel
module name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
@@ -185,7 +189,7 @@ This turns off every automatic assembly of LVM, MD raids, DM raids and
crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the posibility to turn it on on demand.
process, but then you would lose the possibility to turn it on on demand.
[[Injecting]]
@@ -228,10 +232,10 @@ creation time.
----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
# dracut --install 'strace fsck.ext4 ssh' initramfs-dbg.img
----
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
This will create an initramfs with the strace, fsck.ext4 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.
@@ -262,7 +266,7 @@ For example for a NFS image, you would do:
----
# dracut -m "nfs network base" initramfs-nfs-only.img
# dracut -m "nfs network base" initramfs-nfs-only.img
----
Then you would boot from this image with your target machine and reduce the size
@@ -279,10 +283,7 @@ This will reduce the size of the initramfs image significantly.
== Troubleshooting
If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
situation.
[[identifying-your-problem-area]]
=== Identifying your problem area
@@ -349,7 +350,7 @@ serial --unit=0 --speed=9600
terminal --timeout=5 serial console
----
+
. Also in _/boot/grub2/grub.cfg_, add the following boot arguemnts to the ''kernel''
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
line:
+
----
@@ -467,7 +468,7 @@ any logical volumes.
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext4"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+

View File

@@ -3,6 +3,7 @@ LSINITRD(1)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -12,12 +13,15 @@ SYNOPSIS
--------
*lsinitrd* ['OPTION...'] [<image> [<filename> [<filename> [...] ]]]
*lsinitrd* ['OPTION...'] -k <kernel-version>
*lsinitrd* ['OPTION...'] -k <kernel version>
DESCRIPTION
-----------
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
lsinitrd uses the default image _/efi/<machine-id>/<kernel-version>/initrd_,
_/boot/<machine-id>/<kernel-version>/initrd_,
_/boot/efi/<machine-id>/<kernel-version>/initrd_,
_/lib/modules/<kernel-version>/initrd_ or
_/boot/initramfs-<kernel-version>.img_.
OPTIONS
@@ -52,7 +56,7 @@ OPTIONS
AVAILABILITY
------------
The lsinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
link:$$https://github.com/dracutdevs/dracut$$[https://github.com/dracutdevs/dracut]
AUTHORS
-------

View File

@@ -1,226 +0,0 @@
#!/bin/bash --norc
kver=$(uname -r)
boot_dir="/boot"
quiet=0
host_only=0
force=0
error() { echo "$@" >&2; }
usage () {
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
$cmd " [--image-version] [--with=<module>]"
$cmd " [--nocompress]"
$cmd " <initrd-image> <kernel-version>"
$cmd ""
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
[[ $1 = '-n' ]] && exit 0
exit 1
}
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
param="$1"
local rematch='^[^=]*=(.*)$' result
if [[ $2 =~ $rematch ]]; then
read "$param" <<< "${BASH_REMATCH[1]}"
else
for ((i=3; $i <= $#; i++)); do
# Only read next arg if it not an arg itself.
if [[ ${@:$i:1} = -* ]];then
break
fi
result="$result ${@:$i:1}"
# There is no way to shift our callers args, so
# return "no of args" to indicate they should do it instead.
done
read "$1" <<< "$result"
return $(($i - 3))
fi
}
# Taken over from SUSE mkinitrd
default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
s390|s390x)
regex='image'
;;
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
regex='vmlinuz'
;;
arm*)
regex='[uz]Image'
;;
aarch64)
regex='Image'
;;
*) regex='vmlinu.'
;;
esac
# user mode linux
if grep -q UML /proc/cpuinfo; then
regex='linux'
fi
kernel_images=""
initrd_images=""
for kernel_image in $(ls $boot_dir \
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
| grep -v kdump$ ) ; do
# Note that we cannot check the RPM database here -- this
# script is itself called from within the binary kernel
# packages, and rpm does not allow recursive calls.
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
kernel_version=$(/usr/bin/get_kernel_version \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \
-n "$kernel_version" -a \
-d "/lib/modules/$kernel_version" ]; then
kernel_images="$kernel_images $boot_dir/$kernel_image"
initrd_images="$initrd_images $boot_dir/$initrd_image"
fi
done
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
host_only=1
force=1
}
while (($# > 0)); do
case ${1%%=*} in
--with-usb) read_arg usbmodule "$@" || shift $?
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
unset usbmodule;;
--with-avail) read_arg modname "$@" || shift $?
basicmodules="$basicmodules $modname";;
--with) read_arg modname "$@" || shift $?
basicmodules="$basicmodules $modname";;
--version)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-f|--force) force=1;;
--preload) read_arg modname "$@" || shift $?
basicmodules="$basicmodules $modname";;
--image-version) img_vers=yes;;
--rootfs|-d) read_arg rootfs "$@" || shift $?
dracut_args="${dracut_args} --filesystems $rootfs";;
--nocompress) dracut_args="$dracut_args --no-compress";;
--help) usage -n;;
--builtin) ;;
--without*) ;;
--without-usb) ;;
--fstab*) ;;
--ifneeded) ;;
--omit-scsi-modules) ;;
--omit-ide-modules) ;;
--omit-raid-modules) ;;
--omit-lvm-modules) ;;
--omit-dmraid) ;;
--allow-missing) ;;
--net-dev*) ;;
--noresume) ;;
--rootdev*) ;;
--thawdev*) ;;
--rootopts*) ;;
--root*) ;;
--loopdev*) ;;
--loopfs*) ;;
--loopopts*) ;;
--looppath*) ;;
--dsdt*) ;;
--bootchart) ;;
-s) ;;
--quiet|-q) quiet=1;;
-b) read_arg boot_dir "$@" || shift $?
if [ ! -d $boot_dir ];then
error "Boot directory $boot_dir does not exist"
exit 1
fi
;;
-k) # Would be nice to get a list of images here
read_arg kernel_images "$@" || shift $?
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
host_only=1
force=1
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
targets="$targets $boot_dir/$initrd_image"
done
;;
*) if [[ ! $targets ]]; then
targets=$1
elif [[ ! $kernels ]]; then
kernels=$1
else
usage
fi;;
esac
shift
done
[[ $targets && $kernels ]] || default_kernel_images
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
echo "Creating: target|kernel|dracut args|basicmodules "
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
target="${targets[$i]}-${kernels[$i]}"
else
target="${targets[$i]}"
fi
kernel="${kernels[$i]}"
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
echo "$target|$kernel|$dracut_args|$basicmodules"
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel" &>/dev/null
else
dracut $dracut_args "$target" "$kernel" &>/dev/null
fi
else
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel"
else
dracut $dracut_args "$target" "$kernel"
fi
fi
done

View File

@@ -1,106 +0,0 @@
MKINITRD(8)
===========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs
SYNOPSIS
--------
*mkinitrd* ['OPTION...']
DESCRIPTION
-----------
*mkinitrd* creates an initramfs image <initrd-image> for the kernel with
version <kernel-version> by calling *dracut*.
[IMPORTANT]
This version of mkinitrd is provided for compatibility with older
versions of mkinitrd. If a more fine grained control over the
resulting image is needed, *dracut* should be called directly.
OPTIONS
-------
**-R, --version**::
print info about the version
**-k** _<kernel_list>_::
List of kernel images for which initrd files are created (relative
to _boot_dir_), Image name should begin with the following string,
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
for everything else.
**-i** _<initrd_list>_::
List of file names (relative to _boot_dir_) for the initrd; positions
have to match the _kernel_list_. Defaults to _initrd_.
**-m** _<module_list>_::
Modules to include in initrd, defaults to _INITRD_MODULES_ variable
in */etc/sysconfig/kernel*.
**-f** _<feature_list>_::
Features to be enabled for the initrd. In general mkinitrd
configures the initrd for the root device it is started from. With
this option additional feature can be enabled.
**-b** _<bootdir>_::
Boot directory, defaults to */boot*, where the initrd is created.
**-d** _<root_device>_::
Root device, defaults to the device from which the root_dir is
mounted; overwrites the rootdev environment variable if set
**-s** _<size>_::
Add splash animation and bootscreen to initrd.
**-D** _<interface>::
Run dhcp on the specified interface (for example "eth0").
**-I** _<interface>::
Configure the specified interface statically.
**-a** _<acpi_dsdt>::
Attach compiled ACPI DSDT (Differentiated System Description Table)
to initrd. This replaces the DSDT of the BIOS. Defaults to the
_ACPI_DSDT_ variable in */etc/sysconfig/kernel*.
**-M** _<map>::
System.map file to use.
**-B**::
Dont run the *update-bootloader(8)* script after the initrd(s) have
been created. This is useful if you call mkinitrd(8) for anything
else than the running system.
**-A**::
Create a so called "monster initrd" which includes all available
features and modules. This calls dracut with --no-hostonly and
--no-hostonly-cmdline parameters internally, instead of the default
--hostonly and --hostonly-cmdline.
**-v, --verbose**::
increase verbosity level
**-L**::
Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
testing if you dont want to clutter the system log.
**--help**::
print a help message and exit.
AVAILABILITY
------------
The mkinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer, Hannes Reinecke
SEE ALSO
--------
*dracut*(8)
*update-bootloader*(8)

View File

@@ -1,393 +0,0 @@
#!/bin/bash --norc
#
# mkinitrd compability wrapper for SUSE.
#
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
boot_dir="/boot"
quiet=0
logfile=/var/log/YaST2/mkinitrd.log
dracut_cmd=dracut
error() { echo "$@" >&2; }
usage () {
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: ${0##*/} [options]"
$cmd ""
$cmd " Create initial ramdisk images that contain all kernel modules needed"
$cmd " in the early boot process, before the root file system becomes"
$cmd " available."
$cmd " This usually includes SCSI and/or RAID modules, a file system module"
$cmd " for the root file system, or a network interface driver module for dhcp."
$cmd ""
$cmd " options:"
$cmd " -f \"feature list\" Features to be enabled when generating initrd."
$cmd " Available features are:"
$cmd " iscsi, md, multipath, lvm, lvm2,"
$cmd " ifup, fcoe, dcbd"
$cmd " -k \"kernel list\" List of kernel images for which initrd files are"
$cmd " created. Defaults to all kernels found in /boot."
$cmd " -i \"initrd list\" List of file names for the initrd; position have"
$cmd " match to \"kernel list\". Defaults to all kernels"
$cmd " found in /boot."
$cmd " -b boot_dir Boot directory. Defaults to /boot."
$cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp."
$cmd " -M map System.map file to use."
$cmd " -A Create a so called \"monster initrd\" which"
$cmd " includes all features and modules possible."
$cmd " -B Do not update bootloader configuration."
$cmd " -v Verbose mode."
$cmd " -L Disable logging."
$cmd " -h This help screen."
$cmd " -m \"module list\" Modules to include in initrd. Defaults to the"
$cmd " INITRD_MODULES variable in /etc/sysconfig/kernel"
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
$cmd " DOMU_INITRD_MODULES variable in"
$cmd " /etc/sysconfig/kernel."
$cmd " -d root_device Root device. Defaults to the device from"
$cmd " which / is mounted. Overrides the rootdev"
$cmd " enviroment variable if set."
$cmd " -j device Journal device"
$cmd " -D interface Run dhcp on the specified interface."
$cmd " -I interface Configure the specified interface statically."
$cmd " -a acpi_dsdt Obsolete, do not use."
$cmd " -s size Add splash animation and bootscreen to initrd."
[[ $1 = '-n' ]] && exit 0
exit 1
}
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
param="$1"
local rematch='^[^=]*=(.*)$' result
if [[ $2 =~ $rematch ]]; then
read "$param" <<< "${BASH_REMATCH[1]}"
else
for ((i=3; $i <= $#; i++)); do
# Only read next arg if it not an arg itself.
if [[ ${@:$i:1} = -* ]];then
break
fi
result="$result ${@:$i:1}"
# There is no way to shift our callers args, so
# return "no of args" to indicate they should do it instead.
done
read "$1" <<< "$result"
return $(($i - 3))
fi
}
# Helper functions to calculate ipconfig command line
calc_netmask() {
local prefix=$1
[ -z "$prefix" ] && return
mask=$(( 0xffffffff << (32 - $prefix) ))
byte1=$(( mask >> 24 ))
byte2=$(( mask >> 16 ))
byte3=$(( mask >> 8 ))
byte4=$(( mask & 0xff ))
netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);
echo $netmask
}
ipconfig() {
local interface=$1
local iplink macaddr broadcast gateway ipaddr prefix netmask
iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p')
macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p')
broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p')
gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p')
ipaddr=${iplink%%/*}
prefix=${iplink##*/}
netmask=$(calc_netmask $prefix)
echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}"
}
is_xen_kernel() {
local kversion=$1
local root_dir=$2
local cfg
for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
do
test -r $cfg || continue
grep -q "^CONFIG_XEN=y\$" $cfg
return
done
test $kversion != "${kversion%-xen*}"
return
}
# kernel_image_gz_from_image() and kernel_version_from_image() are helpers
# for arm* kernels which produce zImage files which cannot be read from
# get_kernel_version -> get rid of this workaround if possible
kernel_image_gz_from_image() {
local arch=$(uname -i)
local r=${1}.gz
# uImage kernels can't be extracted directly. Use the vmlinux.gz instead
r=${r//uImage/vmlinux}
# on ARM a zImage can't be extracted directly. Other platforms define it
# as a gzipped vmlinux file, but not ARM. So only on ARM, use vmlinux.gz.
if [[ $arch =~ arm ]] || [[ $arch =~ aarch ]]; then
r=${r//zImage/vmlinux}
fi
echo $r
}
kernel_version_from_image() {
local kernel_image="$1" kernel_image_gz=$(kernel_image_gz_from_image "$1")
if get_kernel_version "$kernel_image" 2>/dev/null; then
return
fi
get_kernel_version "$kernel_image_gz" 2>/dev/null
}
# Taken over from SUSE mkinitrd
default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
s390|s390x)
regex='image'
;;
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
regex='vmlinuz'
;;
arm*)
regex='[uz]Image'
;;
aarch64)
regex='Image'
;;
*) regex='vmlinu.'
;;
esac
kernel_images=""
initrd_images=""
for kernel_image in $(ls $boot_dir \
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
| grep -v kdump$ ) ; do
# Note that we cannot check the RPM database here -- this
# script is itself called from within the binary kernel
# packages, and rpm does not allow recursive calls.
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
kernel_version=$(kernel_version_from_image \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \
-n "$kernel_version" -a \
-d "/lib/modules/$kernel_version" ]; then
kernel_images="$kernel_images $boot_dir/$kernel_image"
initrd_images="$initrd_images $boot_dir/$initrd_image"
fi
done
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
}
while (($# > 0)); do
case ${1%%=*} in
-f) read_arg feature_list "$@" || shift $?
# Could be several features
;;
-k) # Would be nice to get a list of images here
read_arg kernel_images "$@" || shift $?
for kernel_image in $kernel_images;do
[ -L "/boot/$kernel_image" ] && kernel_image="$(readlink "/boot/$kernel_image")"
kernels="$kernels ${kernel_image#*-}"
done
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
[ -L "/boot/$initrd_image" ] && initrd_image="$(readlink "/boot/$initrd_image")"
# Check if the initrd_image contains a path.
# if not, then add the default boot_dir
dname=`dirname $initrd_image`
if [ "$dname" == "." ]; then
targets="$targets $boot_dir/$initrd_image";
else
targets="$targets $initrd_image";
fi
done
;;
-b) read_arg boot_dir "$@" || shift $?
if [ ! -d $boot_dir ];then
error "Boot directory $boot_dir does not exist"
exit 1
fi
;;
-t) read_arg tmp_dir "$@" || shift $?
dracut_args="${dracut_args} --tmpdir $tmp_dir"
;;
-M) read_arg map_file "$@" || shift $?
;;
-A) dracut_args="${dracut_args} --no-host-only";;
-B) skip_update_bootloader=1;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-L) logfile=;;
-h|--help) usage -n;;
-m) read_arg module_list "$@" || shift $? ;;
-u) read_arg domu_module_list "$@" || shift $?
echo "mkinitrd: DomU modules not yet supported" ;;
-d) read_arg rootfs "$@" || shift $?
dracut_args="${dracut_args} --filesystems $rootfs" ;;
-D) read_arg dhcp_if "$@" || shift $?
dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
;;
-I) read_arg static_if "$@" || shift $?
dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
;;
-a) read_arg acpi_dsdt "$@" || shift $?
echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
exit 1
;;
-s) read_arg boot_splash "$@" || shift $?
echo "mkinitrd: boot splash not yet supported"
exit 1
;;
-V) echo "mkinitrd: vendor scipts are no longer supported"
exit 1;;
--dracut)
read_arg dracut_cmd "$@" || shift $? ;;
--version|-R)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
--quiet|-q) quiet=1;;
*) if [[ ! $targets ]]; then
targets=$1
elif [[ ! $kernels ]]; then
kernels=$1
else
usage
fi;;
esac
shift
done
[[ $targets && $kernels ]] || default_kernel_images
if [[ ! $targets || ! $kernels ]];then
error "No kernel found in $boot_dir or bad modules dir in /lib/modules"
exit 1
fi
# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
dracut_args="${dracut_args} --force"
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
# Update defaults from /etc/sysconfig/kernel
if [ -f /etc/sysconfig/kernel ] ; then
. /etc/sysconfig/kernel
fi
[[ $module_list ]] || module_list="${INITRD_MODULES}"
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
shopt -s extglob
failed=""
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
target="${targets[$i]}-${kernels[$i]}"
else
target="${targets[$i]}"
fi
kernel="${kernels[$i]}"
if is_xen_kernel $kernel $rootfs ; then
modules_all="${module_list} ${domu_module_list}"
else
modules_all="${module_list}"
fi
# Remove leading and trailing spaces needs (set above): shopt -s extglob
modules_all=${modules_all%%+([[:space:]])}
modules_all=${modules_all##+([[:space:]])}
echo "Creating initrd: $target"
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
# Duplicate code: --force-drivers must not be called with empty string
# -> dracut bug workarounded ugly, because of complex whitespace
# expansion magics
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
[ $? -ne 0 ] && failed="$failed $target"
else
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
[ $? -ne 0 ] && failed="$failed $target"
fi
else
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
[ $? -ne 0 ] && failed="$failed $target"
else
$dracut_cmd $dracut_args "$target" "$kernel"
[ $? -ne 0 ] && failed="$failed $target"
fi
fi
done
if [ "$skip_update_bootloader" ] ; then
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
else
update-bootloader --refresh
[ $? -ne 0 ] && echo "Updating bootloader failed" && exit 1
fi
if [ "$failed" != "" ]; then
echo "Generating $failed targets failed"
exit 1
fi
exit 0

View File

@@ -1,65 +0,0 @@
MKINITRD(8)
=========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
mkinitrd - is a compat wrapper, which calls dracut to generate an initramfs
SYNOPSIS
--------
*mkinitrd* ['OPTION...'] [<initrd-image>] <kernel-version>
DESCRIPTION
-----------
mkinitrd creates an initramfs image <initrd-image> for the kernel with
version <kernel-version> by calling "dracut".
[IMPORTANT]
If a more fine grained control over the resulting image is needed,
"dracut" should be called directly.
OPTIONS
-------
**--version**::
print info about the version
**-v, --verbose**::
increase verbosity level
**-f, --force**::
overwrite existing initramfs file.
**--image-version*::
append the kernel version to the target image
<initrd-image>-<kernel-version>.
**--with=<module>**::
add the kernel module <module> to the initramfs.
**--preload=<module>**::
preload the kernel module <module> in the initramfs before any other kernel
modules are loaded. This can be used to ensure a certain device naming,
which should in theory be avoided and the use of symbolic links in /dev is
encouraged.
**--nocompress**::
do not compress the resulting image.
**--help**::
print a help message and exit.
AVAILABILITY
------------
The mkinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

View File

@@ -1,21 +1,32 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# called by dracut
# Prerequisite check(s) for module.
check() {
require_binaries /bin/bash
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries bash || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# called by dracut
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# called by dracut
# Install the required file(s) and directories for the module in the initramfs.
install() {
# If another shell is already installed, do not use bash
[[ -x $initdir/bin/sh ]] && return
# Prefer bash as /bin/sh if it is available.
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
inst /bin/bash
# Prefer bash as default shell if no other shell is preferred.
[[ -L $initdir/bin/sh ]] || ln -sf bash "${initdir}/bin/sh"
}

View File

@@ -1,30 +0,0 @@
#!/bin/bash
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
require_binaries /sbin/bootchartd || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs
inst_multiple bootchartd bash \
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
accton \
echo \
grep \
usleep
inst /usr/bin/pkill /bin/pkill
inst /usr/bin/[ /bin/[
}

View File

@@ -1,21 +1,32 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# called by dracut
# Prerequisite check(s) for module.
check() {
require_binaries /bin/dash
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries dash || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# called by dracut
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# called by dracut
# Install the required file(s) and directories for the module in the initramfs.
install() {
# If another shell is already installed, do not use dash
[[ -x $initdir/bin/sh ]] && return
# Prefer dash as /bin/sh if it is available.
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
inst /bin/dash
# Prefer dash as default shell if no other shell is preferred.
[[ -L $initdir/bin/sh ]] || ln -sf dash "${initdir}/bin/sh"
}

View File

@@ -0,0 +1,34 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries mksh || return 1
require_binaries printf || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst /bin/mksh
inst printf
# Prefer mksh as default shell if no other shell is preferred.
[[ -L $initdir/bin/sh ]] || ln -sf mksh "${initdir}/bin/sh"
}

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# Prerequisite check(s) for module.
check() {
# Return 255 to only include the module, if another module requires it.
return 255
}
# Module dependency requirements.
depends() {
# This module has external dependency on other module(s).
echo systemd systemd-hostnamed systemd-networkd systemd-resolved systemd-timedated systemd-timesyncd
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}

View File

@@ -1,15 +1,14 @@
#!/bin/bash
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# called by dracut
# Prerequisite check(s) for module.
check() {
[[ $mount_needs ]] && return 1
if require_binaries $systemdutildir/systemd; then
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
(( $SYSTEMD_VERSION >= 198 )) && return 0
return 255
fi
return 1
# If the binary(s) requirements are not fulfilled the module can't be installed
require_binaries "$systemdutildir"/systemd || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# called by dracut
@@ -26,117 +25,115 @@ installkernel() {
install() {
local _mods
if [[ "$prefix" == /run/* ]]; then
dfatal "systemd does not work with a prefix, which contains \"/run\"!!"
if [[ $prefix == /run/* ]]; then
dfatal 'systemd does not work with a prefix, which contains "/run"!!'
exit 1
fi
inst_multiple -o \
$systemdutildir/systemd \
$systemdutildir/systemd-coredump \
$systemdutildir/systemd-cgroups-agent \
$systemdutildir/systemd-shutdown \
$systemdutildir/systemd-reply-password \
$systemdutildir/systemd-fsck \
$systemdutildir/systemd-udevd \
$systemdutildir/systemd-journald \
$systemdutildir/systemd-sysctl \
$systemdutildir/systemd-modules-load \
$systemdutildir/systemd-vconsole-setup \
$systemdutildir/system-generators/systemd-fstab-generator \
$systemdutildir/system-generators/systemd-gpt-auto-generator \
\
$systemdsystemunitdir/cryptsetup.target \
$systemdsystemunitdir/emergency.target \
$systemdsystemunitdir/sysinit.target \
$systemdsystemunitdir/basic.target \
$systemdsystemunitdir/halt.target \
$systemdsystemunitdir/kexec.target \
$systemdsystemunitdir/local-fs.target \
$systemdsystemunitdir/local-fs-pre.target \
$systemdsystemunitdir/remote-fs.target \
$systemdsystemunitdir/remote-fs-pre.target \
$systemdsystemunitdir/multi-user.target \
$systemdsystemunitdir/network.target \
$systemdsystemunitdir/network-pre.target \
$systemdsystemunitdir/network-online.target \
$systemdsystemunitdir/nss-lookup.target \
$systemdsystemunitdir/nss-user-lookup.target \
$systemdsystemunitdir/poweroff.target \
$systemdsystemunitdir/reboot.target \
$systemdsystemunitdir/rescue.target \
$systemdsystemunitdir/rpcbind.target \
$systemdsystemunitdir/shutdown.target \
$systemdsystemunitdir/final.target \
$systemdsystemunitdir/sigpwr.target \
$systemdsystemunitdir/sockets.target \
$systemdsystemunitdir/swap.target \
$systemdsystemunitdir/timers.target \
$systemdsystemunitdir/paths.target \
$systemdsystemunitdir/umount.target \
\
$systemdsystemunitdir/sys-kernel-config.mount \
\
$systemdsystemunitdir/kmod-static-nodes.service \
$systemdsystemunitdir/systemd-tmpfiles-setup.service \
$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \
$systemdsystemunitdir/systemd-ask-password-console.path \
$systemdsystemunitdir/systemd-udevd-control.socket \
$systemdsystemunitdir/systemd-udevd-kernel.socket \
$systemdsystemunitdir/systemd-ask-password-plymouth.path \
$systemdsystemunitdir/systemd-journald.socket \
$systemdsystemunitdir/systemd-journald-audit.socket \
$systemdsystemunitdir/systemd-ask-password-console.service \
$systemdsystemunitdir/systemd-modules-load.service \
$systemdsystemunitdir/systemd-halt.service \
$systemdsystemunitdir/systemd-poweroff.service \
$systemdsystemunitdir/systemd-reboot.service \
$systemdsystemunitdir/systemd-kexec.service \
$systemdsystemunitdir/systemd-fsck@.service \
$systemdsystemunitdir/systemd-udevd.service \
$systemdsystemunitdir/systemd-udev-trigger.service \
$systemdsystemunitdir/systemd-udev-settle.service \
$systemdsystemunitdir/systemd-ask-password-plymouth.service \
$systemdsystemunitdir/systemd-journald.service \
$systemdsystemunitdir/systemd-vconsole-setup.service \
$systemdsystemunitdir/systemd-random-seed-load.service \
$systemdsystemunitdir/systemd-random-seed.service \
$systemdsystemunitdir/systemd-sysctl.service \
\
$systemdsystemunitdir/sysinit.target.wants/systemd-modules-load.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-ask-password-console.path \
$systemdsystemunitdir/sysinit.target.wants/systemd-journald.service \
$systemdsystemunitdir/sockets.target.wants/systemd-udevd-control.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-udevd-kernel.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-journald.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-journald-audit.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-journald-dev-log.socket \
$systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \
$systemdsystemunitdir/sysinit.target.wants/kmod-static-nodes.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-sysctl.service \
\
$systemdsystemunitdir/ctrl-alt-del.target \
$systemdsystemunitdir/reboot.target \
$systemdsystemunitdir/systemd-reboot.service \
$systemdsystemunitdir/syslog.socket \
\
$systemdsystemunitdir/slices.target \
$systemdsystemunitdir/system.slice \
$systemdsystemunitdir/-.slice \
\
$tmpfilesdir/systemd.conf \
\
"$systemdutildir"/systemd \
"$systemdutildir"/systemd-coredump \
"$systemdutildir"/systemd-cgroups-agent \
"$systemdutildir"/systemd-shutdown \
"$systemdutildir"/systemd-reply-password \
"$systemdutildir"/systemd-fsck \
"$systemdutildir"/systemd-udevd \
"$systemdutildir"/systemd-journald \
"$systemdutildir"/systemd-sysctl \
"$systemdutildir"/systemd-modules-load \
"$systemdutildir"/systemd-vconsole-setup \
"$systemdutildir"/systemd-volatile-root \
"$systemdutildir"/systemd-sysroot-fstab-check \
"$systemdutildir"/system-generators/systemd-debug-generator \
"$systemdutildir"/system-generators/systemd-fstab-generator \
"$systemdutildir"/system-generators/systemd-gpt-auto-generator \
"$systemdsystemunitdir"/debug-shell.service \
"$systemdsystemunitdir"/cryptsetup.target \
"$systemdsystemunitdir"/cryptsetup-pre.target \
"$systemdsystemunitdir"/remote-cryptsetup.target \
"$systemdsystemunitdir"/emergency.target \
"$systemdsystemunitdir"/sysinit.target \
"$systemdsystemunitdir"/basic.target \
"$systemdsystemunitdir"/halt.target \
"$systemdsystemunitdir"/kexec.target \
"$systemdsystemunitdir"/local-fs.target \
"$systemdsystemunitdir"/local-fs-pre.target \
"$systemdsystemunitdir"/remote-fs.target \
"$systemdsystemunitdir"/remote-fs-pre.target \
"$systemdsystemunitdir"/multi-user.target \
"$systemdsystemunitdir"/network.target \
"$systemdsystemunitdir"/network-pre.target \
"$systemdsystemunitdir"/network-online.target \
"$systemdsystemunitdir"/nss-lookup.target \
"$systemdsystemunitdir"/nss-user-lookup.target \
"$systemdsystemunitdir"/poweroff.target \
"$systemdsystemunitdir"/reboot.target \
"$systemdsystemunitdir"/rescue.target \
"$systemdsystemunitdir"/rpcbind.target \
"$systemdsystemunitdir"/shutdown.target \
"$systemdsystemunitdir"/final.target \
"$systemdsystemunitdir"/sigpwr.target \
"$systemdsystemunitdir"/sockets.target \
"$systemdsystemunitdir"/swap.target \
"$systemdsystemunitdir"/timers.target \
"$systemdsystemunitdir"/paths.target \
"$systemdsystemunitdir"/umount.target \
"$systemdsystemunitdir"/sys-kernel-config.mount \
"$systemdsystemunitdir"/modprobe@.service \
"$systemdsystemunitdir"/kmod-static-nodes.service \
"$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
"$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
"$systemdsystemunitdir"/systemd-ask-password-console.path \
"$systemdsystemunitdir"/systemd-udevd-control.socket \
"$systemdsystemunitdir"/systemd-udevd-kernel.socket \
"$systemdsystemunitdir"/systemd-ask-password-plymouth.path \
"$systemdsystemunitdir"/systemd-journald.socket \
"$systemdsystemunitdir"/systemd-journald-audit.socket \
"$systemdsystemunitdir"/systemd-ask-password-console.service \
"$systemdsystemunitdir"/systemd-modules-load.service \
"$systemdsystemunitdir"/systemd-halt.service \
"$systemdsystemunitdir"/systemd-poweroff.service \
"$systemdsystemunitdir"/systemd-reboot.service \
"$systemdsystemunitdir"/systemd-kexec.service \
"$systemdsystemunitdir"/systemd-fsck@.service \
"$systemdsystemunitdir"/systemd-udevd.service \
"$systemdsystemunitdir"/systemd-udev-trigger.service \
"$systemdsystemunitdir"/systemd-udev-settle.service \
"$systemdsystemunitdir"/systemd-ask-password-plymouth.service \
"$systemdsystemunitdir"/systemd-journald.service \
"$systemdsystemunitdir"/systemd-vconsole-setup.service \
"$systemdsystemunitdir"/systemd-volatile-root.service \
"$systemdsystemunitdir"/systemd-sysctl.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-modules-load.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-ask-password-console.path \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
"$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-control.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-udevd-kernel.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-audit.socket \
"$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-udevd.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-udev-trigger.service \
"$systemdsystemunitdir"/sysinit.target.wants/kmod-static-nodes.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
"$systemdsystemunitdir"/sysinit.target.wants/systemd-sysctl.service \
"$systemdsystemunitdir"/ctrl-alt-del.target \
"$systemdsystemunitdir"/reboot.target \
"$systemdsystemunitdir"/systemd-reboot.service \
"$systemdsystemunitdir"/syslog.socket \
"$systemdsystemunitdir"/slices.target \
"$systemdsystemunitdir"/system.slice \
"$systemdsystemunitdir"/-.slice \
"$tmpfilesdir"/systemd.conf \
journalctl systemctl \
echo swapoff \
kmod insmod rmmod modprobe modinfo depmod lsmod \
mount umount reboot poweroff \
systemd-run systemd-escape \
systemd-cgls systemd-tmpfiles \
/etc/udev/udev.hwdb \
${NULL}
systemd-ask-password systemd-tty-ask-password-agent \
/etc/udev/udev.hwdb
inst_multiple -o \
/usr/lib/modules-load.d/*.conf \
@@ -144,23 +141,24 @@ install() {
modules_load_get() {
local _line i
for i in "$1"/*.conf; do
for i in "$dracutsysrootdir$1"/*.conf; do
[[ -f $i ]] || continue
while read _line || [ -n "$_line" ]; do
while read -r _line || [ -n "$_line" ]; do
case $_line in
\#*)
;;
\;*)
;;
\#*) ;;
\;*) ;;
*)
echo $_line
echo "$_line"
;;
esac
done < "$i"
done
}
_mods=$(modules_load_get /usr/lib/modules-load.d)
[[ $_mods ]] && hostonly='' instmods $_mods
mapfile -t _mods < <(modules_load_get /usr/lib/modules-load.d)
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
if [[ $hostonly ]]; then
inst_multiple -H -o \
@@ -168,7 +166,11 @@ install() {
/etc/systemd/journald.conf.d/*.conf \
/etc/systemd/system.conf \
/etc/systemd/system.conf.d/*.conf \
"$systemdsystemconfdir"/modprobe@.service \
"$systemdsystemconfdir/modprobe@.service.d/*.conf" \
/etc/hosts \
/etc/hostname \
/etc/nsswitch.conf \
/etc/machine-id \
/etc/machine-info \
/etc/vconsole.conf \
@@ -176,54 +178,71 @@ install() {
/etc/modules-load.d/*.conf \
/etc/sysctl.d/*.conf \
/etc/sysctl.conf \
/etc/udev/udev.conf \
${NULL}
/etc/udev/udev.conf
_mods=$(modules_load_get /etc/modules-load.d)
[[ $_mods ]] && hostonly='' instmods $_mods
mapfile -t _mods < <(modules_load_get /etc/modules-load.d)
[[ ${#_mods[@]} -gt 0 ]] && hostonly='' instmods "${_mods[@]}"
fi
if ! [[ -e "$initdir/etc/machine-id" ]]; then
> "$initdir/etc/machine-id"
: > "$initdir/etc/machine-id"
chmod 444 "$initdir/etc/machine-id"
fi
# install adm user/group for journald
inst_multiple nologin
grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
grep '^wheel:' /etc/group >> "$initdir/etc/group"
grep '^adm:' /etc/group >> "$initdir/etc/group"
grep '^utmp:' /etc/group >> "$initdir/etc/group"
grep '^root:' /etc/group >> "$initdir/etc/group"
{
grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
grep '^adm:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null
} >> "$initdir/etc/passwd"
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
{
grep '^systemd-journal:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^wheel:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^adm:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^utmp:' "$dracutsysrootdir"/etc/group 2> /dev/null
grep '^root:' "$dracutsysrootdir"/etc/group 2> /dev/null
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' "$dracutsysrootdir"/etc/group 2> /dev/null
} >> "$initdir/etc/group"
ln_r $systemdutildir/systemd "/init"
ln_r $systemdutildir/systemd "/sbin/init"
local _systemdbinary="$systemdutildir"/systemd
if ldd "$_systemdbinary" | grep -qw libasan; then
local _wrapper="$systemdutildir"/systemd-asan-wrapper
cat > "$initdir"/"$_wrapper" << EOF
#!/bin/sh
mount -t proc -o nosuid,nodev,noexec proc /proc
exec $_systemdbinary
EOF
chmod 755 "$initdir"/"$_wrapper"
_systemdbinary="$_wrapper"
unset _wrapper
fi
ln_r "$_systemdbinary" "/init"
ln_r "$_systemdbinary" "/sbin/init"
unset _systemdbinary
inst_binary true
ln_r $(type -P true) "/usr/bin/loginctl"
ln_r $(type -P true) "/bin/loginctl"
ln_r "$(find_binary true)" "/usr/bin/loginctl"
ln_r "$(find_binary true)" "/bin/loginctl"
inst_rules \
70-uaccess.rules \
71-seat.rules \
73-seat-late.rules \
90-vconsole.rules \
99-systemd.rules \
${NULL}
99-systemd.rules
for i in \
emergency.target \
rescue.target \
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service \
; do
mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants"
ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
"${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
systemd-ask-password-plymouth.service; do
[[ -f "$systemdsystemunitdir"/$i ]] || continue
$SYSTEMCTL -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
done
mkdir -p "$initdir/etc/systemd"
@@ -235,6 +254,11 @@ install() {
echo "RateLimitBurst=0"
} >> "$initdir/etc/systemd/journald.conf"
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
}
$SYSTEMCTL -q --root "$initdir" set-default multi-user.target
# Install library file(s)
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_*"
}

34
modules.d/00warpclock/module-setup.sh Normal file → Executable file
View File

@@ -1,29 +1,39 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# This file is part of dracut.
# SPDX-License-Identifier: GPL-2.0-or-later
# called by dracut
# Prerequisite check(s) for module.
check() {
# hwclock does not exist on S390(x), bail out silently then
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
require_binaries /sbin/hwclock || return 1
# If the binary(s) requirements are not fulfilled the module can't be installed.
require_binaries hwclock || return 1
# Return 255 to only include the module, if another module requires it.
return 255
}
# called by dracut
# Module dependency requirements.
depends() {
# Return 0 to include the dependent module(s) in the initramfs.
return 0
}
# called by dracut
# Install the required file(s) and directories for the module in the initramfs.
install() {
inst /usr/share/zoneinfo/UTC
inst /etc/localtime
inst /etc/adjtime
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
inst /sbin/hwclock
inst_multiple -o \
/usr/share/zoneinfo/UTC \
/etc/localtime \
/etc/adjtime \
hwclock
}

15
modules.d/00warpclock/warpclock.sh Normal file → Executable file
View File

@@ -1,9 +1,14 @@
#!/bin/sh
# This file is part of dracut warpclock module.
# SPDX-License-Identifier: GPL-2.0-or-later
if test -e /etc/adjtime ; then
while read line ; do
if test "$line" = LOCAL ; then
hwclock --systz
fi
# Set the kernel's timezone and reset the system time
# if adjtime is set to LOCAL.
if test -e /etc/adjtime; then
while read -r line; do
if test "$line" = LOCAL; then
hwclock --systz
fi
done < /etc/adjtime
fi

View File

@@ -1,10 +1,16 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif getarg boot= >/dev/null; then
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif getarg boot= > /dev/null; then
. /sbin/fips.sh
fips_info "fips-boot: start"
if mount_boot; then
do_fips || die "FIPS integrity test failed"
fi
fips_info "fips-boot: done!"
fi

View File

@@ -0,0 +1,14 @@
#!/bin/sh
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
else
. /sbin/fips.sh
fips_info "fips-load-crypto: start"
fips_load_crypto || die "FIPS integrity test failed"
fips_info "fips-load-crypto: done!"
fi

View File

@@ -1,9 +1,15 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif ! [ -f /tmp/fipsdone ]; then
. /sbin/fips.sh
fips_info "fips-noboot: start"
mount_boot
do_fips || die "FIPS integrity test failed"
fips_info "fips-noboot: done!"
fi

View File

@@ -1,145 +1,195 @@
#!/bin/sh
mount_boot()
{
type getarg > /dev/null 2>&1 || . /lib/dracut-lib.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=)
if [ -n "$boot" ]; then
if [ -d /boot ] && ismounted /boot; then
boot_dev=
if command -v findmnt > /dev/null; then
boot_dev=$(findmnt -n -o SOURCE /boot)
fi
fips_info "Ignoring 'boot=$boot' as /boot is already mounted ${boot_dev:+"from '$boot_dev'"}"
return 0
fi
case "$boot" in
LABEL=*)
boot="$(echo $boot | sed 's,/,\\x2f,g')"
boot="/dev/disk/by-label/${boot#LABEL=}"
;;
UUID=*)
boot="/dev/disk/by-uuid/${boot#UUID=}"
;;
PARTUUID=*)
boot="/dev/disk/by-partuuid/${boot#PARTUUID=}"
;;
PARTLABEL=*)
boot="/dev/disk/by-partlabel/${boot#PARTLABEL=}"
;;
/dev/*)
;;
*)
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
boot="$(label_uuid_to_dev "$boot")"
;;
/dev/*) ;;
*)
die "You have to specify boot=<boot device> as a boot option for fips=1"
;;
esac
if ! [ -e "$boot" ]; then
udevadm trigger --action=add >/dev/null 2>&1
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
udevadm trigger --action=add > /dev/null 2>&1
i=0
while ! [ -e $boot ]; do
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$boot
else
udevadm settle --timeout=30
fi
[ -e $boot ] && break
while ! [ -e "$boot" ]; do
udevadm settle --exit-if-exists="$boot"
[ -e "$boot" ] && break
sleep 0.5
i=$(($i+1))
i=$((i + 1))
[ $i -gt 40 ] && break
done
fi
[ -e "$boot" ] || return 1
mkdir /boot
info "Mounting $boot as /boot"
mkdir -p /boot
fips_info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
elif [ -d "$NEWROOT/boot" ]; then
FIPS_MOUNTED_BOOT=1
elif ! ismounted /boot && [ -d "$NEWROOT/boot" ]; then
# shellcheck disable=SC2114
rm -fr -- /boot
ln -sf "$NEWROOT/boot" /boot
else
die "You have to specify boot=<boot device> as a boot option for fips=1"
fi
}
do_rhevh_check()
{
do_rhevh_check() {
KERNEL=$(uname -r)
kpath=${1}
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b || [ -n "$a" ]; do printf "%s\n" $a; done || return 1)
HMAC_SUM_ORIG=$(while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done < "$NEWROOT/boot/.vmlinuz-${KERNEL}.hmac")
HMAC_SUM_CALC=$(sha512hmac "$kpath" | while read -r a _ || [ -n "$a" ]; do printf "%s\n" "$a"; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
fi
info "rhevh_check OK"
fips_info "rhevh_check OK"
return 0
}
do_fips()
{
local _v
local _s
nonfatal_modprobe() {
modprobe "$1" 2>&1 > /dev/stdout \
| while read -r line || [ -n "$line" ]; do
echo "${line#modprobe: FATAL: }" >&2
done
}
fips_load_crypto() {
local _k
local _v
local _module
local _found
KERNEL=$(uname -r)
read -d '' -r FIPSMODULES < /etc/fipsmodules
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}"; 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
while read -r _k _ _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && continue
_found=1
break
done </proc/crypto
[ "$_found" = "0" ] && return 1
done < /proc/crypto
[ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
fi
fi
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
}
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
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
else
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
do_fips() {
KERNEL=$(uname -r)
if [ -z "$BOOT_IMAGE_NAME" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
#on some achitectures BOOT_IMAGE does not contain path to kernel
#so if we can't find anything, let's treat it in the same way as if it was empty
if ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
BOOT_IMAGE_PATH=""
if ! getarg rd.fips.skipkernel > /dev/null; then
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
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
elif [ -e "/run/install/repo/images/pxeboot/vmlinuz" ]; then
# This is a boot.iso with the .hmac inside the install.img
do_rhevh_check /run/install/repo/images/pxeboot/vmlinuz || return 1
else
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
# On s390x, BOOT_IMAGE isn't a path but an integer representing the
# entry number selected. Let's try the root of /boot first, and
# otherwise fallback to trying to parse the BLS entries if it's a
# BLS-based system.
if [ "$(uname -m)" = s390x ]; then
if [ -e "/boot/vmlinuz-${KERNEL}" ]; then
BOOT_IMAGE="vmlinuz-${KERNEL}"
elif [ -d /boot/loader/entries ]; then
bls=$(find /boot/loader/entries -name '*.conf' | sort -rV | sed -n "$((BOOT_IMAGE + 1))p")
if [ -e "${bls}" ]; then
BOOT_IMAGE=$(grep ^linux "${bls}" | cut -d' ' -f2)
fi
fi
fi
fi
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac"
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
warn "${BOOT_IMAGE_HMAC} does not exist"
return 1
fi
# Trim off any leading GRUB boot device (e.g. ($root) )
BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
BOOT_IMAGE_PATH="${BOOT_IMAGE%"${BOOT_IMAGE_NAME}"}"
if [ -z "$BOOT_IMAGE_NAME" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
#on some achitectures BOOT_IMAGE does not contain path to kernel
#so if we can't find anything, let's treat it in the same way as if it was empty
if ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
BOOT_IMAGE_PATH=""
fi
fi
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac"
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
warn "${BOOT_IMAGE_HMAC} does not exist"
return 1
fi
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
fi
fi
info "All initrd crypto checks done"
fips_info "All initrd crypto checks done"
> /tmp/fipsdone
: > /tmp/fipsdone
umount /boot >/dev/null 2>&1
if [ "$FIPS_MOUNTED_BOOT" = 1 ]; then
fips_info "Unmounting /boot"
umount /boot > /dev/null 2>&1
else
fips_info "Not unmounting /boot"
fi
return 0
}

View File

@@ -12,9 +12,9 @@ depends() {
# called by dracut
installkernel() {
local _fipsmodules _mod
local _fipsmodules _mod _bootfstype
if [[ -f "${srcmods}/modules.fips" ]]; then
_fipsmodules="$(cat "${srcmods}/modules.fips")"
read -d '' -r _fipsmodules < "${srcmods}/modules.fips"
else
_fipsmodules=""
@@ -24,10 +24,10 @@ installkernel() {
_fipsmodules+="crc32c crct10dif ghash "
# Ciphers:
_fipsmodules+="cipher_null des3_ede aes "
_fipsmodules+="cipher_null des3_ede aes cfb dh ecdh "
# Modes/templates:
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts "
# Compression algs:
_fipsmodules+="deflate lzo zlib "
@@ -39,35 +39,46 @@ installkernel() {
_fipsmodules+="aead cryptomgr tcrypt crypto_user "
fi
# shellcheck disable=SC2174
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for _mod in $_fipsmodules; do
if hostonly='' instmods -c -s $_mod; then
echo $_mod >> "${initdir}/etc/fipsmodules"
if hostonly='' instmods -c -s "$_mod"; then
echo "$_mod" >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
# with hostonly_default_device fs module for /boot is not installed by default
if [[ $hostonly ]] && [[ $hostonly_default_device == "no" ]]; then
_bootfstype=$(find_mp_fstype /boot)
if [[ -n $_bootfstype ]]; then
hostonly='' instmods "$_bootfstype"
else
dwarning "Can't determine fs type for /boot, FIPS check may fail."
fi
fi
}
# called by dracut
install() {
local _dir
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
inst_hook pre-pivot 00 "$moddir/fips-boot.sh"
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
inst_multiple sha512hmac rmmod insmod mount uname umount
inst_multiple sha512hmac rmmod insmod mount uname umount grep sed cut find sort
inst_simple /etc/system-fips
[ -c ${initdir}/dev/random ] || mknod ${initdir}/dev/random c 1 8 \
[ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \
|| {
dfatal "Cannot create /dev/random"
dfatal "To create an initramfs with fips support, dracut has to run as root"
return 1
}
[ -c ${initdir}/dev/urandom ] || mknod ${initdir}/dev/urandom c 1 9 \
[ -c "${initdir}"/dev/urandom ] || mknod "${initdir}"/dev/urandom c 1 9 \
|| {
dfatal "Cannot create /dev/random"
dfatal "Cannot create /dev/urandom"
dfatal "To create an initramfs with fips support, dracut has to run as root"
return 1
}

View File

@@ -0,0 +1,3 @@
# This file is part of dracut systemd ac power module
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="0", RUN+="/usr/sbin/systemctl start initrd-on-battery-power.target"
SUBSYSTEM=="power_supply", KERNEL=="AC", ATTR{online}=="1", RUN+="/usr/sbin/systemctl start initrd-on-ac-power.target"

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