Compare commits

...

505 Commits

Author SHA1 Message Date
Harald Hoyer
02844ff664 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.
2019-10-23 14:16:56 +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
Harald Hoyer
225e4b94cb Fix tests with network-legacy 2018-10-08 15:38:33 +02:00
Harald Hoyer
3e676eb12f AUTHORS: update 2018-10-08 15:31:49 +02:00
Harald Hoyer
2257b800ac NEWS: update 2018-10-08 15:31:08 +02:00
Eugene Syromiatnikov
290df2e1de modules.d: Add a module for handling additional depmod kernel module directories
It parses depmod configuration and scans modules.dep for kernel modules
present in directories supplied in "overrides", "external", and "search"
depmod configuration options.  The resulting list of (absolute) kernel
module paths is then supplied to instmods.

* modules.d/90kernel-modules-extra/module-setup.sh: New file.
* dracut.spec (%files): Add
%{dracutlibdir}/modules.d/90kernel-modules-extra.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
2018-10-08 10:49:36 +02:00
Harald Hoyer
4be697e5c1 dracut.spec: fixed invalid spec line 2018-09-21 12:41:00 +02:00
Lubomir Rintel
08bdadbf31 network-manager: add module 2018-09-21 11:32:01 +02:00
Lubomir Rintel
734739187b network-legacy: split off from network module 2018-09-21 11:32:01 +02:00
Lubomir Rintel
1c4a51c39c network: fix an error message 2018-09-21 11:32:01 +02:00
Lubomir Rintel
0aa2e5f728 iscsi: start iscsid even w/o systemd 2018-09-21 11:32:01 +02:00
Lubomir Rintel
5e615f4eb4 iscsi: do not install all of /etc/iscsi unless hostonly
/etc/iscsi/initiatorname.iscsi would leak the host initiator name (that
is host configuration) to the initramfs. Perhaps other files too.
2018-09-21 11:32:01 +02:00
Lubomir Rintel
9e82732dd4 iscsi: do not replace the configuration in the host system
ln: failed to create symbolic link '/usr/lib/systemd/system/sockets.target.wants/iscsid.socket': Permission denied
  ln: failed to create symbolic link '/usr/lib/systemd/system/sockets.target.wants/iscsiuio.socket': Permission denied

No way. Just ensure the links are there in the initramfs image. In fact,
that is already the case for iscsiuio.socket. Add iscsid.socket too.
2018-09-21 11:32:01 +02:00
Lubomir Rintel
0454dc247a network: configure NetworkManager to use dhclient
If the network module obtained a lease using dhclient, NetworkManager
must be configured to use it too, otherwise it would obtain a different
lease (and could potentially break a connection to the network volume).
2018-09-21 10:40:55 +02:00
Kairui Song
24f3463bff dracut.spec: Add dracut-squash package
As 99squash module requires extra dependency and it introduces new
files, add a new sub package for this module.
2018-09-21 10:32:04 +02:00
Kairui Song
095e1f37c4 Add support for building a squashed initramfs
With all files stored in ramfs, and most of them are not compressed,
the initramfs will take up a lot of memory. Besides, if the file number
is large, each file will waste some memory due to page fragmetation.
This is due to ramfs' design, at least one page will be allocated for
one file however small the file is. On machine with large page size,
this will become worse and waste too many memory.

One approach to reducing the memory usage is to reduce the number of
files that got directly loaded into the root ramfs, and compress files
by put most files will into a read-only squash image and keep a minimum
set of executable and libraries outside as the loader for the squash
image. After the squash image is mounted, the real 'init' will be
executed and then everything behaves as usual.

This patch will introduce a '99squash' module which will never be
included by default. User can force add it, and if it is included,
dracut will perform some extra steps before creating the final image:

For now, "/etc" and "/usr" will be moved into the squashfs image.
"/init" will be renamed to "/init.stock" and replaced by "/init.squash".
Files and folders need to be accessible before mounting the image will
be still avaliable at their original place. And due to squashfs is
readonly, an overlayfs layer will be created on top of squashfs mount
point, as many dracut module require readwrite access to "/etc" and
"/usr", "init.squash" will ultimately call "/init.stock".

An extra systemd service will be installed. This service will umount all
squashfs related mount points right before switch-root to release
resources properly. This service will not actually do anything if
switch-root is not used.

This is very helpful when mem resource is very limited, like Kdump.
According to my tests, this squash module can help save about 35MB of
memory with 64K page size, or about 15MB with 4K page size on an
ordinary kdump capture routine. This module could also help reduce
memory usage for normal boot up process.

Won't change any behavior if squash module is not enabled.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-09-21 10:32:04 +02:00
Alexander Tsoy
f4334e9bdf base/dracut-lib.sh: use "command -v" in pidof()
"type -P" doesn't work in dash
2018-09-10 09:45:50 +02:00
Alexander Tsoy
838f22259a install: avoid non-portable __WORDSIZE
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.

Patch ported from systemd.
(commit 8507eb20b64010b26f23822cbf442bb0bf96511c)

Original-patch-by: Emil Renner Berthing <systemd@esmil.dk>
Bug: https://bugs.gentoo.org/602122
2018-09-10 09:45:22 +02:00
Alexander Tsoy
b3480d31b0 Prevent environment leaking into initrd-release
On my system the following initrd-release is generated:
...
VERSION="4 dracut-048 dracut-048"
...

VERSION is not defined in /etc/os-release, so the variable is
concatenated with its previous value:

* "4" comes from the kernel build system since dracut is called from the
  kernel install hook ("4" is a major kernel version);
* first "dracut-048" comes from the "systemd-initrd" module;
* second "dracut-048" comes from the "base" module.
2018-09-10 09:42:36 +02:00
Frederick Grose
8dd7bb48fc dmsquash-live/apply-live-updates: Test proper file link.
Update flag link to /dev/root as required by commit
789668deb3.
2018-09-06 11:46:24 +02:00
Frederick Grose
44d1688164 dmsquash-live-root: Manage absent overlayfs module better.
die when required; systemctl reload otherwise.
2018-09-06 11:46:24 +02:00
Frederick Grose
a7d8fc280c dmsquash-live: Avoid grep and sed in this module.
strstr and variable string manipulations suffice.
2018-09-06 11:46:24 +02:00
Daniel Molkentin
e9a84e0a21 98dracut-systemd: Start systemd-vconsole-setup before dracut-cmdline-ask
This is what happened before this patch (edited for brevity):

  dracut-cmdline-ask.service in modules.d/98dracut-systemd, which invokes
  dracut-cmdline-ask.sh. This script and systemd-vconsole-setup are
  started in parallel for the same console (tty1).

  Then dracut-cmdline-ask quits immediately without doing anything (unless
  rd.cmdline=ask is given). As this is a bash script and it gets tty as
  stdin as specified in its *.service, this triggers the hangup of tty1 at
  its exit.

  Meanwhile systemd-vconsole-setup continues and tries some ioctls after
  that, but they fail because of the hung up tty1.

The usual culprit for starting systemd-vconsole-setup early on is
plymouth-start.service, even if plymouth.enable=0 is set.

A popular (and annoying) symptom of this as reported by users was
the inability use their configured keyboard layout in plymouth when
unlocking their crypted block devices.

Reference: boo#1055834
2018-09-05 13:20:36 +02:00
Tobias Klauser
d09218823c Fix misspellings in man pages and usage
Also remove some trailing whitespaces from the same files.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-08-30 13:12:00 +02:00
Tony Asleson
ae9bc0d72f stratis: Add additional binaries
Include all binaries that could be called by the daemon.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2018-08-24 08:46:13 +02:00
Kairui Song
09ba1b289f kernel-modules: add nfit
To support pmem devices, nfit module is required
2018-08-21 13:03:36 +02:00
Kairui Song
9f3c31cd8d 99base: enable initqueue if extra devices are added
When extra devices are added, initqueue should be enabled to make sure
those devices are present, so following services and routines could
use those devices.

See PR #442 for more detail.
2018-08-21 13:03:20 +02:00
Frederick Grose
eb18a1fe29 dmsquash-live, livenet: Simplify OverlayFS read-only overlay setup.
Use multiple lower layer directories in a single OverlayFS mount with
  a transient overlay directory.
Tolerate a command line with rd.live.overlay.readonly and NO persistent
  overlay by reconfiguring the OverlayFS mount options.
Use more compatible shell syntax for testing symlinks, and use printf
  instead of echo -e.
2018-08-21 10:52:34 +02:00
Frederick Grose
789668deb3 dmsquash-live: Support a flattened squashfs.img
A simplified root filesystem structure may be provided for OverlayFS
overlays by squashing the root filesystem directly instead of squashing
an embedded image file at /LiveOS/rootfs.img.  Detect and configure
such a squashed root filesystem for live booting.

For OverlayFS boots, avoid the read-only Device-mapper linear device
  at /dev/mapper/live-base.
Create a consistent device link at /dev/live-base for the read-only
  base loop device for all overlayed live root filesystems.
Consistently provide a link at /dev/root for wait_for_dev.

Update documentation.
2018-08-21 10:52:34 +02:00
Frederick Grose
e791d753be livenet: Enable OverlayFS overlay in sysroot.mount generator.
Adjust sysroot.mount configuration for rd.live.overlay.overlayfs option.
Use link at /dev/root as a consistent flag for wait_for_dev.
Adjust documentation.
2018-08-20 10:08:43 +02:00
Harald Hoyer
e0e6d96d69 travis: re-enable test 14
https://bugzilla.redhat.com/show_bug.cgi?id=1615271
2018-08-20 10:05:41 +02:00
Harald Hoyer
ee18dd2b88 ifcfg/write-ifcfg.sh: aggregate resolv.conf
The old code used /tmp/net.$netif.resolv.conf with $netif being randomly
chosen.

As it is not known which nameserver have which priority, just sort them
and deduplicate.
2018-08-17 15:52:36 +02:00
Harald Hoyer
09132c732a test/test-functions: fixed V=1 logic 2018-08-17 15:38:03 +02:00
Harald Hoyer
f19063ac71 travis: one last job reshuffle 2018-08-16 15:34:49 +02:00
Harald Hoyer
a17440713a travis: reshuffle tests
long running tests first
2018-08-16 14:48:21 +02:00
Harald Hoyer
bd03d374b7 travis: modprobe amd nested=1
GREAT!

$ modinfo kvm-intel kvm-amd| fgrep nested
parm:           nested:bool
parm:           nested:int
2018-08-16 14:28:54 +02:00
Harald Hoyer
06e12e4ba8 travis: rebalance tests 2018-08-16 14:25:23 +02:00
Harald Hoyer
f059ce7682 travis: reshuffle tests 2018-08-16 13:56:19 +02:00
Harald Hoyer
286685cb72 TEST-99-RPM: use releasever of the host system 2018-08-16 13:20:40 +02:00
Harald Hoyer
7c62555bcf TEST-15-BTRFSRAID: use seperate disk image for boot result 2018-08-16 13:20:35 +02:00
Harald Hoyer
2699d8ff7e TEST-99-RPM: removed --releasever 2018-08-16 12:03:40 +02:00
Harald Hoyer
5a8f1aef55 TEST-15-BTRFSRAID: sync in test-init
strange failure
2018-08-16 12:01:40 +02:00
Harald Hoyer
9c034dc326 travis: no rpm check for all matrix tests 2018-08-16 11:57:30 +02:00
Harald Hoyer
f8cad00948 test: for V=2 tail only the last MB of logs 2018-08-16 11:47:21 +02:00
Harald Hoyer
c128b969bb travis: combine more tests 2018-08-16 11:18:33 +02:00
Harald Hoyer
f59664a01f logtee: reduce output 2018-08-16 11:14:11 +02:00
Harald Hoyer
67f43d2124 test: fixed test.log name 2018-08-16 11:13:55 +02:00
Harald Hoyer
0ae5848245 travis: git pull more depth 2018-08-16 10:46:57 +02:00
Harald Hoyer
9f02b291ac travis: git pull --tags 2018-08-16 10:39:49 +02:00
Harald Hoyer
2b77ba0b75 travis: fight with yaml 2018-08-16 10:36:17 +02:00
Harald Hoyer
6f90be2971 travis: fixup 2018-08-16 10:33:06 +02:00
Harald Hoyer
110063c585 travis: git check 2018-08-16 10:29:16 +02:00
Harald Hoyer
51d0a54555 travis: use own logtee.c to reduce log output 2018-08-16 10:17:48 +02:00
Harald Hoyer
c31a80c9ed TEST-01: remove memdebug 2018-08-16 09:50:52 +02:00
Harald Hoyer
79afb279c2 travis: fedora-test.sh send dnf output to dev/null 2018-08-16 09:48:02 +02:00
Harald Hoyer
3c8d3a6565 travis: don't run TEST-40-NBD 2018-08-16 09:35:33 +02:00
Harald Hoyer
01f9d0d9bf travis: combine more tests 2018-08-16 09:26:35 +02:00
Harald Hoyer
3111988680 dracut.sh: remove bogus dir removal for --rebuild 2018-08-16 09:19:52 +02:00
Harald Hoyer
1ebbe2eb7b travis: combine jobs 2018-08-16 09:10:29 +02:00
Harald Hoyer
65d16d1914 travis: extend matrix 2018-08-16 08:50:11 +02:00
Harald Hoyer
da5a44cfb7 .travis.yml: add gitter notifications 2018-08-14 17:06:58 +02:00
Harald Hoyer
75b8b144a1 fedora-test.sh: don't parallelize travis tests 2018-08-14 17:02:43 +02:00
Harald Hoyer
1363167d65 Update README.md 2018-08-14 16:58:52 +02:00
Harald Hoyer
d15c15c8f5 test/test-functions: be verbose for any $V not empty 2018-08-14 16:54:27 +02:00
Harald Hoyer
9288d21b9f TEST-50-MULTINIC: removed bogus qemu compat server call 2018-08-14 16:37:01 +02:00
Harald Hoyer
cafe6675c2 test/run-qemu: move -cpu host to kvm args 2018-08-14 16:31:22 +02:00
Harald Hoyer
fba4d28433 TEST-50-MULTINIC: fixed server.log 2018-08-14 16:30:42 +02:00
Harald Hoyer
b7774da97c might even run without kvm 2018-08-14 16:18:53 +02:00
Harald Hoyer
3c1a083e5c add travis build job 2018-08-14 16:01:39 +02:00
Harald Hoyer
0f294d90b2 TEST-31-ISCSI-MULTI: increase verbose level 2018-08-14 15:54:42 +02:00
Harald Hoyer
a2dbecfcd6 test: add TEST_RUN_ID 2018-08-14 15:54:31 +02:00
Harald Hoyer
604c09b1da TEST-31-ISCSI-MULTI/test.sh: fixed test description 2018-08-14 15:28:56 +02:00
Harald Hoyer
f9c8b3112a TEST-50-MULTINIC/test.sh: fixed server startup 2018-08-14 14:12:54 +02:00
Harald Hoyer
bb75d16521 kernel-network-modules: add vlan kernel modules 2018-08-14 14:07:12 +02:00
Harald Hoyer
ca8f1c1ba3 test: fixed KVERSION and qemu backwards compatiblity 2018-08-14 14:03:55 +02:00
Harald Hoyer
94cc856cb8 TEST-70-BONDBRIDGETEAMVLAN: load vlan kernel modules 2018-08-14 13:57:15 +02:00
Harald Hoyer
827a5b1a80 test: also output server.log on failure 2018-08-14 11:37:57 +02:00
Harald Hoyer
393da0c370 TEST-50-MULTINIC: s/--device/-device 2018-08-14 11:35:26 +02:00
Harald Hoyer
82fe4ea0a5 enable parallel test suite
$ time sudo make -j SKIP=14 V=2 check
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-13-ENC-RAID-LVM'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-40-NBD'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-04-FULL-SYSTEMD'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-12-RAID-DEG'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-15-BTRFSRAID'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-16-DMSQUASH'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-17-LVM-THIN'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-11-LVM'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-31-ISCSI-MULTI'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-20-NFS'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-99-RPM'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-02-SYSTEMD'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-30-ISCSI'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-01-BASIC'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-03-USR-MOUNT'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-70-BONDBRIDGETEAMVLAN'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-50-MULTINIC'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-10-RAID'
make[1]: Entering directory '/home/harald/git/dracut/test/TEST-18-LVM-ENC-LV'
TEST: root filesystem on an encrypted LVM PV on a degraded RAID-5 [STARTED]
TEST: root filesystem on NBD [STARTED]
TEST: root filesystem on NBD [SKIPPED]
TEST: Full systemd serialization/deserialization test with /usr mount [STARTED]
TEST: root filesystem on multiple device btrfs [STARTED]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-40-NBD'
TEST: root filesystem on a LiveCD dmsquash filesystem [STARTED]
TEST: root filesystem on a LiveCD dmsquash filesystem [SKIPPED]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-16-DMSQUASH'
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [STARTED]
TEST: root filesystem on LVM PV [STARTED]
TEST: rpm integrity after dracut and kernel install [STARTED]
TEST: root filesystem on NFS [STARTED]
TEST: root filesystem over iSCSI [STARTED]
TEST: root filesystem on LVM PV with thin pool [STARTED]
TEST: root filesystem over iSCSI [STARTED]
TEST: root filesystem on a ext3 filesystem [STARTED]
TEST: root filesystem on a ext3 filesystem [STARTED]
TEST: root filesystem on a btrfs filesystem with /usr subvolume [STARTED]
TEST: root filesystem on NFS with bridging/bonding/vlan [STARTED]
TEST: root filesystem on NFS with multiple nics [STARTED]
TEST: root filesystem on an encrypted LVM PV on a RAID-5 [STARTED]
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [STARTED]
TEST: root filesystem on LVM PV [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-11-LVM'
TEST: root filesystem on multiple device btrfs [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-15-BTRFSRAID'
TEST: root filesystem on LVM PV with thin pool [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-17-LVM-THIN'
TEST: root filesystem on a ext3 filesystem [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-02-SYSTEMD'
TEST: root filesystem on a btrfs filesystem with /usr subvolume [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-03-USR-MOUNT'
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-18-LVM-ENC-LV'
TEST: Full systemd serialization/deserialization test with /usr mount [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-04-FULL-SYSTEMD'
TEST: root filesystem on an encrypted LVM PV on a RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-10-RAID'
TEST: root filesystem on LVM on encrypted partitions of a RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-13-ENC-RAID-LVM'
TEST: root filesystem over iSCSI [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-30-ISCSI'
TEST: root filesystem on a ext3 filesystem [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-01-BASIC'
TEST: root filesystem over iSCSI [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-31-ISCSI-MULTI'
TEST: rpm integrity after dracut and kernel install [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-99-RPM'
TEST: root filesystem on NFS [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-20-NFS'
TEST: root filesystem on NFS with bridging/bonding/vlan [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-70-BONDBRIDGETEAMVLAN'
TEST: root filesystem on an encrypted LVM PV on a degraded RAID-5 [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-12-RAID-DEG'
TEST: root filesystem on NFS with multiple nics [OK]
make[1]: Leaving directory '/home/harald/git/dracut/test/TEST-50-MULTINIC'

real	9m3,969s
user	22m50,323s
sys	5m24,411s
2018-08-14 11:04:50 +02:00
Harald Hoyer
ffbd37d784 TEST-31-ISCSI-MULTI: use different port than TEST-30 2018-08-14 11:03:48 +02:00
Harald Hoyer
ab94a204e0 load modules earlier for iscsi via dhcp root-path 2018-08-14 11:03:11 +02:00
Harald Hoyer
6058b06b86 test/{TEST-50-MULTINIC,TEST-70-BONDBRIDGETEAMVLAN}: use qemu-3.0 syntax
use qemu-3.0 syntax for network devices
2018-08-13 16:30:25 +02:00
Harald Hoyer
26aea0299a multipath-shutdown: fix shell syntax
seems like a misplaced $()
2018-08-13 16:30:25 +02:00
Harald Hoyer
0a80cda0ea dracut.spec: remove warpclock from z-series, not the other way round 2018-08-13 16:30:25 +02:00
Harald Hoyer
6f0500ed4a iscsi: remove $() where it does not fit
also simplify iscsiadm command to one call
2018-08-13 16:30:25 +02:00
Harald Hoyer
746135dd1e mdraid: better handling of various UUID formats 2018-08-13 16:30:25 +02:00
Lukas Nykryn
a762dedb60 dracut-functions: fix the word splitting 2018-08-09 13:13:52 +02:00
Nicolas Chauvet
a0c915b1e4 Add gpio and pinctrl drivers for arm*/aarch64
This is needed since few gpio/pinctrl can be built as modules and are
useful on early boot.

One example is jetson-tx1 where sata and external mmc can work only
after loading pinctrl-max77620 and gpio-max77620 modules.

Having theses kind of drivers bundled into the initramfs will also
avoid some deferred probes.

V2: add pinctrl for all arches

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2018-08-06 09:46:08 +02:00
Harald Hoyer
99df3d22be mdraid/parse-md.sh: also accept rd.md.uuid with ":"
convert rd.md.uuid=32ef2172:f056:6fa7:66a8:2f7fc8b1798
to udev rules in the correct UUID format 32ef2172-f056-6fa7-66a8-2f7fcf8b1798
2018-08-02 16:32:41 +02:00
Yu Watanabe
be98291caf spec: sort modules
Also drops remaining %defattr.
2018-07-30 10:43:21 +02:00
Yu Watanabe
33782aebbf spec: warpclock is not available on s390 or s390x 2018-07-30 10:43:21 +02:00
Harald Hoyer
55a12055c5 dracut.spec: Remove needless use of %defattr 2018-07-26 13:04:20 +02:00
Harald Hoyer
25111d717e dracut.spec: add 00warpclock dracut module 2018-07-26 13:01:14 +02:00
Harald Hoyer
819ea38651 Bring back 51-dracut-rescue-postinst.sh
can only be obsoleted after F30
2018-07-26 12:58:21 +02:00
Kairui Song
143420bc05 lsinitrd: update help message and man page
Signed-off-by: Kairui Song <kasong@redhat.com>
2018-07-26 09:57:55 +02:00
Kairui Song
986b12d391 lsinitrd: optimize performance when handling multiple files
Currently, when trying to unpack or print the content of multiple
files, lsinitrd will decompress the image and pipe the decompressed
content to cpio to retrive each file if the image is compressed.
Which mean if we want to extract 10 files the image will be decompressed
10 times, which is a waste of time.

This patch will let lsinitrd decompress the image file to a temp file
first if multiple file names are given, then cpio will read from the
decompressed temp file, which will speed up a lot.

Time consumption test for command:
`lsinitrd initramfs-4.16.15-300.fc28.x86_64.img \
    usr/lib/dracut/build-parameter.txt \
    usr/lib/dracut/modules.txt \
    etc/machine-id \
    etc/hostname \
    usr/lib/udev/rules.d/99-systemd.rules`

Before the patch:
2.37user 0.33system 0:02.12elapsed

After the patch:
0.50user 0.42system 0:00.72elapsed

There would be a more significant time difference if we try to
extract more files.
2018-07-26 09:57:55 +02:00
Kairui Song
f81c864eed lsinitrd: allow to only unpack certain files
Before this patch, "--unpack" will always unpack the whole image.
Make "--unpack" be able to unpack only certain files, it will be
easier to retrieve files from initramfs image.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-07-26 09:57:55 +02:00
Harald Hoyer
aac3a0652a NEWS: forgot to update the latest version 2018-07-26 09:54:13 +02:00
Hannes Reinecke
a0eadcdc64 00warpclock: Set correct timezone
Add module for setting correct timezone.

References: bnc#830060

For now, this module will not be included automatically due to different
expectations (see e.g.  https://bugzilla.redhat.com/show_bug.cgi?id=981617)

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Molkentin <daniel.molkentin@suse.com>
2018-07-24 07:08:11 +02:00
Harald Hoyer
e331e06a39 dracut-install: skip modules with empty path
if kmod_module_get_path(module) returns NULL, skip the module
2018-07-18 12:42:02 +02:00
Kairui Song
7047294617 Record loaded kernel modules when hostonly mode is enabled
A hostonly image will not include every possibly required kernel module,
so if any hardware or configuration changed, the image may fail to boot.

One way to know if there are any hardware change or configuration change
that will require an image rebuild or not is to check the loaded kernel
module list. If the loaded kernel module list differs from last build
time, then the image may require to be rebuilt.

This commit will let dracut record the loaded kernel module list when
the image is being built, so other tools or services can compare this
list with currently loaded kernel modules to decide if dracut should be
called to rebuild the image.

To retrieve the loaded kernel modules list when an image is built, use
lsinitrd command:

lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
2018-07-18 11:50:18 +02:00
Harald Hoyer
1caaeaae1e modules.d/95fcoe/cleanup-fcoe.sh: chmod +x 2018-07-12 15:19:17 +02:00
Harald Hoyer
d63a4e285e TEST-40-NBD: disable for now
nbd is always broken
2018-07-12 15:18:48 +02:00
Harald Hoyer
9a9c67d61b TEST-30-ISCSI: readd multiple target test 2018-07-06 11:56:23 +02:00
Harald Hoyer
bc01f822de NEWS and AUTHORS update 2018-07-06 10:37:51 +02:00
Harald Hoyer
f265cb67dc mdraid: fix case if rd.md.uuid is in ID_FS_UUID format
if rd.md.uuid is in ID_FS_UUID format with dashes
e40a0234-7e52-5f10-f267-658d8ec463fa
convert it for the /dev/disk/by-id/md-uuid-${uuid} format
e40a0234:7e525f10:f267658d:8ec463fa
2018-07-06 09:25:03 +02:00
Harald Hoyer
f98d3066d9 rdsosreport.sh: best effort to strip out passwords
Modified version of:
https://github.com/dracutdevs/dracut/pull/96

Thanks to Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
2018-07-05 14:49:23 +02:00
Mike Gilbert
9d1b81c0d1 dracut.sh: improve udevdir and systemdutildir fallback logic
Check for a common binary in systemdutildir. This resolves an issue on
split-usr systems, where it is common to have both /lib/systemd[/system]
and /usr/lib/systemd[/user] present.

Check for systemd-udevd specifically, since some distros (Gentoo) allow
udev to be installed without the rest of the systemd stack.

Similar logic is applied to udevdir simply for consistency.
2018-07-05 13:57:43 +02:00
Harald Hoyer
e3fb645821 TEST-99-RPM: use Fedora 29 2018-07-05 13:39:46 +02:00
Harald Hoyer
8f77326479 dracut-init.sh: fix instmods with zero input
instmods < /dev/null

should not error
2018-07-05 13:39:46 +02:00
Harald Hoyer
ca77afdeb3 dracut.spec: remove 90multipath-hostonly 2018-07-05 13:39:46 +02:00
Kairui Song
35e86ac117 Merge 90-multipath-hostonly and 90-multipath
This commit basically reverts 5ce7cc73

90-multipath-hostonly module was added in 5ce7cc73, because if hostonly
mode is enabled, multipath module will always hardcode wwids which
causes problems when the initramfs is cloned to another system with same
hardware.

Now with tri-state hostonly mode, the two modules could be merged and only
hardcode wwids when "strict" hostonly mode is enabled.
2018-07-05 13:17:19 +02:00
Harald Hoyer
058ff2f06d dracut.spec: add 95qeth_rules 2018-07-05 12:03:34 +02:00
Harald Hoyer
efecf0a95e network: iface_has_carrier(): fixed logic 2018-07-05 09:37:10 +02:00
Hiroaki Mizuguchi
c574c3f565 ifup.sh: don't wait linkup when set static ip explicitly
iface_has_carrier is skipped when set $dev. Fail curl fetch for root=live:<url>.
2018-07-05 09:37:01 +02:00
Daniel Molkentin
61ac90fefa 95qeth_rules: Add new module to copy qeth rules
Only pick rules for interfaces which have a carrier in the running
system. Those interfaces will be assembled by udev to allow booting
from those devices (i.e. iSCSI).

Reference: FATE#323440
2018-07-05 09:15:08 +02:00
Kairui Song
432647c278 90kernel-modules: Don't install extra modules when hostonly mode is set to strict 2018-07-05 09:14:02 +02:00
Kairui Song
a695250ec7 Introduce tri-state hostonly mode
Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:

    * generic: by passing "--no-hostonly" or not passing anything.
               "--hostonly-mode" has no effect in such case.
    * sloppy: by passing "--hostonly --hostonly-mode sloppy". This
              is also the default mode when only "--hostonly" is given.
    * strict: by passing "--hostonly --hostonly-mode strict".

Sloppy mode is the original hostonly mode, the new introduced strict
mode will allow modules to ignore more drivers or do some extra job to
save memory and disk space, while making the image less portable.

Also introduced a helper function "optional_hostonly" to make it
easier for modules to leverage new hostonly mode.

To force install modules only in sloppy hostonly mode, use the form:

hostonly="$(optional_hostonly)" instmods <modules>

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-07-05 09:14:02 +02:00
Harald Hoyer
6ccb58a5b6 iscsi: s/rd.iscsilogin.retries/rd.iscsi.login_retry_max 2018-07-05 09:02:55 +02:00
Harald Hoyer
7d0848957c iscsi: do discovery for every network change 2018-07-04 13:05:56 +02:00
Daniel Molkentin
6b7ffedf0d Fix syncheck complaints 2018-07-04 13:05:56 +02:00
Daniel Molkentin
b31f3fe0d1 95iscsi: Replace iscsistart with iscsid
This allows to setup multiple paths to targets, which is
required for iscsi multipath.
2018-07-04 13:05:56 +02:00
Nicolas Porcel
c1688560ad Add timeout option to crypt module 2018-07-04 09:16:50 +02:00
Jeremy Linton
4cdee66c8e dracut-install: Support modules.softdep
Dracut uses the module deps to determine module dependencies
but that only works for modules with hard symbolic dependencies.
Some modules have dependencies created via callback API's or other
methods which aren't reflected in the modules.dep but rather in
modules.softdep through the use of "pre:" and "post:" commands
created in the kernel with MODULE_SOFTDEP().

Since in dracut we are only concerned about early boot, this patch
only looks at the pre: section of modules which are already being
inserted in the initrd under the assumption that the pre: section
lists dependencies required for the functionality of the module being
installed in the initrd.

Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
2018-07-03 13:36:26 +02:00
Sullivan (CTR), Austin
e0ec6f10d4 Fixed issue #420 2018-07-02 12:42:32 +02:00
Javier Martinez Canillas
f4947f8793 51-dracut-rescue.install: Don't install BLS fragment in /boot/efi on EFI
For EFI systems, the BLS fragments were stored in the EFI System Partition
(ESP) while in non-EFI systems it was stored in /boot.

For consistency, it's better to always store the BLS fragments in the same
path regardless of the firmware interface used.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-07-02 12:28:04 +02:00
Adam Williamson
ba26c59523 Include virtio DRM drivers in hostonly initramfs
The code in 50drm which tries to include all DRM drivers for
hardware attached to the system did not look for virtio devices.
So if the system is a VM using the 'virtio' graphics adapter,
the 'virtio-gpu' module which should be included is not. This
extends the code to also look for virtio devices.

https://bugzilla.redhat.com/show_bug.cgi?id=1593028

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-07-02 11:56:15 +02:00
Ondrej Mosnacek
cec0d04112 fips: only install FIPS-compliant crypto modules
Since the kernel doesn't allow using any non-FIPS-compliant crypto
algorithms, it doesn't make sense to install them. Even if they are
installed, tcrypt will not test them anyway.

Tested on Fedora 28 x86_64 by booting with fips=1 (with hand-patched
module-setup.sh).
2018-07-02 11:42:04 +02:00
Ondrej Mosnacek
f4d34357c0 fips: cleanup FIPS crypto module list
This patch cleans up the default list of kernel modules in the 01fips
dracut module. All the algorithms that are tested in tcrypt are listed
by their algorithm name so that all the generic implementations and
drivers are picked up automatically based on the module alias.

This drops several unneeded modules and even a bogus one (rot13 -- this
one was obviously copy-pasted from tcrypt.c where it was listed as an
easter egg :).

The patch adds also some algorithms that weren't included in the
original set. It turns out in FIPS mode we only need those algorithms
that are marked as FIPS-allowed in testmgr.c (failure to find a non-FIPS
algorithm is ignored). The non-FIPS algorithms are further removed in a
subsequent patch.
2018-07-02 11:42:04 +02:00
Ondrej Mosnacek
eed91294f8 fips: add crypto_user module for new hmaccalc
In Fedora 28+, hmaccalc (sha512hmac) is provided by libkcapi-hmaccalc,
which needs the crypto_user module for its functionality.
2018-07-02 11:42:04 +02:00
Hui Wang
a73ba9a8ef dracut: scan and install external kernel modules
since kmod-25 keyword "external" was implemented in order to avoid
additional actions(like weak-modules) when kernel was updated, which
makes it more simple while kernels' kabi were compatible.

but if move some special modules such as megaraid_sas, mpt3sas and
so on, to a external path like /opt/modules, these modules will not
be install to initramfs by default, which make the initramfs can't
be used to boot for disk detection failure.

according to kmod's document, you must specify a absolute path with
"external" keyword, so scan the lines in modules.dep that begin with
"/" and install them, to make sure necessary modules in external path
can be installed to initramfs too.

Signed-off-by: Hui Wang <john.wanghui@huawei.com>
2018-07-02 11:40:42 +02:00
Javier Martinez Canillas
4f55387829 51-dracut-rescue.install: fix exit status code
After the $COMMAND case statement, the exit status of the last executed
command is added to the $ret variable.

But for the "add" pattern, this last executed command is an arithmetic
expression that also adds the exit status $? to the $ret variable. If
both $? and $ret are 0, then the arithmetic expression evaluates to 0
so is considered false and has an exit status of 1.

This makes the script to wrongly exit with an status code of 1 when it
should had been 0.

  case "$COMMAND" in
      add)
      ...
          ((ret+=$?))
	  # $ret is 0 here
          ;;
  ...
  esac

  ((ret+=$?))
  # $ ret is 1 here

  exit $ret

Since $ret is set in the case statement, just exit with that status code
and remove the last arithmetic expression that wrongly sets $ret to 1.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-07-02 11:33:41 +02:00
Ondrej Mosnacek
bca1967c90 fips: Drop obsolete dependencies
Explicitly require libkcapi-hmaccalc and stop installing NSS/prelink
dependencies that are no longer needed.
2018-06-14 13:07:07 +02:00
Daniel Molkentin
d00cfc2a7b Remove obsolete prelinking functionality 2018-06-14 12:58:59 +02:00
Ondrej Mosnacek
e0758c8168 fips: Drop the 02fips-aesni module
The main 01fips module should always load all optimized/driver modules
of all relevant crypto algorithms (based on their aliases), so we can
drop this useless module.
2018-06-14 12:56:51 +02:00
B. Wilson
1b72c97cc5 crypt: Implement cmdline rd.luks.partuuid
Commit bf5c53a implements support for mounting LUKS devices with
detached headers; however, it assumes that the LUKS device sits on an
unpartitioned disk.

Mirroring the `rd.luks.serial` option, this commit implements the
`rd.luks.partuuid` cmdline option, supporting headless LUKS devices on
drive partitions.
2018-06-13 10:59:28 +02:00
Renaud Métrich
c1c78f8a91 Harden dracut against BASH_ENV environment variable
When dracut silently produces a broken initramfs, then the system will
likely not boot and this can be very problematic. Typical use case is
after the kernel has been updated.

It appears that dracut is not protected against the BASH_ENV variable,
causing various scripts called by dracut to possibly fail or provide
wrong output (e.g. "ldd" is one of these).
Having a broken output for "ldd" makes the generated initramfs be not
usable, typically because vital binaries will be missing (e.g.
"awk", "udevadm", ...).

Note: because the shebang line cannot contain more than one argument,
the '--norc' option had to be removed. IMHO, it was useless anyway.

Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
2018-06-08 10:48:45 +02:00
Ondrej Mosnacek
935dd5746a fips: add sha3_generic and sm3_generic modules
SHA-3 and SM3 have been added to the tcrypt module recently, so without
them the 'modprobe tcrypt' step causes a kernel panic.
2018-06-07 17:18:29 +02:00
Pingfan Liu
67354eebbc 40network: introduce ip=either6 option
In kdump, if dump-target is ssh on ipv6, we need to sync until ipv6 addr
is ready. Currently ip=auto6/dhcp6 provides such function. But in 1st kernel,
it is hard to know whether the ipv6 addr is got by dhcpv6 or SLAAC.
E.g ifcfg-eth* contains DHCPV6C=yes direction, but there is no dhcpv6
server in the network, and then after the system is up, the user
echo 1 > /proc/sys/net/ipv6/conf/eth0/autoconf && accept_ra by manual
to obtain a ipv6 addr. Or vice.
So this patch suggests to make dhcpv6 as auto6 fallback

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2018-05-29 10:07:19 +02:00
Harald Hoyer
f6e777ec4b cleanup empty ldconfig_paths directories
https://bugzilla.redhat.com/show_bug.cgi?id=1324746
2018-05-22 09:51:12 +02:00
Harald Hoyer
df6bb5e959 shutdown: sleep a little, if a process was killed
If a process (maybe plymouth) was still pinning /oldroot, then shutdown
would
- kill -9 $pid
- umount_a
- umount_a
in a very short timeframe. A small sleep hopefully lets the scheduler free
up /oldroot in the mean time.
2018-05-15 13:37:53 +02:00
Harald Hoyer
08e11e30e3 dracut.spec: do not recommend grubby 2018-05-07 15:27:22 +02:00
Harald Hoyer
731b37e929 dracut-install.c: untabify 2018-05-07 15:23:04 +02:00
Harald Hoyer
8ad3215590 don't error out, if no modules were installed
dracut-install … -m -s drm_crtc_init =drivers/staging
should not return an error, if no module was found in =drivers/staging

https://bugzilla.redhat.com/show_bug.cgi?id=1575527
2018-05-07 15:21:35 +02:00
Harald Hoyer
b2a024991f 80lvmmerge/README.md: remove executable bits 2018-05-07 10:40:32 +02:00
Harald Hoyer
bfa4e45fa7 s/find_btrfs_devs/btrfs_devs 2018-05-07 10:26:45 +02:00
Daniel Molkentin
c9b5165daa 10i18n: Fix possible infinite recursion 2018-05-03 15:15:16 +02:00
Colin Walters
740e41b843 Suppress sync/fsfreeze if not running on a live system
It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
and there's no reason to sync, and *definitely* no reason to fsfreeze.

Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
globally.  See e.g. 8642ef5ab3
2018-05-02 17:44:45 +02:00
Michael McCracken
3161dea8e1 Update dracut.modules.7.asc
Update manpage to reflect code behavior for `inst` with >2 args.

Signed-off-by: Michael McCracken <michael.mccracken@gmail.com>
2018-04-30 21:48:34 +02:00
Yu Watanabe
cae0004dbe spec: add stratis module
Follow-up for c4f8329cc2.
2018-04-30 21:48:11 +02:00
Hendrik Brueckner
3c8a69677b crypt: correct s390 arch to include arch-specific crypto modules
Convert the s390x into s390 to also include s390-specific crypto
modules, for example, aes_s390 into the initramfs.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
2018-04-26 13:34:53 +02:00
Tony Asleson
c4f8329cc2 Initial Stratis support
Ref. https://github.com/stratis-storage

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2018-04-26 13:28:36 +02:00
tpgxyz
654484b82b fix zstd magic header 2018-04-19 06:31:23 +02:00
Marcos Mello
ccaf52901f fs-lib: install crc32 in no-hostonly
It is needed by f2fs.
2018-04-17 12:02:00 +02:00
Marcos Mello
384eeedd2d fs-lib: install crc32c for ext4
EXT4 filesystems created with metadata_csum (enabled by default in mke2fs 1.44+) or ea_inode need crc32c.

https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=d0b9e0a6aa7d6805338a43b4e372623352d8df09
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/fs/ext4/super.c?h=v4.15.15#n3491
2018-04-09 08:19:51 +02:00
Marcos Mello
65cfabf7a6 fs-lib: remove redundancy 2018-04-09 08:19:51 +02:00
Enno Boland
2b5192c18d make failing installation of drm modules nonfatal 2018-04-01 16:02:24 +02:00
Alexander Tsoy
fe6c7e0f06 plymouth: fix detection of plymouth directory
Some distros have both /usr/lib/plymouth and /usr/libexec/plymouth
directorirs, so we should check the existance of plymouth-populate-initrd
script.

Fixes: 421b46f8ae
2018-03-23 11:31:43 +01:00
Lukas Nykryn
3c3b2cf093 spec: add missing obsoletes and provides for removed fips subpackages 2018-03-22 16:34:16 +01:00
Lukas Nykryn
1f50d5b86d spec: merge fips subpackages to main package 2018-03-22 10:17:52 +01:00
Lukas Nykryn
0bb9a683d4 spec: drop support for legacy distributions
rhel <= 7 has its own branch and there is no point in supporting the old
fedora
2018-03-22 10:17:52 +01:00
Daniel Molkentin
d23f32dd4b 90kernel-modules: Include Intel Volume Management Device support
Reference: bsc#1079924
2018-03-16 15:37:25 +01:00
Harald Hoyer
ebfd53e1d9 lsinitrd.sh: fixed zstd file signature 2018-03-15 09:56:56 +01:00
Javier Martinez Canillas
f8c24964cd 51-dracut-rescue.install: fix initramfs not generated in /boot case
Commit 5e574046e76e ("5?-dracut*.install: Allow scripts to install
the initramfs in /boot dir") added support to generate initramfs
images in the /boot directory and copy the respective BLS files.

Unfortunately, it broke the rescue initramfs generation when it's
not installed on /boot due not checking for the correct condition.

It checks for the 0-rescue sub-dir to exist, but this is created so
instead if the parent sub-dir exists has to be checked. Also, check
if the destination directory is /boot or not, instead if it exists.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-03-12 09:05:40 +01:00
Harald Hoyer
f8e0c7cc62 kernel-modules: add mmc/core for arm 2018-03-05 09:56:25 +01:00
Lukas Nykryn
3aa37cafde all: fix issues found by shellcheck
Error: SHELLCHECK_WARNING:
/usr/lib/dracut/dracut-init.sh:939:20: error: Argument to implicit -n is always true due to literal strings. [SC2157]
  937|   dracut_kernel_post() {
  938|       for _f in modules.builtin.bin modules.builtin modules.order; do
  939|->         [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
  940|       done
  941|

Error: SHELLCHECK_WARNING:
/usr/lib/dracut/modules.d/98syslog/parse-syslog-opts.sh:18:12: error: This expression is constant. Did you forget a $ somewhere? [SC2078]
   16|       elif [ -e /sbin/syslogd ]; then
   17|           syslogtype="syslogd"
   18|->     elif [ /sbin/syslog-ng ]; then
   19|           syslogtype="syslog-ng"
   20|       else

Error: SHELLCHECK_WARNING:
/usr/lib/dracut/modules.d/90crypt/crypt-lib.sh:15:29: error: Since you double quoted this, it will not word split, and the loop will only run once. [SC2066]
   13|               strstr "$d" "${luks##luks-}" && return 0
   14|               if [ -n "$dev" ]; then
   15|->                 for _dev in "$(devnames $d)"; do
   16|                       [ "$dev" -ef "$_dev" ] && return 0
   17|                   done
2018-03-02 13:41:43 +01:00
Javier Martinez Canillas
b39b8452d2 5?-dracut*.install: Allow scripts to install the initramfs in /boot dir
The GRUB 2 bootloaders expect the initrd to be installed in /boot instead
of /boot/$MACHINE_ID/$KERNEL_VERSION/{linux,initrd}, so if that directory
doesn't exists, install the initramfs images on the /boot directory.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-03-01 14:50:30 +01:00
Daniel Molkentin
48723f28aa 90kernel-modules: Ensure PCI host modules are included
The includes modules like the Intel Volume Management Device driver,
which is required to boot from disk on some systems.

Reference: boo#1079924
2018-03-01 12:51:49 +01:00
Harald Hoyer
3ed33db54a Update %description a bit 2018-02-26 11:22:55 +01:00
Harald Hoyer
0a68b6a518 dracut.spec: remove BuildRoot 2018-02-19 10:17:36 +01:00
Harald Hoyer
7b3f374a82 dracut.spec: remove clean section 2018-02-19 10:16:30 +01:00
Harald Hoyer
8ae8652edd version 047 2018-02-19 10:00:33 +01:00
Harald Hoyer
5283544cc7 dracut.spec: add BuildRequires gcc 2018-02-19 09:10:12 +01:00
Harald Hoyer
e64dafd1f2 dracut-function.sh:check_block_and_slaves() check for block devices
Some nvme have char parents, so check if the "slave" is a block dev.

Fixes https://github.com/dracutdevs/dracut/issues/373
2018-02-19 09:05:01 +01:00
Harald Hoyer
1779aee72c dm:dm-shutdown.sh: silence all disassembly until the last try 2018-02-19 09:05:01 +01:00
Ignaz Forster
94f61235d7 Avoid executing emergency hooks twice 2018-02-08 16:30:05 +01:00
Alexander Tsoy
643be55570 crypt: actually put block_uuid.map into initramfs
Also change path to /etc/block_uuid.map.

Fixes: c3b6970394
2018-02-02 11:40:29 +01:00
Pawel Wieczorkiewicz
f0094476fd 40network: Fix race condition when wait for networks
If no network related params are specific, but rd.neednet=1 is set,
the default initqueue action is to wait until one of the network
interfaces is marked as setup properly.

This also help with initqueue's race condition when the network interface
shows up late

References: bnc#866771

Signed-off-by: Hannes Reinecke <hare@suse.de>
2018-01-30 10:18:37 +01:00
Daniel Molkentin
ed2cc8c9b9 90plymouth: logo file is optional and may not exist 2018-01-30 10:14:22 +01:00
Daniel Molkentin
421b46f8ae 50plymouth: improve distro compatibility
The existence of dpkg-achitecture is not indicative of a debian
installation. It may well be installed on systems of people who
package for both distros. The previous code path did not take
that into account.

We now traverse all known plymouth directories, locking on the first
valid one, and try to work with it.

At the same time, we do not include the module if the plymouth directory
could not be found.
2018-01-30 10:14:22 +01:00
Matthew Thode
c88c3215e8 support kernels with built-in modules
Don't fail if modprobe fails to load a module, the kernel could have it
statically compiled in.

Signed-off-by: Matthew Thode <mthode@mthode.org>
2018-01-30 09:19:16 +01:00
Matthias Gerstner
f48fb6f4ce 98integrity: support X.509-only EVM configuration
Previously if no symmetric key was configured for EVM, then the
initialization process was aborted. It can be a valid use case, however,
to only use EVM digital signatures. In this case only X.509 certificates
need to be loaded.

With this change EVM initialization will continue if any of the
symmetric or X.509 keys could be loaded.
2018-01-25 12:15:36 +01:00
Matthias Gerstner
cb02ff635c 98integrity: support loading x509 into the trusted/builtin .evm keyring
This implements logic analogous to the one already implemented in
ima-keys-load.sh, only for the .evm/_evm keyrings.

If the kernel was built with CONFIG_IMA_TRUSTED_KEYRING then the kernel
initially creates and configures .ima and .evm keyrings. These keyrings
only accept x509 certificates that have been signed by a local CA which
belongs to the kernel builtin trusted keyring.

Thus if such a keyring is already present then additional evm keys
should be loaded into them. If this is not the case then the _evm
keyring needs to be created in userspace and keys will be loaded into
it instead.

Before this change dracut always created the _evm keyring and loaded
keys into it without considering an existing .evm keyring. In case of
CONFIG_IMA_TRUSTED_KEYRING being enabled, the _evm keyring will not be
used by the kernel, however, and EVM digital signatures will not work as
expected.
2018-01-25 12:15:36 +01:00
Matthias Gerstner
a1c1be4f3e 98integrity: fix inconsistent whitespace 2018-01-25 12:15:36 +01:00
Harald Hoyer
6c7776e344 dracut-install: strdup() kmod_module_get_name() string
otherwise it can't be used later on after freeing the context.

Should resolve https://bugzilla.redhat.com/show_bug.cgi?id=1536609
2018-01-23 14:09:31 +01:00
Harald Hoyer
d7e3bf7abd Merge pull request #365 from Conan-Kudo/early-microcode-by-default
Enable 'early_microcode' by default
2018-01-18 15:20:51 +01:00
Thomas Backlund
b25ef46f93 Enable 'early_microcode' by default
We initially enabled it for Haswell TSX bug (mga#16657)

Now there is also Meltdown and Spectre security issues,
and more microcode issues will most likely show up...

So the sane default for 'early_microcode' to have it enabled,
as theese changes must be done early in boot process to take
effect as intended.

Update documentation accordingly.

Reference: https://bugs.mageia.org/show_bug.cgi?id=16657

Signed-off-by: Thomas Backlund <tmb@mageia.org>
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
2018-01-18 05:30:28 -05:00
Harald Hoyer
cbb9a4e955 Merge pull request #362 from danimo/persistance_policy
Give --persistent_policy precedence over /dev/mapper names
2018-01-18 10:35:02 +01:00
Harald Hoyer
dfbd8f74fd Merge pull request #317 from dracut-mailing-devs/20171212142718.11451-1-carlo@caione.org
drm: Look for DRM drivers in the staging directory
2018-01-18 10:24:41 +01:00
Harald Hoyer
8379784a0e lsinitrd.sh: quote filename in extract_files() 2018-01-18 10:17:42 +01:00
Harald Hoyer
a54206722d dracut.cmdline.7.asc: document rd.ccw and rd.znet
rd.znet should be used instead of rd.ccw.

Add more info about rd.znet.

Fixes github issue 364
2018-01-18 08:57:00 +01:00
Harald Hoyer
83b19de168 Merge pull request #363 from danimo/dracut_dmraid_use_udev
0202-dracut_dmraid_use_udev
2018-01-17 18:32:52 +01:00
Hannes Reinecke
9d651355a1 Use udev rules to create dmraid /dev/mapper/ devices
https://bugzilla.opensuse.org/show_bug.cgi?id=905746
2018-01-17 17:51:42 +01:00
Martin Wilck
b6054b5de6 Give --persistent_policy precedence over /dev/mapper names
There is currently no way to override dracut's preference for
/dev/mapper device names. But using these is problematic in
different scenarios: For example, if a user has a multipath-
enabled system but wants to disable multipath, or if the
names of multipath maps change because of configuration changes
(e.g. toggling user_friendly_names in /etc/multipath.conf).

This patch makes dracut prefer the user-specified
--persistent_policy names over /dev/mapper names.

It might be worthwhile to discuss why dracut prefers /dev/mapper
of /dev/disk/by-uuid at all. This preference was introduced
in 9037b63e with the argument "dm devices maintain /dev/mapper/* as
persistent names", but that's wrong for the scenarios mentioned
above, and is not a compelling reason for preferring /dev/mapper
over /dev/disk/by-uuid.

References: bsc#908143

Signed-off-by: Martin Wilck <mwilck@suse.de>
2018-01-17 12:05:44 +01:00
Harald Hoyer
308c4066fe Merge pull request #359 from yuwata/kmod-version
configure, kmod: bump kmod version to >= 23
2018-01-17 09:51:54 +01:00
Harald Hoyer
bff3ee1936 Merge pull request #361 from danimo/dm_multipath
90multipath: load dm_multipath module during startup
2018-01-17 09:50:54 +01:00
Hannes Reinecke
d842d5cf9e 90multipath: load dm_multipath module during startup
As the 'multipath' program will be triggered directly from
udev events it will be called before the multipath service
unit has started up. Which means we cannot rely on the
service unit to load the module for us, but we rather
have to do it early before udev is started.

References: bsc#986734

Signed-off-by: Hannes Reinecke <hare@suse.com>
2018-01-16 16:30:53 +01:00
Yu Watanabe
7bb8083562 configure, kmod: bump kmod version to >= 23
Follow-up for 2a0da60ed1.
2018-01-16 23:10:21 +09:00
Harald Hoyer
2a0da60ed1 configure: bump kmod version to >= 23
for issue #357
2018-01-16 14:17:16 +01:00
Harald Hoyer
bce6823a19 lsinitrd: no more cat: write error: Broken pipe
silence the cat
2018-01-16 13:57:34 +01:00
Harald Hoyer
33b560fcc2 Merge pull request #356 from yuwata/spec-s390-2
spec: remove 81cio_ignore module from non-s390 arch
2018-01-16 10:15:38 +01:00
Yu Watanabe
885b4a17d4 update AUTHORS 2018-01-16 01:05:14 +09:00
Yu Watanabe
a07b1bb6bb spec: remove 81cio_ignore module from non-s390 arch
Follow-up for b925f7f5d9.
2018-01-16 01:03:31 +09:00
Harald Hoyer
9ed6eb741f dracut-functions.sh:check_vol_slaves() speedup LV -> VG name
Instead of trying all /dev/mapper/* devices to match the maj:min, and
get the VG name with "lvm lvs", use the dm/name from /sys and dmsetup
splitname.

This should speedup execution with lots of LVs.
2018-01-15 15:47:17 +01:00
Harald Hoyer
b925f7f5d9 Merge pull request #347 from danimo/81cio_ignore
81cio_ignore: handle cio_ignore commandline
2018-01-15 09:04:12 +01:00
Hannes Reinecke
637fb76291 0056-81cio_ignore-handle-cio_ignore-commandline
81cio_ignore: handle cio_ignore commandline

References: bnc#874902

Incorporates following on-top patches/fixes:
----------------------------
Subject: 81cio_ignore: skip module if cio_ignore is not active

When cio_ignore is not active we should skip the entire module
during boot; otherwise it'll lead to adverse effects.

References: bnc#882685
----------------------------
Subject: 81cio_ignore: rewrite module

Rewrite cio_ignore module to rely on the dracut commandline
parameter 'rd.cio_accept', which takes a comma-separated list
of CCW IDs. Each of those IDs are being removed from the
list of devices from cio_ignore.

The default values for rd.cio_accept are taken from
/boot/zipl/active_devices.txt.

References: bnc#882685
-----------------------------
Subject: More empty cmdline fixes

This fixes up some more modules which might print out empty
commandline files.
-----------------------------
Subject: Mark scripts as executable

All scripts need to be marked as executable, otherwise dracut
won't be running them.

References: bnc#887010

Signed-off-by: Thomas Renninger <trenn@suse.de>
2018-01-12 15:35:24 +01:00
Harald Hoyer
8b4b7dc5b2 iscsi: remove last iscsid code snippet 2018-01-12 13:45:20 +01:00
Harald Hoyer
cc3808184c README.md: add test 31 2018-01-12 13:34:57 +01:00
Harald Hoyer
d888e21b5d test/ci-matrix.txt: add file specifying which tests to run 2018-01-12 13:04:34 +01:00
Harald Hoyer
5cc17c25c2 TEST-14-IMSM: fail early, if setup failed 2018-01-12 11:34:45 +01:00
Harald Hoyer
2bb4881b82 dracut.spec: fixed typo
introduced with commit 52d19cb161
2018-01-12 11:33:53 +01:00
Harald Hoyer
28a68f1f3c iSCSI: no more iscsid
According to Cathy Zhou <Cathy.Zhou@Oracle.COM>:

"iscsistart is not designed to be working together with iscsid. When an
interface gets the dhcp offer successfully, the iscsiroot script is run
which starts the iscsistart service to establish the iSCSI session. With
the existence of iscsid, the iscsistart service's attempt to setup its
own mgmt ipc fails. Instead, the request to login to the iscsi target
is handled by the mgmt ipc of iscsid. After iscsistart finishes its
login attempt, it eventually sends a stop_event_loop request to stop
the mgmt process. As the result, it terminates iscsid."

So, iscsid is kicked out again.

Additionally iscsistart-flocked is used to make sure iscsistart is not
run in parallel.
2018-01-12 10:38:20 +01:00
Harald Hoyer
b7a7ab1943 Merge pull request #354 from yuwata/spec-s390x
spec: do not package s390 specific modules
2018-01-12 10:36:56 +01:00
Yu Watanabe
52d19cb161 spec: sort modules 2018-01-12 18:24:52 +09:00
Yu Watanabe
4c3688d355 spec: do not package s390 specific modules 2018-01-12 18:24:31 +09:00
Harald Hoyer
8e7d0856d0 Merge pull request #351 from danimo/91zipl
Add 91zipl, which adds support for indirect booting on s390.
2018-01-12 09:34:08 +01:00
Harald Hoyer
6ccb77e19a dracut-systemd/dracut-pre-udev.service: also run for /etc/cmdline
Fixes #117
2018-01-12 09:32:45 +01:00
Harald Hoyer
47f83419a7 Merge pull request #353 from lnykryn/ntfs_3
90dmsquash-live: we don't have find_binary inside initramdisk
2018-01-11 15:33:45 +01:00
Lukas Nykryn
c42c387cca 90dmsquash-live: we don't have find_binary inside initramdisk 2018-01-11 13:31:43 +01:00
Harald Hoyer
b8b341a07f Merge pull request #352 from lnykryn/ntfs
90dmsquash-live-ntfs: fix depends()
2018-01-11 13:18:14 +01:00
Lukas Nykryn
f3e09bf1cb 90dmsquash-live-ntfs: fix depends()
Dependencies should not include module number.
2018-01-11 13:16:17 +01:00
Harald Hoyer
3a6a8d5c83 Merge pull request #346 from danimo/95dcssblk
95dcssblk: Add new module for DCSS block devices
2018-01-11 12:34:40 +01:00
Harald Hoyer
cd83391c72 Merge pull request #350 from yuwata/fsfreeze
dracut.sh: do not invoke fsfreeze on EFI System Partition
2018-01-11 12:30:01 +01:00
Harald Hoyer
0f6d93eb9d crypt: escape backslashes for systemd unit names b/c udev/initqueue/bash
otherwise
luks\x2d25e41d19\x2d1580\x2d4e7c\x2d8875\x2d134045008f33
turns to
luksx2d25e41d19x2d1580x2d4e7cx2d8875x2d134045008f33
2018-01-11 11:42:22 +01:00
Thomas Renninger
33260dac6e Add /boot/zipl to host devs if it is a mount point
bnc#892187

Signed-off-by: Thomas Renninger <trenn@suse.de>
2018-01-11 11:40:06 +01:00
Thomas Blume
8bae047a4e 91zipl: Update active_devices.txt from /boot/zipl device
References: bsc#939101

Signed-off-by: Thomas Blume <thomas.blume@suse.com>
2018-01-11 11:12:39 +01:00
Hannes Reinecke
d118e9d940 91zipl: Install script as executable
initqueue will only work with executable scripts, so we need to
mark it as such.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2018-01-11 11:12:39 +01:00
Hannes Reinecke
403f2c3e1d 91zipl: Translate 'ext2/3' into ext4
91zipl tries to read the filesystem for the /boot/zipl device.
On SLE12, however, the ext2 and ext3 filesystems are handled
by the ext4 module.
And due to bug#886839 no error is registered and booting fails.
So implement a band-aid to translate it into ext4.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2018-01-11 11:12:39 +01:00
Hannes Reinecke
73f89bbadb 91zipl: Store commandline correctly
The 'rd.zipl' command was only printed and never stored in the
initramfs itself.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2018-01-11 11:12:39 +01:00
Hannes Reinecke
ea7ffef13e 91zipl: Add new module to update s390x configuration
Add new module to update the dracut commandline values
during booting with the values found in the file
dracut-cmdline.conf on the device specified by
rd.zipl.

Signed-off-by: Hannes Reinecke <hare@suse.de>

Contrary to the original patch, this one has been modified
to check for /boot/zipl, the location of the first stage kernel
in indirect boot, in order not to install on systems
booting directly via zipl.

Signed-off-by: Daniel Molkentin <daniel.molkentin@suse.com>
2018-01-11 11:12:39 +01:00
Yu Watanabe
7bc681fd88 dracut.sh: do not invoke fsfreeze on EFI System Partition
When the system boots with EFI, then initrd image is stored
on EFI System Partition. Thus dracut always warn about the
failure to invoke fsfreeze on the partition.
This prevents to run fsfreeze on ESP and suppress the warning.
2018-01-11 13:55:14 +09:00
Thomas Renninger
d43cccf588 95dcssblk: Add new module for DCSS block devices
Add s390 dcssblk driver and introduce rd.dcssblk= to pass mounts
that should get activated at initrd stage.

References: FATE#308263

Signed-off-by: Hannes Reinecke <hare@suse.de>
2018-01-10 13:18:24 +01:00
Harald Hoyer
5a8efed021 TEST-3[01]-ISCSI*: increase disk size 2018-01-10 09:13:31 +01:00
Harald Hoyer
17414dd01b Merge pull request #344 from yuwata/spec-cleanup
spec: use if-undefined instead of empty if-defined block
2018-01-09 13:24:46 +01:00
Yu Watanabe
965cacd43a spec: use if-undefined instead of empty if-defined block
Follow-up for 68cbbae33a.
2018-01-09 17:47:03 +09:00
Harald Hoyer
ba2cfcab1e Merge pull request #338 from danimo/fshelp
dracut-emergency: optionally print fs help
2018-01-08 15:05:28 +01:00
Mark Fasheh
1f8a7ae799 dracut-emergency: optionally print fs help
Allow filesystem modules to install a fs-specific text file with
instructions on what to do when mount fails. This is printed when we go into
an emergency shell.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
2018-01-08 14:14:05 +01:00
Harald Hoyer
577f109243 Merge pull request #339 from danimo/fix_include_parsing
Fix parsing of "-i" and "--include"
2018-01-08 13:31:55 +01:00
Fabian Vogt
dcacd2b072 Fix parsing of "-i" and "--include"
- dracut replaced every instance of "-i" in the cmdline,
  even if it was part of a kernel image name, e.g. "vmlinuz-i"
- Fixes boo#908452

Signed-off-by: Fabian Vogt <fvogt@suse.com>

Adjusted to not support "dracut -ifoo bar", as this breaks expected
upstream behavior.
2018-01-08 10:43:46 +01:00
Harald Hoyer
d300160e70 Revert "mdraid: call mdadm with "--wait-clean" instead of "-W""
This reverts commit bc4ce61efc.

Read wrong man page section. Got confused by
https://github.com/dracutdevs/dracut/issues/342
2018-01-05 11:02:12 +01:00
Harald Hoyer
c9d207467c dracut.spec: add lunmask dracut module 2018-01-05 10:42:22 +01:00
Harald Hoyer
68cbbae33a dracut.spec: remove systemd-bootchart 2018-01-05 10:39:44 +01:00
Harald Hoyer
03214e51ae Merge pull request #343 from lnykryn/boot_image_once_more
01fips: Properly creating path to .hmac of kernel based on BOOT_IMAGE
2018-01-02 15:01:15 +01:00
Harald Hoyer
bc4ce61efc mdraid: call mdadm with "--wait-clean" instead of "-W"
seems like -W changed meanings over the years :-/
2018-01-02 14:58:14 +01:00
Lukas Nykryn
d818986db4 01fips: Properly fix creating path to .hmac of kernel based on BOOT_IMAGE
8f5c5 broke the case where BOOT_IMAGE is not set at all.
This code should handle following:
1) BOOT_IMAGE not set
2) BOOT_IMAGE set to something unrelated (s390)
3) BOOT_IMAGE=vmlinuz-4.14.7-300.fc27.x86_64
4) BOOT_IMAGE=/vmlinuz-4.14.7-300.fc27.x86_64
5) BOOT_IMAGE=/boot/vmlinuz-4.14.7-300.fc27.x86_64
6) BOOT_IMAGE=subdir/vmlinuz-4.14.7-300.fc27.x86_64
7) BOOT_IMAGE=/subdir/vmlinuz-4.14.7-300.fc27.x86_64
8) BOOT_IMAGE=/boot/subdir/vmlinuz-4.14.7-300.fc27.x86_64

https://bugzilla.redhat.com/show_bug.cgi?id=1415032
2017-12-28 09:59:48 +01:00
Harald Hoyer
8134db6c33 Merge pull request #321 from danimo/multipath-fixes
SUSE fixes for 90multipath
2017-12-19 15:43:58 +01:00
Harald Hoyer
8c3e65d1ce Merge pull request #318 from danimo/fcoe-fixes
All FCOE-related SUSE patches, rebased on top of master
2017-12-19 15:43:13 +01:00
Harald Hoyer
51d2436c22 Merge pull request #340 from danimo/mkinitrd_suse_A
mkinitrd-suse.sh: Implement functionality of -A option
2017-12-19 15:41:33 +01:00
Harald Hoyer
29a9e92999 Merge pull request #331 from fcami/master-fsfreeze
call fsfreeze(8) on /boot to flush initramfs data & metadata to media
2017-12-19 15:35:18 +01:00
François Cami
de576db3c2 call fsfreeze(8) on /boot to flush initramfs data & metadata to media 2017-12-19 14:47:11 +01:00
Harald Hoyer
a187bc3ca5 Merge pull request #337 from danimo/lunmask
95lunmask: Add module to handle LUN masking
2017-12-19 14:39:07 +01:00
Harald Hoyer
598660bbe6 Merge pull request #336 from danimo/add_drivers
Fix possible hang in dracut
2017-12-19 14:36:45 +01:00
Fabian Vogt
39ee4fdfbd mkinitrd-suse.sh: Implement functionality of -A option
- Without this patch, -A sets host_only=0,
    but host_only wasn't used
- Translates into --no-host-only now
2017-12-19 13:23:08 +01:00
Hannes Reinecke
10f06425a5 95lunmask: Add module to handle LUN masking
Using the module option 'scsi_mod.scan=manual'
this implements LUN masking by selectively enable only those
devices required for booting.

References: bsc#954600,FATE#319786

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-12-19 00:34:45 +01:00
Fabian Vogt
d53bb5c017 Fix possible hang in dracut
- Caused by add_drivers+=" " in dracut.conf (bsc#923116)

Signed-off-by: Fabian Vogt <fvogt@suse.com>
2017-12-19 00:04:35 +01:00
Hannes Reinecke
164760f4b0 95fcoe: use interface names instead of MAC addresses
Now that we are using persistent network names we can switch
to using the interface names when specifying the fcoe configuration.
With that we can print the fcoe configuration only once.

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-18 21:48:07 +01:00
Hannes Reinecke
fd13d5d4d5 95fcoe: add timeout initqueue entries
Occasionally the FCoE connection might be reset after fipvlan was
called, causing the FCoE connection to be dropped and boot to fail.
For these cases we should be adding a timeout entry for the
initqueue to have a failsave mechanism to re-run fipvlan in
these cases.

References: bsc#1052840

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-18 21:48:07 +01:00
Hannes Reinecke
36a8b2e305 95fcoe: Switch back to using fipvlan for bnx2fc
bnx2fc doesn't _actually_ need fcoemon, so fipvlan is sufficient
to start the FCoE connection.
And, in fact, fcoemon is started for every interface, causing
subsequent invocations to fail with

fcoemon[1157]: error 98 address already in use

and fcoemon tearing down the connection.

References: bsc#1052840

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-18 21:48:07 +01:00
Hannes Reinecke
4e3eb1e9d1 95fcoe: fixup fcoe-genrules.sh for VN2VN mode
The 'mode' argument was never referenced in the printf format, causing
invalid rules to be written.

References: bsc#1036323

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-18 21:48:07 +01:00
Hannes Reinecke
a3f91db476 95fcoe: Add shutdown script
We should be disabling the FCoE connection (which triggers sending
a LOGO internally) to logout from the target; this resets the target
and will avoid hitting a busy condition during reboots.

References: bsc#994860

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-18 21:48:07 +01:00
Hannes Reinecke
2aac319410 95fcoe: always set AUTO_VLAN for fcoemon
fcoemon is well capable of figuring out whether a vlan should
be used, so there's no need to disable the AUTO_VLAN feature.

References: bsc#995019

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-18 21:48:05 +01:00
Harald Hoyer
43634c2469 Merge pull request #335 from lnykryn/BOOT_IMAGE-to-HMAC
01fips: Fix creating path to .hmac of kernel based on BOOT_IMAGE
2017-12-18 15:26:31 +01:00
Lukas Nykryn
8f5c564cb3 01fips: Fix creating path to .hmac of kernel based on BOOT_IMAGE
Old code did not work for two most common use-cases.
On most machines BOOT_IMAGE is set to something like
/vmlinuz-4.11.3-202.fc25.x86_64. So if we just add prefix "/boot/."
it won't work. Also on machines without /boot on separate partition
BOOT_IMAGE already has the /boot/ prefix (/boot/vmlinuz-3.10.0-799.el7.x86_64).
So let's strip it in such case.

https://bugzilla.redhat.com/show_bug.cgi?id=1415032
2017-12-18 14:48:59 +01:00
Harald Hoyer
07e413bd0f Merge pull request #334 from FloGa/master
Use pattern matching function
2017-12-18 11:29:17 +01:00
Florian Gamböck
63755f4db8 Use pattern matching function
The needle argument in this specific case is a pattern, which cannot be
matched by the "literal" string matcher strstr.

This can result in fsck calls like:

    e2fsck -a -y /dev/sda1

Which will then exit with an error like:

    e2fsck: Only one of the options -p/-a, -n or -y may be specified.

Hence, it is necessary to use the strglobin function to correctly match
the pattern.
2017-12-18 11:04:05 +01:00
Harald Hoyer
2d3273f96f Merge pull request #325 from danimo/dasd_cio_free
95dasd_mod: do not set module parameters if dasd_cio_free is not present
2017-12-18 10:01:33 +01:00
Harald Hoyer
a45651c193 Merge pull request #328 from danimo/nfs_bonddevices
Do not pass ifname for bonding devices (bsc#995812)
2017-12-18 09:44:24 +01:00
Harald Hoyer
12930f30a1 Merge pull request #324 from danimo/mdraid-no-delete-part
90dmraid: do not delete partitions
2017-12-18 09:43:57 +01:00
Harald Hoyer
1619e731f7 Merge pull request #330 from danimo/task_max_emergency
Set TaskMax=inifinite for the emergency shell
2017-12-18 09:14:21 +01:00
Harald Hoyer
84912dde41 Merge pull request #327 from danimo/nfs_host_robustness
Rebustness fixes for NFS hostnames
2017-12-18 09:13:29 +01:00
Harald Hoyer
dfbbb0baf5 Merge pull request #326 from danimo/no_efi_fcoe_default
fcoe-uefi: Add check for usage
2017-12-18 09:11:54 +01:00
Harald Hoyer
c0f2b6bebc Merge pull request #323 from danimo/dm-fixes
Two SUSE fixes for 90dm
2017-12-18 09:06:54 +01:00
Harald Hoyer
8f4f40cb3c Merge pull request #322 from danimo/font_maps
10i18n: Add correct fontmaps
2017-12-18 09:05:49 +01:00
Harald Hoyer
fa54381b4e Merge pull request #320 from danimo/ifname-bond
Do not pass ifname for bonding devices (bsc#995812)
2017-12-18 09:02:39 +01:00
Harald Hoyer
ffbe0373e2 Merge pull request #319 from danimo/modules-load.d-hostonly
Fix loading of modules in modules-load.d
2017-12-18 09:01:21 +01:00
Daniel Molkentin
649619f6a5 Set TaskMax=inifinite for the emergency shell
Certain rescue/recovery operations, e.g. xfs_repair need
that liberty (bsc#1019938).
2017-12-15 22:00:41 +01:00
Daniel Molkentin
72f5a098e9 Do not pass ifname for bonding devices (bsc#995812)
Patch-By: Thomas Renninger <trenn@suse.de>
2017-12-15 21:55:41 +01:00
Fabian Vogt
8602e59867 NFS: Support host being a DNS ALIAS
The "host" command may also print something else than
"asdf.local.lan has address 1.2.3.4", like:
"rootserver.local.net is an alias for rainbow.local.net.".
So "head -n1" is not enough.

Fixes boo#955592
2017-12-15 21:52:59 +01:00
Thomas Renninger
f5c10673de 95nfs: Fix mount if IPv4 address is used in /etc/fstab
Signed-off-by: Thomas Renninger <trenn@suse.com>
2017-12-15 21:52:28 +01:00
Fabian Vogt
22836a0921 fcoe-uefi: Add check for usage
References: boo#965477

fcoe-uefi gets included by default on EFI systems,
as it does not do the same check that fcoe does,
therefore needlessly pulling in network modules.
This patch copies the check from fcoe to fcoe-uefi.
2017-12-15 21:19:30 +01:00
Hannes Reinecke
6f1b5c0dab 95dasd_mod: do not set module parameters if dasd_cio_free is not present
We're now parsing the 'rd.dasd' parameter from 95dasd_rules, so
setting the 'dasd_mod' module parameter should be dropped here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-12-15 21:14:51 +01:00
Hannes Reinecke
871378aad4 90dmraid: do not delete partitions
There is no point trying to delete partitions; dmraid works
happily even with them. On the contrary trying to delete partitions
can even be harmful when eg dmraid should _not_ be started.

References: bsc#998860

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 20:58:41 +01:00
Hannes Reinecke
870591acec 90dm: fixup dependency cycle between MD and DM shutdown
DM devices might be located on top of MD devices, so we need to
call the DM shutdown script before MD shutdown. The exception
here are multipath devices, which are below MD devices.
So skip removing multipath devices here to avoid spurious errors.

References: bsc#994860

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 20:55:37 +01:00
Hannes Reinecke
07e6357483 90dm: Fixup shutdown script
When calling the shutdown script we need to take care of traversing
the device-mapper tables, otherwise we might end up trying to remove
a device-mapper device which still has another one stacked on top
and the removal will fail.

References: bsc#994860

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 20:55:23 +01:00
Fabian Vogt
251afd36b2 10i18n: Add correct fontmaps
References: bsc#943312, bsc#932981

Signed-off-by: Fabian Vogt <fvogt@suse.com>
2017-12-15 20:50:10 +01:00
Martin Wilck
8008d47faf 90multipath: start before local-fs-pre.target
local-fs-pre.target serves as a separator between the code for
detecting block devices and systemd's fsck/mount logic. This
patch ensures that multipathd is started before local-fs-pre.target
in the initrd. By adding a "Wants=" line for local-fs-pre.target,
it makes sure that this target is started at all.

References: bsc#1006118
Signed-off-by: Martin Wilck <mwilck@suse.de>

===================================================================
2017-12-15 20:42:53 +01:00
Hannes Reinecke
af99264a36 90multipath: parse kernel commandline option 'multipath=off'
SLES11 provided a kernel commandline option 'multipath=off',
so dracut should be parsing the option, too.

References: bsc#1001691

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 20:42:24 +01:00
Hannes Reinecke
239e8ba2ac 90multipath: add shutdown script
As the device-mapper module is removing all device-mapper tables
during shutdown we need to make sure to disable queuing on the
multipath devices; otherwise there might still be I/O pending
and the removal will fail.

References: bsc#994860

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 20:42:15 +01:00
Hannes Reinecke
8d20322f11 90multipath: Start daemon after udev settle
We need to wait until udev has processed all events, otherwise we'll
risk of misdetecting devices. This might cause a temporary interruption
during which multipath removes a device-mapper device, which then
causes a booting failure.

References: bsc#986734

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 20:41:59 +01:00
Hannes Reinecke
d12ce1da85 90multipath: do not fail startup on missing configuration
References: bsc#930019

If rootfs is on multipath, but platform does not have an /etc/multipath.conf
file which is not urgently needed, they system will not boot, due to:

multipathd is not started and rootfs and swap are not found:
systemctl status multipathd.service
* multipathd.service - Device-Mapper Multipath Device Controller
   Loaded: loaded (/usr/lib/systemd/system/multipathd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
Condition: start condition failed at Thu 2015-05-07 11:49:11 CEST; 7min ago
           ConditionPathExists=/etc/multipath.conf was not met

and exit to dracut shell.
2017-12-15 20:41:36 +01:00
Daniel Molkentin
51f4ab300d Do not pass ifname for bonding devices (bsc#995812)
Patch-By: Thomas Renninger <trenn@suse.de>
2017-12-15 20:35:29 +01:00
Fabian Vogt
9fd3e045d5 Fix loading of modules in modules-load.d
With hostonly enabled, only modules that are currently
loaded are included in the initrd. Modules which are
explicitly listed in modules-load.d do not need to
be filtered that way. Fix for boo#962224.
2017-12-15 20:19:52 +01:00
Hannes Reinecke
c75196e11e 95fcoe: Allow to specify the FCoE mode via the fcoe= parameter
FCoE can run in Fabric (ie FCF) or VN2VN mode, so we should allowing
to set this parameter from the commandline, too.

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 18:51:49 +01:00
Daniel Molkentin
d71c9ee286 95fcoe: silence lldpad warnings
When lldpad is not running, any calls to 'dcbtool' will be printing
out a warning. As it perfectly legit to have FCoE running without
DCB we should not be printing out the error.

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 18:51:49 +01:00
Hannes Reinecke
d066fcc3fb 95fcoe: Do not overwrite FCoE configuration
If the installation already has a FCoE configuration we should
not attempt to overwrite it but rather use the pre-defined
configuration.

References: bsc#993861

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-12-15 18:51:49 +01:00
Johannes Thumshirn
6b96b50d2c 95fcoe: Reorder initialisation for bnx2x
Check first if we're running off an bnx2x device and start FCoE on it
via fipvlan, then go the normal/Intel way of starting DCB.

Also the SUSE version of fcoemon needs the yes parameter for the
--syslog option

References: bsc#982588

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.com>
2017-12-15 18:51:42 +01:00
Harald Hoyer
611b8ae0d7 Merge pull request #316 from danimo/btrfs-crc32-accel
Include crc32c-intel module when using btrfs
2017-12-14 15:38:12 +01:00
Harald Hoyer
fb9970ba2d Merge pull request #315 from danimo/emergency-task-limit
Fix task limit in emergency.service (the same change as in dracut-emergency.service) (bsc#1019938)
2017-12-14 15:37:40 +01:00
Harald Hoyer
6b7dca1631 Merge pull request #314 from danimo/simplify-amd-ucode
Simplify microcode lookup for for AMD CPUs
2017-12-14 15:36:54 +01:00
Daniel Molkentin
9f2916cce1 Include crc32c-intel module when using btrfs
Reference: bsc#1011554
2017-12-14 13:41:37 +01:00
Lidong Zhong
df96cccc8f Fix task limit in emergency.service (the same change as in dracut-emergency.service) (bsc#1019938) 2017-12-14 13:37:44 +01:00
Daniel Molkentin
19453dc874 Simplify microcode lookup for for AMD CPUs
Suggested by Tom Lendacky <thomas.lendacky@amd.com>
2017-12-14 12:25:50 +01:00
Harald Hoyer
3dbf1f0783 Merge pull request #313 from danimo/amd-family0x17
Support Microcode Updates for AMD CPU Family 0x17
2017-12-13 08:51:12 +01:00
Daniel Molkentin
215fe58324 Support Microcode Updates for AMD CPU Family 0x17
Original-Patch-By: Tom Lendacky <thomas.lendacky@amd.com>
2017-12-13 01:42:52 +01:00
Carlo Caione
94d09135a7 drm: Look for DRM drivers in the staging directory
The recently upstreamed virtualbox video driver (vboxvideo) is shipped
in the staging directory. We need to probe it before Xorg is loaded to
avoid a corrupted X.

In general it is a good practice to look also in the staging directory
for DRM drivers.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
2017-12-12 16:04:24 +01:00
Harald Hoyer
cd0305cee0 Merge pull request #312 from jnbr/network
40network: install grep
2017-12-12 10:22:41 +01:00
johannes
69acd20d4e 40network: install grep
since version 046 40network/net-lib.sh uses grep but the module does not install grep
2017-12-11 17:52:03 +01:00
Harald Hoyer
825730780a Merge pull request #310 from danimo/remove-systemd-bootchart
Remove 00systemd-bootchart
2017-12-06 14:58:36 +01:00
Harald Hoyer
2bdce3d461 Merge pull request #311 from dracut-mailing-devs/1512379451-17727-1-git-send-email-piliu@redhat.com
dracut.sh: for_each_host_xx() function should indicate the empty case
2017-12-06 14:49:42 +01:00
Daniel Molkentin
b36d322bd2 Remove 00systemd-bootchart
This was removed from systemd almost two years ago in
c550f7a9b89d017215af084288bc44f736f774fe, so dracut should drop support
as well.

Reference: bsc#1067279
2017-12-04 16:01:46 +01:00
Pingfan Liu
e6199960d9 dracut.sh: for_each_host_xx() function should indicate the empty case
The caller of "for_each_host_xx func" needs to tell three cases:
func success/ fail / not be called.
E.g, in kdump case, host_devs can be empty, and we want to know it.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2017-12-04 11:04:53 +01:00
Robert Scheck
84fe3c1a20 Add fuse/ntfs-3g run-time dependencies for -live subpackage 2017-12-01 14:18:55 +01:00
Harald Hoyer
96d69bbf34 Merge pull request #309 from danimo/multipath_bin_error
Fix warning about multipath if not needed
2017-12-01 09:13:53 +01:00
Fabian Vogt
ee6b44342b Fix warning about multipath if not needed
Although no device uses multipath, the module checks
for presence of the multipath binary first, printing a
warning if not present. This patch fixes the wrong ordering.
2017-11-30 16:51:15 +01:00
Harald Hoyer
a13e97e511 dracut-install: remove double "//" in path names
makes relative symlinks shorter
2017-11-30 15:07:48 +01:00
Harald Hoyer
1ec2e34adc Merge pull request #300 from danimo/pick_all_matching_keymaps
10i18n: Load all keymaps for a given locale
2017-11-06 09:56:13 +01:00
Harald Hoyer
11b3d60f5c Merge pull request #303 from FGrose/bootmsg
dmsquash-live-root: Replace incompatible shell syntax.
2017-11-06 09:55:54 +01:00
Frederick Grose
b1e1b6cba3 dmsquash-live-root: Replace incompatible shell syntax.
Fix issue #279  supercede PR #299
Fix bug https://issues.openmandriva.org/show_bug.cgi?id=2219
Replace Bashisms in the boot message for a missing overlay.
Verify presence of plymouth before calling it.
(Rework of commit f1b65e92af5e3f9df79f99e55d5aa936c9bca940.)
2017-11-05 02:19:10 -05:00
Harald Hoyer
18a5011ff2 Revert "lsinitrd.sh: dismiss "cat" error messages"
This reverts commit e190224345.
2017-11-03 09:16:45 +01:00
Harald Hoyer
f9042fd839 Merge pull request #302 from keszybz/yet-another-timeout-fix
dmsquash-generator.sh: properly escape backslash in path
2017-11-03 09:15:02 +01:00
Zbigniew Jędrzejewski-Szmek
38ff9dfbe5 dmsquash-generator.sh: properly escape backslash in path
We need an actual bashslash in the filename on disk.

https://bugzilla.redhat.com/show_bug.cgi?id=1508794
2017-11-02 17:07:09 +01:00
Daniel Molkentin
28aea41829 10i18n: Load all keymaps for a given locale
Previously, dracut would only copy the first one found. However,
with legacy maps for some locales around, there is a chance we
pick the wrong one. Pick all matching keymaps instead

Reference: boo#1065058
2017-11-01 11:33:24 +01:00
Harald Hoyer
d976e19325 Merge pull request #298 from derekhiggins/master
Skip iscsi attachment if no info
2017-10-27 09:10:22 +02:00
Derek Higgins
9408a2ac33 Skip iscsi attachment if no info
If no iscsi session information can be retrieved from the firmware
then skip the iscsi attachment and allow the boot process to continue.
Ensure the timeout scripts don't hit their timeout waiting for
/tmp/iscsistarted-firmware to be created.
This will allow a common image to be used for servers with both a
local and iscsi root with rd.iscsi.firmware set.
2017-10-26 16:27:45 +01:00
Harald Hoyer
ed9281d6d1 dracut.sh: after doing the lazy resolve always install dependencies
Exit the lazy resolving mode after doing the lazy resolve, because there
won't be any lazy resolving anymore after this step.

Fixes https://github.com/dracutdevs/dracut/issues/152
Obsoletes https://github.com/dracutdevs/dracut/pull/225
2017-10-26 09:31:27 +02:00
Harald Hoyer
e190224345 lsinitrd.sh: dismiss "cat" error messages
nobody wants to see "cat: broken pipe"
2017-10-26 09:08:28 +02:00
Harald Hoyer
21789cbb0a make qemu and qemu-net a default module in non-hostonly mode 2017-10-25 13:00:39 +02:00
Harald Hoyer
1751bacda1 Merge pull request #296 from dracut-mailing-devs/20170303132146.4968-1-crrodriguez@opensuse.org
systemd 233 requires sha256, hmac and algif_hash modules
2017-10-23 10:23:42 +02:00
Harald Hoyer
4b758ebe22 Merge pull request #294 from nullr0ute/arm-fixes
Add rpmsg, hwspinlock and usb/misc for ARM
2017-10-12 13:32:00 +02:00
Peter Robinson
82651e9ef3 Add rpmsg, hwspinlock and usb/misc for ARM
Some of the more complex devices now need rpmsg and hwspinlock in the early boot
process to start, and these to the initrd, and pull in usb/misc because
apparently non standard usb hubs are a thing.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2017-10-12 12:17:41 +01:00
Harald Hoyer
6bc8fbda61 Merge pull request #223 from bmr-cymru/bmr-ignore-activation-skip
lvm_scan.sh: use -K when calling lvchange
2017-10-12 11:23:38 +02:00
Harald Hoyer
faabcb2360 dracut.sh: quote sync file argument 2017-10-11 15:28:20 +02:00
Harald Hoyer
1df4538662 Merge pull request #293 from dracut-mailing-devs/1502088233-10139-1-git-send-email-ankit@linux.vnet.ibm.com
Sync initramfs after creation
2017-10-11 15:10:26 +02:00
Harald Hoyer
2c9bcac113 dracut-install: char* -> const char* 2017-10-10 13:39:17 +02:00
Harald Hoyer
04fa949877 Merge pull request #284 from sm00th/kmoddir
dracut-install: fix relative paths in --kerneldir
2017-10-10 13:29:41 +02:00
Harald Hoyer
791d801689 dracut.sh: if /boot/vmlinuz-$version exists use /boot/ as output dir
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1475565
2017-10-10 10:30:44 +02:00
Harald Hoyer
8c2aa6161a git2spec.pl: handle empty merge commits 2017-10-09 17:40:04 +02:00
Martin Wilck
4c2d98c75b emergency.service: use Type=idle
Type=oneshot, as currently set in dracut's emergency service file,
causes an awkward situation if emergency mode is entered e.g. because
of a root device timeout, and the root device appears later because it
just has taken longer than the timeout. In that situation, my
expectation (backed by past positive experience) is that the user should
be able to simply exit the emergency shell and resume normal boot.

:/# systemctl status sysroot.mount
● sysroot.mount - /sysroot
   Loaded: loaded (/proc/cmdline; bad; vendor preset: enabled)
   Active: active (mounted) since Mon 2017-10-09 14:32:15 CEST; 16s ago
    Where: /sysroot
     What: /dev/mapper/3600601600a30200024fbbaf3f500e411-part5
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 1873 ExecMount=/usr/bin/mount /dev/disk/by-uuid/63751805-6abc-46a3-a66f-427920dece4d /sysroot -o ro (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 512)

:/# systemctl list-jobs
JOB UNIT              TYPE  STATE
 56 emergency.target  start waiting
 57 emergency.service start running

2 jobs listed.
:/# exit
logout
Failed to start default.target: Transaction is destructive.

(system keeps idling from this point on, user has no chance to
do anything).

This results from the combination of two effects:
1) initrd-root-fs.target sets "OnFailureJobMode=replace-irreversibly",
2) emergency.service's Type=oneshot causes the start jobs for both
emergency.service and emergency.target to persist while the user is in
the emergency shell.

When the shell is exited, systemd tries to isolate "initrd.target"
again, but this fails with "the transaction is destructive" error
because of the still pending jobs.

This patch fixes this by changing the Type of "emergency.service" from
"oneshot" to "idle".
2017-10-09 14:51:45 +02:00
Harald Hoyer
b69ce65bf4 Merge pull request #286 from rldleblanc/bonding_mtu_fix
Fix MTU on bond interface.
2017-10-09 12:59:59 +02:00
Harald Hoyer
4e3833f6a2 Merge pull request #285 from rldleblanc/fix-typos
Fix a couple of typos.
2017-10-09 12:59:29 +02:00
Harald Hoyer
0d947530b2 TEST-70: sort interfaces for validation 2017-10-09 12:53:40 +02:00
Harald Hoyer
bf5c53a33f Merge pull request #290 from privb0x23/luks-detached
Add basic LUKS detached header support
2017-10-09 12:51:29 +02:00
Harald Hoyer
bada26263c Merge pull request #287 from xlpang/master
fcoe: handle CNAs with DCB firmware support
2017-10-09 11:47:08 +02:00
Harald Hoyer
7c9e64272e Merge pull request #280 from tpgxyz/zstd
add support for Zstandard
2017-10-09 11:39:10 +02:00
Harald Hoyer
32618b456e Merge pull request #277 from imran1008/bond-master-mtu
Set MTU on bond master as opposed to a bond slave
2017-10-09 09:38:37 +02:00
Michal Sekletar
28401778c4 systemd: fix setting of timeouts for device units
JobRunningTimeoutSec now affects how long can start jobs for device
units stay in the "running" state. Disabling default job timeout via
JobTimeoutSec=0 doesn't disable running state timeout. We need to set
running state timeout as well.

Note that doing this the other way around has effect on generic timeout,
i.e. disabling running state timeout disables generic timeout. But doing
it this way we would create implicit dependency on fairly new
systemd-234. However, by setting both options we don't create dependency
on specific systemd version.
2017-10-06 10:05:25 +02:00
privb0x23
b7058d0ce5 Add basic LUKS detached header support
A LUKS root volume with a detached header on a device without partitioning will not have a UUID and will not have an attribute ENV{ID_FS_TYPE}=="crypto_LUKS".
Therefore, several areas need to be addressed: identification of the LUKS device, inclusion of entries within crypttab, and provision of the detached header file.
- Added support for an option (4th column: "force") in /etc/crypttab to force the inclusion of the entry in the initramfs version (avoiding the fs type test).
- Added support for an option (4th column: "header=/path/to/file") in /etc/crypttab to provide a path to a detached header file embedded within the initramfs.
- Added ID and PARTUUID support to the device (2nd column) in /etc/crypttab (complementing the existing UUID functionality).
- Added cmdline support to indicate LUKS device ("rd.luks.serial=") that refers to the attribute ENV{ID_SERIAL_SHORT}.
Tested successfully on Void Linux (x86_64 musl) (no systemd) with a LUKS root volume accessed with a keyfile and using a detached header.
Not tested on systemd, or on a LUKS root volume with a passphrase rather than a keyfile.
2017-10-03 23:37:55 +01:00
Xunlei Pang
795256bbb1 fcoe: handle CNAs with DCB firmware support
Some Combined Network Adapters(CNAs) implement DCB protocol
in firmware, it is recommended that do not run software-based
DCB or LLDP on CNAs that implement DCB, but we have to start
the lldpad service anyway(there might be other software DCB).

If the network interface provides hardware DCB/DCBX capabilities,
the field DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to
be set to "no".

We met an issue on "QLogic BCM57810" with DCB firmware support,
and found dracut still generated "fcoe=<mac>:dcb" which caused
kdump boot failure when using that fcoe dump target.

This patch parses /etc/fcoe/cfg-xxx to detect DCB_REQUIRED="no",
and force "nodcb" if it is the case.

Also improved some coding style in passing.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-09-27 10:36:44 +08:00
Robert LeBlanc
d0eabcab43 Fix MTU on bond interface.
The MTU is only being set on the slave devices and the MTU of the
bonding master is not being updated. This updates the bonding master and
also changes the MTU on the slaves as expected.

Signed-Off-By: Robert LeBlanc <robert@leblancnet.us>
2017-09-21 14:33:59 -06:00
Robert LeBlanc
4d60324757 Fix a couple of typos.
Signed-Off-By: Robert LeBlanc <robert@leblancnet.us>
2017-09-21 13:39:52 -06:00
Artem Savkov
ef84ce2521 dracut-install: fix relative paths in --kerneldir
kerneldirlen is used to modify absolute path returned by
kmod_module_get_path() while it is calculated on user-supplied
--kerneldir argument which can be a relative path.

Use kmod_get_dirname() to convert user-supplied path to the same format
as used by kmod_module_get_path().

This also allows to get rid of now useless strcmp checks that seem to
imply that /lib and /usr/lib are linked which is not always true.
2017-09-21 11:27:23 +02:00
tpgxyz
da97807ccc fix typo 2017-09-05 01:26:31 +02:00
tpgxyz
7dbadcc749 add support for Zstandard 2017-09-05 01:23:38 +02:00
Imran Haider
79926486a0 Set MTU on bond master as opposed to a bond slave
Prior to this commit, the MTU setting was applied to a bond slave
interface.  In older versions of the Linux kernel, this setting
propagated to the bond master and the other bond slaves associated with
the master.  In recent versions of the kernel (observed in Linux 4.12),
increasing the MTU of a slave does not automatically increase the MTU of
the master.  This allows for more flexibility but requires the MTU of
the master to be changed manually.

Ideally, the MTU setting should be applied to the bond master and the
setting will propagate to the bond slaves, since the slaves are required
to have a MTU that is greater than or equal to the bond master.
2017-09-03 00:15:37 -04:00
Harald Hoyer
424c065cd9 Merge pull request #276 from danimo/copy_multipath_confd
95multipath: Pickup files in /etc/multipath/conf.d
2017-08-30 11:51:12 +02:00
Harald Hoyer
1499719d25 Merge pull request #274 from danimo/system_allow_coredump
Enable core dumps with systemd from initrd
2017-08-30 11:39:06 +02:00
Daniel Molkentin
d000b9a2c7 95multipath: Pickup files in /etc/multipath/conf.d
Reference: boo#1048551
2017-08-30 09:05:19 +02:00
Daniel Molkentin
afe4e2844f Enable core dumps with systemd from initrd
systemd sets /proc/sys/kernel/core_pattern to use systemd-coredump.
However, systemd-coredump is missing from initrd, making dumping
the core in initrd impossible by default.

Reference: bsc#1054809
2017-08-29 08:53:35 +02:00
Harald Hoyer
15d00459c3 Merge pull request #272 from yzygitzh/no-lsinitrd-if-quiet
dracut.sh: disable lsinitrd logging when quiet
2017-08-23 09:31:53 +02:00
Ziyue Yang
bd93e9287d dracut.sh: disable lsinitrd logging when quiet
Currently in Fedora/RedHat dracut installs its fedora.conf.example
as the default config file, in which sysloglvl is set 5. This leads
to maxloglvl=5 in dracut calls, making unnecessary lsinitrd calls
during initramfs builds by kdump.

This patch disables lsinitrd logging when --quiet option is given,
which is controlled by maxloglvl only before. This will speed up
dracut image building as the following if --quiet is used in kdump:

1) Before this patch
$ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Detected change(s) in the following file(s):
  /etc/kdump.conf
Rebuilding /boot/initramfs-4.13.0-0.rc1.git4.1.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]
real    0m26.824s
user    0m9.958s
sys     0m15.106s

2) After this patch
$ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Detected change(s) in the following file(s):
  /etc/kdump.conf
Rebuilding /boot/initramfs-4.13.0-0.rc1.git4.1.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]
real    0m20.420s
user    0m8.385s
sys     0m10.468s

Signed-off-by: Ziyue Yang <ziyang@redhat.com>
2017-08-23 11:23:34 +08:00
Harald Hoyer
721bec3f14 Merge pull request #269 from xlpang/master
introduce new "--no-hostonly-default-device"  argument
2017-08-18 09:33:10 +02:00
Xunlei Pang
5634a31156 rootfs-block/module-setup.sh: check root_devs in cmdline_rootfs()
In case of "--no-hostonly-default-device", we do not need
the root device, thus add this check.

Also fixed the stale "root_dev" export.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-08-18 14:44:19 +08:00
Xunlei Pang
37f2fe55d1 dracut.sh: introduce "--no-hostonly-default-device" argument
Kdump doesn't need default host devices like root, swap, fstab, etc,
we only care about the dump target which can be added via "--mount"
or "--add-device". We met several issues that kdump kernel failed
due to one of those host devices added by dracut, additionally, the
needless devices(e.g. LVM) consume some appreciable amount of memory
which is more likely to cause OOM under memory-limited kdump.

So this patch introduced "--no-hostonly-default-device" to avoid
adding those default devices as host_devs.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2017-08-18 09:58:08 +08:00
Harald Hoyer
e5d6018783 Merge pull request #268 from danimo/ssh_include_nss
ssh-client: Include nss_ libraries
2017-08-16 10:16:55 +02:00
Michal Koutný
348935e3b6 ssh-client: Include nss_ libraries
SSH uses passwd database and thus need various NSS plugin libraries,
depending upon setting in nsswitch.conf.

SSH binary fails within the dracut environment without the libraries:

    #:/ ssh
    No user exist for uid 0
2017-08-15 16:10:50 +02:00
Harald Hoyer
3bd3ef5819 kernel-modules: don't call instmods with empty arguments
otherwise it will try to read from stdin and stall
2017-08-14 14:58:47 +02:00
Harald Hoyer
00f3525a30 lvmmerge: depend on systemd
Fixes https://github.com/dracutdevs/dracut/issues/267
2017-08-14 09:47:22 +02:00
Harald Hoyer
0344c2be13 dracut.spec: add support for builds without dist-tag
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.
2017-08-11 14:13:02 +02:00
Ankit Kumar
81269979e6 Sync initramfs after creation
If we trigger crash just after creating initramfs, sometimes it is
observed that initramfs is not written to disk causing the subsequent
boot to fail. A sync should resolve this.

Signed-off-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
2017-08-07 09:03:46 +02:00
Bryn M. Reeves
cc4e507322 lvm_scan.sh: use -K when calling lvchange
The --ignoreactivationskip/-K switch was added to LVM2 in 2.02.99
(July 2013) and is used to control the activation of volumes with
the activation skip flag set: without -K these volumes will be
ignored when 'lvchange -ay $LV' is issued.

This prevents an LVM2 thin-privisioned snapshot from being used
as the root device when booting with rd.lvm.lv=vg/lv since the
activation skip flag is set for these snapshots by default (the
legacy non-thinp snapshots do not set this flag and can already
be activated and used as a root device by specifying appropriate
values for rd.lvm.lv).

This is only used in the rd.lvm.lv case since in that situation
we are activating one or more named LVs specified by the user:
the flag is not given when calling 'vgchange' since this may
cause many unwanted volumes to be activated during early user
space. Users wishing to use a specific snapshot volume should
specify it with 'rd.lvm.lv'.
2017-04-26 14:15:15 +01:00
Cristian Rodriguez
ccf948f2ab systemd 233 requires sha256, hmac and algif_hash modules 2017-03-03 15:01:56 +01:00
221 changed files with 4891 additions and 1815 deletions

1
.gitignore vendored
View File

@@ -10,6 +10,7 @@
/dracut-install
/modules.d/99base/switch_root
/test/*/test.log
/test/*/.testdir
test*.img
/.buildpath
/.project

View File

@@ -4,6 +4,7 @@ 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>
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>
@@ -17,3 +18,16 @@ Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
Shawn W Dunn <sfalken@opensuse.org> <sfalken@opensuse.org>
Kyle McMartin <kmcmarti@redhat.com> <kyle@redhat.com>
Angelo "pallotron" Failla <pallotron@fb.com> <pallotron@fb.com>
Yu Watanabe <watanabe.yu+github@gmail.com>
Martin Wilck <mwilck@suse.de> <mwilck@suse.com>
Thomas Renninger <trenn@suse.com> <trenn@suse.de>
Andrey Borzenkov <arvidjaar@gmail.com>
Cristian Rodríguez <crrodriguez@opensuse.org>
Daniel Drake <drake@endlessm.com> <dsd@laptop.org>
Fabian Vogt <fvogt@suse.com>
Hannes Reinecke <hare@suse.com> <hare@suse.de>
Julian Wolf <juwolf@suse.com> <juwolf@suse.de>
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>

49
.travis.yml Normal file
View File

@@ -0,0 +1,49 @@
language: generic
dist: bionic
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=60
- 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=29 TESTS=13
- IMAGE=29 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 fetch --tags --unshallow
- |
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

View File

@@ -11,6 +11,13 @@ 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)
@@ -18,9 +25,9 @@ case "$COMMAND" in
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" \
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
@@ -28,10 +35,14 @@ case "$COMMAND" in
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
else
declare -a BOOT_OPTIONS
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
BOOT_OPTIONS+=("$i")
done
fi
unset noimageifnotneeded
@@ -42,11 +53,11 @@ case "$COMMAND" in
break
fi
done
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
ret=$?
;;
remove)
rm -f -- "$BOOT_DIR_ABS"/initrd
rm -f -- "$BOOT_DIR_ABS/$INITRD"
ret=$?
;;
esac

View File

@@ -47,9 +47,9 @@ 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
else
declare -a BOOT_OPTIONS
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
@@ -57,21 +57,26 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
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
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
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
ret=0
case "$COMMAND" in
add)
[[ -f "$LOADER_ENTRY" ]] && exit 0
[[ -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
@@ -82,21 +87,29 @@ case "$COMMAND" in
[[ -d "$BOOT_DIR_ABS" ]] || mkdir -p "$BOOT_DIR_ABS"
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS"/linux; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'!" >&2
if ! cp --reflink=auto "$KERNEL_IMAGE" "$BOOT_DIR_ABS/$KERNEL"; then
echo "Can't copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/$KERNEL'!" >&2
fi
dracut --no-hostonly -a "rescue" "$BOOT_DIR_ABS"/initrd "$KERNEL_VERSION"
((ret+=$?))
if [[ ! -f "$BOOT_DIR_ABS/$INITRD" ]]; then
dracut -f --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
{
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
((ret+=$?))
;;
@@ -109,6 +122,4 @@ case "$COMMAND" in
ret=1;;
esac
((ret+=$?))
exit $ret

111
AUTHORS
View File

@@ -1,44 +1,53 @@
Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Hannes Reinecke <hare@suse.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>
David Dillow <dave@thedillows.org>
Hannes Reinecke <hare@suse.de>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Daniel Molkentin <dmolkentin@suse.com>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.de>
WANG Chao <chaowang@redhat.com>
Andrey Borzenkov <arvidjaar@gmail.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>
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>
Hans de Goede <hdegoede@redhat.com>
Frederick Grose <fgrose@sugarlabs.org>
Peter Robinson <pbrobinson@fedoraproject.org>
Fabian Vogt <fvogt@suse.com>
Kairui Song <kasong@redhat.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Xunlei Pang <xlpang@redhat.com>
Daniel Drake <drake@endlessm.com>
Lubomir Rintel <lkundrak@v3.sk>
Angelo "pallotron" Failla <pallotron@fb.com>
Brian C. Lane <bcl@redhat.com>
Daniel Drake <dsd@laptop.org>
Peter Robinson <pbrobinson@gmail.com>
Ville Skyttä <ville.skytta@iki.fi>
Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Daniel Molkentin <dmolkentin@suse.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
Leho Kraav <leho@kraav.com>
Xunlei Pang <xlpang@redhat.com>
Colin Walters <walters@verbum.org>
Cristian Rodríguez <crrodriguez@opensuse.org>
Leho Kraav <leho@kraav.com>
Moritz Maxeiner <moritz@ucworks.org>
Nicolas Chauvet <kwizart@gmail.com>
Ondrej Mosnacek <omosnace@redhat.com>
Fabian Deutsch <fabiand@fedoraproject.org>
Javier Martinez Canillas <javierm@redhat.com>
Kamil Rytarowski <n54@gmx.com>
Lukas Nykryn <lnykryn@redhat.com>
Lidong Zhong <lidong.zhong@suse.com>
Marc Grimme <grimme@atix.de>
NeilBrown <neilb@suse.de>
Nicolas Chauvet <kwizart@gmail.com>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
@@ -46,10 +55,13 @@ 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>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Adam Williamson <awilliam@redhat.com>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Chapman Flack <g2@anastigmatix.net>
@@ -60,19 +72,22 @@ Jan Synacek <jsynacek@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Lidong Zhong <lzhong@suse.com>
Marcos Mello <marcosfrm@gmail.com>
Marian Ganisin <mganisin@redhat.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Michael Ploujnikov <plouj@somanetworks.com>
Mike Gilbert <floppym@gentoo.org>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Steven Brudenell <steven.brudenell@gmail.com>
Stig Telfer <stelfer@cray.com>
Thomas Backlund <tmb@mageia.org>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Wim Muskee <wimmuskee@gmail.com>
yuwata <watanabe.yu+github@gmail.com>
tpgxyz <tpgxyz@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
Ankit Kumar <ankit@linux.vnet.ibm.com>
Antony Messerli <amesserl@rackspace.com>
Chao Fan <cfan@redhat.com>
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
@@ -81,90 +96,106 @@ Denis Silakov <dsilakov@virtuozzo.com>
Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Erwan Velu <erwan.velu@enovance.com>
Evgeny Vereshchagin <evvers@ya.ru>
Fabian Vogt <fvogt@suse.com>
Guido Trentalancia <guido@trentalancia.net>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Ian Dall <ian@beware.dropbear.id.au>
Imran Haider <imran1008@gmail.com>
James Buren <ryuo@frugalware.org>
Joey Boggs <jboggs@redhat.com>
Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Lubomir Rintel <lkundrak@v3.sk>
Lukas Wunner <lukas@wunner.de>
Mike Snitzer <snitzer@redhat.com>
Minfei Huang <mhuang@redhat.com>
Moritz Maxeiner <moritz@ucworks.org>
Nikoli <nikoli@gmx.us>
Pingfan Liu <piliu@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Robert LeBlanc <robert@leblancnet.us>
Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@us.ibm.com>
Thomas Backlund <tmb@mageia.org>
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>
Yu Watanabe <watanabe.yu+github@gmail.com>
pallotron <pallotron@fb.com>
Adam Williamson <awilliam@redhat.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Alexander Kurtz <alexander@kurtz.be>
Alexander Todorov <atodorov@redhat.com>
Andreas Stieger <astieger@suse.com>
Andrei Borzenkov <arvidjaar@gmail.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Artem Savkov <asavkov@redhat.com>
B. Wilson <x@wilsonb.com>
Brandon Philips <brandon@ifup.co>
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>
Christian Heinz <christian.ch.heinz@gmail.com>
Christian Rodrigues <crrodriguez@opensuse.org>
Cong Wang <amwang@redhat.com>
Dan Fuhry <dfuhry@datto.com>
Daniel Drake <drake@endlessm.com>
Dave Jones <davej@redhat.com>
David Disseldorp <ddiss@suse.de>
David Michael <david.michael@coreos.com>
Dennis Schridde <devurandom@gmx.net>
Derek Higgins <derekh@redhat.com>
Duane Griffin <duaneg@dghda.com>
Elan Ruusamäe <glen@delfi.ee>
Fabian <fvogt@suse.com>
Enno Boland <g@s01.de>
Eugene Syromiatnikov <esyr@redhat.com>
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Florian Gamböck <mail@floga.de>
François Cami <fcami@fedoraproject.org>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Hendrik Brueckner <brueckner@linux.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org>
Imran Haider <imran1008@gmail.com>
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
Hui Wang <john.wanghui@huawei.com>
Ignaz Forster <iforster@suse.com>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jason Dana <jasondana@quarksecurity.com>
Jeremy Linton <lintonrjeremy@gmail.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
Johannes Thumshirn <jthumshirn@suse.com>
Jonas Jonsson <jonas@websystem.se>
Julian Wolf <juwolf@suse.com>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lidong Zhong <lidong.zhong@suse.com>
Major Hayden <major@mhtx.net>
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Marian Csontos <mcsontos@redhat.com>
Mark Fasheh <mfasheh@suse.de>
Marko Myllynen <myllynen@redhat.com>
Martin Wilck <mwilck@suse.com>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Matthew Thode <mthode@mthode.org>
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 Schmidt <mschmidt@redhat.com>
Michal Sekletar <msekleta@redhat.com>
Mike Gorse <mgorse@suse.com>
Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
Nikoli <nikoli@gmx.us>
Nikoli <nikoli@lavabit.com>
Nicolas Porcel <nicolasporcel06@gmail.com>
Olivier Blin <dev@blino.org>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Pavel Zhukov <pzhukov@redhat.com>
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Pekka Wallendahl <wyrmiyu@gmail.com>
Peter Robinson <pbrobinson@fedoraproject.org>
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>
Rusty Bird <rustybird@openmailbox.org>
@@ -172,20 +203,26 @@ 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>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Blume <thomas.blume@suse.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>
Vratislav Podzimek <vpodzime@redhat.com>
Xunlei Pang <xpang@redhat.com>
Yanko Kaneti <yaneti@declera.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
Ziyue Yang <ziyang@redhat.com>
honza801 <honza801@gmail.com>
jloeser <jloeser@suse.de>
johannes <johannes.brechtmann@gmail.com>
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
maximilian attems <max@stro.at>
privb0x23 <privb0x23@users.noreply.github.com>
tpg <tpgxyz@gmail.com>
xtraeme <xtraeme@voidlinux.eu>

View File

@@ -1,7 +1,8 @@
-include dracut-version.sh
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION))
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
DRACUT_MAIN_VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || :)
DRACUT_MAIN_VERSION ?= $(DRACUT_VERSION)
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
-include Makefile.inc
@@ -40,7 +41,7 @@ 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 rpm srpm testimage test all check AUTHORS doc dracut-version.sh
all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio
@@ -63,6 +64,9 @@ install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h ins
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
logtee: logtee.c
$(CC) $(LDFLAGS) -o $@ $<
dracut-install: install/dracut-install
ln -fs $< $@
@@ -105,7 +109,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_MAIN_VERSION)$(GITVERSION)" >> dracut.pc
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
@@ -175,7 +179,7 @@ endif
dracut-version.sh:
@rm -f dracut-version.sh
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)$(GITVERSION)" > dracut-version.sh
clean:
$(RM) *~
@@ -190,28 +194,39 @@ clean:
$(RM) $(manpages) dracut.html
$(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
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
rpm: dracut-$(VERSION).tar.xz syncheck
rpm: dracut-$(DRACUT_MAIN_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; \
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_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 )
( mv "$$rpmbuild"/{,$$(uname -m)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
srpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; \
[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || 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" -bs dracut.spec; ) && \
( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
@@ -259,9 +274,9 @@ efi: all
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
dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(DRACUT_MAIN_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-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/

234
NEWS
View File

@@ -1,3 +1,237 @@
dracut-049
==========
lsinitrd:
- record loaded kernel modules when hostonly mode is enabled
lsinitrd $image -f */lib/dracut/loaded-kernel-modules.txt
- allow to only unpack certain files
kernel-modules:
- add gpio and pinctrl drivers for arm*/aarch64
- add nfit
kernel-network-modules:
- add vlan kernel modules
ifcfg/write-ifcfg.sh:
- aggregate resolv.conf
livenet:
- Enable OverlayFS overlay in sysroot.mount generator.
dmsquash-live:
- Support a flattened squashfs.img
dracut-systemd:
- Start systemd-vconsole-setup before dracut-cmdline-ask
iscsi:
- do not install all of /etc/iscsi unless hostonly
- start iscsid even w/o systemd
multipath:
- fixed shutdown
network:
- configure NetworkManager to use dhclient
mdraid:
- fixed uuid handling ":" versus "-"
stratis:
- Add additional binaries
new modules:
- 00warpclock
- 99squash
Adds support for building a squashed initramfs
- 35network-legacy
the old 40network
- 35network-manager
alternative to 35network-legacy
- 90kernel-modules-extra
adds out-of-tree kernel modules
testsuite:
- now runs on travis
- support new qemu device options
- even runs without kvm now
dracut-048
==========
dracut.sh:
- fixed finding of btrfs devices
- harden dracut against BASH_ENV environment variable
- no more prelinking
- scan and install "external" kernel modules
- fixed instmods with zero input
- rdsosreport: best effort to strip out passwords
- introduce tri-state hostonly mode
Add a new option --hostonly-mode which accept an <mode> parameter, so we have a tri-state hostonly mode:
* generic: by passing "--no-hostonly" or not passing anything.
"--hostonly-mode" has no effect in such case.
* sloppy: by passing "--hostonly --hostonly-mode sloppy". This
is also the default mode when only "--hostonly" is given.
* strict: by passing "--hostonly --hostonly-mode strict".
Sloppy mode is the original hostonly mode, the new introduced strict
mode will allow modules to ignore more drivers or do some extra job to
save memory and disk space, while making the image less portable.
Also introduced a helper function "optional_hostonly" to make it
easier for modules to leverage new hostonly mode.
To force install modules only in sloppy hostonly mode, use the form:
hostonly="$(optional_hostonly)" instmods <modules>
dracut-install:
- don't error out, if no modules were installed
- support modules.softdep
lsinitrd.sh:
- fixed zstd file signature
kernel:
- include all pci/host modules
- add mmc/core for arm
- Include Intel Volume Management Device support
plymouth:
- fix detection of plymouth directory
drm:
- make failing installation of drm modules nonfatal
- include virtio DRM drivers in hostonly initramfs
stratis:
- initial Stratis support
crypt:
- correct s390 arch to include arch-specific crypto modules
- add cmdline rd.luks.partuuid
- add timeout option rd.luks.timeout
shutdown:
- sleep a little, if a process was killed
network:
- introduce ip=either6 option
iscsi:
- replace iscsistart with iscsid
qeth_rules:
- new module to copy qeth rules
multipath-hostonly:
- merged back into multipath
mdraid:
- fixed case if rd.md.uuid is in ID_FS_UUID format
dracut-047
==========
dracut.sh:
- sync initramfs to filesystem with fsfreeze
- introduce "--no-hostonly-default-device"
- disable lsinitrd logging when quiet
- add support for Zstandard compression
- fixed relative paths in --kerneldir
- if /boot/vmlinuz-$version exists use /boot/ as default output dir
- make qemu and qemu-net a default module in non-hostonly mode
- fixed relative symlinks
- support microcode updates for all AMD CPU families
- install all modules-load.d regardless of hostonly
- fixed parsing of "-i" and "--include"
- bump kmod version to >= 23
- enable 'early_microcode' by default
- fixed check_block_and_slaves() for nvme
lsinitrd.sh:
- dismiss "cat" error messages
systemd-bootchart:
- removed
i18n:
- install all keymaps for a given locale
- add correct fontmaps
dmsquash-live:
- fixed systemd unit escape
systemd:
- enable core dumps with systemd from initrd
- fixed setting of timeouts for device units
- emergency.service: use Type=idle and fixed task limit
multipath:
- include files from /etc/multipath/conf.d
- do not fail startup on missing configuration
- start daemon after udev settle
- add shutdown script
- parse kernel commandline option 'multipath=off'
- start before local-fs-pre.target
dracut-emergency:
- optionally print filesystem help
network:
- fixed MTU for bond master
- fixed race condition when wait for networks
fcoe:
- handle CNAs with DCB firmware support
- allow to specify the FCoE mode via the fcoe= parameter
- always set AUTO_VLAN for fcoemon
- add shutdown script
- fixup fcoe-genrules.sh for VN2VN mode
- switch back to using fipvlan for bnx2fc
- add timeout mechanism
crypt:
- add basic LUKS detached header support
- escape backslashes for systemd unit names correctly
- put block_uuid.map into initramfs
dmraid:
- do not delete partitions
dasd_mod:
- do not set module parameters if dasd_cio_free is not present
nfs:
- fix mount if IPv4 address is used in /etc/fstab
- support host being a DNS ALIAS
fips:
- fixed creating path to .hmac of kernel based on BOOT_IMAGE
lunmask:
- add module to handle LUN masking
s390:
- add rd.cio_accept
dcssblk:
- add new module for DCSS block devices
zipl:
- add new module to update s390x configuration
iscsi:
- no more iscsid, either iscsistart or iscsid
integrity:
- support loading x509 into the trusted/builtin .evm keyring
- support X.509-only EVM configuration
plymouth:
- improve distro compatibility
dracut-046
==========

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

106
README.md
View File

@@ -1,25 +1,89 @@
# dracut - master branch
dracut
====
dracut is an initramfs infrastructure.
dracut is an event driven initramfs infrastructure.
## CentOS CI
[![Build Status](https://travis-ci.org/dracutdevs/dracut.svg?branch=master)](https://travis-ci.org/dracutdevs/dracut)
[![Build Status](https://ci.centos.org/job/dracut-push-master/badge/icon)](https://ci.centos.org/job/dracut-push-master/)
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.
- 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 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/)
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

8
configure vendored
View File

@@ -52,8 +52,8 @@ while (($# > 0)); do
shift
done
if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 15 "; then
echo "dracut needs pkg-config and libkmod >= 15." >&2
if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
echo "dracut needs pkg-config and libkmod >= 23." >&2
exit 1
fi
@@ -66,8 +66,8 @@ sbindir ?= ${sbindir:-${prefix}/sbin}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation:-yes}
bindir ?= ${bindir:-${prefix}/bin}
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 15 ")
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 15 ")
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
EOF
{

View File

@@ -29,11 +29,9 @@ _dracut() {
--hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
--lvmconf --nolvmconf --debug --profile --verbose --quiet
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --no-compress --gzip --list-modules --show-modules --keep
--xz --zstd --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline --prelink --noprelink --reproducible
--uefi
'
--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

View File

@@ -174,9 +174,6 @@ convert_abs_rel() {
# $ get_fs_env /dev/sda2
# ext4
get_fs_env() {
local evalstr
local found
[[ $1 ]] || return
unset ID_FS_TYPE
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
@@ -199,7 +196,7 @@ get_fs_env() {
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
local _maj _min _majmin
local _majmin
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
}
@@ -223,14 +220,20 @@ get_devpath_block() {
# get a persistent path from a device
get_persistent_dev() {
local i _tmp _dev
local i _tmp _dev _pol
_dev=$(get_maj_min "$1")
[ -z "$_dev" ] && return
if [[ -n "$persistent_policy" ]]; then
_pol="/dev/disk/${persistent_policy}/*"
else
_pol=
fi
for i in \
$_pol \
/dev/mapper/* \
/dev/disk/${persistent_policy:-by-uuid}/* \
/dev/disk/by-uuid/* \
/dev/disk/by-label/* \
/dev/disk/by-partuuid/* \
@@ -468,7 +471,8 @@ for_each_host_dev_fs()
local _dev
local _ret=1
[[ "${#host_fs_types[@]}" ]] || return 0
[[ "${#host_fs_types[@]}" ]] || return 2
for _dev in "${!host_fs_types[@]}"; do
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
@@ -490,13 +494,14 @@ check_block_and_slaves() {
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $_x ]] || continue
check_block_and_slaves $1 $(<"$_x") && return 0
for _x in /sys/dev/block/$2/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
check_block_and_slaves $1 $(<"$_x/dev") && return 0
done
return 1
}
@@ -508,13 +513,14 @@ check_block_and_slaves_all() {
_ret=0
fi
check_vol_slaves_all "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then
if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for _x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $_x ]] || continue
check_block_and_slaves_all $1 $(<"$_x") && _ret=0
for _x in /sys/dev/block/$2/slaves/*; do
[[ -f $_x/dev ]] || continue
[[ $_x/subsystem -ef /sys/class/block ]] || continue
check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
done
return $_ret
}
@@ -527,7 +533,7 @@ for_each_host_dev_and_slaves_all()
local _dev
local _ret=1
[[ "${host_devs[@]}" ]] || return 0
[[ "${host_devs[@]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
@@ -543,7 +549,7 @@ for_each_host_dev_and_slaves()
local _func="$1"
local _dev
[[ "${host_devs[@]}" ]] || return 0
[[ "${host_devs[@]}" ]] || return 2
for _dev in "${host_devs[@]}"; do
[[ -b "$_dev" ]] || continue
@@ -559,45 +565,39 @@ for_each_host_dev_and_slaves()
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
local _lv _vg _pv _dm
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_lv=$(get_maj_min $i)
_dm=/sys/dev/block/$_lv/dm
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || continue
if [[ $_lv = $2 ]]; then
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
done
fi
fi
done
local _lv _vg _pv _dm _majmin
_majmin="$2"
_lv="/dev/block/$_majmin"
_dm=/sys/dev/block/$_majmin/dm
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
done
fi
return 1
}
check_vol_slaves_all() {
local _lv _vg _pv
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_lv=$(get_maj_min $i)
if [[ $_lv = $2 ]]; then
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves_all $1 $(get_maj_min $_pv)
done
return 0
fi
fi
done
local _lv _vg _pv _majmin
_majmin="$2"
_lv="/dev/block/$_majmin"
_dm="/sys/dev/block/$_majmin/dm"
[[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || return 1
_vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves_all $1 $(get_maj_min $_pv)
done
return 0
fi
return 1
}
@@ -661,11 +661,8 @@ get_ucode_file ()
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
# If family greater than or equal to 0x16
if [[ $family -ge 22 ]]; then
printf "microcode_amd_fam16h.bin"
elif [[ $family -eq 21 ]]; then
printf "microcode_amd_fam15h.bin"
if [[ $family -ge 21 ]]; then
printf "microcode_amd_fam%xh.bin" $family
else
printf "microcode_amd.bin"
fi

View File

@@ -150,6 +150,14 @@ dracut_module_included() {
[[ " $mods_to_load $modules_loaded " == *\ $*\ * ]]
}
dracut_no_switch_root() {
>"$initdir/lib/dracut/no-switch-root"
}
dracut_module_path() {
echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }
}
if ! [[ $DRACUT_INSTALL ]]; then
DRACUT_INSTALL=$(find_binary dracut-install)
fi
@@ -261,6 +269,24 @@ inst_script() {
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_fsck_help() {
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
}
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
# If hosotnly mode is set to "strict", hostonly restrictions will still
# be applied, else will ignore hostonly mode and try to install all
# given modules.
optional_hostonly() {
if [[ $hostonly_mode = "strict" ]]; then
printf -- "$hostonly"
else
printf ""
fi
}
mark_hostonly() {
for i in "$@"; do
echo "$i" >> "$initdir/lib/dracut/hostonly-files"
@@ -515,6 +541,14 @@ inst_libdir_file() {
[[ $_files ]] && inst_multiple $_files
}
# get a command to decompress the given file
get_decompress_cmd() {
case "$1" in
*.gz) echo 'gzip -f -d' ;;
*.bz2) echo 'bzip2 -d' ;;
*.xz) echo 'xz -f -d' ;;
esac
}
# install function decompressing the target and handling symlinks
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
@@ -526,11 +560,8 @@ inst_decompress() {
for _src in $@
do
case ${_src} in
*.gz) _cmd='gzip -f -d' ;;
*.bz2) _cmd='bzip2 -d' ;;
*) return 1 ;;
esac
_cmd=$(get_decompress_cmd ${_src})
[[ -z "${_cmd}" ]] && return 1
inst_simple ${_src}
# Decompress with chosen tool. We assume that tool changes name e.g.
# from 'name.gz' to 'name'.
@@ -549,15 +580,16 @@ inst_opt_decompress() {
done
}
# module_check <dracut module>
# module_check <dracut module> [<forced>] [<module path>]
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "check $hostonly" is called
module_check() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$3
local _ret
local _forced=0
local _hostonly=$hostonly
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[ $# -eq 2 ] && _forced=$2
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
@@ -580,14 +612,15 @@ module_check() {
return $_ret
}
# module_check_mount <dracut module>
# module_check_mount <dracut module> [<module path>]
# execute the check() function of module-setup.sh of <dracut module>
# or the "check" script, if module-setup.sh is not found
# "mount_needs=1 check 0" is called
module_check_mount() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$2
local _ret
mount_needs=1
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
# if we do not have a check script, we are unconditionally included
@@ -606,12 +639,13 @@ module_check_mount() {
return $_ret
}
# module_depends <dracut module>
# module_depends <dracut module> [<module path>]
# execute the depends() function of module-setup.sh of <dracut module>
# or the "depends" script, if module-setup.sh is not found
module_depends() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
# if we do not have a check script, we have no deps
@@ -629,12 +663,13 @@ module_depends() {
fi
}
# module_cmdline <dracut module>
# module_cmdline <dracut module> [<module path>]
# execute the cmdline() function of module-setup.sh of <dracut module>
# or the "cmdline" script, if module-setup.sh is not found
module_cmdline() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
@@ -650,12 +685,13 @@ module_cmdline() {
fi
}
# module_install <dracut module>
# module_install <dracut module> [<module path>]
# execute the install() function of module-setup.sh of <dracut module>
# or the "install" script, if module-setup.sh is not found
module_install() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/install ]] && . "$_moddir/install"
@@ -671,12 +707,13 @@ module_install() {
fi
}
# module_installkernel <dracut module>
# module_installkernel <dracut module> [<module path>]
# execute the installkernel() function of module-setup.sh of <dracut module>
# or the "installkernel" script, if module-setup.sh is not found
module_installkernel() {
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[[ -d $_moddir ]] || return 1
if [[ ! -f $_moddir/module-setup.sh ]]; then
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
@@ -692,15 +729,16 @@ module_installkernel() {
fi
}
# check_mount <dracut module>
# check_mount <dracut module> [<use_as_dep>] [<module path>]
# check_mount checks, if a dracut module is needed for the given
# device and filesystem types in "${host_fs_types[@]}"
check_mount() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$3
local _ret
local _moddep
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
[ "${#host_fs_types[@]}" -le 0 ] && return 1
# If we are already scheduled to be loaded, no need to check again.
@@ -717,7 +755,7 @@ check_mount() {
fi
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
module_check_mount $_mod; ret=$?
module_check_mount $_mod $_moddir; ret=$?
# explicit module, so also accept ret=255
[[ $ret = 0 || $ret = 255 ]] || return 1
@@ -725,14 +763,14 @@ check_mount() {
# module not in our list
if [[ $dracutmodules = all ]]; then
# check, if we can and should install this module
module_check_mount $_mod || return 1
module_check_mount $_mod $_moddir || return 1
else
# skip this module
return 1
fi
fi
for _moddep in $(module_depends $_mod); do
for _moddep in $(module_depends $_mod $_moddir); do
# handle deps as if they were manually added
[[ " $dracutmodules " == *\ $_mod\ * ]] \
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
@@ -756,15 +794,17 @@ check_mount() {
return 0
}
# check_module <dracut module> [<use_as_dep>]
# check_module <dracut module> [<use_as_dep>] [<module path>]
# check if a dracut module is to be used in the initramfs process
# if <use_as_dep> is set, then the process also keeps track
# that the modules were checked for the dependency tracking process
check_module() {
local _mod=$1
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
local _moddir=$3
local _ret
local _moddep
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
# If we are already scheduled to be loaded, no need to check again.
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
[[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1
@@ -781,9 +821,9 @@ check_module() {
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
module_check $_mod 1; ret=$?
module_check $_mod 1 $_moddir; ret=$?
else
module_check $_mod 0; ret=$?
module_check $_mod 0 $_moddir; ret=$?
fi
# explicit module, so also accept ret=255
[[ $ret = 0 || $ret = 255 ]] || return 1
@@ -791,7 +831,7 @@ check_module() {
# module not in our list
if [[ $dracutmodules = all ]]; then
# check, if we can and should install this module
module_check $_mod; ret=$?
module_check $_mod 0 $_moddir; ret=$?
if [[ $ret != 0 ]]; then
[[ $2 ]] && return 1
[[ $ret != 255 ]] && return 1
@@ -802,7 +842,7 @@ check_module() {
fi
fi
for _moddep in $(module_depends $_mod); do
for _moddep in $(module_depends $_mod $_moddir); do
# handle deps as if they were manually added
[[ " $dracutmodules " == *\ $_mod\ * ]] \
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
@@ -827,7 +867,7 @@ check_module() {
}
# for_each_module_dir <func>
# execute "<func> <dracut module> 1"
# execute "<func> <dracut module> 1 <module path>"
for_each_module_dir() {
local _modcheck
local _mod
@@ -839,7 +879,7 @@ for_each_module_dir() {
[[ -e $_moddir/install || -e $_moddir/installkernel || \
-e $_moddir/module-setup.sh ]] || continue
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
$_func $_mod 1
$_func $_mod 1 $_moddir
done
# Report any missing dracut modules, the user has specified
@@ -860,83 +900,9 @@ for_each_module_dir() {
done
}
# Install a single kernel module along with any firmware it may require.
# $1 = full path to kernel module to install
install_kmod_with_fw() {
# no need to go further if the module is already installed
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
&& return 0
if [[ $omit_drivers ]]; then
local _kmod=${1##*/}
_kmod=${_kmod%.ko*}
_kmod=${_kmod/-/_}
if [[ "$_kmod" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
return 0
fi
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
return 0
fi
fi
if [[ $silent_omit_drivers ]]; then
local _kmod=${1##*/}
_kmod=${_kmod%.ko*}
_kmod=${_kmod/-/_}
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
fi
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
ret=$?
(($ret != 0)) && return $ret
local _modname=${1##*/} _fwdir _found _fw
_modname=${_modname%.ko*}
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
_found=''
for _fwdir in $fw_dir; do
[[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
_found=yes
done
if [[ $_found != yes ]]; then
if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then
dinfo "Possible missing firmware \"${_fw}\" for kernel module" \
"\"${_modname}.ko\""
else
dwarn "Possible missing firmware \"${_fw}\" for kernel module" \
"\"${_modname}.ko\""
fi
fi
done
return 0
}
# Do something with all the dependencies of a kernel module.
# Note that kernel modules depend on themselves using the technique we use
# $1 = function to call for each dependency we find
# It will be passed the full path to the found kernel module
# $2 = module to get dependencies for
# rest of args = arguments to modprobe
# _fderr specifies FD passed from surrounding scope
for_each_kmod_dep() {
local _func=$1 _kmod=$2 _cmd _modpath _options
shift 2
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
[[ $_cmd = insmod ]] || continue
$_func ${_modpath} || exit $?
done
)
}
dracut_kernel_post() {
for _f in modules.builtin.bin modules.builtin modules.order; do
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
done
# generate module dependencies for the initrd
@@ -975,6 +941,10 @@ instmods() {
set -- "${args[@]}"
fi
if (($# == 0)); then
return 0
fi
$DRACUT_INSTALL \
${initdir:+-D "$initdir"} \
${loginstall:+-L "$loginstall"} \
@@ -1015,3 +985,25 @@ else
ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
}
fi
is_qemu_virtualized() {
# 0 if a virt environment was detected
# 1 if a virt environment could not be detected
# 255 if any error was encountered
if type -P systemd-detect-virt >/dev/null 2>&1; then
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
(($? != 0)) && return 255
[[ $vm = "qemu" ]] && return 0
[[ $vm = "kvm" ]] && return 0
[[ $vm = "bochs" ]] && return 0
fi
for i in /sys/class/dmi/id/*_vendor; do
[[ -f $i ]] || continue
read vendor < $i
[[ "$vendor" == "QEMU" ]] && return 0
[[ "$vendor" == "Red Hat" ]] && return 0
[[ "$vendor" == "Bochs" ]] && return 0
done
return 1
}

View File

@@ -31,6 +31,8 @@ elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null;
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
rm -f -- .need_shutdown
else
# something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2
@@ -38,4 +40,18 @@ else
exit 1
fi
if [[ -d squash ]]; then
unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null
if [ $? -ne 0 ]; 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
/usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts /run/initramfs > /dev/null
fi
exit 0

View File

@@ -243,12 +243,6 @@ example:
**--nostrip**::
do not strip binaries in the initramfs
**--prelink**::
prelink binaries in the initramfs (default)
**--noprelink**::
do not prelink binaries in the initramfs
**--hardlink**::
hardlink files in the initramfs (default)
@@ -323,6 +317,10 @@ provide a valid _/etc/fstab_.
**--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).
@@ -428,6 +426,14 @@ Make sure your kernel has lz4 decompression support compiled in, otherwise you
will not be able to boot.
====
**--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.
====
**--compress** _<compressor>_::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that

View File

@@ -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.

View File

@@ -242,7 +242,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>__::
@@ -311,6 +311,11 @@ crypto LUKS
**rd.luks.crypttab=0**::
do not check, if LUKS partition is in _/etc/crypttab_
**rd.luks.timeout=**__<seconds>__::
specify how long dracut should wait when waiting for the user to enter the
password. This avoid blocking the boot if no password is entered. It does
not apply to luks key. The default is '0', which means 'forever'.
crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
@@ -341,7 +346,7 @@ 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!
to cryptsetup luksFormat with _-d -_, too!
Here follows example for key encrypted with GPG:
@@ -480,7 +485,7 @@ USB Android phone::
* enp0s29u1u2
=====================
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
**ip=**__{dhcp|on|any|dhcp6|auto6|either6}__::
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
with a valid DHCP root-path.
@@ -489,6 +494,8 @@ USB Android phone::
dhcp6::: IPv6 DHCP
either6::: if auto6 fails, then dhcp6
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
This parameter can be specified multiple times.
+
@@ -521,7 +528,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,
@@ -594,7 +601,7 @@ NFS
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
dhcp next_server. If server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
":" or "," and are seperated by ",".
":" 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
@@ -727,6 +734,9 @@ You may want to use rd.iscsi.firmware.
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
will read the iscsi parameter from the BIOS firmware
**rd.iscsi.login_retry_max=**__<num>__::
maximum number of login retries
**rd.iscsi.param=**__<param>__::
<param> will be passed as "--param <param>" to iscsistart.
This parameter can be specified multiple times.
@@ -755,10 +765,15 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
FCoE
~~~~
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::
**rd.nofcoe=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. For the second argument, currently only nodcb is
supported. This parameter can be specified multiple times.
_<MAC>_ or EDD settings. The second argument specifies if DCB
should be used. The optional third argument specifies whether
fabric or VN2VN mode should be used.
This parameter can be specified multiple times.
+
NOTE: letters in the MAC-address must be lowercase!
@@ -809,6 +824,9 @@ rd.zfcp=0.0.4000
ZNET
~~~~
**rd.znet=**__<nettype>__,__<subchannels>__,__<options>__::
The whole parameter is appended to /etc/ccw.conf, which is used on
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.
+
[listing]
@@ -823,23 +841,24 @@ Booting live images
Dracut offers multiple options for live booted images:
=====================
SquashFS with read-only filesystem image::: The system will boot with a read
only filesystem from the SquashFS and apply a writable device-mapper snapshot
over the read only filesystem. Using this method ensures a relatively fast
boot and lower RAM usage. Users **must be careful** to avoid writing too many
blocks to the snapshot volume. Once the blocks of the snapshot overlay are
exhausted, the root filesystem becomes read only and may cause application
failures. The overlay file is marked 'Overflow', and a difficult recovery is
required to repair and enlarge the overlay offline. Non-persistent overlays
are sparse files in RAM that only consume content space as required blocks are
allocated. They default to an apparent size of 32 GiB in RAM. The size can be
adjusted with the **rd.live.overlay.size=** kernel command line option.
SquashFS with read-only filesystem image::: The system will boot with a
read-only filesystem from the SquashFS and apply a writable Device-mapper
snapshot or an OverlayFS overlay mount for the read-only base filesystem. This
method ensures a relatively fast boot and lower RAM usage. Users **must be
careful** to avoid writing too many blocks to a snapshot volume. Once the
blocks of the snapshot overlay are exhausted, the root filesystem becomes
read-only and may cause application failures. The snapshot overlay file is
marked 'Overflow', and a difficult recovery is required to repair and enlarge
the overlay offline. Non-persistent overlays are sparse files in RAM that only
consume content space as required blocks are allocated. They default to an
apparent size of 32 GiB in RAM. The size can be adjusted with the
**rd.live.overlay.size=** kernel command line option.
+
The filesystem structure is expected to be:
The filesystem structure is traditionally expected to be:
+
[listing]
--
squashfs.img | Squashfs from LiveCD .iso downloaded via network
squashfs.img | SquashFS from LiveCD .iso
!(mount)
/LiveOS
|- rootfs.img | Filesystem image to mount read-only
@@ -850,21 +869,35 @@ squashfs.img | Squashfs from LiveCD .iso downloaded via network
... |
--
+
Dracut uses this method of live booting by default. No additional command line
options are required other than **root=live:<URL>** to specify the location
of your squashed filesystem.
For OverlayFS mount overlays, the filesystem structure may also be a direct
compression of the root filesystem:
+
[listing]
--
squashfs.img | SquashFS from LiveCD .iso
!(mount)
/bin | Live filesystem
/boot |
/dev |
... |
--
+
Dracut uses one of the overlay methods of live booting by default. No
additional command line options are required other than **root=live:<URL>** to
specify the location of your squashed filesystem.
+
- The compressed SquashFS image can be copied during boot to RAM at
`/run/initramfs/squashed.img` by using the **rd.live.ram=1** option.
- A device with a persistent overlay can be booted read only by using the
- A device with a persistent overlay can be booted read-only by using the
**rd.live.overlay.readonly** option on the kernel command line. This will
cause a temporary, writable overlay to be stacked over a read-only snapshot
of the root filesystem.
either cause a temporary, writable overlay to be stacked over a read-only
snapshot of the root filesystem or the OverlayFS mount will use an additional
lower layer with the root filesystem.
+
Uncompressed live filesystem image:::
When the live system was installed with the '--skipcompress' option of the
__livecd-iso-to-disk__ installation script for Live USB devices, the root
filesystem image, `rootfs.img`, is expanded on installation and no SquashFS
filesystem image, __rootfs.img__, is expanded on installation and no SquashFS
is involved during boot.
+
- If **rd.live.ram=1** is used in this situation, the full, uncompressed
@@ -872,12 +905,12 @@ root filesystem is copied during boot to `/run/initramfs/rootfs.img` in the
`/run` tmpfs.
+
- If **rd.live.overlay=none** is provided as a kernel command line option,
a writable, linear device-mapper target is created on boot with no overlay.
a writable, linear Device-mapper target is created on boot with no overlay.
writable filesystem image:::
Writable filesystem image:::
The system will retrieve a compressed filesystem image, extract it to
`/run/initramfs/fsimg/rootfs.img`, connect it to a loop device, create a
writable, linear device-mapper target at `/dev/mapper/live-rw`, and mount that
writable, linear Device-mapper target at `/dev/mapper/live-rw`, and mount that
as a writable volume at `/`. More RAM is required during boot but the live
filesystem is easier to manage if it becomes full. Users can make a filesystem
image of any size and that size will be maintained when the system boots. There
@@ -887,7 +920,7 @@ The filesystem structure is expected to be:
+
[listing]
--
rootfs.tgz | Compressed tarball containing fileystem image
rootfs.tgz | Compressed tarball containing filesystem image
!(unpack)
/rootfs.img | Filesystem image at /run/initramfs/fsimg/
!(mount)
@@ -915,10 +948,11 @@ NOTE: There must be enough free RAM available to hold the complete image.
This method is very suitable for diskless boots.
**root=**live:__<url>__::
Boots a live image retrieved from __<url>__. Valid handlers: __http, https, ftp, torrent, tftp__.
Boots a live image retrieved from __<url>__. Requires the dracut 'livenet'
module. Valid handlers: __http, https, ftp, torrent, tftp__.
+
[listing]
.Example
.Examples
--
root=live:http://example.com/liveboot.img
root=live:ftp://ftp.example.com/liveboot.img
@@ -930,7 +964,7 @@ Enables debug output from the live boot process.
**rd.live.dir=**__<path>__::
Specifies the directory within the boot device where the squashfs.img or
rootfs.img can be found. By default, this is __LiveOS__.
rootfs.img can be found. By default, this is `/LiveOS`.
**rd.live.squashimg=**__<filename of SquashFS image>__::
Specifies the filename for a SquashFS image of the root filesystem.
@@ -938,35 +972,52 @@ By default, this is __squashfs.img__.
**rd.live.ram=**1::
Copy the complete image to RAM and use this for booting. This is useful
when the image resides on, i.e., a DVD which needs to be ejected later on.
when the image resides on, e.g., a DVD which needs to be ejected later on.
**rd.live.overlay=**__<devspec>__:__(<pathspec>|auto)__|__none__::
Allow the usage of a permanent overlay.
- _<devspec>_ specifies the path to a device with a mountable filesystem.
- _<pathspec>_ is the path to a file within that filesystem, which shall be
**rd.live.overlay={**__<devspec>__[:__{<pathspec>|auto}__]|__none__}::
Manage the usage of a permanent overlay.
+
--
* _<devspec>_ specifies the path to a device with a mountable filesystem.
* _<pathspec>_ is the path to a file within that filesystem, which shall be
used to persist the changes made to the device specified by the
**root=live:__<url>__** option.
- _none_ specifies no overlay when an uncompressed live root filesystem is
available.
If a persistent overlay is detected at the standard LiveOS path, the overlay &
overlay type detected (whether Device-mapper or OverlayFS) will be used.
+
The default _pathspec_, when _auto_ or no _:<pathspec>_ is given, is
`/<+++<b>rd.live.dir</b>+++>/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.
+
If a persistent overlay __is detected__ at the standard LiveOS path, the
overlay & overlay type detected, whether Device-mapper or OverlayFS, will be
used.
--
+
[listing]
.Example
.Examples
--
rd.live.overlay=/dev/sdb1:persistent-overlay.img
rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
--
**rd.live.overlay.size=**__<size_MiB>__::
Specifies a non-persistent overlay size in MiB. The default is _32768_.
Specifies a non-persistent Device-mapper overlay size in MiB. The default is
_32768_.
**rd.live.overlay.readonly=**1::
Specifies a non-persistent, writable snapshot overlay to be stacked over a
read-only snapshot of the root filesystem, `/dev/mapper/live-ro`, or a read-
only loop device of a writable `rootfs.img`.
This is used to boot with a normally read-write persistent overlay in a
read-only mode. With this option, either an additional, non-persistent,
writable snapshot overlay will be stacked over a read-only snapshot,
`/dev/mapper/livero`, of the base filesystem with the persistent overlay, or a
read-only loop device, in the case of a writable __rootfs.img__, or an OverlayFS
mount will use the persistent overlay directory linked at `/run/overlayfsr` as
an additional lower layer along with the base root filesystem and apply a
transient, writable upper directory overlay, in order to complete the booted
root filesystem.
**rd.live.overlay.reset=**1::
Specifies that a persistent overlay should be reset on boot. All root
Specifies that a persistent overlay should be reset on boot. All previous root
filesystem changes are vacated by this action.
**rd.live.overlay.thin=**1::
@@ -977,28 +1028,57 @@ that memory is given back to the kernel when the filesystem does not claim it
anymore.
**rd.live.overlay.overlayfs=**1::
Enables the use of the **OverlayFS** kernel module, if available, to provide a
Enables the use of the *OverlayFS* kernel module, if available, to provide a
copy-on-write union directory for the root filesystem. OverlayFS overlays are
directories of the files that have changed on the read-only base (lower)
filesystem. The root filesystem is provided through a special overlay type
mount that merges the lower and upper directories. If an OverlayFS upper
directory is not present on the boot device, a tmpfs directory will be created
at /run/overlayfs to provide temporary storage. Persistent storage can be
at `/run/overlayfs` to provide temporary storage. Persistent storage can be
provided on vfat or msdos formatted devices by supplying the OverlayFS upper
directory within an embedded filesystem that supports the creation of trusted.*
extended attributes and provides a valid d_type in readdir responses, such as
with ext4 and xfs. On non-vfat-formatted devices, a persistent OverlayFS
overlay can extend the available root filesystem storage up to the capacity of
the LiveOS device.
the LiveOS disk device.
+
If a persistent overlay is detected at the standard LiveOS path, the overlay &
overlay type detected (whether OverlayFS or Device-mapper) will be used.
overlay type detected, whether OverlayFS or Device-mapper, will be used.
+
The **rd.live.overlay.readonly** option, which allows a persistent overlayfs to
be mounted read only through a higher level transient overlay directory, has
be mounted read-only through a higher level transient overlay directory, has
been implemented through the multiple lower layers feature of OverlayFS.
ZIPL
~~~~
**rd.zipl=**__<path to blockdevice>__::
Update the dracut commandline with the values found in the
_dracut-cmdline.conf_ file on the given device.
The values are merged into the existing commandline values
and the udev events are regenerated.
+
[listing]
.Example
--
rd.zipl=UUID=0fb28157-99e3-4395-adef-da3f7d44835a
--
CIO_IGNORE
~~~~~~~~~~
**rd.cio_accept=**__<device-ids>__::
Remove the devices listed in <device-ids> from the default
cio_ignore kernel command-line settings.
<device-ids> is a list of comma-separated CCW device ids.
The default for this value is taken from the
_/boot/zipl/active_devices.txt_ file.
+
[listing]
.Example
--
rd.cio_accept=0.0.0180,0.0.0800,0.0.0801,0.0.0802
--
Plymouth Boot Splash
~~~~~~~~~~~~~~~~~~~~
**plymouth.enable=0**::
@@ -1052,7 +1132,8 @@ their new replacement.
rdbreak:: rd.break
rd_CCW:: rd.ccw
rd.ccw:: rd.znet
rd_CCW:: rd.znet
rd_DASD_MOD:: rd.dasd

View File

@@ -79,7 +79,7 @@ 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|<compressor [args ...]>}__"::
*compress=*"__{bzip2|lzma|xz|gzip|lzo|lz4|zstd|<compressor [args ...]>}__"::
Compress the generated initramfs using the passed compression program. If
you pass it just the name of a compression program, it will call that
program with known-working arguments. If you pass arguments, it will be called
@@ -89,9 +89,6 @@ Configuration files must have the extension .conf; other extensions are ignored.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
*do_prelink=*"__{yes|no}__"::
Prelink binaries in the initramfs (default=yes)
*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.
@@ -160,14 +157,14 @@ 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=no)
Combine early microcode with ramdisk (default=yes)
*stdloglvl*="__\{0-6\}__"::
Set logging to standard error level.
@@ -190,7 +187,7 @@ 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.
@@ -207,6 +204,10 @@ provide a valid _/etc/fstab_.
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
*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.
*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>_

View File

@@ -12,4 +12,4 @@ ro_mnt=yes
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"
omit_drivers+=" i2o_scsi "

View File

@@ -1,6 +1,6 @@
# 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).
@@ -10,7 +10,7 @@ hostonly_cmdline="yes"
compress="xz -0 --check=crc32 --memlimit-compress=50%"
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.

View File

@@ -103,7 +103,7 @@ half of the rd.retry counter.
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
@@ -212,7 +212,7 @@ check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fullfilled
1:: Do not include the dracut module. The requirements are not fulfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
@@ -255,7 +255,9 @@ not lead to an error.
==== inst <src> [<dst>]
installs _one_ file <src> either to the same place in the initramfs or to an
optional <dst>.
optional <dst>. inst with more than two arguments is treated the same as
inst_multiple, all arguments are treated as files to install and none as
install destinations.
==== inst_hook <hookdir> <prio> <src>
@@ -264,7 +266,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> ... ]

383
dracut.sh
View File

@@ -1,4 +1,4 @@
#!/bin/bash --norc
#!/bin/bash -p
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
@@ -23,6 +23,8 @@
# store for logging
unset BASH_ENV
# Verify bash version, current minimum is 4
if (( BASH_VERSINFO[0] < 4 )); then
printf -- 'You need at least Bash 4 to use dracut, sorry.' >&2
@@ -108,8 +110,6 @@ Creates initial ramdisk images for preloading modules
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
--strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs
--prelink Prelink binaries in the initramfs
--noprelink Do not prelink binaries in the initramfs
--hardlink Hardlink files in the initramfs
--nohardlink Do not hardlink files in the initramfs
--prefix [DIR] Prefix initramfs files with [DIR]
@@ -147,10 +147,29 @@ Creates initial ramdisk images for preloading modules
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
-N, --no-hostonly Disables Host-Only mode
--hostonly-mode <mode>
Specify the hostonly mode to use. <mode> could be
one of "sloppy" or "strict". "sloppy" mode is used
by default.
In "sloppy" hostonly mode, extra drivers and modules
will be installed, so minor hardware change won't make
the image unbootable (eg. 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.
DO NOT use "strict" mode unless you know what you
are doing.
--hostonly-cmdline Store kernel command line arguments needed
in the initramfs
--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).
--no-hostonly-i18n Install all keyboard and font files available.
@@ -193,6 +212,9 @@ Creates initial ramdisk images for preloading modules
--lz4 Compress the generated initramfs using lz4.
Make sure that your kernel has lz4 support compiled
in, otherwise you will not be able to boot.
--zstd Compress the generated initramfs using Zstandard.
Make sure that your kernel has zstd support compiled
in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the
passed compression program. Make sure your kernel
knows how to decompress the generated initramfs,
@@ -250,6 +272,14 @@ read_arg() {
fi
}
check_conf_file()
{
if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then
printf '\ndracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!\n' >&2
printf 'dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.\n\n' >&2
fi
}
dropindirs_sort()
{
local suffix=$1; shift
@@ -279,11 +309,15 @@ dropindirs_sort()
rearrange_params()
{
# Workaround -i, --include taking 2 arguments
set -- "${@/--include/++include}"
# This prevents any long argument ending with "-i"
# -i, like --opt-i but I think we can just prevent that
set -- "${@/%-i/++include}"
newat=()
for i in "$@"; do
if [[ $i == "-i" ]] || [[ $i == "--include" ]]; then
newat+=("++include") # Replace --include by ++include
else
newat+=("$i")
fi
done
set -- "${newat[@]}" # Set new $@
TEMP=$(unset POSIXLY_CORRECT; getopt \
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
@@ -323,8 +357,6 @@ rearrange_params()
--long kernel-cmdline: \
--long strip \
--long nostrip \
--long prelink \
--long noprelink \
--long hardlink \
--long nohardlink \
--long noprefix \
@@ -343,8 +375,10 @@ rearrange_params()
--long host-only \
--long no-hostonly \
--long no-host-only \
--long hostonly-mode: \
--long hostonly-cmdline \
--long no-hostonly-cmdline \
--long no-hostonly-default-device \
--long persistent-policy: \
--long fstab \
--long help \
@@ -353,6 +387,7 @@ rearrange_params()
--long xz \
--long lzo \
--long lz4 \
--long zstd \
--long no-compress \
--long gzip \
--long list-modules \
@@ -447,9 +482,6 @@ if [[ $append_args_l == "yes" ]]; then
eval set -- "$TEMP"
rearrange_params "$@"
fi
# clean the temporarily used scratch-pad directory
rm -rf $scratch_dir
fi
unset PARMS_TO_STORE
@@ -507,8 +539,6 @@ while :; do
early_microcode_l="no";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--prelink) do_prelink_l="yes";;
--noprelink) do_prelink_l="no";;
--hardlink) do_hardlink_l="yes";;
--nohardlink) do_hardlink_l="no";;
--noprefix) prefix_l="/";;
@@ -531,6 +561,8 @@ while :; do
hostonly_l="yes" ;;
-N|--no-hostonly|--no-host-only)
hostonly_l="no" ;;
--hostonly-mode)
hostonly_mode_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--hostonly-cmdline)
hostonly_cmdline_l="yes" ;;
--hostonly-i18n)
@@ -539,6 +571,8 @@ while :; do
i18n_install_all_l="yes" ;;
--no-hostonly-cmdline)
hostonly_cmdline_l="no" ;;
--no-hostonly-default-device)
hostonly_default_device="no" ;;
--persistent-policy)
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fstab) use_fstab_l="yes" ;;
@@ -550,6 +584,7 @@ while :; do
--xz) compress_l="xz";;
--lzo) compress_l="lzo";;
--lz4) compress_l="lz4";;
--zstd) compress_l="zstd";;
--no-compress) _no_compress_l="cat";;
--gzip) compress_l="gzip";;
--list-modules) do_list="yes";;
@@ -662,10 +697,14 @@ if [[ ! -d $confdir ]]; then
fi
# source our config file
[[ -f $conffile ]] && . "$conffile"
if [[ -f $conffile ]]; then
check_conf_file "$conffile"
. "$conffile"
fi
# source our config dir
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
check_conf_file "$f"
[[ -e $f ]] && . "$f"
done
@@ -708,14 +747,13 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $do_strip ]] || do_strip=yes
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
[[ $do_prelink ]] || do_prelink=yes
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
[[ $do_hardlink ]] || do_hardlink=yes
[[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
[[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
[[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
@@ -732,7 +770,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $nofscks_l ]] && nofscks="yes"
[[ $ro_mnt_l ]] && ro_mnt="yes"
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
[[ $early_microcode ]] || early_microcode=no
[[ $early_microcode ]] || early_microcode=yes
[[ $logfile_l ]] && logfile="$logfile_l"
[[ $reproducible_l ]] && reproducible="$reproducible_l"
[[ $loginstall_l ]] && loginstall="$loginstall_l"
@@ -746,12 +784,22 @@ if ! [[ $outfile ]]; then
fi
if [[ $uefi == "yes" ]]; then
if [[ -n "$uefi_secureboot_key" && -z "$uefi_secureboot_cert" ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
exit 1
fi
if [[ -n "$uefi_secureboot_key" && -n "$uefi_secureboot_cert" ]] && !command -v sbsign &>/dev/null; then
dfatal "Need 'sbsign' to create a signed UEFI executable"
exit 1
fi
BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
| while read -r line || [[ $line ]]; do \
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
done)
if [[ -d /efi ]] && mountpoint -q /efi; then
efidir=/efi
efidir=/efi/EFI
else
efidir=/boot/EFI
if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
@@ -761,7 +809,9 @@ if ! [[ $outfile ]]; then
mkdir -p "$efidir/Linux"
outfile="$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
else
if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
if [[ -e "/boot/vmlinuz-$kernel" ]]; then
outfile="/boot/initramfs-$kernel.img"
elif [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
outfile="/boot/${MACHINE_ID}/$kernel/initrd"
else
outfile="/boot/initramfs-$kernel.img"
@@ -790,7 +840,7 @@ fi
if ! [[ $compress ]]; then
# check all known compressors, if none specified
for i in pigz gzip lz4 lzop lzma xz lbzip2 bzip2 cat; do
for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
command -v "$i" &>/dev/null || continue
compress="$i"
break
@@ -830,11 +880,27 @@ case $compress in
lz4)
compress="lz4 -l -9"
;;
zstd)
compress="zstd -15 -q -T0"
;;
esac
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
case $hostonly_mode in
'')
[[ $hostonly ]] && hostonly_mode="sloppy" ;;
sloppy|strict)
if [[ ! $hostonly ]]; then
unset hostonly_mode
fi
;;
*)
printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
exit 1
esac
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
readonly TMPDIR="$(realpath -e "$tmpdir")"
@@ -955,6 +1021,16 @@ esac
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
[[ -d $systemdutildir ]] \
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
if ! [[ -d "$systemdutildir" ]]; then
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
fi
if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
if ! [[ -f $srcmods/modules.dep ]]; then
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
@@ -1016,13 +1092,13 @@ if [[ ! $print_cmdline ]]; then
exit 1
fi
unset EFI_MACHINE_TYPE_NAME
case $(arch) in
case $(uname -m) in
x86_64)
EFI_MACHINE_TYPE_NAME=x64;;
ia32)
EFI_MACHINE_TYPE_NAME=ia32;;
*)
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
exit 1
;;
esac
@@ -1133,7 +1209,7 @@ if (( ${#add_device_l[@]} )); then
push_host_devs "${add_device_l[@]}"
fi
if [[ $hostonly ]]; then
if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
# in hostonly mode, determine all devices, which have to be accessed
# and examine them for filesystem types
@@ -1151,6 +1227,7 @@ if [[ $hostonly ]]; then
"/usr/lib64" \
"/boot" \
"/boot/efi" \
"/boot/zipl" \
;
do
mp=$(readlink -f "$mp")
@@ -1214,7 +1291,7 @@ if [[ $hostonly ]]; then
push_host_devs "$_dev"
if [[ "$_t" == btrfs ]]; then
for i in $(find_btrfs_devs "$_m"); do
for i in $(btrfs_devs "$_m"); do
push_host_devs "$i"
done
fi
@@ -1266,16 +1343,8 @@ done
[[ -d $udevdir ]] \
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
if ! [[ -d "$udevdir" ]]; then
[[ ! -h /lib ]] && [[ -d /lib/udev ]] && udevdir=/lib/udev
[[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
fi
[[ -d $systemdutildir ]] \
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
if ! [[ -d "$systemdutildir" ]]; then
[[ ! -h /lib ]] && [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
[[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
[[ -e /lib/udev/ata_id ]] && udevdir=/lib/udev
[[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
fi
[[ -d $systemdsystemunitdir ]] \
@@ -1300,7 +1369,7 @@ export initdir dracutbasedir \
dracutmodules force_add_dracutmodules add_dracutmodules omit_dracutmodules \
mods_to_load \
fw_dir drivers_dir debug no_kernel kernel_only \
omit_drivers mdadmconf lvmconf root_dev \
omit_drivers mdadmconf lvmconf root_devs \
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug host_fs_types host_devs swap_devs sshkey add_fstab \
@@ -1328,7 +1397,7 @@ do_print_cmdline()
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
[[ ${_mods_to_print[$_d_mod]} ]] || continue
module_cmdline "$_d_mod"
module_cmdline "$_d_mod" "$moddir"
done
unset moddir
}
@@ -1409,14 +1478,14 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
dinfo "*** Including module: $_d_mod ***"
fi
if [[ $kernel_only == yes ]]; then
module_installkernel "$_d_mod" || {
module_installkernel "$_d_mod" "$moddir" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
else
module_install "$_d_mod"
module_install "$_d_mod" "$moddir"
if [[ $no_kernel != yes ]]; then
module_installkernel "$_d_mod" || {
module_installkernel "$_d_mod" "$moddir" || {
dfatal "installkernel failed in module $_d_mod"
exit 1
}
@@ -1444,12 +1513,15 @@ dinfo "*** Including modules done ***"
## final stuff that has to happen
if [[ $no_kernel != yes ]]; then
if [[ $hostonly ]]; then
cp "$DRACUT_KERNEL_MODALIASES" $initdir/lib/dracut/hostonly-kernel-modules.txt
fi
if [[ $drivers ]]; then
hostonly='' instmods $drivers
fi
if [[ $add_drivers ]]; then
if [[ -n "${add_drivers// }" ]]; then
hostonly='' instmods -c $add_drivers
fi
if [[ $force_drivers ]]; then
@@ -1524,9 +1596,13 @@ if [[ $kernel_only != yes ]]; then
dinfo "*** Resolving executable dependencies ***"
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} --
dinfo "*** Resolving executable dependencies done***"
dinfo "*** Resolving executable dependencies done ***"
fi
# Now we are done with lazy resolving, always install dependencies
unset DRACUT_RESOLVE_LAZY
export DRACUT_RESOLVE_DEPS=1
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
for _dir in $libdirs; do
for _f in "$_dir/libpthread.so"*; do
@@ -1543,7 +1619,7 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
if [[ $src && $target ]]; then
if [[ -f $src ]]; then
inst $src $target
else
elif [[ -d $src ]]; then
ddebug "Including directory: $src"
destdir="${initdir}/${target}"
mkdir -p "$destdir"
@@ -1564,6 +1640,10 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
$DRACUT_CP -t "$destdir" "$objectname"
fi
done
elif [[ -e $src ]]; then
derror "$src is neither a directory nor a regular file"
else
derror "$src doesn't exist"
fi
fi
done
@@ -1582,21 +1662,6 @@ if [[ $kernel_only != yes ]]; then
fi
fi
PRELINK_BIN="$(command -v prelink)"
if [[ $EUID = 0 ]] && [[ $PRELINK_BIN ]]; then
if [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Installing prelink files ***"
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
elif [[ $do_prelink == yes ]]; then
dinfo "*** Pre-linking files ***"
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
chroot "$initdir" "$PRELINK_BIN" -a
rm -f -- "$initdir/$PRELINK_BIN"
rm -fr -- "$initdir"/etc/prelink.*
dinfo "*** Pre-linking files done ***"
fi
fi
if [[ $do_hardlink = yes ]] && command -v hardlink >/dev/null; then
dinfo "*** Hardlinking files ***"
hardlink "$initdir" 2>&1
@@ -1617,21 +1682,11 @@ if [[ $do_strip = yes ]] ; then
done
fi
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| xargs -r -0 $strip_cmd -g 2>/dev/null
# cleanup empty ldconfig_paths directories
for d in $(ldconfig_paths); do
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
done
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f || [ -n "$f" ]; do
SIG=$(tail -c 28 "$f" | tr -d '\000')
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 $strip_cmd -g
dinfo "*** Stripping files done ***"
fi
if [[ $early_microcode = yes ]]; then
dinfo "*** Generating early-microcode cpio image ***"
ucode_dir=(amd-ucode intel-ucode)
@@ -1648,7 +1703,7 @@ if [[ $early_microcode = yes ]]; then
for _fwdir in $fw_dir; do
if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
_src="*"
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
dinfo "*** Constructing ${ucode_dest[$idx]} ***"
if [[ $hostonly ]]; then
_src=$(get_ucode_file)
[[ $_src ]] || break
@@ -1703,6 +1758,142 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
fi
fi
if dracut_module_included "squash"; then
dinfo "*** Install squash loader ***"
if ! check_kernel_config CONFIG_SQUASHFS; then
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
exit 1
fi
if ! check_kernel_config CONFIG_OVERLAY_FS; then
dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
exit 1
fi
if ! check_kernel_config CONFIG_DEVTMPFS; then
dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
exit 1
fi
readonly squash_dir="$initdir/squash/root"
readonly squash_img=$initdir/squash/root.img
# Currently only move "usr" "etc" to squashdir
readonly squash_candidate=( "usr" "etc" )
mkdir -m 0755 -p $squash_dir
for folder in "${squash_candidate[@]}"; do
mv $initdir/$folder $squash_dir/$folder
done
# Move some files out side of the squash image, including:
# - Files required to boot and mount the squashfs image
# - Files need to be accessible without mounting the squash image
required_in_root() {
local file=$1
local _sqsh_file=$squash_dir/$file
local _init_file=$initdir/$file
if [[ -e $_init_file ]]; then
return
fi
if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
derror "$file is required to boot a squashed initramfs but it's not installed!"
return
fi
if [[ ! -d $(dirname $_init_file) ]]; then
required_in_root $(dirname $file)
fi
if [[ -L $_sqsh_file ]]; then
cp --preserve=all -P $_sqsh_file $_init_file
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
# Relative symlink
required_in_root ${_sqsh_file#$squash_dir/}
return
fi
if [[ -e $squash_dir$_sqsh_file ]]; then
# Absolute symlink
required_in_root ${_sqsh_file#/}
return
fi
required_in_root ${module_spec#$squash_dir/}
else
if [[ -d $_sqsh_file ]]; then
mkdir $_init_file
else
mv $_sqsh_file $_init_file
fi
fi
}
required_in_root etc/initrd-release
for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
do
required_in_root ${module_spec#$squash_dir/}
done
for dracut_spec in $squash_dir/usr/lib/dracut/*;
do
required_in_root ${dracut_spec#$squash_dir/}
done
mv $initdir/init $initdir/init.stock
ln -s squash/init.sh $initdir/init
# Reinstall required files for the squash image setup script.
# We have moved them inside the squashed image, but they need to be
# accessible before mounting the image.
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir"
hostonly="" instmods "loop" "squashfs" "overlay"
# Only keep systemctl outsite if we need switch root
if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
inst "systemctl"
fi
for folder in "${squash_candidate[@]}"; do
# Remove duplicated files in squashfs image, save some more space
[[ ! -d $initdir/$folder/ ]] && continue
for file in $(find $initdir/$folder/ -not -type d);
do
if [[ -e $squash_dir${file#$initdir} ]]; then
mv $squash_dir${file#$initdir} $file
fi
done
done
fi
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| xargs -r -0 $strip_cmd -g -p 2>/dev/null
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f || [ -n "$f" ]; do
SIG=$(tail -c 28 "$f" | tr -d '\000')
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 $strip_cmd -g -p
dinfo "*** Stripping files done ***"
fi
if dracut_module_included "squash"; then
dinfo "*** Squashing the files inside the initramfs ***"
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
if [[ $? != 0 ]]; then
dfatal "dracut: Failed making squash image"
exit 1
fi
rm -rf $squash_dir
dinfo "*** Squashing the files inside the initramfs done ***"
fi
dinfo "*** Creating image file '$outfile' ***"
if [[ $uefi = yes ]]; then
@@ -1752,7 +1943,7 @@ if ! (
exit 1
fi
if (( maxloglvl >= 5 )); then
if (( maxloglvl >= 5 )) && (( verbosity_mod_l >= 0 )); then
if [[ $allowlocal ]]; then
"$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img"| ddebug
else
@@ -1776,7 +1967,7 @@ if [[ $uefi = yes ]]; then
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
dinfo "Using UEFI kernel cmdline:"
dinfo $(< "$uefi_outdir/cmdline.txt")
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
@@ -1786,9 +1977,22 @@ if [[ $uefi = yes ]]; then
--add-section .cmdline="${uefi_outdir}/cmdline.txt" --change-section-vma .cmdline=0x30000 \
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
"$uefi_stub" "${uefi_outdir}/linux.efi" \
&& cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
dinfo "*** Creating UEFI image file '$outfile' done ***"
"$uefi_stub" "${uefi_outdir}/linux.efi"; then
if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then \
if sbsign \
--key "${uefi_secureboot_key}" \
--cert "${uefi_secureboot_cert}" \
--output "$outfile" "${uefi_outdir}/linux.efi"; then
dinfo "*** Creating signed UEFI image file '$outfile' done ***"
else
dfatal "*** Creating signed UEFI image file '$outfile' failed ***"
exit 1
fi
else
if cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
dinfo "*** Creating UEFI image file '$outfile' done ***"
fi
fi
else
rm -f -- "$outfile"
dfatal "*** Creating UEFI image file '$outfile' failed ***"
@@ -1806,10 +2010,23 @@ fi
command -v restorecon &>/dev/null && restorecon -- "$outfile"
sync $outfile 2> /dev/null
if [ $? -ne 0 ] ; then
dinfo "dracut: sync operartion on newly created initramfs $outfile failed"
exit 1
# We sync/fsfreeze only if we're operating on a live booted system.
# It's possible for e.g. `kernel` to be installed as an RPM BuildRequires or equivalent,
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
if test -d /run/systemd/system; then
if ! sync "$outfile" 2> /dev/null; then
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
exit 1
fi
# use fsfreeze only if we're not writing to /
if [[ "$(stat -c %m -- "$outfile")" != "/" && "$(stat -f -c %T -- "$outfile")" != "msdos" ]]; then
if ! $(fsfreeze -f $(dirname "$outfile") 2>/dev/null && fsfreeze -u $(dirname "$outfile") 2>/dev/null); then
dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
fi
fi
fi
exit 0

View File

@@ -5,18 +5,11 @@
# strip the automatically generated dep here and instead co-own the
# directory.
%global __requires_exclude pkg-config
# Variables must be defined
%define with_nbd 1
# nbd in Fedora only
%if 0%{?rhel} >= 6
%define with_nbd 0
%endif
%define dist_free_release xxx
Name: dracut
Version: xxx
Release: xxx
Release: %{dist_free_release}%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@@ -37,57 +30,40 @@ URL: https://dracut.wiki.kernel.org/
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 git
BuildRequires: kmod-devel >= 15
BuildRequires: bash
BuildRequires: git
BuildRequires: pkgconfig(libkmod) >= 23
BuildRequires: gcc
%if 0%{?fedora} || 0%{?rhel}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig
BuildRequires: systemd
%endif
%if 0%{?fedora}
BuildRequires: bash-completion
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%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
BuildRequires: docbook-xsl-stylesheets libxslt
%endif
BuildRequires: asciidoc
%endif
%if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer
# all functionality of the obsoleted packages
Obsoletes: mkinitrd < 6.0.94
Obsoletes: mkinitrd-devel < 6.0.94
Obsoletes: nash < 6.0.94
Obsoletes: libbdevid-python < 6.0.94
%endif
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
BuildRequires: systemd-units
%endif
%if 0%{?suse_version} > 9999
Obsoletes: mkinitrd < 2.6.1
Provides: mkinitrd = 2.6.1
%endif
Obsoletes: dracut-kernel < 005
Provides: dracut-kernel = %{version}-%{release}
Obsoletes: dracut < 030
Obsoletes: dracut-norescue < 030
Provides: dracut-norescue = %{version}-%{release}
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
@@ -100,43 +76,45 @@ Requires: sed
Requires: xz
Requires: gzip
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
Recommends: grubby
%if 0%{?fedora} || 0%{?rhel}
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Requires: systemd >= 219
Requires: systemd-udev >= 219
Requires: procps-ng
Conflicts: grubby < 8.23
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
Conflicts: bcache-tools < 0-0.14.20130909git
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif
Conflicts: mdadm < 3.2.6-14
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
Requires: libkcapi-hmaccalc
%endif
%description
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code 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.
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
@@ -147,32 +125,6 @@ Provides: dracut-generic = %{version}-%{release}
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
%package fips
Summary: dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
Requires: hmaccalc
%if 0%{?rhel} > 5
# For Alpha 3, we want nss instead of nss-softokn
Requires: nss
%else
Requires: nss-softokn
%endif
Requires: nss-softokn-freebl
%description fips
This package requires everything which is needed to build an
initramfs with dracut, which does an integrity check.
%endif
%package fips-aesni
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
Requires: %{name}-fips = %{version}-%{release}
%description fips-aesni
This package requires everything which is needed to build an
initramfs with dracut, which does an integrity check and adds the aesni-intel kernel module.
%package caps
Summary: dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
@@ -184,9 +136,17 @@ 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
@@ -218,6 +178,16 @@ 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: squashfs-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} .
@@ -234,9 +204,6 @@ cp %{SOURCE1} .
make %{?_smp_mflags}
%install
%if 0%{?fedora} || 0%{?rhel}
rm -rf -- $RPM_BUILD_ROOT
%endif
make %{?_smp_mflags} install \
DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib
@@ -245,7 +212,6 @@ echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dr
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
%if %{defined _unitdir}
@@ -266,6 +232,23 @@ 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
@@ -274,48 +257,39 @@ 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
%else
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
%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
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man8/mkinitrd.8*
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
# FIXME: remove after F19
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
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
%endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
> $RPM_BUILD_ROOT/etc/system-fips
%if 0%{?fedora} || 0%{?rhel}
# FIXME: remove after F30
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%clean
rm -rf -- $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%if %{with doc}
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
%doc README.md 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} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
%endif
@@ -341,10 +315,13 @@ rm -rf -- $RPM_BUILD_ROOT
%if %{with doc}
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} > 9999
%{_mandir}/man8/mkinitrd.8*
%{_mandir}/man1/lsinitrd.1*
%endif
%if 0%{?suse_version}
%{_mandir}/man8/mkinitrd-suse.8*
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.modules.7*
@@ -352,60 +329,73 @@ rm -rf -- $RPM_BUILD_ROOT
%{_mandir}/man5/dracut.conf.5*
%endif
%if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart
%else
%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/06rngd
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80cms
%{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/90multipath-hostonly
%{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/95dasd
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules
%{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/98dracut-systemd
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
@@ -429,55 +419,39 @@ rm -rf -- $RPM_BUILD_ROOT
%{_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} > 6
%{_prefix}/lib/kernel/install.d/50-dracut.install
%endif
%files network
%defattr(-,root,root,0755)
%{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/95fcoe
%{dracutlibdir}/modules.d/95iscsi
%{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
%{dracutlibdir}/modules.d/45ifcfg
%ifarch s390 s390x
%{dracutlibdir}/modules.d/95znet
%{dracutlibdir}/modules.d/95fcoe-uefi
%endif
%{dracutlibdir}/modules.d/99uefi-lib
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%files fips
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/01fips
%{dracutlibdir}/dracut.conf.d/40-fips.conf
%config(missingok) /etc/system-fips
%endif
%files fips-aesni
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02fips-aesni
%files caps
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02caps
%files live
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90dmsquash-live-ntfs
%{dracutlibdir}/modules.d/90livenet
%files tools
%defattr(-,root,root,0755)
%if %{with doc}
%doc %{_mandir}/man8/dracut-catimages.8*
%endif
@@ -487,15 +461,17 @@ rm -rf -- $RPM_BUILD_ROOT
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay
%files squash
%{dracutlibdir}/modules.d/99squash
%files config-generic
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
%files config-rescue
%defattr(-,root,root,0755)
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel} > 6
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%if 0%{?fedora} || 0%{?rhel}
# FIXME: remove after F30
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif

View File

@@ -83,7 +83,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 +94,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.
@@ -151,9 +151,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
@@ -185,7 +185,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]]
@@ -243,7 +243,7 @@ If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
server about the ip address for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
@@ -252,7 +252,7 @@ method described in <<Injecting>>.
==== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by ommitting all
To reduce the size of the initramfs, you should create it with by omitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny
@@ -262,7 +262,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
@@ -349,7 +349,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:
+
----

62
fedora-test.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/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 \
tcpdump \
$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

@@ -5,6 +5,8 @@ sub create_patches {
my $pdir=shift;
my $n=1;
my @lines;
my $fname;
my $f=0;
mkdir $pdir, 0755;
@@ -12,9 +14,13 @@ sub create_patches {
while (<GIT>) {
if (/^From [a-z0-9]{40} .*$/) {
my $fname = sprintf("%04d", $n++).".patch";
push @lines, $fname;
$fname = sprintf("%04d", $n++).".patch";
open FH, ">".$pdir."/".$fname;
$f=1;
}
if (/^---$/ && $f == 1) {
push @lines, $fname;
$f=0;
}
print FH;
}
@@ -31,7 +37,7 @@ $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/;
$tag=~s/[^0-9]+?([0-9]+)/$1/ if $tag !~ /\b[0-9a-f]{5,40}\b/;
my $release="$num.git$datestr";
$release="1" if $num == 1;
@@ -39,8 +45,8 @@ while(<>) {
if (/^Version:/) {
print "Version: $tag\n";
}
elsif (/^Release:/) {
print "Release: $release%{?dist}\n";
elsif (/^%define dist_free_release/) {
print "%define dist_free_release $release\n";
}
elsif ((/^Source0:/) || (/^Source:/)) {
print $_;

View File

@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false;
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
static inline void kmod_module_unrefp(struct kmod_module **p) {
if (*p)
kmod_module_unref(*p);
}
#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
static inline void kmod_module_unref_listp(struct kmod_list **p) {
if (*p)
@@ -402,9 +407,9 @@ static int resolve_deps(const char *src)
_cleanup_pclose_ FILE *fptr = NULL;
_cleanup_free_ char *cmd = NULL;
buf = malloc(LINE_MAX);
if (buf == NULL)
return -errno;
buf = malloc(LINE_MAX);
if (buf == NULL)
return -errno;
if (strstr(src, ".so") == 0) {
_cleanup_close_ int fd = -1;
@@ -456,11 +461,11 @@ static int resolve_deps(const char *src)
break;
}
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
/* glibc */
/* glibc */
if (strstr(buf, "cannot execute binary file"))
break;
@@ -479,11 +484,7 @@ static int resolve_deps(const char *src)
if (strstr(buf, destrootdir))
break;
p = strstr(buf, "=>");
if (!p)
p = buf;
p = strchr(p, '/');
p = strchr(buf, '/');
if (p) {
char *q;
@@ -633,7 +634,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
hashmap_put(items, i, i);
ret = asprintf(&fulldstpath, "%s/%s", destrootdir, dst);
ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
@@ -720,7 +721,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
if (lstat(fulldstpath, &sb) != 0) {
_cleanup_free_ char *absdestpath = NULL;
ret = asprintf(&absdestpath, "%s/%s", destrootdir, abspath);
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath));
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
@@ -933,13 +934,6 @@ static int parse_argv(int argc, char *argv[])
break;
case ARG_KERNELDIR:
kerneldir = strdup(optarg);
if ((strncmp("/lib/modules/", kerneldir, 13) != 0)
&& (strncmp("/usr/lib/modules/", kerneldir, 17) != 0)) {
char *p;
p = strstr(kerneldir, "/lib/modules/");
if (p != NULL)
kerneldirlen = p - kerneldir;
}
break;
case ARG_FIRMWAREDIRS:
firmwaredirs = strv_split(optarg, ":");
@@ -1068,7 +1062,7 @@ static int install_one(const char *src, const char *dst)
if (strchr(src, '/') == NULL) {
char **p = find_binary(src);
if (p) {
char **q = NULL;
char **q = NULL;
STRV_FOREACH(q, p) {
char *newsrc = *q;
log_debug("dracut_install '%s' '%s'", newsrc, dst);
@@ -1104,7 +1098,7 @@ static int install_all(int argc, char **argv)
if (strchr(argv[i], '/') == NULL) {
char **p = find_binary(argv[i]);
if (p) {
char **q = NULL;
char **q = NULL;
STRV_FOREACH(q, p) {
char *newsrc = *q;
log_debug("dracut_install '%s'", newsrc);
@@ -1157,6 +1151,8 @@ static int install_firmware(struct kmod_module *mod)
ret = -1;
STRV_FOREACH(q, firmwaredirs) {
_cleanup_free_ char *fwpath = NULL;
_cleanup_free_ char *fwpath_xz = NULL;
const char *fw;
struct stat sb;
int r;
@@ -1166,12 +1162,21 @@ static int install_firmware(struct kmod_module *mod)
exit(EXIT_FAILURE);
}
fw = fwpath;
if (stat(fwpath, &sb) != 0) {
log_debug("stat(%s) != 0", fwpath);
continue;
r = asprintf(&fwpath_xz, "%s.xz", fwpath);
if (r < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
if (stat(fwpath_xz, &sb) != 0) {
log_debug("stat(%s) != 0", fwpath);
continue;
}
fw = fwpath_xz;
}
ret = dracut_install(fwpath, fwpath, false, false, true);
ret = dracut_install(fw, fw, false, false, true);
if (ret == 0)
log_debug("dracut_install '%s' OK", fwpath);
}
@@ -1238,11 +1243,62 @@ static bool check_module_path(const char *path)
return true;
}
static int install_dependent_modules(struct kmod_list *modlist)
{
struct kmod_list *itr;
const char *path = NULL;
const char *name = NULL;
int ret = 0;
kmod_list_foreach(itr, modlist) {
_cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
mod = kmod_module_get_module(itr);
path = kmod_module_get_path(mod);
if (path == NULL)
continue;
if (check_hashmap(items_failed, path))
return -1;
if (check_hashmap(items, path)) {
continue;
}
name = kmod_module_get_name(mod);
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
continue;
}
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
if (ret == 0) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
install_firmware(mod);
modlist = kmod_module_get_dependencies(mod);
ret = install_dependent_modules(modlist);
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
if (ret == 0)
ret = install_dependent_modules(modpre);
}
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
}
}
return ret;
}
static int install_module(struct kmod_module *mod)
{
int ret = 0;
struct kmod_list *itr;
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
const char *path = NULL;
const char *name = NULL;
@@ -1285,23 +1341,12 @@ static int install_module(struct kmod_module *mod)
install_firmware(mod);
modlist = kmod_module_get_dependencies(mod);
kmod_list_foreach(itr, modlist) {
mod = kmod_module_get_module(itr);
path = kmod_module_get_path(mod);
ret = install_dependent_modules(modlist);
name = kmod_module_get_name(mod);
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
kmod_module_unref(mod);
continue;
}
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
install_firmware(mod);
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
}
kmod_module_unref(mod);
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
if (ret == 0)
ret = install_dependent_modules(modpre);
}
return ret;
@@ -1398,10 +1443,18 @@ static int install_modules(int argc, char **argv)
struct kmod_module *mod = NULL, *mod_o = NULL;
const char *modname = NULL;
const char *abskpath = NULL;
char *p;
int i;
int modinst = 0;
ctx = kmod_new(kerneldir, NULL);
abskpath = kmod_get_dirname(ctx);
p = strstr(abskpath, "/lib/modules/");
if (p != NULL)
kerneldirlen = p - abskpath;
if (arg_hostonly) {
char *modalias_file;
modalias_file = getenv("DRACUT_KERNEL_MODALIASES");
@@ -1439,11 +1492,11 @@ static int install_modules(int argc, char **argv)
for (i = 0; i < argc; i++) {
int r = 0;
int ret = -1;
log_debug("Handle module '%s'", argv[i]);
if (argv[i][0] == '/') {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_free_ const char *modname = NULL;
r = kmod_module_new_from_path(ctx, argv[i], &mod_o);
if (r < 0) {
@@ -1453,7 +1506,7 @@ static int install_modules(int argc, char **argv)
continue;
}
/* Check, if we have to load another module with that name instead */
modname = kmod_module_get_name(mod_o);
modname = strdup(kmod_module_get_name(mod_o));
if (!modname) {
if (!arg_optional) {
@@ -1497,6 +1550,7 @@ static int install_modules(int argc, char **argv)
return -ENOENT;
};
ret = ( ret == 0 ? 0 : r );
modinst = 1;
}
} else if (argv[i][0] == '=') {
_cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL;
@@ -1529,6 +1583,7 @@ static int install_modules(int argc, char **argv)
for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_free_ const char *modname = NULL;
if((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) {
fts_set(fts, ftsent, FTS_SKIP);
@@ -1551,7 +1606,7 @@ static int install_modules(int argc, char **argv)
}
/* Check, if we have to load another module with that name instead */
modname = kmod_module_get_name(mod_o);
modname = strdup(kmod_module_get_name(mod_o));
if (!modname) {
log_error("Failed to get name for module '%s'", ftsent->fts_accpath);
@@ -1590,6 +1645,7 @@ static int install_modules(int argc, char **argv)
return -ENOENT;
};
ret = ( ret == 0 ? 0 : r );
modinst = 1;
}
}
if (errno) {
@@ -1636,10 +1692,11 @@ static int install_modules(int argc, char **argv)
return -ENOENT;
};
ret = ( ret == 0 ? 0 : r );
modinst = 1;
}
}
if ((ret != 0) && (!arg_optional)) {
if ((modinst != 0) && (ret != 0) && (!arg_optional)) {
if (!arg_silent)
log_error("ERROR: installing '%s'", argv[i]);
return EXIT_FAILURE;

View File

@@ -167,7 +167,7 @@ int safe_atoi(const char *s, int *ret_i);
int safe_atollu(const char *s, unsigned long long *ret_u);
int safe_atolli(const char *s, long long int *ret_i);
#if __WORDSIZE == 32
#if LONG_MAX == INT_MAX
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);

54
logtee.c Normal file
View File

@@ -0,0 +1,54 @@
#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

@@ -34,11 +34,17 @@ OPTIONS
**-k, --kver** _<kernel version>_::
inspect the initramfs of <kernel version>.
**-m, --mod**::
list dracut modules included of the initramfs image.
**--unpack**::
unpack the initramfs to the current directory, instead of displaying the contents.
If optional filenames are given, will only unpack specified files, else the whole image will be unpacked.
Won't unpack anything from early cpio part.
**--unpackearly**::
unpack the early microcode initramfs to the current directory, instead of displaying the contents.
Same as --unpack, but only unpack files from early cpio part.
**-v, --verbose**::
unpack verbosely

View File

@@ -28,7 +28,10 @@ usage()
echo "-m, --mod list modules."
echo "-f, --file <filename> print the contents of <filename>."
echo "--unpack unpack the initramfs, instead of displaying the contents."
echo " If optional filenames are given, will only unpack specified files,"
echo " else the whole image will be unpacked. Won't unpack anything from early cpio part."
echo "--unpackearly unpack the early microcode part of the initramfs."
echo " Same as --unpack, but only unpack files from early cpio part."
echo "-v, --verbose unpack verbosely."
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
echo
@@ -118,6 +121,9 @@ if ! [[ -f "$image" ]]; then
exit 1
fi
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
trap "rm -rf '$TMPDIR'" EXIT
dracutlibdirs() {
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
echo "$d/$1"
@@ -130,7 +136,7 @@ extract_files()
for f in "${!filenames[@]}"; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2>/dev/null
((ret+=$?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
@@ -149,23 +155,79 @@ list_files()
{
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret+=$?))
echo "========================================================================"
}
unpack_files()
list_squash_content()
{
$CAT "$image" | cpio -id --quiet $verbose
((ret+=$?))
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
$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 -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
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
if [ -n $uefi ]; then
echo -n "initrd in UEFI: $uefi: "
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
if [ -f "$TMPDIR/osrel.txt" ]; then
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 a b || [ -n "$a" ]; do echo $a;done
fi
echo "========================================================================"
fi
@@ -175,7 +237,10 @@ case $bin in
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
if [[ "$is_early" ]]; then
if [[ -n "$unpackearly" ]]; then
if [[ -n "$unpack" ]]; then
# should use --unpackearly for early CPIO
:
elif [[ -n "$unpackearly" ]]; then
unpack_files
elif (( ${#filenames[@]} > 0 )); then
extract_files
@@ -219,6 +284,9 @@ case $bin in
$'\x89'LZO$'\0'*)
CAT="lzop -d -c"
;;
$'\x28\xB5\x2F\xFD'*)
CAT="zstd -d -c"
;;
*)
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
CAT="xzcat --single-stream --"
@@ -238,6 +306,16 @@ if [[ $SKIP ]]; then
CAT=skipcpio
fi
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
@@ -260,6 +338,7 @@ else
echo
list_modules
list_files
list_squash_content
fi
fi

View File

@@ -66,7 +66,7 @@ default_kernel_images() {
arm*)
regex='[uz]Image'
;;
aarch64)
aarch64|riscv64)
regex='Image'
;;
*) regex='vmlinu.'

View File

@@ -18,7 +18,7 @@ DESCRIPTION
version <kernel-version> by calling *dracut*.
[IMPORTANT]
This version of mkinitrd is provided for compability with older
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.
@@ -30,7 +30,7 @@ OPTIONS
**-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_
defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x and _vmlinuz_
for everything else.
**-i** _<initrd_list>_::
@@ -51,7 +51,7 @@ OPTIONS
**-d** _<root_device>_::
Root device, defaults to the device from which the root_dir is
mounted; overwrites the rootdev enviroment variable if set
mounted; overwrites the rootdev environment variable if set
**-s** _<size>_::
Add splash animation and bootscreen to initrd.

View File

@@ -1,6 +1,6 @@
#!/bin/bash --norc
#
# mkinitrd compability wrapper for SUSE.
# mkinitrd compatibility wrapper for SUSE.
#
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
#
@@ -62,7 +62,7 @@ usage () {
$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 " environment 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."
@@ -145,31 +145,17 @@ is_xen_kernel() {
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")
local dir="${1%/*}/"
[[ "$dir" != "$1" ]] || dir=""
local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
echo kernel_image_gz="'$kernel_image_gz'" >&2
if get_kernel_version "$kernel_image" 2>/dev/null; then
return
fi
# As a last resort, try vmlinux-$version.gz, which might be around
get_kernel_version "$kernel_image_gz" 2>/dev/null
}
@@ -191,7 +177,7 @@ default_kernel_images() {
arm*)
regex='[uz]Image'
;;
aarch64)
aarch64|riscv64)
regex='Image'
;;
*) regex='vmlinu.'
@@ -265,7 +251,7 @@ while (($# > 0)); do
;;
-M) read_arg map_file "$@" || shift $?
;;
-A) host_only=0;;
-A) dracut_args="${dracut_args} --no-host-only";;
-B) skip_update_bootloader=1;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-L) logfile=;;

View File

@@ -1,19 +0,0 @@
#!/bin/bash
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
require_binaries $systemdutildir/systemd-bootchart || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst_symlink /init /sbin/init
inst_multiple $systemdutildir/systemd-bootchart
}

View File

@@ -1,10 +1,21 @@
#!/bin/bash
getSystemdVersion() {
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
# Check if the systemd version is a valid number
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
exit 1
fi
echo $SYSTEMD_VERSION
}
# called by dracut
check() {
[[ $mount_needs ]] && return 1
if require_binaries $systemdutildir/systemd; then
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
SYSTEMD_VERSION=$(getSystemdVersion)
(( $SYSTEMD_VERSION >= 198 )) && return 0
return 255
fi
@@ -18,7 +29,7 @@ depends() {
}
installkernel() {
hostonly='' instmods autofs4 ipv6
hostonly='' instmods autofs4 ipv6 algif_hash hmac sha256
instmods -s efivarfs
}
@@ -31,8 +42,15 @@ install() {
exit 1
fi
if [ $(getSystemdVersion) -ge 240 ]; then
inst_multiple -o \
$systemdutildir/system-generators/systemd-debug-generator \
$systemdsystemunitdir/debug-shell.service
fi
inst_multiple -o \
$systemdutildir/systemd \
$systemdutildir/systemd-coredump \
$systemdutildir/systemd-cgroups-agent \
$systemdutildir/systemd-shutdown \
$systemdutildir/systemd-reply-password \
@@ -42,6 +60,7 @@ install() {
$systemdutildir/systemd-sysctl \
$systemdutildir/systemd-modules-load \
$systemdutildir/systemd-vconsole-setup \
$systemdutildir/systemd-volatile-root \
$systemdutildir/system-generators/systemd-fstab-generator \
$systemdutildir/system-generators/systemd-gpt-auto-generator \
\
@@ -98,6 +117,7 @@ install() {
$systemdsystemunitdir/systemd-ask-password-plymouth.service \
$systemdsystemunitdir/systemd-journald.service \
$systemdsystemunitdir/systemd-vconsole-setup.service \
$systemdsystemunitdir/systemd-volatile-root.service \
$systemdsystemunitdir/systemd-random-seed-load.service \
$systemdsystemunitdir/systemd-random-seed.service \
$systemdsystemunitdir/systemd-sysctl.service \
@@ -159,7 +179,7 @@ install() {
}
_mods=$(modules_load_get /usr/lib/modules-load.d)
[[ $_mods ]] && instmods $_mods
[[ $_mods ]] && hostonly='' instmods $_mods
if [[ $hostonly ]]; then
inst_multiple -H -o \
@@ -179,7 +199,7 @@ install() {
${NULL}
_mods=$(modules_load_get /etc/modules-load.d)
[[ $_mods ]] && instmods $_mods
[[ $_mods ]] && hostonly='' instmods $_mods
fi
if ! [[ -e "$initdir/etc/machine-id" ]]; then

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
# hwclock does not exist on S390(x), bail out silently then
local _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
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
inst /usr/share/zoneinfo/UTC
inst /etc/localtime
inst /etc/adjtime
inst_hook pre-trigger 00 "$moddir/warpclock.sh"
inst /sbin/hwclock
}

View File

@@ -0,0 +1,9 @@
#!/bin/sh
if test -e /etc/adjtime ; then
while read line ; do
if test "$line" = LOCAL ; then
hwclock --systz
fi
done < /etc/adjtime
fi

View File

@@ -0,0 +1,8 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
else
. /sbin/fips.sh
fips_load_crypto || die "FIPS integrity test failed"
fi

View File

@@ -69,6 +69,34 @@ do_rhevh_check()
return 0
}
fips_load_crypto()
{
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
# check if kernel provides generic algo
_found=0
while read _k _s _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && continue
_found=1
break
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"
modprobe tcrypt || return 1
rmmod tcrypt
}
do_fips()
{
local _v
@@ -78,31 +106,6 @@ do_fips()
KERNEL=$(uname -r)
FIPSMODULES=$(cat /etc/fipsmodules)
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
# check if kernel provides generic algo
_found=0
while read _k _s _v || [ -n "$_k" ]; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_v" != "$_module" ] && continue
_found=1
break
done </proc/crypto
[ "$_found" = "0" ] && return 1
fi
fi
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
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
@@ -110,13 +113,29 @@ do_fips()
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
else
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
[ -e "/boot/.${BOOT_IMAGE}.hmac" ] || BOOT_IMAGE="vmlinuz-${KERNEL}"
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ]; then
warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
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=""
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
sha512hmac -c "/boot/.${BOOT_IMAGE}.hmac" || return 1
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
fi
info "All initrd crypto checks done"

View File

@@ -12,16 +12,31 @@ depends() {
# called by dracut
installkernel() {
local _fipsmodules _mod
local _fipsmodules _mod _bootfstype
if [[ -f "${srcmods}/modules.fips" ]]; then
_fipsmodules="$(cat "${srcmods}/modules.fips")"
else
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 authenc authencesn blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib "
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390 cmac authenc "
_fipsmodules=""
# Hashes:
_fipsmodules+="sha1 sha224 sha256 sha384 sha512 "
_fipsmodules+="sha3-224 sha3-256 sha3-384 sha3-512 "
_fipsmodules+="crc32c crct10dif ghash "
# Ciphers:
_fipsmodules+="cipher_null des3_ede aes cfb "
# Modes/templates:
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
# Compression algs:
_fipsmodules+="deflate lzo zlib "
# PRNG algs:
_fipsmodules+="ansi_cprng "
# Misc:
_fipsmodules+="aead cryptomgr tcrypt crypto_user "
fi
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
@@ -32,23 +47,28 @@ installkernel() {
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-mount 01 "$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 fipscheck
inst_multiple sha512hmac rmmod insmod mount uname umount
inst_libdir_file libsoftokn3.so libsoftokn3.so \
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
libfreeblpriv3.so libfreeblpriv3.chk
inst_multiple -o prelink
inst_simple /etc/system-fips
[ -c ${initdir}/dev/random ] || mknod ${initdir}/dev/random c 1 8 \
|| {

View File

@@ -37,33 +37,5 @@ install() {
$systemdsystemunitdir/initrd-parse-etc.service
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
if [ -e /etc/os-release ]; then
. /etc/os-release
VERSION+=" "
PRETTY_NAME+=" "
else
VERSION=""
PRETTY_NAME=""
fi
NAME=dracut
ID=dracut
VERSION+="dracut-$DRACUT_VERSION"
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
VERSION_ID=$DRACUT_VERSION
ANSI_COLOR="0;34"
{
echo NAME=\"$NAME\"
echo VERSION=\"$VERSION\"
echo ID=$ID
echo VERSION_ID=$VERSION_ID
echo PRETTY_NAME=\"$PRETTY_NAME\"
echo ANSI_COLOR=\"$ANSI_COLOR\"
} > $initdir/usr/lib/initrd-release
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
ln -sf initrd-release $initdir/usr/lib/os-release
ln -sf initrd-release $initdir/etc/os-release
}

View File

@@ -1,32 +0,0 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
local _fipsmodules _mod
_fipsmodules="aesni-intel ghash_clmulni_intel"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for _mod in $_fipsmodules; do
if instmods $_mod; then
echo $_mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
}
# called by dracut
install() {
return 0
}

View File

@@ -22,9 +22,6 @@ install() {
_progs="$_progs $_i"
done
# FIXME: switch_root should be in the above list, but busybox version hangs
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
for _i in $_progs; do
_path=$(find_binary "$_i")
[ -z "$_path" ] && continue

View File

@@ -0,0 +1,39 @@
#!/bin/bash
# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
#
# Copyright (c) 2019 Red Hat, Inc.
# Author: Renaud Métrich <rmetrich@redhat.com>
#
# 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 3 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/>.
#
depends() {
echo systemd
return 0
}
check() {
# if there's no rngd binary, no go.
require_binaries rngd || return 1
return 0
}
install() {
inst rngd
inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
ln -rfs "${initdir}${systemdsystemunitdir}/rngd.service" \
"${initdir}${systemdsystemunitdir}/sysinit.target.wants/rngd.service"
}

View File

@@ -0,0 +1,7 @@
[Unit]
Description=Hardware RNG Entropy Gatherer Daemon
DefaultDependencies=no
Before=systemd-udevd.service
[Service]
ExecStart=/usr/sbin/rngd -f

View File

@@ -8,7 +8,7 @@ fi
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
DEFAULT_FONT=LatArCyrHeb-16
DEFAULT_FONT=eurlatgr
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
set_keyboard() {

View File

@@ -23,27 +23,30 @@ install() {
fi
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
DEFAULT_FONT="${i18n_default_font:-eurlatgr}"
I18N_CONF="/etc/locale.conf"
VCONFIG_CONF="/etc/vconsole.conf"
# This is from 10redhat-i18n.
findkeymap () {
local MAP=$1
local MAPS=$1
local MAPNAME=${1%.map*}
[[ ! -f $MAP ]] && \
MAP=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\* | head -n1)
[[ " $KEYMAPS " = *" $MAP "* ]] && return
KEYMAPS="$KEYMAPS $MAP"
case $MAP in
*.gz) cmd=zgrep;;
*.bz2) cmd=bzgrep;;
*) cmd=grep ;;
esac
local map
[[ ! -f $MAPS ]] && \
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
for INCL in $($cmd "^include " $MAP | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
findkeymap $FN
for map in $MAPS; do
KEYMAPS="$KEYMAPS $map "
case $map in
*.gz) cmd=zgrep;;
*.bz2) cmd=bzgrep;;
*) cmd=grep ;;
esac
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
strstr "$KEYMAPS" " $FN " || findkeymap $FN
done
done
done
}
@@ -191,7 +194,9 @@ install() {
findkeymap ${map}
done
inst_opt_decompress ${KEYMAPS}
for keymap in ${KEYMAPS}; do
inst_opt_decompress ${keymap}
done
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
@@ -204,7 +209,11 @@ install() {
if [[ ${FONT_MAP} ]]
then
FONT_MAP=${FONT_MAP%.trans}
inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans
# There are three different formats that setfont supports
inst_simple ${kbddir}/consoletrans/${FONT_MAP} \
|| inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans \
|| inst_simple ${kbddir}/consoletrans/${FONT_MAP}_to_uni.trans \
|| dwarn "Could not find FONT_MAP ${FONT_MAP}!"
fi
if [[ ${FONT_UNIMAP} ]]

View File

@@ -126,9 +126,11 @@ parse_option_121() {
elif [ $mask -gt 8 ]; then
destination="$1.$2.0.0/$mask"
shift; shift
else
elif [ $mask -gt 0 ]; then
destination="$1.0.0.0/$mask"
shift
else
destination="0.0.0.0/$mask"
fi
# Read the gateway
@@ -138,7 +140,7 @@ parse_option_121() {
# Multicast routing on Linux
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
# - If you simply leave it link-local and attach it to an interface, it works fine.
if [ $multicast -eq 1 ]; then
if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
temp_result="$destination dev $interface"
else
temp_result="$destination via $gateway dev $interface"

View File

@@ -41,6 +41,12 @@ do_dhcp() {
return 1
fi
if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
mkdir -p /run/NetworkManager/conf.d
echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
fi
while [ $_COUNT -lt $_DHCPRETRY ]; do
info "Starting dhcp for interface $netif"
dhclient "$@" \
@@ -70,23 +76,25 @@ load_ipv6() {
}
do_ipv6auto() {
local ret
load_ipv6
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
linkup $netif
wait_for_ipv6_auto $netif
ret=$?
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
return 0
return $ret
}
# Handle static ip configuration
do_static() {
strglobin $ip '*:*:*' && load_ipv6
if [ -z "$dev" ] && ! iface_has_carrier "$netif"; then
if ! iface_has_carrier "$netif"; then
warn "No carrier detected on interface $netif"
return 1
elif ! linkup "$netif"; then
@@ -257,7 +265,7 @@ if [ -z "$NO_BOND_MASTER" ]; then
done
# Set mtu on bond master
[ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $netif
[ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $bondname
# add the bits to setup the needed post enslavement parameters
for arg in $bondoptions ; do
@@ -400,7 +408,11 @@ for p in $(getargs ip=); do
esac
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
if [ -n "$dev" ]; then
[ "$dev" != "$netif" ] && continue
else
iface_is_enslaved "$netif" && continue
fi
# Store config for later use
for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do
@@ -416,6 +428,8 @@ for p in $(getargs ip=); do
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
either6)
do_ipv6auto || do_dhcp -6 ;;
*)
do_static ;;
esac
@@ -448,6 +462,11 @@ for p in $(getargs ip=); do
fi
;;
esac
if command -v wicked >/dev/null && [ -z "$manualup" ]; then
/sbin/netroot $netif
fi
exit $ret
fi
done

View File

@@ -0,0 +1,92 @@
#!/bin/bash
# called by dracut
check() {
local _program
require_binaries ip dhclient sed awk grep || return 1
require_any_binary arping arping2 || return 1
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
return 0
}
# called by dracut
install() {
local _arch _i _dir
inst_multiple ip dhclient sed awk grep
inst_multiple -o arping arping2
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
inst_multiple -o ping ping6
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
inst_simple -H "/etc/dhclient.conf"
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 96 "$moddir/parse-team.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
# install all config files for teaming
unset TEAM_MASTER
unset TEAM_CONFIG
unset TEAM_PORT_CONFIG
unset HWADDR
unset SUBCHANNELS
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
[ -e "$i" ] || continue
case "$i" in
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
continue
;;
esac
(
. "$i"
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
mkdir -p $initdir/etc/teamd
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
elif [ -n "$TEAM_PORT_CONFIG" ]; then
inst_simple "$i"
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
if [ -n "$HWADDR" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
fi
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
if [ -n "$SUBCHANNELS" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
fi
fi
fi
)
done
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
dracut_need_initqueue
}

View File

@@ -105,6 +105,9 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
cond='ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}!="wlan|wwan"'
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
if [ "$NEEDNET" = "1" ]; then
echo 'for i in /tmp/net.*.did-setup; do [ -f "$i" ] && exit 0; done; exit 1' >$hookdir/initqueue/finished/wait-network.sh
fi
fi
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh

View File

@@ -1,7 +1,7 @@
#!/bin/sh
#
# Format:
# bond=<bondname>[:<bondslaves>:[:<options>[:<mtu>]]]
# bond=<bondname>[:<bondslaves>[:<options>[:<mtu>]]]
#
# bondslaves is a comma-separated list of physical (ethernet) interfaces
# options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
@@ -12,7 +12,7 @@
# if the mtu is specified, it will be set on the bond master
#
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
# We translate list of slaves to space-separated here to make it easier to loop over them in ifup
# Ditto for bonding options
parsebond() {
local v=${1}:

View File

@@ -76,6 +76,7 @@ for p in $(getargs ip=); do
die "Sorry, automatic calculation of netmask is not yet supported"
;;
auto6);;
either6);;
dhcp|dhcp6|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"

View File

@@ -0,0 +1,52 @@
#!/bin/bash
# called by dracut
check() {
local _program
require_binaries sed grep || return 1
# do not add this module by default
return 255
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
return 0
}
# called by dracut
install() {
local _nm_version
_nm_version=$(NetworkManager --version)
inst_multiple sed grep
inst NetworkManager
inst /usr/libexec/nm-initrd-generator
inst_multiple -o teamd dhclient
inst_hook cmdline 99 "$moddir/nm-config.sh"
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
inst_rules 85-nm-unmanaged.rules
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
inst /usr/libexec/nm-dhcp-helper
elif ! [[ -e "$initdir/etc/machine-id" ]]; then
# The internal DHCP client silently fails if we
# have no machine-id
systemd-machine-id-setup --root="$initdir"
fi
# We don't install the ifcfg files from the host automatically.
# But if the user chooses to include them, we pull in the machinery to read them.
if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
fi
}

View File

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

View File

@@ -0,0 +1,17 @@
#!/bin/sh
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
else
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
fi
for _i in /sys/class/net/*/
do
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
grep -q connection-uuid= $state 2>/dev/null || continue
ifname=${_i##*/}
sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' <$state >/tmp/dhclient.$ifname.dhcpopts
source_hook initqueue/online $ifname
/sbin/netroot $ifname
done

View File

@@ -2,17 +2,17 @@
# called by dracut
check() {
local _program
require_binaries ip dhclient || return 1
require_any_binary arping arping2 || return 1
return 255
}
# called by dracut
depends() {
echo "kernel-network-modules"
echo -n "kernel-network-modules "
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
echo "network-manager"
else
echo "network-legacy"
fi
return 0
}
@@ -24,74 +24,11 @@ installkernel() {
# called by dracut
install() {
local _arch _i _dir
inst_multiple ip dhclient sed awk
inst_multiple -o arping arping2
strstr "$(arping 2>&1)" "ARPing 2" && mv "$initdir/bin/arping" "$initdir/bin/arping2"
inst_multiple -o ping ping6
inst_multiple -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/netroot.sh" "/sbin/netroot"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
inst_simple -H "/etc/dhclient.conf"
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 96 "$moddir/parse-team.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
# install all config files for teaming
unset TEAM_MASTER
unset TEAM_CONFIG
unset TEAM_PORT_CONFIG
unset HWADDR
unset SUBCHANNELS
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
[ -e "$i" ] || continue
case "$i" in
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
continue
;;
esac
(
. "$i"
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
mkdir -p $initdir/etc/teamd
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
elif [ -n "$TEAM_PORT_CONFIG" ]; then
inst_simple "$i"
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
if [ -n "$HWADDR" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
fi
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
if [ -n "$SUBCHANNELS" ]; then
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
fi
fi
fi
)
done
_arch=$(uname -m)
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
dracut_need_initqueue
}

View File

@@ -14,20 +14,20 @@ is_ip() {
get_ip() {
local iface="$1" ip=""
ip=$(ip -o -f inet addr show $iface)
ip=$(ip -f inet addr show $iface)
ip=${ip%%/*}
ip=${ip##* }
echo $ip
}
iface_for_remote_addr() {
set -- $(ip -o route get to $1)
echo $5
set -- $(ip route get to $1 | sed 's/.*\bdev\b//p;q')
echo $1
}
iface_for_ip() {
set -- $(ip -o addr show to $1)
echo $2
set -- $(ip addr show to $1)
echo ${2%:}
}
iface_for_mac() {
@@ -129,7 +129,7 @@ setup_net() {
for _p in $(getargs rd.route); do
route_to_var "$_p" || continue
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
ip route add "$route_mask" ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}
if strstr "$route_mask" ":"; then
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
> /tmp/net.route6."$netif"
@@ -458,12 +458,12 @@ ip_to_var() {
fi
if [ $# -eq 1 ]; then
# format: ip={dhcp|on|any|dhcp6|auto6}
# format: ip={dhcp|on|any|dhcp6|auto6|either6}
# or
# ip=<ipv4-address> means anaconda-style static config argument cluster
autoconf="$1"
if strstr "$autoconf" "*.*.*.*"; then
if strglob "$autoconf" "*.*.*.*"; then
# ip=<ipv4-address> means anaconda-style static config argument cluster:
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
@@ -485,7 +485,7 @@ ip_to_var() {
return 0
fi
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" ]; then
if [ "$2" = "dhcp" -o "$2" = "on" -o "$2" = "any" -o "$2" = "dhcp6" -o "$2" = "auto6" -o "$2" = "either6" ]; then
# format: ip=<interface>:{dhcp|on|any|dhcp6|auto6}[:[<mtu>][:<macaddr>]]
[ -n "$1" ] && dev="$1"
[ -n "$2" ] && autoconf="$2"
@@ -593,7 +593,7 @@ wait_for_if_link() {
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip -o link show dev $1 2>/dev/null)
li=$(ip link show dev $1 2>/dev/null)
[ -n "$li" ] && return 0
sleep 0.1
cnt=$(($cnt+1))
@@ -609,7 +609,7 @@ wait_for_if_up() {
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
li=$(ip -o link show up dev $1)
li=$(ip link show up dev $1)
if [ -n "$li" ]; then
case "$li" in
*\<UP*)
@@ -653,7 +653,8 @@ wait_for_ipv6_dad_link() {
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
&& [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
&& return 0
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
@@ -671,7 +672,8 @@ wait_for_ipv6_dad() {
timeout=$(($timeout*10))
while [ $cnt -lt $timeout ]; do
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
[ -n "$(ip -6 addr show dev "$1")" ] \
&& [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
&& return 0
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
@@ -721,13 +723,17 @@ iface_has_carrier() {
linkup "$1"
li=$(ip -o link show up dev $1)
li=$(ip link show up dev $1)
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
while [ $cnt -lt $timeout ]; do
if [ -n "$_no_carrier_flag" ]; then
li=$(ip link show up dev $1)
# NO-CARRIER flag was cleared
strstr "$li" "NO-CARRIER" || return 0
elif ! [ -e "$interface/carrier" ]; then
# sysfs not available and "NO-CARRIER" not displayed
return 0
fi
# double check the syscfs carrier flag
[ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
@@ -741,6 +747,13 @@ iface_has_link() {
iface_has_carrier "$@"
}
iface_is_enslaved() {
local _li
_li=$(ip link show dev $1)
strstr "$_li" " master " || return 1
return 0
}
find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do

View File

@@ -46,7 +46,7 @@ if [ -z "$2" ]; then
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
warn "No dhcp root-path received for '$netif' trying other interfaces if available"
exit 1
fi

View File

@@ -14,6 +14,7 @@ depends() {
# called by dracut
install() {
inst_binary awk
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
}

View File

@@ -286,7 +286,10 @@ echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
{
cp /tmp/net.* /run/initramfs/
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
for i in /tmp/net.*.resolv.conf; do
[ -f "$i" ] && cat "$i"
done | awk '!($0 in a) { a[$0]; print }' > /run/initramfs/state/etc/resolv.conf
[ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
} > /dev/null 2>&1

View File

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

View File

@@ -1,8 +1,23 @@
#!/bin/bash
pkglib_dir() {
local _dirs="/usr/lib/plymouth /usr/libexec/plymouth/"
if type -P dpkg-architecture &>/dev/null; then
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
fi
for _dir in $_dirs; do
if [ -x $_dir/plymouth-populate-initrd ]; then
echo $_dir
return
fi
done
}
# called by dracut
check() {
[[ "$mount_needs" ]] && return 1
[ -z $(pkglib_dir) ] && return 1
require_binaries plymouthd plymouth plymouth-set-default-theme
}
@@ -13,12 +28,7 @@ depends() {
# called by dracut
install() {
PKGLIBDIR="/usr/lib/plymouth"
if type -P dpkg-architecture &>/dev/null; then
PKGLIBDIR="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
fi
[ -x /usr/libexec/plymouth/plymouth-populate-initrd ] && PKGLIBDIR="/usr/libexec/plymouth"
PKGLIBDIR=$(pkglib_dir)
if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
|| [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
. "$moddir"/plymouth-populate-initrd.sh

View File

@@ -4,9 +4,10 @@ PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
PLYMOUTH_THEME=$(plymouth-set-default-theme)
inst_multiple plymouthd plymouth \
"${PLYMOUTH_LOGO_FILE}" \
/etc/system-release
test -e "${PLYMOUTH_LOGO_FILE}" && inst_simple "${PLYMOUTH_LOGO_FILE}"
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
inst_libdir_file "plymouth/text.so" "plymouth/details.so"

0
modules.d/80lvmmerge/README.md Executable file → Normal file
View File

View File

@@ -10,7 +10,7 @@ check() {
# called by dracut
depends() {
echo lvm
echo lvm dracut-systemd systemd
return 0
}

View File

@@ -0,0 +1,40 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
# do not add this module by default
local arch=$(uname -m)
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 0
}
cmdline() {
local cio_accept
if [ -e /boot/zipl/active_devices.txt ] ; then
while read dev etc ; do
[ "$dev" = "#" -o "$dev" = "" ] && continue;
if [ -z "$cio_accept" ] ; then
cio_accept="$dev"
else
cio_accept="${cio_accept},${dev}"
fi
done < /boot/zipl/active_devices.txt
fi
if [ -n "$cio_accept" ] ; then
echo "rd.cio_accept=${cio_accept}"
fi
}
# called by dracut
install() {
if [[ $hostonly_cmdline == "yes" ]] ; then
local _cio_accept=$(cmdline)
[[ $_cio_accept ]] && printf "%s\n" "$_cio_accept" >> "${initdir}/etc/cmdline.d/01cio_accept.conf"
fi
inst_hook cmdline 20 "$moddir/parse-cio_accept.sh"
inst_multiple cio_ignore
}

View File

@@ -0,0 +1,22 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
CIO_IGNORE=$(getarg cio_ignore)
CIO_ACCEPT=$(getarg rd.cio_accept)
if [ -z $CIO_IGNORE ] ; then
info "cio_ignored disabled on commandline"
return
fi
if [ -n "$CIO_ACCEPT" ] ; then
OLDIFS="$IFS"
IFS=,
set -- $CIO_ACCEPT
while (($# > 0)) ; do
info "Enabling device $1"
cio_ignore --remove $1
shift
done
IFS="$OLDIFS"
fi

View File

@@ -26,6 +26,8 @@ depends() {
# called by dracut
installkernel() {
instmods btrfs
# Make sure btfs can use fast crc32c implementations where available (bsc#1011554)
instmods crc32c-intel
}
# called by dracut

View File

@@ -12,17 +12,17 @@ crypttab_contains() {
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
if [ -n "$dev" ]; then
for _dev in "$(devnames $d)"; do
for _dev in $(devnames $d); do
[ "$dev" -ef "$_dev" ] && return 0
done
fi
if [ -e /usr/lib/dracut/modules.d/90crypt/block_uuid.map ]; then
if [ -e /etc/block_uuid.map ]; then
# search for line starting with $d
_line=$(sed -n "\,^$d .*$,{p}" /usr/lib/dracut/modules.d/90crypt/block_uuid.map)
_line=$(sed -n "\,^$d .*$,{p}" /etc/block_uuid.map)
[ -z "$_line" ] && continue
# get second column with uuid
_uuid="$(echo $_line | sed 's,^.* \(.*$\),\1,')"
strstr "$_uuid" "${luks##luks-}" && return 0
strstr "$_uuid" "${luks##luks-}" && return 0
fi
done < /etc/crypttab
fi
@@ -191,7 +191,7 @@ readkey() {
local device="$3"
# No mounting needed if the keyfile resides inside the initrd
if [ "/" == "$keydev" ]; then
if [ "/" = "$keydev" ]; then
local mntp=/
else
# This creates a unique single mountpoint for *, or several for explicitly

View File

@@ -8,6 +8,8 @@ NEWROOT=${NEWROOT:-"/sysroot"}
. /lib/dracut-lib.sh
mkdir -m 0700 /run/cryptsetup
# if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
@@ -29,13 +31,27 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; t
continue
fi
# PARTUUID used in crypttab
if [ "${dev%%=*}" = "PARTUUID" ]; then
if [ "luks-${dev##PARTUUID=}" = "$luksname" ]; then
luksname="$name"
break
fi
# UUID used in crypttab
if [ "${dev%%=*}" = "UUID" ]; then
elif [ "${dev%%=*}" = "UUID" ]; then
if [ "luks-${dev##UUID=}" = "$luksname" ]; then
luksname="$name"
break
fi
# ID used in crypttab
elif [ "${dev%%=*}" = "ID" ]; then
if [ "luks-${dev##ID=}" = "$luksname" ]; then
luksname="$name"
break
fi
# path used in crypttab
else
cdev=$(readlink -f $dev)
@@ -88,6 +104,10 @@ while [ $# -gt 0 ]; do
;;
allow-discards)
allowdiscards="--allow-discards"
;;
header=*)
cryptsetupopts="${cryptsetupopts} --${1}"
;;
esac
shift
done
@@ -138,21 +158,24 @@ else
info "Using '$keypath' on '$keydev'"
readkey "$keypath" "$keydev" "$device" \
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname" \
&& ask_passphrase=0
unset keypath keydev
ask_passphrase=0
break
done
fi
if [ $ask_passphrase -ne 0 ]; then
luks_open="$(command -v cryptsetup) $cryptsetupopts luksOpen"
_timeout=$(getargs "rd.luks.timeout")
_timeout=${_timeout:-0}
ask_for_password --ply-tries 5 \
--ply-cmd "$luks_open -T1 $device $luksname" \
--ply-prompt "Password ($device)" \
--tty-tries 1 \
--tty-cmd "$luks_open -T5 $device $luksname"
--tty-cmd "$luks_open -T5 -t $_timeout $device $luksname"
unset luks_open
unset _timeout
fi
unset device luksname luksfile

View File

@@ -25,8 +25,9 @@ depends() {
# called by dracut
installkernel() {
hostonly="" instmods drbg
arch=$(arch)
arch=$(uname -m)
[[ $arch == x86_64 ]] && arch=x86
[[ $arch == s390x ]] && arch=s390
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
}
@@ -68,22 +69,50 @@ install() {
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _rest || [ -n "$_mapper" ]; do
while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
[[ $_dev ]] || continue
[[ $_dev == PARTUUID=* ]] && \
_dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
[[ $_dev == UUID=* ]] && \
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
echo "$_dev $(blkid $_dev -s UUID -o value)" > /usr/lib/dracut/modules.d/90crypt/block_uuid.map
[[ $_dev == ID=* ]] && \
_dev="/dev/disk/by-id/${_dev#ID=}"
for _hdev in "${!host_fs_types[@]}"; do
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
echo "$_mapper $_dev $_rest"
break
fi
echo "$_dev $(blkid $_dev -s UUID -o value)" >> "${initdir}/etc/block_uuid.map"
# loop through the options to check for the force option
luksoptions=${_luksoptions}
OLD_IFS="${IFS}"
IFS=,
set -- ${luksoptions}
IFS="${OLD_IFS}"
while [ $# -gt 0 ]; do
case $1 in
force)
forceentry="yes"
break
;;
esac
shift
done
# include the entry regardless
if [ "${forceentry}" = "yes" ]; then
echo "$_mapper $_dev $_luksfile $_luksoptions"
else
for _hdev in "${!host_fs_types[@]}"; do
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then
echo "$_mapper $_dev $_luksfile $_luksoptions"
break
fi
done
fi
done < /etc/crypttab > $initdir/etc/crypttab
mark_hostonly /etc/crypttab
fi

View File

@@ -35,6 +35,8 @@ else
echo 'ACTION!="add|change", GOTO="luks_end"'
} > /etc/udev/rules.d/70-luks.rules.new
PARTUUID=$(getargs rd.luks.partuuid -d rd_LUKS_PARTUUID)
SERIAL=$(getargs rd.luks.serial -d rd_LUKS_SERIAL)
LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID)
tout=$(getarg rd.luks.key.tout)
@@ -44,7 +46,71 @@ else
done < /etc/crypttab
fi
if [ -n "$LUKS" ]; then
if [ -n "$PARTUUID" ]; then
for uuid in $PARTUUID; do
uuid=${uuid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$uuid="); then
luksname="${luksname#$uuid=}"
else
luksname="luks-$uuid"
fi
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
luksname="$(str_replace "$luksname" '\' '\\')"
if ! crypttab_contains "$uuid"; then
{
printf -- 'ENV{ID_PART_ENTRY_UUID}=="*%s*", ' "$uuid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
} >> /etc/udev/rules.d/70-luks.rules.new
fi
fi
done
elif [ -n "$SERIAL" ]; then
for serialid in $SERIAL; do
serialid=${serialid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$serialid="); then
luksname="${luksname#$serialid=}"
else
luksname="luks-$serialid"
fi
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_SERIAL_SHORT}=="*%s*", ' "$serialid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
luksname="$(str_replace "$luksname" '\' '\\')"
if ! crypttab_contains "$serialid"; then
{
printf -- 'ENV{ID_SERIAL_SHORT}=="*%s*", ' "$serialid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name systemd-cryptsetup-%%k %s start ' "$(command -v systemctl)"
printf -- 'systemd-cryptsetup@%s.service"\n' "$luksname"
} >> /etc/udev/rules.d/70-luks.rules.new
fi
fi
done
elif [ -n "$LUKS" ]; then
for luksid in $LUKS; do
luksid=${luksid##luks-}
@@ -64,6 +130,8 @@ else
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
luksname="$(str_replace "$luksname" '\' '\\')"
if ! crypttab_contains "$luksid"; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '

View File

@@ -18,7 +18,7 @@ if getargbool 1 rd.luks -n rd_NO_LUKS && \
fi
# A keydev of '/' is treated as the initrd itself
if [ "/" == "$keydev" ]; then
if [ "/" = "$keydev" ]; then
[ -z "$luksdev" ] && luksdev='*'
echo "$luksdev:$keydev:$keypath" >> /tmp/luks.keys
continue

View File

@@ -1,7 +1,7 @@
SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"
KERNEL!="dm-[0-9]*", GOTO="dm_end"
ACTION=="add", GOTO="dm_end"

View File

@@ -1,11 +1,42 @@
#!/bin/sh
_remove_dm() {
local dev=$1
local s
local devname
for s in /sys/block/${dev}/holders/dm-* ; do
[ -e ${s} ] || continue
_remove_dm ${s##*/}
done
# multipath devices might have MD devices on top,
# which are removed after this script. So do not
# remove those to avoid spurious errors
case $(cat /sys/block/${dev}/dm/uuid) in
mpath-*)
return 0
;;
*)
devname=$(cat /sys/block/${dev}/dm/name)
dmsetup -v --noudevsync remove "$devname" || return $?
;;
esac
return 0
}
_do_dm_shutdown() {
local ret=0
local final=$1
local dev
info "Disassembling device-mapper devices"
for dev in $(dmsetup info -c --noheadings -o name) ; do
dmsetup -v --noudevsync remove "$dev" || ret=$?
for dev in /sys/block/dm-* ; do
[ -e ${dev} ] || continue
if [ "x$final" != "x" ]; then
_remove_dm ${dev##*/} || ret=$?
else
_remove_dm ${dev##*/} >/dev/null 2>&1 || ret=$?
fi
done
if [ "x$final" != "x" ]; then
info "dmsetup ls --tree"

View File

@@ -38,6 +38,6 @@ install() {
inst_rules "$moddir/59-persistent-storage-dm.rules"
prepare_udev_rules 59-persistent-storage-dm.rules
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
inst_hook shutdown 25 "$moddir/dm-shutdown.sh"
}

View File

@@ -5,7 +5,7 @@
SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
@@ -23,9 +23,6 @@ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
GOTO="dm_end"
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
RUN+="/sbin/initqueue --onetime --unique --settled /sbin/dmraid_scan $env{DEVNAME}"
LABEL="dm_end"

View File

@@ -33,8 +33,6 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
if [ "${s##$r}" != "$s" ]; then
info "Activating $s"
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
udevsettle
fi
done
done

View File

@@ -74,6 +74,8 @@ install() {
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
inst_rules 66-kpartx.rules 67-kpartx-compat.rules
inst_libdir_file "libdmraid-events*.so*"
inst_rules "$moddir/61-dmraid-imsm.rules"

View File

@@ -8,7 +8,7 @@ check() {
}
depends() {
echo 90dmsquash-live
echo dmsquash-live
return 0
}

View File

@@ -1,6 +1,6 @@
#!/bin/sh
if [ -L /run/rootfsbase ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
info "Applying updates to live image..."
mount -o bind /run $NEWROOT/run
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories

View File

@@ -18,12 +18,12 @@ fi
case "$liveroot" in
live:LABEL=*|LABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
live:CDLABEL=*|CDLABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
live:UUID=*|UUID=*) \
@@ -54,8 +54,10 @@ GENERATOR_DIR="$2"
[ -z "$GENERATOR_DIR" ] && exit 1
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
[ -e /xor_readonly ] && xor_readonly="--readonly"
ROOTFLAGS="$(getarg rootflags)"
{
echo "[Unit]"
@@ -64,13 +66,18 @@ ROOTFLAGS="$(getarg rootflags)"
echo "Where=/sysroot"
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
echo "What=LiveOS_rootfs"
echo "Options=${ROOTFLAGS},lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork"
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
else
ovlfs=lowerdir=/run/rootfsbase
fi
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
echo "Type=overlay"
_dev=LiveOS_rootfs
else
echo "What=/dev/mapper/live-rw"
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
_dev=dev-mapper-live\x2drw
_dev=$'dev-mapper-live\\x2drw'
fi
} > "$GENERATOR_DIR"/sysroot.mount
@@ -78,4 +85,5 @@ mkdir -p "$GENERATOR_DIR/$_dev.device.d"
{
echo "[Unit]"
echo "JobTimeoutSec=3000"
echo "JobRunningTimeoutSec=3000"
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"

View File

@@ -84,7 +84,7 @@ else
# Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
# at the first glance, but ends with lots and lots of squashfs
# errors, because systemd attempts to kill the ntfs-3g process?!
if [ -x "$(find_binary "ntfs-3g")" ]; then
if [ -x "/usr/bin/ntfs-3g" ]; then
( exec -a @ntfs-3g ntfs-3g -o ${liverw:-ro} $livedev /run/initramfs/live ) | vwarn
else
die "Failed to mount block device of live image: Missing NTFS support"
@@ -109,15 +109,15 @@ do_live_overlay() {
if [ -z "$overlay" ]; then
pathspec="/${live_dir}/overlay-$l-$u"
elif ( echo $overlay | grep -q ":" ); then
elif strstr $overlay ":"; then
# pathspec specified, extract
pathspec=$( echo $overlay | sed -e 's/^.*://' )
pathspec=${overlay##*:}
fi
if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
pathspec="/${live_dir}/overlay-$l-$u"
fi
devspec=$( echo $overlay | sed -e 's/:.*$//' )
devspec=${overlay%%:*}
# need to know where to look for the overlay
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
@@ -137,7 +137,7 @@ do_live_overlay() {
fi
if [ -n "$overlayfs" ]; then
unset -v overlayfs
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
fi
setup="yes"
else
@@ -146,10 +146,10 @@ do_live_overlay() {
[ -d /run/initramfs/overlayfs/ovlwork ]; then
ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt
ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt
if [ -z "$overlayfs" ]; then
overlayfs="yes"
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
overlayfs="required"
setup="yes"
fi
fi
@@ -157,19 +157,24 @@ do_live_overlay() {
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs$opt
ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork$opt
if [ -z "$overlayfs" ]; then
overlayfs="yes"
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="yes"
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
overlayfs="required"
setup="yes"
fi
fi
if [ -n "$overlayfs" ]; then
modprobe overlay
if [ $? != 0 ]; then
if [ "$overlayfs" = required ]; then
die "OverlayFS is required but not available."
exit 1
fi
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit=":>/xor_overlayfs;"
m='OverlayFS is not available; using temporary Device-mapper overlay.'
info $m
unset -v overlayfs setup
[ -n "$reloadsysrootmountunit" ] && unset -v reloadsysrootmountunit
fi
fi
@@ -178,34 +183,36 @@ do_live_overlay() {
warn "Using temporary overlay."
elif [ -n "$devspec" -a -n "$pathspec" ]; then
[ -z "$m" ] &&
m=' Unable to find a persistent overlay; using a temporary one.'
m=($'\n' "$m" $'\n'
' All root filesystem changes will be lost on shutdown.'
$'\n' ' Press any key to continue')
echo -e "\n\n\n${m[*]}\n\n\n" > /dev/kmsg
m=' Unable to find a persistent overlay; using a temporary one.'
m="$m"$'\n All root filesystem changes will be lost on shutdown.'
m="$m"$'\n Press [Enter] to continue.'
printf "\n\n\n\n${m}\n\n\n" > /dev/kmsg
if [ -n "$DRACUT_SYSTEMD" ]; then
if plymouth --ping ; then
if type plymouth >/dev/null 2>&1 && plymouth --ping ; then
if getargbool 0 rhgb || getargbool 0 splash ; then
m[0]='>>>'$'\n''>>>'$'\n''>>>'$'\n\n'
m[5]=$'\n''<<<'$'\n''<<<'$'\n''<<<'
plymouth display-message --text="${m[*]}"
m='>>>'$'\n''>>>'$'\n''>>>'$'\n\n\n'"$m"
m="${m%n.*}"$'n.\n\n\n''<<<'$'\n''<<<'$'\n''<<<'
plymouth display-message --text="${m}"
else
plymouth ask-question --prompt="${m[*]}" --command=true
plymouth ask-question --prompt="${m}" --command=true
fi
else
m[0]='>>>'
m[5]='<<<'
unset -v m[2] m[4]
systemd-ask-password --timeout=0 "${m[*]}"
m=">>>${m//.[[:space:]]/.} <<<"
systemd-ask-password --timeout=0 "${m}"
fi
else
plymouth --ping && plymouth --quit
read -s -r -p $'\n\n'"${m[*]}:" -n 1 reply
type plymouth >/dev/null 2>&1 && plymouth --ping && plymouth --quit
read -s -r -p $'\n\n'"${m}" -n 1 reply
fi
fi
if [ -n "$overlayfs" ]; then
mkdir -m 0755 /run/overlayfs
mkdir -m 0755 /run/ovlwork
if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then
info "No persistent overlay found."
unset -v readonly_overlay
[ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="${reloadsysrootmountunit}:>/xor_readonly;"
fi
else
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
@@ -253,14 +260,13 @@ do_live_overlay() {
echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw
fi
# Create a device that always points to a ro base image
if [ -n "$overlayfs" ]; then
BASE_LOOPDUP=$(losetup -f --show -r $BASE_LOOPDEV)
echo 0 $sz linear $BASE_LOOPDUP 0 | dmsetup create --readonly live-base
else
# Create a device for the ro base of overlayed file systems.
if [ -z "$overlayfs" ]; then
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
fi
ln -s $BASE_LOOPDEV /dev/live-base
}
# end do_live_overlay()
# we might have a genMinInstDelta delta file for anaconda to take advantage of
if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then
@@ -294,10 +300,21 @@ if [ -e "$SQUASHED" ]; then
mkdir -m 0755 -p /run/initramfs/squashfs
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
if [ -d /run/initramfs/squashfs/LiveOS ]; then
if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
fi
elif [ -d /run/initramfs/squashfs/proc ]; then
FSIMG=$SQUASHED
if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
reloadsysrootmountunit=":>/xor_overlayfs;"
fi
overlayfs="required"
else
die "Failed to find a root filesystem in $SQUASHED."
exit 1
fi
else
# we might have an embedded fs image to use as rootfs (uncompressed live)
@@ -315,8 +332,8 @@ else
fi
fi
if [ -n "$FSIMG" ] ; then
if [ -n "$writable_fsimg" ] ; then
if [ -n "$FSIMG" ]; then
if [ -n "$writable_fsimg" ]; then
# mount the provided filesystem read/write
echo "Unpacking live filesystem (may take some time)" > /dev/kmsg
mkdir -m 0755 /run/initramfs/fsimg/
@@ -339,9 +356,13 @@ if [ -n "$FSIMG" ] ; then
setup=yes
fi
fi
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
sz=$(blockdev --getsz $BASE_LOOPDEV)
if [ "$setup" == rw ]; then
if [ "$FSIMG" = "$SQUASHED" ]; then
BASE_LOOPDEV=$SQUASHED_LOOPDEV
else
BASE_LOOPDEV=$(losetup -f --show $opt $FSIMG)
sz=$(blockdev --getsz $BASE_LOOPDEV)
fi
if [ "$setup" = rw ]; then
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create live-rw
else
# Add a DM snapshot or OverlayFS for writes.
@@ -349,8 +370,6 @@ if [ -n "$FSIMG" ] ; then
fi
fi
[ -e "$SQUASHED" ] && [ -z "$overlayfs" ] && umount -l /run/initramfs/squashfs
if [ -b "$OSMIN_LOOPDEV" ]; then
# set up the devicemapper snapshot device, which will merge
# the normal live fs image, and the delta, into a minimzied fs image
@@ -358,7 +377,7 @@ if [ -b "$OSMIN_LOOPDEV" ]; then
fi
if [ -n "$reloadsysrootmountunit" ]; then
> /xor_overlayfs
eval "$reloadsysrootmountunit"
systemctl daemon-reload
fi
@@ -366,33 +385,33 @@ ROOTFLAGS="$(getarg rootflags)"
if [ -n "$overlayfs" ]; then
mkdir -m 0755 /run/rootfsbase
if [ -n "$reset_overlay" ] && [ -L /run/overlayfs ]; then
if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
ovlfs=$(readlink /run/overlayfs)
info "Resetting the OverlayFS overlay directory."
rm -r -- ${ovlfs}/* ${ovlfs}/.* >/dev/null 2>&1
fi
if [ -n "$readonly_overlay" ]; then
mkdir -m 0755 /run/rootfsbase-r
mount -r $FSIMG /run/rootfsbase-r
mount -t overlay LiveOS_rootfs-r -oro,lowerdir=/run/overlayfs-r:/run/rootfsbase-r /run/rootfsbase
if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
else
mount -r $FSIMG /run/rootfsbase
ovlfs=lowerdir=/run/rootfsbase
fi
mount -r $FSIMG /run/rootfsbase
if [ -z "$DRACUT_SYSTEMD" ]; then
#FIXME What to link to /dev/root? Is it even needed?
printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
'lowerdir=/run/rootfsbase,upperdir=/run/overlayfs,workdir=/run/ovlwork' \
"$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
"$NEWROOT" > $hookdir/mount/01-$$-live.sh
fi
else
ln -s /dev/mapper/live-rw /dev/root
if [ -z "$DRACUT_SYSTEMD" ]; then
[ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS"
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
fi
ln -s $BASE_LOOPDEV /run/rootfsbase
fi
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
ln -s null /dev/root
need_shutdown
exit 0

View File

@@ -22,7 +22,7 @@ installkernel() {
# called by dracut
install() {
inst_multiple umount dmsetup blkid dd losetup grep blockdev find
inst_multiple umount dmsetup blkid dd losetup blockdev find
inst_multiple -o checkisomd5
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"

View File

@@ -20,12 +20,12 @@ modprobe -q loop
case "$liveroot" in
live:LABEL=*|LABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
live:CDLABEL=*|CDLABEL=*) \
root="${root#live:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="${root//\//\\x2f}"
root="live:/dev/disk/by-label/${root#CDLABEL=}"
rootok=1 ;;
live:UUID=*|UUID=*) \
@@ -57,6 +57,6 @@ info "root was $liveroot, is now $root"
# make sure that init doesn't complain
[ -z "$root" ] && root="live"
wait_for_dev -n /run/rootfsbase
wait_for_dev -n /dev/root
return 0

View File

@@ -0,0 +1,194 @@
#!/bin/bash
# called by dracut
#
# Parses depmod configuration and calls instmods for out-of-tree kernel
# modules found. Specifically, kernel modules inside directories that
# come from the following places are included (if these kernel modules
# are present in modules.dep):
# - "search" configuration option;
# - "override" configuration option (matching an exact file name constructed
# by concatenating the provided directory and the kernel module name);
# - "external" configuration option (if "external" is a part of "search"
# configuration).
# (See depmod.d(5) for details.)
#
# This module has the following variables available for configuration:
# - "depmod_modules_dep" - Path to the modules.dep file
# ("$srcmods/modules.dep" by default);
# - "depmod_module_dir" - Directory containing kernel modules ("$srcmods"
# by default);
# - "depmod_configs" - array of depmod configuration paths to parse
# (as supplied to depmod -C, ("/run/depmod.d/"
# "/etc/depmod.d/" "/lib/depmod.d/") by default).
installkernel()
{
: "${depmod_modules_dep:=$srcmods/modules.dep}"
: "${depmod_module_dir:=$srcmods}"
[[ -f "${depmod_modules_dep}" ]] || return 0
# Message printers with custom prefix
local mod_name="kernel-modules-extra"
prinfo() { dinfo " ${mod_name}: $*"; }
prdebug() { ddebug " ${mod_name}: $*"; }
# Escape a string for usage as a part of extended regular expression.
# $1 - string to escape
re_escape() {
printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
}
local OLDIFS
local cfg
local cfgs=()
local search_list=""
local overrides=()
local external_dirs=()
local e f
## Gathering and sorting configuration file list
[ -n "${depmod_configs[@]-}" ] \
|| depmod_configs=(/run/depmod.d/ /etc/depmod.d/ /lib/depmod.d/)
for cfg in "${depmod_configs[@]}"; do
[ -e "$cfg" ] || {
prdebug "configuration source \"$cfg\" does not exist"
continue
}
# '/' is used as a separator between configuration name and
# configuration path
if [ -d "$cfg" ]; then
for f in "$cfg/"*; do
[[ -e "$f" && ! -d "$f" ]] || {
prdebug "configuration source" \
"\"$cfg\" is ignored" \
"(directory or doesn't exist)"
continue
}
cfgs+=("$(basename "$f")/$f")
done
else
cfgs+=("$(basename "$cfg")/$cfg")
fi
done
OLDIFS="$IFS"
IFS=$'\n'
LANG=C cfgs=($(printf '%s\n' "${cfgs[@]}" \
| sort -u -k1,1 -t '/' | cut -f 2- -d '/'))
IFS="$OLDIFS"
## Parse configurations
for cfg in "${cfgs[@]}"; do
prdebug "parsing configuration file \"$cfg\""
local k v mod kverpat path
while read -r k v; do
case "$k" in
search)
search_list="$search_list $v"
prdebug "$cfg: added \"$v\" to the list of" \
"search directories"
;;
override) # module_name kver_pattern dir
read -r mod kverpat path <<<"$v"
if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]
then
prinfo "$cfg: ignoring incorrect" \
"override option: \"$k $v\""
continue
fi
if [[ '*' = "$kverpat" \
|| "$kernel" =~ "$kverpat" ]]
then
overrides+=("${path}/${mod}")
prdebug "$cfg: added override" \
"\"${path}/${mod}\""
else
prdebug "$cfg: override \"$v\" is" \
"ignored since \"$kverpat\"" \
"doesn't match \"$kernel\""
fi
;;
external) # kverpat dir
read -r kverpat path <<<"$v"
if [[ ! "$kverpat" || ! "$path" ]]; then
prinfo "$cfg: ignoring incorrect" \
"external option: \"$k $v\""
continue
fi
if [[ '*' = "$kverpat" \
|| "$kernel" =~ "$kverpat" ]]
then
external_dirs+=("$path")
prdebug "$cfg: added external" \
"directory \"$path\""
else
prdebug "$cfg: external directory" \
"\"$path\" is ignored since" \
"\"$kverpat\" doesn't match " \
"\"$kernel\""
fi
;;
'#'*|'') # comments and empty strings
;;
include|make_map_files) # ignored by depmod
;;
*)
prinfo "$cfg: unknown depmod configuration" \
"option \"$k $v\""
;;
esac
done < "$cfg"
done
# "updates built-in" is the default search list
: "${search_list:=updates}"
## Build a list of regular expressions for grepping modules.dep
local pathlist=()
for f in "${overrides[@]}"; do
pathlist+=("^$(re_escape "$f")")
done
for f in $(printf "%s" "$search_list"); do
# Ignoring builtin modules
[ "built-in" != "$f" ] || continue
if [ "external" = "$f" ]; then
for e in "${external_dirs[@]}"; do
pathlist+=("$(re_escape "${e%/}")/[^:]+")
done
fi
pathlist+=("$(re_escape "${f%/}")/[^:]+")
done
## Filter modules.dep, canonicalise the resulting filenames and supply
## them to instmods.
[ 0 -lt "${#pathlist[@]}" ] || return 0
printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
| (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
| tr -d ':' \
| (cd "$depmod_module_dir" || exit; xargs -r realpath -se --) \
| instmods || return 1
return 0
}

View File

@@ -2,6 +2,20 @@
# called by dracut
installkernel() {
find_kernel_modules_external () {
local _OLDIFS
local external_pattern="^/"
[[ -f "$srcmods/modules.dep" ]] || return 0
_OLDIFS=$IFS
IFS=:
while read a rest; do
[[ $a =~ $external_pattern ]] || continue
printf "%s\n" "$a"
done < "$srcmods/modules.dep"
IFS=$_OLDIFS
}
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
if [[ -z $drivers ]]; then
@@ -11,53 +25,64 @@ installkernel() {
ohci-hcd ohci-pci \
uhci-hcd \
xhci-hcd xhci-pci xhci-plat-hcd \
pinctrl-cherryview \
"=drivers/pinctrl" \
${NULL}
hostonly=$(optional_hostonly) instmods \
"=drivers/hid" \
"=drivers/tty/serial" \
"=drivers/input/serio" \
"=drivers/input/keyboard" \
"=drivers/usb/storage" \
"=drivers/pci/host" \
${NULL}
instmods \
yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
"=drivers/pcmcia" =ide nvme
"=drivers/pcmcia" =ide nvme vmd nfit
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
# arm/aarch64 specific modules
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
instmods \
"=drivers/clk" \
"=drivers/dma" \
"=drivers/extcon" \
"=drivers/gpio" \
"=drivers/hwspinlock" \
"=drivers/i2c/busses" \
"=drivers/mfd" \
"=drivers/mmc/core" \
"=drivers/phy" \
"=drivers/power" \
"=drivers/regulator" \
"=drivers/rpmsg" \
"=drivers/rtc" \
"=drivers/soc" \
"=drivers/usb/chipidea" \
"=drivers/usb/dwc2" \
"=drivers/usb/dwc3" \
"=drivers/usb/host" \
"=drivers/usb/misc" \
"=drivers/usb/musb" \
"=drivers/usb/phy" \
"=drivers/scsi/hisi_sas" \
"=drivers/scsi/hisi_sas" \
${NULL}
fi
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
find_kernel_modules_external | instmods
# if not on hostonly mode, install all known filesystems,
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then
if [[ -z $filesystems ]]; then
dracut_instmods -o -P ".*/(kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd)/.*" '=fs'
fi
else
elif [[ "${host_fs_types[*]}" ]]; then
hostonly='' instmods "${host_fs_types[@]}"
fi
fi

View File

@@ -28,7 +28,7 @@ installkernel() {
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net xennet
ecb arc4 bridge stp llc ipv6 bonding 8021q ipvlan macvlan af_packet virtio_net xennet
hostonly="" instmods iscsi_ibft crc32c iscsi_boot_sysfs
}

View File

@@ -43,18 +43,36 @@ GENERATOR_DIR="$2"
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes"
[ -e /xor_overlayfs ] && xor_overlayfs="yes"
[ -e /xor_readonly ] && xor_readonly="--readonly"
ROOTFLAGS="$(getarg rootflags)"
{
echo "[Unit]"
echo "Before=initrd-root-fs.target"
echo "[Mount]"
echo "Where=/sysroot"
echo "What=/dev/mapper/live-rw"
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
if [ "$overlayfs$xor_overlayfs" = "yes" ]; then
echo "What=LiveOS_rootfs"
if [ "$readonly_overlay$xor_readonly" = "--readonly" ]; then
ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
else
ovlfs=lowerdir=/run/rootfsbase
fi
echo "Options=${ROOTFLAGS},${ovlfs},upperdir=/run/overlayfs,workdir=/run/ovlwork"
echo "Type=overlay"
_dev=LiveOS_rootfs
else
echo "What=/dev/mapper/live-rw"
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
_dev=$'dev-mapper-live\\x2drw'
fi
} > "$GENERATOR_DIR"/sysroot.mount
mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
mkdir -p "$GENERATOR_DIR/$_dev.device.d"
{
echo "[Unit]"
echo "JobTimeoutSec=3000"
} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
echo "JobRunningTimeoutSec=3000"
} > "$GENERATOR_DIR/$_dev.device.d/timeout.conf"

View File

@@ -7,7 +7,7 @@
SUBSYSTEM!="block", GOTO="lvm_end"
ACTION!="add|change", GOTO="lvm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="lvm_end"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end"

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