Compare commits

..

134 Commits
045 ... 046

Author SHA1 Message Date
Harald Hoyer
a0799ffb55 NEWS: update 2017-08-11 13:44:06 +02:00
Harald Hoyer
65f78f3d74 crypt: handle rd.luks.name
systemd supports renaming of dm devices with rd.luks.name.

Honor the kernel command line parameter.
2017-08-11 13:23:10 +02:00
Harald Hoyer
2b909b9a4b dracut-install: fixed hostonly modules hashmap_put 2017-08-10 09:20:35 +02:00
Harald Hoyer
ed25fb0e91 dracut-install: fixed typo 2017-08-10 09:20:35 +02:00
Harald Hoyer
c2408eed7f Merge pull request #266 from martinezjavier/master
network: Only bring up wired network interfaces
2017-08-10 08:49:14 +02:00
Javier Martinez Canillas
1792759721 network: Only bring up wired network interfaces
The dracut network module is only supposed to be used for wired interfaces
but if driver modules for wireless devices are wrongly copied, these will
be loaded and the available interfaces brought up.

If the rd.neednet=1 command line parameter is used, dhclient will attempt
to request an IP address for the interfaces and these requests will fail.

But other dracut modules that depend on the network to be settled, will
have to wait for the DHCP requests to timeout. Which can be a lot of time
since the dhclient default timeout value is 60 seconds.

Instead of trying to blacklist all possible kernel modules for wireless
devices, only bring up network interfaces if these are for wired devices.

Suggested-by: Harald Hoyer <harald@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2017-08-09 19:10:42 +02:00
Ankit Kumar
e316ae0e43 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-09 12:04:16 +02:00
Harald Hoyer
5abd692fe4 network/ifup: don't arping for point-to-point connections
https://bugzilla.redhat.com/show_bug.cgi?id=1477339
2017-08-07 15:09:36 +02:00
Harald Hoyer
1279a9e1a0 fcoe: install hba.conf and libhbalinux only if hba.conf exists 2017-08-07 14:45:55 +02:00
Harald Hoyer
0baf5a3e99 Merge pull request #265 from nullr0ute/arm-fixes
A few ARM fixes for a number of newer devices which have some wider deps
2017-08-07 13:10:55 +02:00
Harald Hoyer
bdf0f9ce32 Merge pull request #257 from sbrudenell/loop-keys-in-initrd
Support crypto loop keys in initrd.
2017-08-07 11:41:11 +02:00
Harald Hoyer
ae989390a1 dracut.sh: --nofscks does not take parameters
fixes: https://github.com/dracutdevs/dracut/issues/264
2017-08-07 11:39:45 +02:00
Peter Robinson
39018c93c2 arm: add soc/extcon/mfd as they're often needed for USB and core memory/soc drivers
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2017-08-04 19:51:25 +01:00
Peter Robinson
f496af50b7 add options to pickup dw_mmc submodules to blockfuncs
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2017-08-04 18:43:26 +01:00
Steven Brudenell
c427603cd1 Include both and in luks key name. 2017-08-03 21:47:06 -04:00
Steven Brudenell
e2b877a18b Change mntp->keydev in loopback key luks name. 2017-08-03 21:47:06 -04:00
Steven Brudenell
690b24f02f Support crypto loop keys in initrd. 2017-08-03 21:47:05 -04:00
Harald Hoyer
98663fcaac Merge pull request #261 from jonathan-teh/amd-family-16h
Add early microcode support for AMD family 16h
2017-08-02 11:31:19 +02:00
Harald Hoyer
8523ec50c2 Merge pull request #260 from haraldh/crypto-cleanup
crypt-loop: cleanup cleanup procedures
2017-08-02 11:28:47 +02:00
jonathan-teh
af6eee79e3 Add early microcode support for AMD family 16h 2017-07-29 00:19:19 +01:00
Harald Hoyer
9fd0461b7d nbd: use systemd-run to start nbd-client 2017-07-28 15:15:02 +02:00
Harald Hoyer
66a3d4053b testsuite: increase disk image size 2017-07-28 15:15:02 +02:00
Harald Hoyer
b1ae591945 dracut-systemd: add back missing dependencies
otherwise TEST-20-NFS fails
2017-07-28 11:57:07 +02:00
Harald Hoyer
017978f868 network: redirect stderr for arping test 2017-07-28 11:54:27 +02:00
Harald Hoyer
2187b3d097 crypt-loop: cleanup cleanup procedures
Using initqueue --finished to cleanup stuff is not what the
initqueue/finished hook was meant for.

Move stuff to the real cleanup hook.
2017-07-28 10:43:39 +02:00
Harald Hoyer
c75ce02775 TEST-02-systemd: add systemd-analyze verify 2017-07-28 10:19:26 +02:00
Harald Hoyer
f24d205537 dracut-systemd: fixed dependencies
try to break an ordering cycle.

https://github.com/dracutdevs/dracut/issues/259
2017-07-28 10:19:26 +02:00
Harald Hoyer
85ed04e0cf dracut-systemd/*.service: fix copyright message and comment 2017-07-28 10:17:06 +02:00
Harald Hoyer
c0371761fb add systemd-analyze to debug and TEST-02-SYSTEMD 2017-07-28 10:17:06 +02:00
Harald Hoyer
2ceb910a73 git2spec.pl: handle github merges
found a nice strategy to produce patchset from merges
2017-07-27 16:34:25 +02:00
Harald Hoyer
72c084918a Merge pull request #253 from yuwata/spec
spec: add missing modules
2017-07-26 09:28:49 +02:00
Yu Watanabe
ad3b209d40 spec: add missing modules 2017-07-25 10:31:55 +09:00
Harald Hoyer
1a95f1f4fc dracut.spec: add 80lvmmerge 2017-07-24 16:11:41 +02:00
Harald Hoyer
ef025dcbbe Update README.md 2017-07-24 15:59:12 +02:00
Harald Hoyer
d23b0efc1a 80lvmmerge: remove unused file 2017-07-24 15:54:16 +02:00
Harald Hoyer
1bfa75b015 80lvmmerge: README.md update 2017-07-24 15:53:50 +02:00
Harald Hoyer
dd75a946db Update README.md 2017-07-24 15:51:54 +02:00
Harald Hoyer
e95a3c36ed add lvmmerge dracut module 2017-07-24 15:48:54 +02:00
Harald Hoyer
400a85ffaf install arping V2 as arping2 2017-07-24 10:03:42 +02:00
Harald Hoyer
9388d99361 simplify TEST-30-ISCSI for CI 2017-07-21 16:01:04 +02:00
Harald Hoyer
5a532aa83f Update README.md 2017-07-21 15:47:37 +02:00
Harald Hoyer
9cd4edb445 TEST-12: increase retry and loglevel 2017-07-21 15:04:57 +02:00
Harald Hoyer
a1d92d8ace TEST-12: sleep to get log messages 2017-07-21 14:44:20 +02:00
Harald Hoyer
fac3e9d975 TEST-12: settle before doing sfdisk 2017-07-21 14:07:30 +02:00
Harald Hoyer
9b8e6e40a9 increased qemu memory 2017-07-21 11:43:08 +02:00
Harald Hoyer
a430c3f7a6 Merge pull request #252 from landgraf/dhcp_option_21
dhclient: send client-identifier matching hardware address
2017-07-19 14:32:41 +02:00
Harald Hoyer
e7b343138f Merge pull request #233 from yuwata/kernel-install
kernel-install: Skip to create initrd if /etc/machine-id is missing or empty
2017-07-19 09:53:40 +02:00
Pavel Zhukov
4011b48c42 dhclient: send client-identifier matching hardware address
Forcing dhclient to use hardware address instead of DUID to make it
predictable and allows system installation in whitelist based networks.
2017-07-17 17:58:28 +02:00
Harald Hoyer
295194ee42 Merge pull request #251 from danimo/fix_hostonly_cmdline
Do generate error when hostonly_cmdline is set to "no"
2017-07-17 17:08:29 +02:00
Daniel Molkentin
76dd870bfd Do generate error when hostonly_cmdline is set to "no"
Reference: bsc#1048748
2017-07-17 17:01:07 +02:00
Harald Hoyer
3e7498ea03 Merge pull request #250 from lnykryn/classless-static-routes
40network/dhclient.conf: rename classless-routes to classless-static-…
2017-07-14 08:36:16 +02:00
Lukas Nykryn
62b7920ed1 40network/dhclient.conf: rename classless-routes to classless-static-routes
We tell dhclient to name 121 option "classless-routes",
but in dhclient-script we parse classless_static_routes.
So either have to change the configuration or the script.

And since dhclient uses by default classless_static_routes,
let's change the configuration
2017-07-13 16:46:19 +02:00
Harald Hoyer
5ce7cc7337 add 90multipath-hostonly module
hardcoding the wwid of the drives in the initramfs causes problems
when the drives are cloned to a system with the same hardware, but
different disk wwid's

https://bugzilla.redhat.com/show_bug.cgi?id=1457311
2017-07-10 13:28:40 +02:00
Harald Hoyer
d84f4687c3 dracut-init.sh: check for file $DRACUT_KERNEL_MODALIASES
and not for the directory
2017-07-07 15:59:31 +02:00
Harald Hoyer
db17ef6c4f dracut-init.sh: add the kernel directory to the --modalias generation 2017-07-07 15:58:02 +02:00
Harald Hoyer
3ad12c7be8 Check all modalias files in /sys/devices for modules
and add the corresponding kernel modules to the host module list

https://bugzilla.redhat.com/show_bug.cgi?id=1467427
2017-07-07 15:55:55 +02:00
Harald Hoyer
26264af7f5 Merge pull request #191 from robert-scheck/master
Add NTFS support to 90dmsquash-live module
2017-07-06 09:26:51 +02:00
Robert Scheck
37437cac8a Add NTFS support to 90dmsquash-live module (#191)
Support booting from USB media with NTFS filesystem (optionally),
which removes the FAT32 related 4 GB file size limit for LiveOS/
squashfs.img (and any other file on the same USB media).
2017-06-30 00:15:57 +02:00
Harald Hoyer
106255afd4 bail out if module directory does not exist
this basically reverts commit 05214a0bed

if people want to build the initramfs without kernel modules,
then --no-kernel should be specified
2017-06-29 17:09:50 +02:00
Harald Hoyer
c1699b59c6 kernel-modules: add serial line drivers 2017-06-29 12:18:26 +02:00
Harald Hoyer
add1ea88d2 mark these as needing bash 2017-06-29 12:18:26 +02:00
Harald Hoyer
3d875f77f3 Try BOOT_IMAGE and fallback to vmlinuz-${KERNEL}
On s390 BOOT_IMAGE only denotes the number of the boot record that
was selected in the bootloader and not the path to the kernel image.

Also only bail out, if the kernel hmac checking relies on that path.
2017-06-29 10:40:29 +02:00
Harald Hoyer
44302d6f28 dracut.spec: use Recommends for rhel > 7 2017-06-29 10:40:29 +02:00
Harald Hoyer
38e9d6249a Merge pull request #246 from lnykryn/authenc
01fips: add authenec module
2017-06-28 18:09:54 +02:00
Lukas Nykryn
0a50111ab3 01fips: add authenec module
Resolves: #1465946
2017-06-28 17:46:04 +02:00
Harald Hoyer
937cc53ecb Merge pull request #241 from danimo/zfcp_rules_dasd_rules_updates
s390 changes that never went upstream
2017-06-28 11:57:33 +02:00
Harald Hoyer
343c74311b Merge pull request #244 from danimo/crypt_with_uuid
90crypt: Fixed crypttab_contains() to also work with device path in /etc/crypttab
2017-06-28 09:26:03 +02:00
Julian Wolf
c3b6970394 90crypt: Fixed crypttab_contains() to also work with device path in /etc/crypttab
blkid is not available when this function is called, so block_uuid.map is put into
the initrd, mapping block devices from /etc/crypttab to UUIDs.

This fixes a bug where udev rules were created by mistake as crypttab_contains()
returned false for devices specified by path in /etc/crypttab which resulted in
error messages during boot.

Signed-off-by: Julian Wolf <juwolf@suse.de>
2017-06-27 16:43:47 +02:00
Harald Hoyer
9bf5f989ee Merge pull request #242 from lnykryn/classless
network/dhclient-script: also parse dot separated $new_classless_static_routes
2017-06-27 13:27:41 +02:00
Harald Hoyer
940169e8d8 check for CONFIG_ACPI_TABLE_UPGRADE
additionally as for CONFIG_ACPI_INITRD_TABLE_OVERRIDE
config parameter got renamed
2017-06-27 12:29:07 +02:00
Lukas Nykryn
337a55eb2d network/dhclient-script: also parse dot separated $new_classless_static_routes
Previously our dhclient-script expected that $new_classless_static_routes
will have all values separated by a whitespace. But at least on F25
dhclient will put there the destination descriptor in the same format
as it is used by ISC dhcp-server.
For example:
new_classless_static_routes=32.10.198.122.47 192.168.78.4
while our current code expects
new_classless_static_routes=32 10 198 122 47 192 168 78 4

So let's just accept both of these formats by adding "." to IFS.

For details plesse see https://tools.ietf.org/html/rfc3442
"Classless Route Option Format"
2017-06-26 10:12:46 +02:00
Hannes Reinecke
c8aa1d949a 95zfcp_rules: simplified rd.zfcp commandline for NPIV
When NPIV is enabled and the allow_lun_scan parameter is set to 'Y'
the HBA will initiate a LUN scan automatically, so there is no need
to specify the WWPN and LUN number manually.

References: bsc#964456

Signed-off-by: Hannes Reinecke <hare@suse.com>
2017-06-23 21:27:48 +02:00
Hannes Reinecke
5f923256e3 95zfcp_rules: fix typo in module_setup
module_setup.sh has a typo preventing it from saving the correct
dracut commandline.

References: bnc#887582

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:27:44 +02:00
Hannes Reinecke
5e7bbe43a3 95zfcp_rules: Enable the device before checking device type
For creating dynamic udev rules parse-dasd.sh look for the device
type in sysfs, which of course does not exist if cio_ignore is
active. So first enable the device before checking.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:27:41 +02:00
Hannes Reinecke
3a8ba44026 95zfcp_rules: Store all devices in commandline
'for_each_host_dev_and_slaves' would stop at the first found
device, so the cmdline() call would never list all required
devices. Use 'for_each_host_dev_and_slaves_all' instead and
filter out duplicates.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:27:38 +02:00
Hannes Reinecke
e0c3b0793f Fix DASD with SSID greater than 0
bsc#989313

Signed-off-by: Thomas Renninger <trenn@suse.com>
2017-06-23 21:27:07 +02:00
Hannes Reinecke
8b0791fa01 Reset IFS variable
Setting and unsetting the IFS variable is tricky. To be on the
safe side we should always reset the IFS variable to its original
value after parsing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:27:02 +02:00
Thomas Renninger
e5bf1cecd6 95dasd_rules: Install 'collect' udev helper binary
Install the 'collect' udev helper binary for s390-specific rules.

References: bsc#938867

Signed-off-by: Thomas Renninger <trenn@suse.com>
2017-06-23 21:26:57 +02:00
Hannes Reinecke
cf9c8c5fe3 95dasd_rules: Enable the device before checking device type
For creating dynamic udev rules parse-dasd.sh look for the device
type in sysfs, which of course does not exist if cio_ignore is
active. So first enable the device before checking.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:53 +02:00
Hannes Reinecke
05bf320972 95dasd_rules: Store all devices in commandline
'for_each_host_dev_and_slaves' would stop at the first found
device, so the cmdline() call would never list all required
devices. Use 'for_each_host_dev_and_slaves_all' instead and
filter out duplicates.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:49 +02:00
Hannes Reinecke
2600b54c18 Fixup typo 'firmare' instead of 'firmware'
Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:46 +02:00
Hannes Reinecke
bd355f8643 95dasd_rules: Auto-generate udev rule for ipl device
We should be generating a udev rule for the ipl device; it'll
be enabled anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:42 +02:00
Hannes Reinecke
1362641310 95dasd_rules: print out 'rd.dasd' commandline
When a DASD is found to be required for the rootfs we should
be printing out a 'rd.dasd' commandline parameter. This not
only enables us to correctly enable the device with cio_ignore,
we can also inspect the resulting initrd to figure out which
devices are required to mount the rootfs.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:39 +02:00
Hannes Reinecke
e5d21b80c0 95dasd_rules: fixup rd.dasd parsing
There were some errors when rd.dasd parsing, resulting in the
device never to be activated. And we should check for
cio_ignore even if a udev rules has been found.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:36 +02:00
Hannes Reinecke
5d1ea2d726 Correctly set cio_ignore for dynamic s390 rules
When converting 'rd.zfcp' and 'rd.dasd' into udev rules we
need to make sure the enable those device ids via cio_ignore,
otherwise the rules might never be called.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:33 +02:00
Hannes Reinecke
856d039ba4 95dasd_rules: enable parsing of rd.dasd= commandline parameter
Dracut documents the 'rd.dasd=' parameter, so we should be
enabling the usage of this parameter, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:30 +02:00
Hannes Reinecke
55c763b1ff Add new s390x-specific rule files
With the new s390x configuration tool the naming of the udev
rules files have changed. So add these to the existing ones
to be compatible with existing and new installations.

References: bnc#856585

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:26:27 +02:00
Hannes Reinecke
c8e531239b 95zfcp_rules: Auto-generate udev rule for ipl device
We should auto-generate an udev rule for the ipl device; it'll be
enabled anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:06:05 +02:00
Hannes Reinecke
624f173cbd 95zfcp_rules: print out rd.zfcp commandline parameter
When called with '--hostonly-cmdline' the module should print
out the configuration.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:06:02 +02:00
Hannes Reinecke
9be4be7aa7 95zfcp_rules: Fixup rd.zfcp parsing
There were some errors when parsing rd.zfcp, causing the device
never to be activated.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:05:59 +02:00
Hannes Reinecke
bbca3891ed Correctly set cio_ignore for dynamic s390 rules
When converting 'rd.zfcp' and 'rd.dasd' into udev rules we
need to make sure the enable those device ids via cio_ignore,
otherwise the rules might never be called.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2017-06-23 21:05:55 +02:00
Harald Hoyer
a0d129e33e Merge pull request #239 from lnykryn/cmdline
dracut-lib: put together CMDLINE even if /proc/cmdline does not exist
2017-06-21 16:34:09 +02:00
Lukas Nykryn
0c4c9792c8 dracut-lib: put together CMDLINE even if /proc/cmdline does not exist 2017-06-21 14:14:06 +02:00
Harald Hoyer
6ed9975c5a Merge pull request #238 from danimo/systemd_fix_force_drivers
98dracut-systemd: Fix module force loading with systemd
2017-06-19 13:43:42 +02:00
Harald Hoyer
73e30ea106 Merge pull request #180 from danimo/tests_find_kvm_on_suse
Tests: find qemu on (open)SUSE systems
2017-06-19 13:42:30 +02:00
Daniel Molkentin
e3189ab123 98dracut-systemd: Fix module force loading with systemd
This used to work only when specified via the command line
or if systemd was not being used. However, the exisistence of
20_force_driver.conf also requires dracut-pre-udev.service
to be run.

Reference: bsc#986216
2017-06-16 16:58:12 +02:00
Harald Hoyer
cf9a4e0c73 network: fix dhcp classless_static_routes
removed copy&paste artifact "modify_routes add"

there is no modify_routes() function, and we simply want the output
of the parse function.

(cherry picked from commit 33710dfbfc)
2017-06-14 15:22:18 +02:00
Harald Hoyer
08e51654bf Merge pull request #237 from lnykryn/fips-cmac
fips: add cmac kernel module
2017-06-14 14:40:08 +02:00
Lukas Nykryn
63c7b358f5 fips: add cmac kernel module
cmac is now marked as fips_allowed

Resolves: rhbz#1460865
2017-06-13 10:29:54 +02:00
Harald Hoyer
70ce5ea256 Merge pull request #235 from lnykryn/tmpfiles
systemd: include systemd-tmpfiles-setup.service
2017-06-09 14:08:48 +02:00
Lukas Nykryn
a0e3794b2a systemd: include systemd-tmpfiles-setup.service
... because otherwise nothing will actually
apply configuration from tmpfiles snippets
2017-06-08 15:06:34 +02:00
Prarit Bhargava
fd24c90c36 module-setup.sh: Add ARM specific driver to initramfs image
If a hisi_sas storage device is used as / during system install, the
resulting installation will not boot because the hisi_sas driver is not
included in the initramfs.

The Hisilicon storage driver needs to be added to the initramfs image for
aarch64 kernels.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: dzickus@redhat.com
Cc: dmarlin@redhat.com
Cc: wefu@redhat.com
Cc: harald@redhat.com
2017-06-06 13:39:43 +02:00
Harald Hoyer
1856ae95c8 handle rpcbind /run/rpcbind directory 2017-06-06 13:38:29 +02:00
Yu Watanabe
b71d162a7a kernel-install: Skip to create initrd if /etc/machine-id is missing or empty
From systemd-234, kernel-install plugins are called even if /etc/machine-id
is missing or empty, and in that case BOOT_DIR_ABS is a fake directory.
So, let's skip to create initrd in that case.
2017-06-02 18:07:25 +09:00
Harald Hoyer
3cea065819 mdraid: wait for rd.md.uuid specified devices to be assembled
This patch uses wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}" for the
specified uuids.

On timeout only md devices are force started which are specified by
uuid, or all, if rd.auto was specified.

Fixes https://github.com/dracutdevs/dracut/issues/227
2017-05-16 11:37:27 +02:00
Harald Hoyer
87ddd4d9af Merge pull request #213 from danimo/elfutils
Make binutils optional when elfutils are available
2017-05-15 14:53:35 +02:00
Harald Hoyer
1e00295a15 Merge pull request #229 from jwrdegoede/master
drm: Install pwm modules on all architectures
2017-05-15 11:37:45 +02:00
Harald Hoyer
b40585e6c7 Merge pull request #226 from AdamWill/curl-nssckbi
Handle curl using libnssckbi for TLS (RHBZ #1447777)
2017-05-15 11:28:10 +02:00
Hans de Goede
feaaee4278 drm: Install pwm modules on all architectures
At least on x86 on Bay and Cherry Trail devices the pmw-lpss modules must
be in the initrd too, otherwise the i915 driver will still load, but
it will report the following error:

[drm:pwm_setup_backlight [i915]] *ERROR* Failed to own the pwm chip

And not register /sys/class/backlight/intel_backlight and users will
not be able to control their backlight.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2017-05-14 23:24:46 +02:00
Adam Williamson
892b1fe6b7 Handle curl using libnssckbi for TLS (RHBZ #1447777)
curl in Fedora recently changed its default CA trust store. The
Fedora package no longer specifies an OpenSSL-format bundle file
during build, and curl itself has been patched to use an NSS
plugin called libnssckbi.so when no bundle file or directory is
specified. There are (at present) two possible providers of the
libnssckbi.so module: the original NSS implementation, which
uses a trust bundle built in at build time, and a compatible
implementation from the p11-kit project, which reads a trust
bundle at run time. So if we find a string in libcurl.so that
suggests libnssckbi might be in use, we must both install it and
make an effort to install any trust bundle files it may use.

The p11-kit libnssckbi implementation does include a string that
lists the top-level trust directories it will use, so we try to
find that string, though the best effort I can come up with will
also find many false positives too. To weed out the false
positives, we check whether the matches actually exist as dirs,
and if so, whether they contain some specific subdirectories we
know p11-kit trust dirs must have (thanks, @kaie). For the NSS
libnssckbi implementation, we will likely wind up not finding any
dirs that match the requirements, so we will simply install the
libnssckbi.so file itself, which is the correct action.

This fixes TLS transactions in the initramfs environment when
using a curl that's built this new way; it's significant for
use of kickstarts and update images with the Fedora / RHEL
installer, as these are retrieved in the initramfs environment,
and are frequently retrieved via HTTPS.
2017-05-11 10:13:22 -07:00
Harald Hoyer
2e1861fde2 Merge pull request #224 from jasondana/integrity-fix
Check the proper variable for a custom IMA keys directory
2017-04-27 14:08:47 +02:00
Jason Dana
ab66ef2d4a Check the proper variable for a custom IMA keys directory 2017-04-27 07:55:58 -04:00
Harald Hoyer
29fd71b23d TEST-50-MULTINIC: fix bridge test
Bridge with nics on a different vlan, otherwise we will see:

[  117.750825] bridge0: received packet on ens5 with own address as source address
2017-04-26 09:39:20 +02:00
Harald Hoyer
bc6f06a795 Merge pull request #222 from danimo/fix_subnet_calc
mkinitrd-suse.sh: Fix prefix calculation
2017-04-26 09:22:19 +02:00
Daniel Molkentin
7cf2c21798 mkinitrd-suse.sh: Fix prefix calculation
The previous algorithm was incorrect and would return
incorrect results e.g. for a /20 mask. Also gets rid
of an undocumented depencency on bc(1).

Reference: bsc#1035743
2017-04-25 15:30:13 +02:00
Harald Hoyer
11947da13f Merge pull request #219 from tpgxyz/master
fix build with KMOD
2017-04-25 10:51:39 +02:00
Tomasz Paweł Gajc
f59548aeab fix build with KMOD 2017-04-24 21:37:56 +02:00
Harald Hoyer
fafb4c0182 Merge pull request #210 from Calrama/gpg-smartcard
crypt-gpg: For GnuPG >= 2.1 support gpg keyfile decryption via a OpenPGP smartcard in a CCID reader
2017-04-19 09:09:14 +02:00
Harald Hoyer
0096157e14 Merge pull request #214 from pallotron/master
Look for IPv6 RA in wait_for_ipv6_dad, wait_for_ipv6_dad_link and wait_for_ipv6_auto
2017-04-11 13:40:27 +02:00
Harald Hoyer
9998940493 Merge pull request #217 from FGrose/overlayfs
dmsquash-live-root: Avoid mount source conflict on $BASE_LOOPDEV.
2017-04-11 13:39:27 +02:00
Harald Hoyer
538ff0fd80 add .mailmap 2017-04-10 14:50:21 +02:00
Daniel Molkentin
8b6d136e62 Make binutils optional when elfutils are available
This is intended for minimum host OSes where 36 MB used by binutils
are deemed too expensive. We only need "strip", which exists as eu-strip
in elfutils, which in turn is < 1 MB in size.

Note that the tests (TEST-04-FULL-SYSTEMD/test.sh) still depend on
strip from binutils. It could use sstrip in the future.
2017-04-10 11:28:04 +02:00
Frederick Grose
ea765c0ee1 dmsquash-live-root: Avoid mount source conflict on $BASE_LOOPDEV.
The newer mount utilities are more strict about directly shared
devices. For OverlayFS boots, which mount $BASE_LOOPDEV directly,
avoid a mount error by indirectly sharing the read-only base
filesystem through a second, over-attached $BASE_LOOPDEV for
the DM live-base target.
2017-04-09 11:23:12 -04:00
pallotron
e190073b21 Merge remote-tracking branch 'upstream/master' 2017-04-05 11:59:36 -07:00
Daniel Molkentin
ce999bff98 Tests: find qemu on (open)SUSE systems 2017-04-05 16:42:22 +02:00
pallotron
031e2f7bb8 more ipv6 improvements 2017-04-05 00:23:36 -07:00
pallotron
a0545765e8 remove prints 2017-04-05 00:16:16 -07:00
pallotron
96b708e178 more ipv6 improvements 2017-04-05 00:15:16 -07:00
pallotron
4c3d99f966 enabling some ipv6 config before running wait_for_ipv6_dad 2017-04-04 12:59:45 -07:00
pallotron
c603419030 wait for IPv6 RA if using none/static IPv6 assignment 2017-04-04 08:31:21 -07:00
Moritz Maxeiner
0e1b686b83 crypt-gpg: Include module if CCID smartcard support requested 2017-03-30 14:54:26 +02:00
Moritz Maxeiner
0982fcb2e5 crypt-gpg: Rework setup for CCID smartcard support 2017-03-30 14:17:05 +02:00
Moritz Maxeiner
98047e08d0 crypt-gpg: Add README describing the procedure of moving from
password-only gpg keyfile to password/smartcard gpg keyfile
2017-03-30 02:18:39 +02:00
Moritz Maxeiner
2a1723ed83 crypt-gpg: For GnuPG >= 2.1 support OpenPGP smartcards 2017-03-30 02:18:39 +02:00
99 changed files with 1810 additions and 478 deletions

View File

@@ -16,3 +16,4 @@ Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
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>

View File

@@ -5,6 +5,12 @@ KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
# If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory.
# So, let's skip to create initrd.
if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then
exit 0
fi
ret=0
case "$COMMAND" in
add)

View File

@@ -33,11 +33,15 @@ dropindirs_sort()
[[ -f /etc/os-release ]] && . /etc/os-release
if [[ ! -f /etc/machine-id ]] || [[ ! -s /etc/machine-id ]]; then
systemd-machine-id-setup
if [[ ${KERNEL_INSTALL_MACHINE_ID+x} ]]; then
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
elif [[ -f /etc/machine-id ]] ; then
read MACHINE_ID < /etc/machine-id
fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if ! [[ $MACHINE_ID ]]; then
exit 0
fi
if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline

View File

@@ -12,8 +12,8 @@ pkglibdir ?= ${libdir}/dracut
sysconfdir ?= ${prefix}/etc
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
CFLAGS ?= -O2 -g -Wall $(KMOD_CFLAGS)
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
CFLAGS ?= -O2 -g -Wall
CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 $(KMOD_CFLAGS)
bashcompletiondir ?= ${datadir}/bash-completion/completions
pkgconfigdatadir ?= $(datadir)/pkgconfig

51
NEWS
View File

@@ -1,3 +1,54 @@
dracut-046
==========
dracut.sh:
- bail out if module directory does not exist
if people want to build the initramfs without kernel modules,
then --no-kernel should be specified
- add early microcode support for AMD family 16h
- collect also all modaliases modules from sysfs for hostonly modules
- sync initramfs after creation
network:
- wait for IPv6 RA if using none/static IPv6 assignment
- ipv6 improvements
- Handle curl using libnssckbi for TLS
- fix dhcp classless_static_routes
- dhclient: send client-identifier matching hardware address
- don't arping for point-to-point connections
- only bring up wired network interfaces (no wlan and wwan)
mraid:
- mdraid: wait for rd.md.uuid specified devices to be assembled
crypt:
- handle rd.luks.name
crypt-gpg:
- For GnuPG >= 2.1 support OpenPGP smartcards
kernel-install:
- Skip to create initrd if /etc/machine-id is missing or empty
nfs:
- handle rpcbind /run/rpcbind directory
s390:
- various fixes
dmsquash-live:
- add NTFS support
multipath:
- split out multipath-hostonly module
lvmmerge:
- new module, see README.md in the module directory
dracut-systemd:
- fixed dependencies
dracut-045
==========

View File

@@ -2,5 +2,24 @@
dracut is an initramfs infrastructure.
CentOS CI: [![Build Status](https://ci.centos.org/job/dracut-push-master/badge/icon)](https://ci.centos.org/job/dracut-push-master/)
## CentOS CI
[![Build Status](https://ci.centos.org/job/dracut-push-master/badge/icon)](https://ci.centos.org/job/dracut-push-master/)
- 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/)

View File

@@ -661,8 +661,10 @@ get_ucode_file ()
local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
# If family greater or equal than 0x15
if [[ $family -ge 21 ]]; 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"
else
printf "microcode_amd.bin"

View File

@@ -52,13 +52,6 @@ if ! [[ -d $initdir ]]; then
mkdir -p "$initdir"
fi
if [[ $DRACUT_KERNEL_LAZY ]] && ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then
if ! [[ -d "$initdir/.kernelmodseen" ]]; then
mkdir -p "$initdir/.kernelmodseen"
fi
DRACUT_KERNEL_LAZY_HASHDIR="$initdir/.kernelmodseen"
fi
if ! [[ $kernel ]]; then
kernel=$(uname -r)
export kernel
@@ -172,6 +165,13 @@ if ! [[ -x $DRACUT_INSTALL ]]; then
exit 10
fi
if [[ $hostonly == "-h" ]]; then
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
$DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
fi
fi
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
inst_dir() {
[[ -e ${initdir}/"$1" ]] && return 0 # already there
@@ -935,9 +935,6 @@ for_each_kmod_dep() {
}
dracut_kernel_post() {
local _moddirname=${srcmods%%/lib/modules/*}
local _pid
for _f in modules.builtin.bin modules.builtin modules.order; do
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
done

View File

@@ -788,12 +788,19 @@ DASD
ZFCP
~~~~
**rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
rd.zfcp can be specified multiple times on the kernel command line.
rd.zfcp can be specified multiple times on the kernel command
line.
**rd.zfcp=**__<zfcp adaptor device bus ID>__::
If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp
module is set to 'Y' then the zfcp adaptor will be initiating a
scan internally and the <WWPN> and <FCPLUN> parameters can be omitted.
+
[listing]
.Example
--
rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
rd.zfcp=0.0.4000
--
**rd.zfcp.conf=0**::

View File

@@ -97,7 +97,7 @@ Configuration files must have the extension .conf; other extensions are ignored.
instead of a generic host and generate host-specific configuration.
*hostonly_cmdline=*"__{yes|no}__"::
If set, store the kernel command line arguments needed in the initramfs
If set to "yes", store the kernel command line arguments needed in the initramfs
*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.

View File

@@ -306,7 +306,7 @@ rearrange_params()
--long mount: \
--long device: \
--long add-device: \
--long nofscks: \
--long nofscks \
--long ro-mnt \
--long kmoddir: \
--long conf: \
@@ -621,12 +621,6 @@ if ! [[ $kernel ]]; then
kernel=$(uname -r)
fi
if [[ $kernel ]]; then
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
printf -- "Kernel version $kernel has no module directory /lib/modules/$kernel\n" >&2
fi
fi
export LC_ALL=C
export LANG=C
unset LC_MESSAGES
@@ -894,6 +888,12 @@ else
exit 1
fi
if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
printf "%s\n" "dracut: Cannot find module directory $srcmods" >&2
printf "%s\n" "dracut: and --no-kernel was not specified" >&2
exit 1
fi
if ! [[ $print_cmdline ]]; then
inst /bin/sh
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
@@ -1053,8 +1053,8 @@ if [[ ! $print_cmdline ]]; then
fi
fi
if [[ $acpi_override = yes ]] && ! check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE; then
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y"
if [[ $acpi_override = yes ]] && ! ( check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE ); then
dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y or CONFIG_ACPI_TABLE_UPGRADE!=y"
unset acpi_override
fi
@@ -1605,7 +1605,11 @@ fi
# strip binaries
if [[ $do_strip = yes ]] ; then
for p in strip xargs find; do
# Prefer strip from elfutils for package size
declare strip_cmd=$(command -v eu-strip)
test -z "$strip_cmd" && strip_cmd="strip"
for p in $strip_cmd xargs find; do
if ! type -P $p >/dev/null; then
dinfo "Could not find '$p'. Not stripping the initramfs."
do_strip=no
@@ -1617,14 +1621,14 @@ 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 -g 2>/dev/null
| xargs -r -0 $strip_cmd -g 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 -g
done | xargs -r -0 $strip_cmd -g
dinfo "*** Stripping files done ***"
fi
@@ -1684,7 +1688,7 @@ if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
exit 1
fi
if [[ $hostonly_cmdline ]] ; then
if [[ $hostonly_cmdline == "yes" ]] ; then
unset _stored_cmdline
if [ -d $initdir/etc/cmdline.d ];then
dinfo "Stored kernel commandline:"
@@ -1802,4 +1806,10 @@ 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
fi
exit 0

View File

@@ -37,7 +37,6 @@ 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
@@ -101,7 +100,7 @@ Requires: sed
Requires: xz
Requires: gzip
%if 0%{?fedora} > 22
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
Recommends: grubby
Recommends: hardlink
Recommends: pigz
@@ -371,6 +370,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{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
@@ -379,6 +379,7 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90multipath-hostonly
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
@@ -471,6 +472,7 @@ rm -rf -- $RPM_BUILD_ROOT
%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

View File

@@ -3,10 +3,22 @@
sub create_patches {
my $tag=shift;
my $pdir=shift;
my $num=0;
open( GIT, 'git format-patch -M -N --no-signature -o "'.$pdir.'" '.$tag.' |');
@lines=<GIT>;
close GIT; # be done
my $n=1;
my @lines;
mkdir $pdir, 0755;
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse '.$tag.'..HEAD |');
while (<GIT>) {
if (/^From [a-z0-9]{40} .*$/) {
my $fname = sprintf("%04d", $n++).".patch";
push @lines, $fname;
open FH, ">".$pdir."/".$fname;
}
print FH;
}
return @lines;
};
@@ -35,7 +47,7 @@ while(<>) {
$num=1;
for(@patches) {
s/.*\///g;
print "Patch$num: $_";
print "Patch$num: $_\n";
$num++;
}
print "\n";

View File

@@ -41,6 +41,7 @@
#include <libkmod.h>
#include <fts.h>
#include <regex.h>
#include <sys/utsname.h>
#include "log.h"
#include "hashmap.h"
@@ -54,6 +55,7 @@ static bool arg_optional = false;
static bool arg_silent = false;
static bool arg_all = false;
static bool arg_module = false;
static bool arg_modalias = false;
static bool arg_resolvelazy = false;
static bool arg_resolvedeps = false;
static bool arg_hostonly = false;
@@ -794,6 +796,7 @@ static void usage(int status)
" --kerneldir Specify the kernel module directory\n"
" --firmwaredirs Specify the firmware directory search path with : separation\n"
" --silent Don't display error messages for kernel module install\n"
" --modalias Only generate module list from /sys/devices modalias list\n"
" -o --optional If kernel module does not exist, do not fail\n"
" -p --mod-filter-path Filter kernel modules by path regexp\n"
" -P --mod-filter-nopath Exclude kernel modules by path regexp\n"
@@ -818,6 +821,7 @@ static int parse_argv(int argc, char *argv[])
enum {
ARG_VERSION = 0x100,
ARG_SILENT,
ARG_MODALIAS,
ARG_KERNELDIR,
ARG_FIRMWAREDIRS,
ARG_DEBUG
@@ -843,6 +847,7 @@ static int parse_argv(int argc, char *argv[])
{"mod-filter-symbol", required_argument, NULL, 's'},
{"mod-filter-nosymbol", required_argument, NULL, 'S'},
{"mod-filter-noname", required_argument, NULL, 'N'},
{"modalias", no_argument, NULL, ARG_MODALIAS},
{"silent", no_argument, NULL, ARG_SILENT},
{"kerneldir", required_argument, NULL, ARG_KERNELDIR},
{"firmwaredirs", required_argument, NULL, ARG_FIRMWAREDIRS},
@@ -863,6 +868,10 @@ static int parse_argv(int argc, char *argv[])
case ARG_SILENT:
arg_silent = true;
break;
case ARG_MODALIAS:
arg_modalias = true;
return 1;
break;
case 'v':
arg_loglevel = LOG_INFO;
break;
@@ -949,6 +958,16 @@ static int parse_argv(int argc, char *argv[])
}
}
if (!kerneldir) {
struct utsname buf;
uname(&buf);
kerneldir = strdup(buf.version);
}
if (arg_modalias) {
return 1;
}
if (arg_module) {
if (!firmwaredirs) {
char *path = NULL;
@@ -965,6 +984,7 @@ static int parse_argv(int argc, char *argv[])
firmwaredirs = strv_split(path, ":");
}
}
if (!optind || optind == argc) {
log_error("No SOURCE argument given");
usage(EXIT_FAILURE);
@@ -1218,16 +1238,6 @@ static bool check_module_path(const char *path)
return true;
}
static bool check_module_hostonly(struct kmod_module *mod)
{
const char *name = kmod_module_get_name(mod);
if (check_hashmap(modules_loaded, name))
return true;
return false;
}
static int install_module(struct kmod_module *mod)
{
int ret = 0;
@@ -1242,7 +1252,7 @@ static int install_module(struct kmod_module *mod)
return 0;
}
if (arg_hostonly && ! check_module_hostonly(mod)) {
if (arg_hostonly && !check_hashmap(modules_loaded, name)) {
log_debug("dracut_install '%s' not hostonly", name);
return 0;
}
@@ -1258,7 +1268,7 @@ static int install_module(struct kmod_module *mod)
return 0;
if (!check_module_path(path) || !check_module_symbols(mod)) {
log_debug("No symbol or patch match for '%s'", path);
log_debug("No symbol or path match for '%s'", path);
return 1;
}
@@ -1297,12 +1307,94 @@ static int install_module(struct kmod_module *mod)
return ret;
}
static int modalias_list(struct kmod_ctx *ctx)
{
int err;
struct kmod_list *loaded_list = NULL;
struct kmod_list *itr, *l;
_cleanup_fts_close_ FTS *fts = NULL;
{
char *paths[] = { "/sys/devices", NULL };
fts = fts_open(paths, FTS_NOCHDIR|FTS_NOSTAT, NULL);
}
for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *list = NULL;
struct kmod_list *l;
int err;
char alias[2048];
size_t len;
if (strncmp("modalias", ftsent->fts_name, 8) != 0)
continue;
if (!(f = fopen(ftsent->fts_accpath, "r")))
continue;
if(!fgets(alias, sizeof(alias), f))
continue;
len = strlen(alias);
if (len == 0)
continue;
if (alias[len-1] == '\n')
alias[len-1] = 0;
err = kmod_module_new_from_lookup(ctx, alias, &list);
if (err < 0)
continue;
kmod_list_foreach(l, list) {
struct kmod_module *mod = kmod_module_get_module(l);
char *name = strdup(kmod_module_get_name(mod));
kmod_module_unref(mod);
hashmap_put(modules_loaded, name, name);
}
}
err = kmod_module_new_from_loaded(ctx, &loaded_list);
if (err < 0) {
errno = err;
log_error("Could not get list of loaded modules: %m. Switching to non-hostonly mode.");
arg_hostonly = false;
} else {
kmod_list_foreach(itr, loaded_list) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
struct kmod_module *mod = kmod_module_get_module(itr);
char *name = strdup(kmod_module_get_name(mod));
hashmap_put(modules_loaded, name, name);
kmod_module_unref(mod);
/* also put the modules from the new kernel in the hashmap,
* which resolve the name as an alias, in case a kernel module is
* renamed.
*/
err = kmod_module_new_from_lookup(ctx, name, &modlist);
if (err < 0)
continue;
if (!modlist)
continue;
kmod_list_foreach(l, modlist) {
mod = kmod_module_get_module(l);
char *name = strdup(kmod_module_get_name(mod));
hashmap_put(modules_loaded, name, name);
kmod_module_unref(mod);
}
}
kmod_module_unref_list(loaded_list);
}
return 0;
}
static int install_modules(int argc, char **argv)
{
_cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL;
struct kmod_list *loaded_list = NULL;
struct kmod_list *itr, *l;
int err;
struct kmod_list *itr;
struct kmod_module *mod = NULL, *mod_o = NULL;
@@ -1311,38 +1403,37 @@ static int install_modules(int argc, char **argv)
ctx = kmod_new(kerneldir, NULL);
if (arg_hostonly) {
err = kmod_module_new_from_loaded(ctx, &loaded_list);
if (err < 0) {
errno = err;
log_error("Could not get list of loaded modules: %m. Switching to non-hostonly mode.");
arg_hostonly = false;
char *modalias_file;
modalias_file = getenv("DRACUT_KERNEL_MODALIASES");
if (modalias_file == NULL) {
modalias_list(ctx);
} else {
kmod_list_foreach(itr, loaded_list) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
_cleanup_fclose_ FILE *f = NULL;
if ((f = fopen(modalias_file, "r"))) {
char name[2048];
struct kmod_module *mod = kmod_module_get_module(itr);
char *name = strdup(kmod_module_get_name(mod));
hashmap_put(modules_loaded, name, name);
kmod_module_unref(mod);
while (!feof(f)) {
size_t len;
char *dupname = NULL;
/* also put the modules from the new kernel in the hashmap,
* which resolve the name as an alias, in case a kernel module is
* renamed.
*/
err = kmod_module_new_from_lookup(ctx, name, &modlist);
if (err < 0)
continue;
if (!modlist)
continue;
kmod_list_foreach(l, modlist) {
mod = kmod_module_get_module(l);
char *name = strdup(kmod_module_get_name(mod));
hashmap_put(modules_loaded, name, name);
kmod_module_unref(mod);
if(!(fgets(name, sizeof(name), f)))
continue;
len = strlen(name);
if (len == 0)
continue;
if (name[len-1] == '\n')
name[len-1] = 0;
log_debug("Adding module '%s' to hostonly module list", name);
dupname = strdup(name);
hashmap_put(modules_loaded, dupname, dupname);
}
}
kmod_module_unref_list(loaded_list);
}
}
for (i = 0; i < argc; i++) {
@@ -1576,6 +1667,20 @@ int main(int argc, char **argv)
log_open();
modules_loaded = hashmap_new(string_hash_func, string_compare_func);
if (arg_modalias) {
Iterator i;
char *name;
_cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL;
ctx = kmod_new(kerneldir, NULL);
modalias_list(ctx);
HASHMAP_FOREACH(name, modules_loaded, i) {
printf("%s\n", name);
}
exit(0);
}
path = getenv("PATH");
if (path == NULL) {
@@ -1614,7 +1719,6 @@ int main(int argc, char **argv)
items = hashmap_new(string_hash_func, string_compare_func);
items_failed = hashmap_new(string_hash_func, string_compare_func);
modules_loaded = hashmap_new(string_hash_func, string_compare_func);
if (!items || !items_failed || !modules_loaded) {
log_error("Out of memory");

View File

@@ -104,7 +104,7 @@ calc_netmask() {
local prefix=$1
[ -z "$prefix" ] && return
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
mask=$(( 0xffffffff << (32 - $prefix) ))
byte1=$(( mask >> 24 ))
byte2=$(( mask >> 16 ))
byte3=$(( mask >> 8 ))

View File

@@ -77,6 +77,7 @@ install() {
$systemdsystemunitdir/sys-kernel-config.mount \
\
$systemdsystemunitdir/kmod-static-nodes.service \
$systemdsystemunitdir/systemd-tmpfiles-setup.service \
$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \
$systemdsystemunitdir/systemd-ask-password-console.path \
$systemdsystemunitdir/systemd-udevd-control.socket \
@@ -112,6 +113,7 @@ install() {
$systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \
$systemdsystemunitdir/sysinit.target.wants/kmod-static-nodes.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-sysctl.service \
\
@@ -194,6 +196,10 @@ install() {
grep '^utmp:' /etc/group >> "$initdir/etc/group"
grep '^root:' /etc/group >> "$initdir/etc/group"
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
ln_r $systemdutildir/systemd "/init"
ln_r $systemdutildir/systemd "/sbin/init"

View File

@@ -77,12 +77,6 @@ do_fips()
local _module
KERNEL=$(uname -r)
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
BOOT_IMAGE="${BOOT_IMAGE:-/vmlinuz-${KERNEL}}"
if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ] && ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
return 1
fi
FIPSMODULES=$(cat /etc/fipsmodules)
@@ -115,6 +109,13 @@ do_fips()
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
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}"
if ! [ -e "/boot/.${BOOT_IMAGE}.hmac" ]; then
warn "/boot/.${BOOT_IMAGE}.hmac does not exist"
return 1
fi
sha512hmac -c "/boot/.${BOOT_IMAGE}.hmac" || return 1
fi

View File

@@ -21,7 +21,7 @@ installkernel() {
_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"
_fipsmodules+="aes_s390 des_s390 prng sha256_s390 sha_common des_check_key ghash_s390 sha1_s390 sha512_s390 cmac authenc "
fi
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"

View File

@@ -191,7 +191,10 @@ case $reason in
echo '. /lib/net-lib.sh'
echo "setup_net $netif"
if [ -n "$new_classless_static_routes" ]; then
modify_routes add "$(parse_option_121 $new_classless_static_routes)"
OLDIFS="$IFS"
IFS=".$IFS"
parse_option_121 $new_classless_static_routes
IFS="$OLDIFS"
fi
echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"

View File

@@ -1,6 +1,8 @@
option classless-routes code 121 = array of unsigned integer 8;
option classless-static-routes code 121 = array of unsigned integer 8;
send dhcp-client-identifier = hardware;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
root-path, interface-mtu, classless-routes;
root-path, interface-mtu, classless-static-routes;

View File

@@ -108,17 +108,22 @@ do_static() {
if strglobin $ip '*:*:*'; then
# note no ip addr flush for ipv6
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
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
wait_for_ipv6_dad $netif
else
if command -v arping2 >/dev/null; then
if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
warn "Duplicate address detected for $ip for interface $netif."
return 1
fi
else
if ! arping -f -q -D -c 2 -I $netif $ip ; then
warn "Duplicate address detected for $ip for interface $netif."
return 1
if [ -z "$srv" ]; then
if command -v arping2 >/dev/null; then
if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
warn "Duplicate address detected for $ip for interface $netif."
return 1
fi
else
if ! arping -f -q -D -c 2 -I $netif $ip ; then
warn "Duplicate address detected for $ip for interface $netif."
return 1
fi
fi
fi
ip addr flush dev $netif

View File

@@ -25,7 +25,10 @@ installkernel() {
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

View File

@@ -102,7 +102,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
# Default: We don't know the interface to use, handle all
# Fixme: waiting for the interface as well.
else
cond='ACTION=="add", SUBSYSTEM=="net"'
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
fi

View File

@@ -654,6 +654,7 @@ wait_for_ipv6_dad_link() {
while [ $cnt -lt $timeout ]; do
[ -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)" ] \
&& return 1
@@ -671,6 +672,7 @@ wait_for_ipv6_dad() {
while [ $cnt -lt $timeout ]; do
[ -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)" ] \
&& return 1
@@ -688,7 +690,7 @@ wait_for_ipv6_auto() {
while [ $cnt -lt $timeout ]; do
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
&& [ -n "$(ip -6 route list proto ra dev "$1")" ] \
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
&& return 0
sleep 0.1
cnt=$(($cnt+1))

View File

@@ -15,7 +15,7 @@ depends() {
# called by dracut
install() {
local _dir _crt _found _lib
local _dir _crt _found _lib _nssckbi _p11roots _p11root _p11item
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"
inst_multiple -o ctorrent
inst_multiple curl
@@ -29,6 +29,7 @@ install() {
[[ -d $_dir ]] || continue
for _lib in $_dir/libcurl.so.*; do
[[ -e $_lib ]] || continue
[[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
_crt=$(grep -F --binary-files=text -z .crt $_lib)
[[ $_crt ]] || continue
[[ $_crt == /*/* ]] || continue
@@ -39,6 +40,39 @@ install() {
_found=1
done
done
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
# If we found no cert bundle files referenced in libcurl but we
# *did* find a mention of libnssckbi (checked above), install it.
# If its truly NSS libnssckbi, it includes its own trust bundle,
# but if it's really p11-kit-trust.so, we need to find the dirs
# where it will look for a trust bundle and install them too.
if ! [[ $_found ]] && [[ $_nssckbi ]] ; then
_found=1
inst_libdir_file "libnssckbi.so*" || _found=
for _dir in $libdirs; do
[[ -e $_dir/libnssckbi.so ]] || continue
# this looks for directory-ish strings in the file
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $_dir/libnssckbi.so) ; do
# the string can be a :-separated list of dirs
for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
# check if it's actually a directory (there are
# several false positives in the results)
[[ -d "$_p11root" ]] || continue
# check if it has some specific subdirs that all
# p11-kit trust dirs have
[[ -d "${_p11root}/anchors" ]] || continue
[[ -d "${_p11root}/blacklist" ]] || continue
# so now we know it's really a p11-kit trust dir;
# install everything in it
for _p11item in $(find "$_p11root") ; do
if ! inst "$_p11item" ; then
dwarn "Couldn't install '$_p11item' from p11-kit trust dir '$_p11root'; HTTPS might not work."
continue
fi
done
done
done
done
fi
[[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle or libnssckbi.so; HTTPS won't work."
}

View File

@@ -21,12 +21,11 @@ installkernel() {
"=drivers/gpu/drm/i2c" \
"=drivers/gpu/drm/panel" \
"=drivers/gpu/drm/bridge" \
"=drivers/pwm" \
"=drivers/video/backlight" \
${NULL}
fi
instmods amdkfd hyperv_fb
instmods amdkfd hyperv_fb "=drivers/pwm"
# if the hardware is present, include module even if it is not currently loaded,
# as we could e.g. be in the installer; nokmsboot boot parameter will disable

61
modules.d/80lvmmerge/README.md Executable file
View File

@@ -0,0 +1,61 @@
# lvmmerge - dracut module
## Preparation
- ensure that the lvm thin pool is big enough
- backup any (most likely /boot and /boot/efi) device with:
```
# mkdir /restoredev
# dev=<device>; umount $dev; dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev"); mount $dev
```
- backup the MBR
```
# dev=<device>; dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev") bs=446 count=1
# ls -l /dev/disk/by-path/virtio-pci-0000\:00\:07.0
lrwxrwxrwx. 1 root root 9 Jul 24 04:27 /dev/disk/by-path/virtio-pci-0000:00:07.0 -> ../../vda
```
- backup some partitions
```
# dev=/dev/disk/by-path/virtio-pci-0000:00:07.0
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev") bs=446 count=1
# umount /boot/efi
# dev=/dev/disk/by-partuuid/687177a8-86b3-4e37-a328-91d20db9563c
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev")
# umount /boot
# dev=/dev/disk/by-partuuid/4fdf99e9-4f28-4207-a26f-c76546824eaf
# dd if="$dev" of=/restoredev/$(systemd-escape -p "$dev")
```
Final /restoredev
```
# ls -al /restoredev/
total 1253380
drwx------. 2 root root 250 Jul 24 04:38 .
dr-xr-xr-x. 18 root root 242 Jul 24 04:32 ..
-rw-------. 1 root root 209715200 Jul 24 04:34 dev-disk-by\x2dpartuuid-4fdf99e9\x2d4f28\x2d4207\x2da26f\x2dc76546824eaf
-rw-------. 1 root root 1073741824 Jul 24 04:34 dev-disk-by\x2dpartuuid-687177a8\x2d86b3\x2d4e37\x2da328\x2d91d20db9563c
-rw-------. 1 root root 446 Jul 24 04:38 dev-disk-by\x2dpath-virtio\x2dpci\x2d0000:00:07.0
```
- make a thin snapshot
```
# lvm lvcreate -pr -s rhel/root --name reset
```
- mark the snapshot with a tag
```
# lvm lvchange --addtag reset rhel/reset
```
- remove /restoredev
```
# rm -fr /restoredev
```
## Operation
If a boot entry with ```rd.lvm.mergetags=<tag>``` is selected and there are LVs with ```<tag>```
dracut will
- make a copy of the snapshot
- merge it back to the original
- rename the copy back to the name of the snapshot
- if /restordev appears in the root, then it will restore the images
found in that directory. This can be used to restore /boot and /boot/efi and the
MBR of the boot device

View File

@@ -0,0 +1,96 @@
#!/bin/bash
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
do_merge() {
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' \
/etc/lvm/lvm.conf
systemctl --no-block stop sysroot.mount
swapoff -a
umount -R /sysroot
for tag in $(getargs rd.lvm.mergetags); do
lvm vgs --noheadings -o vg_name | \
while read -r vg || [[ -n $vg ]]; do
unset LVS
declare -a LVS
lvs=$(lvm lvs --noheadings -o lv_name "$vg")
for lv in $lvs; do
lvm lvchange -an "$vg/$lv"
tags=$(trim "$(lvm lvs --noheadings -o lv_tags "$vg/$lv")")
strstr ",${tags}," ",${tag}," || continue
if ! lvm lvs --noheadings -o lv_name "${vg}/${lv}_dracutsnap" &>/dev/null; then
info "Creating backup ${lv}_dracutsnap of ${vg}/${lv}"
lvm lvcreate -pr -s "${vg}/${lv}" --name "${lv}_dracutsnap"
fi
lvm lvchange --addtag "$tag" "${vg}/${lv}_dracutsnap"
info "Merging back ${vg}/${lv} to the original LV"
lvm lvconvert --merge "${vg}/${lv}"
LVS+=($lv)
done
systemctl --no-block stop sysroot.mount
udevadm settle
for ((i=0; i < 100; i++)); do
lvm vgchange -an "$vg" && break
sleep 0.5
done
udevadm settle
lvm vgchange -ay "$vg"
udevadm settle
for lv in "${LVS[@]}"; do
info "Renaming ${lv}_dracutsnap backup to ${vg}/${lv}"
lvm lvrename "$vg" "${lv}_dracutsnap" "${lv}"
done
udevadm settle
done
done
systemctl --no-block reset-failed systemd-fsck-root
systemctl --no-block start systemd-fsck-root
systemctl --no-block reset-failed sysroot.mount
systemctl --no-block start sysroot.mount
for ((i=0; i < 100; i++)); do
[[ -d /sysroot/dev ]] && break
sleep 0.5
systemctl --no-block start sysroot.mount
done
if [[ -d /sysroot/restoredev ]]; then
(
if cd /sysroot/restoredev; then
# restore devices and partitions
for i in *; do
target=$(systemd-escape -pu "$i")
if ! [[ -b $target ]]; then
warn "Not restoring $target, as the device does not exist"
continue
fi
# Just in case
umount "$target" &> /dev/null
info "Restoring $target"
dd if="$i" of="$target" |& vinfo
done
fi
)
mount -o remount,rw /sysroot
rm -fr /sysroot/restoredev
fi
info "Rebooting"
reboot
}
if getarg rd.lvm.mergetags; then
do_merge
fi

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# called by dracut
check() {
# No point trying to support lvm if the binaries are missing
require_binaries lvm dd swapoff || return 1
return 255
}
# called by dracut
depends() {
echo lvm
return 0
}
installkernel() {
hostonly="" instmods dm-snapshot
}
# called by dracut
install() {
inst_multiple dd swapoff
inst_hook cleanup 01 "$moddir/lvmmerge.sh"
}

View File

@@ -16,6 +16,14 @@ crypttab_contains() {
[ "$dev" -ef "$_dev" ] && return 0
done
fi
if [ -e /usr/lib/dracut/modules.d/90crypt/block_uuid.map ]; then
# search for line starting with $d
_line=$(sed -n "\,^$d .*$,{p}" /usr/lib/dracut/modules.d/90crypt/block_uuid.map)
[ -z "$_line" ] && continue
# get second column with uuid
_uuid="$(echo $_line | sed 's,^.* \(.*$\),\1,')"
strstr "$_uuid" "${luks##luks-}" && return 0
fi
done < /etc/crypttab
fi
return 1
@@ -210,8 +218,7 @@ readkey() {
if [ -f /lib/dracut-crypt-loop-lib.sh ]; then
. /lib/dracut-crypt-loop-lib.sh
loop_decrypt "$mntp" "$keypath" "$keydev" "$device"
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-99-${mntp##*/}" \
$(command -v umount) "$mntp; " $(command -v rmdir) "$mntp"
printf "%s\n" "umount \"$mntp\"; rmdir \"$mntp\";" > ${hookdir}/cleanup/"crypt-loop-cleanup-99-${mntp##*/}".sh
return 0
else
die "No loop file support to decrypt '$keypath' on '$keydev'."

View File

@@ -75,6 +75,8 @@ install() {
[[ $_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
for _hdev in "${!host_fs_types[@]}"; do
[[ ${host_fs_types[$_hdev]} == "crypto_LUKS" ]] || continue
if [[ $_hdev -ef $_dev ]] || [[ /dev/block/$_hdev -ef $_dev ]]; then

View File

@@ -2,6 +2,30 @@
type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
_cryptgetargsname() {
debug_off
local _o _found _key
unset _o
unset _found
CMDLINE=$(getcmdline)
_key="$1"
set --
for _o in $CMDLINE; do
if [ "$_o" = "$_key" ]; then
_found=1;
elif [ "${_o%=*}" = "${_key%=}" ]; then
[ -n "${_o%=*}" ] && set -- "$@" "${_o#*=}";
_found=1;
fi
done
if [ -n "$_found" ]; then
[ $# -gt 0 ] && printf '%s' "$*"
return 0
fi
return 1;
}
if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
info "rd.luks=0: removing cryptoluks activation"
rm -f -- /etc/udev/rules.d/70-luks.rules
@@ -15,8 +39,8 @@ else
tout=$(getarg rd.luks.key.tout)
if [ -e /etc/crypttab ]; then
while read _mapper _dev _rest ; do
set_systemd_timeout_for_dev $_dev
while read -r _ _dev _ || [ -n "$_dev" ]; do
set_systemd_timeout_for_dev "$_dev"
done < /etc/crypttab
fi
@@ -24,23 +48,29 @@ else
for luksid in $LUKS; do
luksid=${luksid##luks-}
if luksname=$(_cryptgetargsname "rd.luks.name=$luksid="); then
luksname="${luksname#$luksid=}"
else
luksname="luks-$luksid"
fi
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
printf -- 'RUN+="%s --settled --unique --onetime ' "$(command -v initqueue)"
printf -- '--name cryptroot-ask-%%k %s ' "$(command -v cryptroot-ask)"
printf -- '$env{DEVNAME} %s %s"\n' "$luksname" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
luksname=$(dev_unit_name "$luksname")
if ! crypttab_contains "$luksid"; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --settled --unique --onetime ' $(command -v initqueue)
printf -- '--name systemd-cryptsetup-%%k %s start ' $(command -v systemctl)
printf -- 'systemd-cryptsetup@luks$$(dev_unit_name -$env{ID_FS_UUID}).service"\n'
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' "$luksid"
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
@@ -48,25 +78,25 @@ else
uuid=$luksid
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
printf -- '[ -e /dev/disk/by-id/dm-uuid-CRYPT-LUKS?-*%s*-* ] || exit 1\n' $uuid \
>> $hookdir/initqueue/finished/90-crypt.sh
>> "$hookdir/initqueue/finished/90-crypt.sh"
{
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
} >> $hookdir/emergency/90-crypt.sh
} >> "$hookdir/emergency/90-crypt.sh"
done
elif getargbool 0 rd.auto; then
if [ -z "$DRACUT_SYSTEMD" ]; then
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
printf -- '--unique --settled --onetime --name cryptroot-ask-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' "$(command -v cryptroot-ask)" "$tout"
} >> /etc/udev/rules.d/70-luks.rules.new
else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' "$(command -v initqueue)"
printf -- '--unique --settled --onetime --name crypt-run-generator-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $(command -v crypt-run-generator)
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' "$(command -v crypt-run-generator)"
} >> /etc/udev/rules.d/70-luks.rules.new
fi
fi

View File

@@ -0,0 +1,22 @@
#!/bin/bash
command -v
check() {
require_binaries ntfs-3g || return 1
return 255
}
depends() {
echo 90dmsquash-live
return 0
}
install() {
inst_multiple fusermount ulockmgr_server mount.fuse ntfs-3g
dracut_need_initqueue
}
installkernel() {
hostonly='' instmods fuse
}

View File

@@ -78,7 +78,20 @@ if [ -f $livedev ]; then
esac
[ -e /sys/fs/$fstype ] || modprobe $fstype
else
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
if [ "$(blkid -o value -s TYPE $livedev)" != "ntfs" ]; then
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
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
( 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"
exit 1
fi
fi
if [ "$?" != "0" ]; then
die "Failed to mount block device of live image"
exit 1
@@ -241,7 +254,12 @@ do_live_overlay() {
fi
# Create a device that always points to a ro base image
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
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
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base
fi
}
# we might have a genMinInstDelta delta file for anaconda to take advantage of

View File

@@ -13,6 +13,7 @@ installkernel() {
xhci-hcd xhci-pci xhci-plat-hcd \
pinctrl-cherryview \
"=drivers/hid" \
"=drivers/tty/serial" \
"=drivers/input/serio" \
"=drivers/input/keyboard" \
"=drivers/usb/storage" \
@@ -26,20 +27,25 @@ installkernel() {
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/i2c/busses" \
"=drivers/mfd" \
"=drivers/phy" \
"=drivers/power" \
"=drivers/regulator" \
"=drivers/rtc" \
"=drivers/soc" \
"=drivers/usb/chipidea" \
"=drivers/usb/dwc2" \
"=drivers/usb/dwc3" \
"=drivers/usb/host" \
"=drivers/usb/musb" \
"=drivers/usb/phy" \
"=drivers/scsi/hisi_sas" \
${NULL}
fi

View File

@@ -43,7 +43,7 @@ cmdline() {
}
installkernel() {
instmods dm-snapshot
hostonly='' instmods dm-snapshot
}
# called by dracut

View File

@@ -1,34 +1,68 @@
#!/bin/sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
_md_force_run() {
type getargs >/dev/null 2>&1 || . /lib/dracut-lib.sh
_md_start() {
local _udevinfo
local _path_s
local _path_d
local _md="$1"
local _offroot="$2"
_udevinfo="$(udevadm info --query=env --name="${_md}")"
strstr "$_udevinfo" "MD_LEVEL=container" && continue
strstr "$_udevinfo" "DEVTYPE=partition" && continue
_path_s="/sys/$(udevadm info -q path -n "${_md}")/md/array_state"
[ ! -r "$_path_s" ] && continue
# inactive ?
[ "$(cat "$_path_s")" != "inactive" ] && continue
mdadm $_offroot -R "${_md}" 2>&1 | vinfo
# still inactive ?
[ "$(cat "$_path_s")" = "inactive" ] && continue
_path_d="${_path_s%/*}/degraded"
[ ! -r "$_path_d" ] && continue
> $hookdir/initqueue/work
}
_md_force_run() {
local _offroot
local _md
local _UUID
local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
[ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
# try to force-run anything not running yet
for md in /dev/md[0-9_]*; do
[ -b "$md" ] || continue
_udevinfo="$(udevadm info --query=env --name="$md")"
strstr "$_udevinfo" "MD_LEVEL=container" && continue
strstr "$_udevinfo" "DEVTYPE=partition" && continue
_path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
[ ! -r "$_path_s" ] && continue
if [ -n "$_MD_UUID" ]; then
for _md in /dev/md[0-9_]*; do
[ -b "$_md" ] || continue
_UUID=$(
/sbin/mdadm -D --export "$_md" \
| while read line || [ -n "$line" ]; do
str_starts "$line" "MD_UUID=" || continue
printf "%s" "${line#MD_UUID=}"
done
)
# inactive ?
[ "$(cat "$_path_s")" != "inactive" ] && continue
[ -z "$_UUID" ] && continue
mdadm $_offroot -R "$md" 2>&1 | vinfo
# check if we should handle this device
strstr " $_MD_UUID " " $_UUID " || continue
# still inactive ?
[ "$(cat "$_path_s")" = "inactive" ] && continue
_path_d="${_path_s%/*}/degraded"
[ ! -r "$_path_d" ] && continue
> $hookdir/initqueue/work
done
_md_start "${_md}" "${_offroot}"
done
else
# try to force-run anything not running yet
for _md in /dev/md[0-9_]*; do
[ -b "$_md" ] || continue
_md_start "${_md}" "${_offroot}"
done
fi
}
_md_force_run

View File

@@ -25,6 +25,9 @@ else
done < "${f}" > "${f}.new"
mv "${f}.new" "$f"
done
for uuid in $MD_UUID; do
wait_for_dev "/dev/disk/by-id/md-uuid-${uuid}"
done
fi
fi

View File

@@ -0,0 +1,53 @@
#!/bin/bash
# called by dracut
check() {
return 255
}
# called by dracut
depends() {
echo multipath
return 0
}
# called by dracut
install() {
local _f _allow
is_mpath() {
local _dev=$1
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
return 1
}
majmin_to_mpath_dev() {
local _dev
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_dev=$(get_maj_min $i)
if [ "$_dev" = "$1" ]; then
echo $i
return
fi
done
}
add_hostonly_mpath_conf() {
is_mpath $1 && {
local _dev
_dev=$(majmin_to_mpath_dev $1)
[ -z "$_dev" ] && return
strstr "$_allow" "$_dev" && return
_allow="$_allow --allow $_dev"
}
}
[[ $hostonly ]] && {
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
}
}

View File

@@ -7,17 +7,6 @@ is_mpath() {
return 1
}
majmin_to_mpath_dev() {
local _dev
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_dev=$(get_maj_min $i)
if [ "$_dev" = "$1" ]; then
echo $i
return
fi
done
}
# called by dracut
check() {
local _rootdev
@@ -64,16 +53,6 @@ installkernel() {
# called by dracut
install() {
local _f _allow
add_hostonly_mpath_conf() {
is_mpath $1 && {
local _dev
_dev=$(majmin_to_mpath_dev $1)
[ -z "$_dev" ] && return
strstr "$_allow" "$_dev" && return
_allow="$_allow --allow $_dev"
}
}
inst_multiple -o \
dmsetup \
@@ -88,11 +67,6 @@ install() {
/etc/multipath.conf \
/etc/multipath/*
[[ $hostonly ]] && {
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
[ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
}
inst $(command -v partx) /sbin/partx
inst_libdir_file "libmultipath*" "multipath/*"

View File

@@ -0,0 +1,50 @@
# Directions for changing a system from password-based gpg keyfile
# to smartcard-based gpg keyfile
# Be sure that you meet the following requirements:
# 1. GnuPG >= 2.1 installed with
# * Smartcard support enabled (scdaemon must be built)
# * Direct CCID access built into scdaemon
# 2. A password-based gpg keyfile ${KEYFILE} (e.g. "keyfile.gpg"):
# That is, a file containing the slot key for LUKS, which
# has been encrypted symmetrically with GnuPG using
# a password.
# 3. Your public OpenPGP identity ${RECIPIENT} (e.g. "3A696356")
# 4. An OpenPGP smartcard holding the decryption key associated
# with your public identity
# 5. A CCID smartcard reader
# Notes: Requirement 4. and 5. can of course be one device, e.g.
# a USB token with an integrated OpenPGP smartcard
# Make a backup of your keyfile (assuming it lies on the boot partition)
$ cp /boot/${KEYFILE} /safe/place/keyfile.bak.gpg
# Change your keyfile from purely password-based to both
# password-based and key-based (you can then decrypt the keyfile
# with either method). As an example aes256 is chosen, the cipher
# is not important to this guide, but do note that your kernel
# must support it at boot time (be it built into the kernel image
# or loaded as a module from the initramfs).
$ cat /safe/place/keyfile.bak.gpg | gpg -d | gpg --encrypt --recipient ${RECIPIENT} --cipher-algo aes256 --armor -c > /safe/place/keyfile_sc.gpg
# Verify that you can decrypt your new keyfile both with the password
# and your smartcard.
# (with smartcard inserted, you should be prompted for your PIN, unless
# you already did so and have not yet timed out)
$ gpg -d /safe/place/keyfile_sc.gpg
# (with smartcard disconnected, you should be prompted for your password)
$ gpg -d /safe/place/keyfile_sc.gpg
# After verification, replace your old keyfile with your new one
$ su -c 'cp /safe/place/keyfile_sc.gpg /boot/${KEYFILE}'
# Export your public key to where crypt-gpg can find it
$ gpg --armor --export-options export-minimal --export ${RECIPIENT} > /safe/place/crypt-public-key.gpg
$ su -c 'cp /safe/place/crypt-public-key.gpg /etc/dracut.conf.d/crypt-public-key.gpg'
# Rebuild your initramfs as usual
# When booting with any of the requirements not met, crypt-gpg will default to password-based keyfile unlocking.
# If all requirements are met and smartcard support is not disabled by setting the kernel option "rd.luks.smartcard=0"
# crypt-gpg will try find and use a connected OpenPGP smartcard by prompting you for the PIN and then
# unlocking the gpg keyfile with the smartcard.

View File

@@ -4,7 +4,7 @@ command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
# gpg_decrypt mnt_point keypath keydev device
#
# Decrypts encrypted symmetrically key to standard output.
# Decrypts symmetrically encrypted (password or OpenPGP smartcard) key to standard output.
#
# mnt_point - mount point where <keydev> is already mounted
# keypath - GPG encrypted key path relative to <mnt_point>
@@ -22,10 +22,40 @@ gpg_decrypt() {
mkdir -m 0700 -p "$gpghome"
# Setup GnuPG home and gpg-agent for usage of OpenPGP smartcard.
# This requires GnuPG >= 2.1, as it uses the new ,,pinentry-mode´´
# feature, which - when set to ,,loopback´´ - allows us to pipe
# the smartcard's pin to GnuPG (instead of using a normal pinentry
# program needed with GnuPG < 2.1), making for uncomplicated
# integration with the existing codebase.
local useSmartcard="0"
local gpgMajorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
local gpgMinorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
if [ "${gpgMajorVersion}" -ge 2 ] && [ "${gpgMinorVersion}" -ge 1 ] \
&& [ -f /root/crypt-public-key.gpg ] && getargbool 1 rd.luks.smartcard ; then
useSmartcard="1"
echo "allow-loopback-pinentry" >> "$gpghome/gpg-agent.conf"
GNUPGHOME="$gpghome" gpg-agent --quiet --daemon
GNUPGHOME="$gpghome" gpg --quiet --no-tty --import < /root/crypt-public-key.gpg
local smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \
| sed -n -r -e 's|Serial number.*: ([0-9]*)|\1|p' | tr -d '\n')"
if [ -n "${smartcardSerialNumber}" ]; then
inputPrompt="PIN (OpenPGP card ${smartcardSerialNumber})"
fi
GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null learn /bye
opts="$opts --pinentry-mode=loopback"
fi
ask_for_password \
--cmd "gpg $opts --decrypt $mntp/$keypath" \
--prompt "Password ($keypath on $keydev for $device)" \
--prompt "${inputPrompt:-Password ($keypath on $keydev for $device)}" \
--tries 3 --tty-echo-off
# Clean up the smartcard gpg-agent
if [ "${useSmartcard}" == "1" ]; then
GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null killagent /bye
fi
rm -rf -- "$gpghome"
}

View File

@@ -5,6 +5,14 @@
check() {
require_binaries gpg || return 1
if sc_requested; then
if ! sc_supported; then
dwarning "crypt-gpg: GnuPG >= 2.1 with scdaemon and libusb required for ccid smartcard support"
return 1
fi
return 0
fi
return 255
}
@@ -17,4 +25,38 @@ depends() {
install() {
inst_multiple gpg
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"
if sc_requested; then
inst_multiple gpg-agent
inst_multiple gpg-connect-agent
inst_multiple /usr/libexec/scdaemon
cp "$(sc_public_key)" "${initdir}/root/"
fi
}
sc_public_key() {
echo -n "/etc/dracut.conf.d/crypt-public-key.gpg"
}
# CCID Smartcard support requires GnuPG >= 2.1 with scdaemon and libusb
sc_supported() {
local gpgMajor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
local gpgMinor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
if [[ "${gpgMajor}" -gt 2 || "${gpgMajor}" -eq 2 && "${gpgMinor}" -ge 1 ]] && \
require_binaries gpg-agent &&
require_binaries gpg-connect-agent &&
require_binaries /usr/libexec/scdaemon &&
(ldd /usr/libexec/scdaemon | grep libusb > /dev/null); then
return 0
else
return 1
fi
}
sc_requested() {
if [ -f "$(sc_public_key)" ]; then
return 0
else
return 1
fi
}

View File

@@ -16,7 +16,7 @@ loop_decrypt() {
local keydev="$3"
local device="$4"
local key="/dev/mapper/${mntp##*/}"
local key="/dev/mapper/$(str_replace "loop-$keydev-$mntp-$keypath" '/' '-')"
if [ ! -b $key ]; then
local loopdev=$(losetup -f "${mntp}/${keypath}" --show)
@@ -29,10 +29,8 @@ loop_decrypt() {
[ -b $key ] || die "Failed to unlock $keypath on $keydev for $device."
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-10-${key##*/}" \
$(command -v cryptsetup) "luksClose $key"
initqueue --onetime --finished --unique --name "crypt-loop-cleanup-20-${loopdev##*/}" \
$(command -v losetup) "-d $loopdev"
printf "%s\n" "cryptsetup luksClose \"$key\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-10-${key##*/}".sh
printf "%s\n" "losetup -d \"$loopdev\"" > ${hookdir}/cleanup/"crypt-loop-cleanup-20-${loopdev##*/}".sh
fi
cat $key

View File

@@ -1,8 +1,10 @@
#!/bin/sh
for dasd_arg in $(getargs rd.dasd= -d rd_DASD= DASD=); do
(
local OLDIFS="$IFS"
IFS=","
set -- $dasd_arg
IFS="$OLDIFS"
echo "$@" | normalize_dasd_arg >> /etc/dasd.conf
)
done

View File

@@ -1,10 +1,39 @@
#!/bin/bash
# called by dracut
cmdline() {
is_dasd() {
local _dev=$1
local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
[ "${_devpath#*/dasd}" == "$_devpath" ] && return 1
_ccw="${_devpath%%/block/*}"
echo "rd.dasd=${_ccw##*/}"
return 0
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves_all is_dasd || return 255
} | sort | uniq
}
# called by dracut
check() {
local _arch=$(uname -m)
local found=0
local bdev
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries dasd_configure /usr/lib/udev/collect || return 1
require_binaries /usr/lib/udev/collect || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
for bdev in /sys/block/* ; do
case "${bdev##*/}" in
dasd*)
found=$(($found+1));
break;
esac
done
[ $found -eq 0 ] && return 255
}
return 0
}
@@ -18,8 +47,13 @@ depends() {
install() {
inst_multiple /usr/lib/udev/collect
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
if [[ $hostonly_cmdline == "yes" ]] ; then
local _dasd=$(cmdline)
[[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf"
fi
if [[ $hostonly ]] ; then
inst_rules_wildcard 51-dasd-*.rules
inst_rules_wildcard 41-s390x-dasd-*.rules
fi
inst_rules 59-dasd.rules
}

View File

@@ -1,10 +1,14 @@
#!/bin/sh
#!/bin/bash
create_udev_rule() {
local ccw=$1
local _drv _cu_type _dev_type
local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null ; then
cio_ignore -r $ccw
fi
if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
@@ -38,17 +42,76 @@ ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
EOF
}
if [[ -f /sys/firmware/ipl/ipl_type &&
$(</sys/firmware/ipl/ipl_type) = "ccw" ]] ; then
(
local _ccw=$(cat /sys/firmware/ipl/device)
create_udev_rule $_ccw
)
fi
for dasd_arg in $(getargs root=) $(getargs resume=); do
(
case $dasd_arg in
/dev/disk/by-path/ccw-*)
ccw_arg=${dasd_arg##*/}
break;
;;
esac
if [ -n "$ccw_arg" ] ; then
OLDIFS="$IFS"
IFS="-"
set -- $ccw_arg
IFS="$OLDIFS"
create_udev_rule $2
fi
)
done
for dasd_arg in $(getargs rd.dasd=); do
(
OLDIFS="$IFS"
IFS=","
set -- $dasd_arg
IFS="$OLDIFS"
while (($# > 0)); do
case $1 in
autodetect|probeonly)
shift
;;
*-*)
range=$1
OLDIFS="$IFS"
IFS="-"
set -- $range
prefix=${1%.*}
start=${1##*.}
shift
end=${1##.}
shift
IFS="$OLDIFS"
for dev in $(seq $(( 16#$start )) $(( 16#$end )) ) ; do
create_udev_rule $(printf "%s.%04x" "$prefix" "$dev")
done
;;
*)
dev=${1%(ro)}
if [ "$dev" != "$1" ] ; then
ro=1
fi
OLDIFS="$IFS"
IFS="."
set -- $dev
sid=$1
shift
ssid=$1
shift
chan=$1
IFS="$OLDIFS"
create_udev_rule $(printf "%01x.%01x.%04x" $(( 16#$sid )) $(( 16#$ssid )) $(( 16#$chan )) )
shift
;;
esac
done
)
done

View File

@@ -15,7 +15,7 @@ depends() {
install() {
inst_multiple -o cat ls ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh find vi \
tcpdump cp less hostname mkdir \
tcpdump cp less hostname mkdir systemd-analyze \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"

View File

@@ -68,8 +68,10 @@ cmdline() {
# called by dracut
install() {
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
inst_libdir_file 'libhbalinux.so*'
inst "/etc/hba.conf" "/etc/hba.conf"
if [ -e "/etc/hba.conf" ]; then
inst_libdir_file 'libhbalinux.so*'
inst_simple "/etc/hba.conf"
fi
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
mkdir -m 0755 -p "$initdir/etc/fcoe"

View File

@@ -109,9 +109,25 @@ if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then
fi
if [ "$nbdport" -gt 0 ] 2>/dev/null; then
nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
if [ -z "$DRACUT_SYSTEMD" ]; then
nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
else
systemd-run --no-block --service-type=forking --quiet \
--description="nbd nbd0" \
-p 'DefaultDependencies=no' \
-p 'KillMode=none' \
--unit="nbd0" -- nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts >/dev/null 2>&1 || exit 1
fi
else
nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1
if [ -z "$DRACUT_SYSTEMD" ]; then
nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts || exit 1
else
systemd-run --no-block --service-type=forking --quiet \
--description="nbd nbd0" \
-p 'DefaultDependencies=no' \
-p 'KillMode=none' \
--unit="nbd0" -- nbd-client -name "$nbdport" "$nbdserver" /dev/nbd0 $preopts $opts >/dev/null 2>&1 || exit 1
fi
fi
# NBD doesn't emit uevents when it gets connected, so kick it

View File

@@ -70,7 +70,7 @@ install() {
local _i
local _nsslibs
inst_multiple -o portmap rpcbind rpc.statd mount.nfs \
mount.nfs4 umount rpc.idmapd sed /etc/netconfig chmod
mount.nfs4 umount rpc.idmapd sed /etc/netconfig chmod "$tmpfilesdir/rpcbind.conf"
inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
if [[ $hostonly_cmdline == "yes" ]]; then

View File

@@ -9,7 +9,10 @@ if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
# Start rpcbind or rpcbind
# FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
if command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ]; then
mkdir -p /run/rpcbind
rpcbind
fi
# Start rpc.statd as mount won't let us use locks on a NFSv4
# filesystem without talking to it. NFSv4 does locks internally,

View File

@@ -1,10 +1,56 @@
#!/bin/bash
# called by dracut
cmdline() {
is_zfcp() {
local _dev=$1
local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type
local _allow_lun_scan _is_npiv
_allow_lun_scan=$(cat /sys/module/zfcp/parameters/allow_lun_scan)
[ "${_devpath#*/sd}" == "$_devpath" ] && return 1
_sdev="${_devpath%%/block/*}"
[ -e ${_sdev}/fcp_lun ] || return 1
_scsiid="${_sdev##*/}"
_hostno="${_scsiid%%:*}"
[ -d /sys/class/fc_host/host${_hostno} ] || return 1
_port_type=$(cat /sys/class/fc_host/host${_hostno}/port_type)
case "$_port_type" in
NPIV*)
_is_npiv=1
;;
esac
_ccw=$(cat ${_sdev}/hba_id)
if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ] ; then
echo "rd.zfcp=${_ccw}"
else
_lun=$(cat ${_sdev}/fcp_lun)
_wwpn=$(cat ${_sdev}/wwpn)
echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
fi
return 0
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves_all is_zfcp
} | sort | uniq
}
# called by dracut
check() {
local _arch=$(uname -m)
local _ccw
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries zfcp_disk_configure /usr/lib/udev/collect || return 1
require_binaries /usr/lib/udev/collect || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
found=0
for _ccw in /sys/bus/ccw/devices/*/host* ; do
[ -d "$_ccw" ] || continue
found=$(($found+1));
done
[ $found -eq 0 ] && return 255
}
return 0
}
@@ -17,7 +63,15 @@ depends() {
install() {
inst_multiple /usr/lib/udev/collect
inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
if [[ $hostonly_cmdline == "yes" ]] ; then
local _zfcp
for _zfcp in $(cmdline) ; do
printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf"
done
fi
if [[ $hostonly ]] ; then
inst_rules_wildcard 51-zfcp-*.rules
inst_rules_wildcard 41-s390x-zfcp-*.rules
fi
}

View File

@@ -1,13 +1,15 @@
#!/bin/sh
#!/bin/bash
create_udev_rule() {
local ccw=$1
local wwpn=$2
local lun=$3
local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
local _cu_type _dev_type
local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null ; then
cio_ignore -r $ccw
fi
if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
@@ -29,34 +31,56 @@ ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="zfcp", IMPORT{program}="collect $c
ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
EOF
fi
[ -z "$wwpn" -o -z "$lun" ] && return
m=$(sed -n "/.*${wwpn}.*${lun}.*/p" $_rule)
if [ -z "$m" ] ; then
cat >> $_rule <<EOF
ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
EOF
fi
if [ -x /sbin/cio_ignore ] && ! cio_ignore -i $ccw > /dev/null ; then
cio_ignore -r $ccw
fi
}
if [[ -f /sys/firmware/ipl/ipl_type &&
$(</sys/firmware/ipl/ipl_type) = "fcp" ]] ; then
(
local _wwpn=$(cat /sys/firmware/ipl/wwpn)
local _lun=$(cat /sys/firmware/ipl/lun)
local _ccw=$(cat /sys/firmware/ipl/device)
create_udev_rule $_ccw $_wwpn $_lun
)
fi
for zfcp_arg in $(getargs rd.zfcp); do
(
OLDIFS="$IFS"
IFS=","
set $zfcp_arg
IFS="$OLDIFS"
create_udev_rule $1 $2 $3
)
done
for zfcp_arg in $(getargs root=) $(getargs resume=); do
(
local _wwpn
local _lun
case $zfcp_arg in
/dev/disk/by-path/ccw-*)
ccw_arg=${zfcp_arg##*/}
break;
;;
esac
if [ -n "$ccw_arg" ] ; then
OLDIFS="$IFS"
IFS="-"
set -- $ccw_arg
wwpn=${4%:*}
lun=${4#*:}
IFS="$OLDIFS"
_wwpn=${4%:*}
_lun=${4#*:}
create_udev_rule $2 $wwpn $lun
fi
)

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut ask for additional cmdline parameters
@@ -17,7 +12,6 @@ ConditionPathExists=/usr/lib/initrd-release
ConditionKernelCommandLine=|rd.cmdline=ask
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut cmdline hook
@@ -21,7 +16,6 @@ ConditionKernelCommandLine=|rd.break=cmdline
ConditionKernelCommandLine=|resume
ConditionKernelCommandLine=|noresume
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=Dracut Emergency Shell
@@ -13,7 +8,6 @@ DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=HOME=/

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut initqueue hook
@@ -19,7 +14,6 @@ ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=|/lib/dracut/need-initqueue
ConditionKernelCommandLine=|rd.break=initqueue
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut mount hook
@@ -17,7 +12,6 @@ ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
ConditionKernelCommandLine=|rd.break=mount
DefaultDependencies=no
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,24 +1,17 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut pre-mount hook
Documentation=man:dracut-pre-mount.service(8)
DefaultDependencies=no
Before=initrd-root-fs.target sysroot.mount systemd-fsck-root.service
After=dracut-initqueue.service
After=cryptsetup.target
After=dracut-initqueue.service cryptsetup.target
ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-mount
ConditionKernelCommandLine=|rd.break=pre-mount
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut pre-pivot and cleanup hook
@@ -25,7 +20,6 @@ ConditionKernelCommandLine=|rd.break
ConditionPathExists=|/dev/root
ConditionPathExists=|/dev/nfs
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut pre-trigger hook
@@ -18,7 +13,6 @@ ConditionPathExists=/usr/lib/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger
ConditionKernelCommandLine=|rd.break=pre-trigger
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=dracut pre-udev hook
@@ -15,13 +10,13 @@ Before=systemd-udevd.service dracut-pre-trigger.service
After=dracut-cmdline.service
Wants=dracut-cmdline.service
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=|/etc/cmdline.d/20-force_drivers.conf
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
ConditionKernelCommandLine=|rd.break=pre-udev
ConditionKernelCommandLine=|rd.driver.blacklist
ConditionKernelCommandLine=|rd.driver.pre
ConditionKernelCommandLine=|rd.driver.post
Conflicts=shutdown.target emergency.target
Before=shutdown.target emergency.target
[Service]
Environment=DRACUT_SYSTEMD=1

View File

@@ -1,9 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See dracut.bootup(7) for details
[Unit]
Description=Restore /run/initramfs on shutdown

View File

@@ -1,11 +1,6 @@
# This file is part of systemd.
# This file is part of dracut.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See systemd.special(7) for details
# See dracut.bootup(7) for details
[Unit]
Description=Emergency Shell

View File

@@ -13,7 +13,7 @@ load_x509_keys()
. ${IMACONFIG}
fi
if [ -z "${IMAKEYDIR}" ]; then
if [ -z "${IMAKEYSDIR}" ]; then
IMAKEYSDIR="/etc/keys/ima"
fi

View File

@@ -152,8 +152,8 @@ getcmdline() {
while read -r _line || [ -n "$_line" ]; do
CMDLINE_PROC="$CMDLINE_PROC $_line"
done </proc/cmdline;
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
fi
CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
printf "%s" "$CMDLINE"
}

View File

@@ -11,7 +11,7 @@ test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/result \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-watchdog i6300esb -watchdog-action poweroff \
-no-reboot \
@@ -80,7 +80,7 @@ test_setup() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-m 256M -smp 2 -nographic -net none \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1

View File

@@ -0,0 +1,17 @@
#!/bin/bash
cp /usr/bin/true /usr/bin/man
for i in \
sysinit.target \
basic.target \
initrd-fs.target \
initrd.target \
initrd-switch-root.target \
emergency.target \
shutdown.target; do
if ! systemd-analyze verify $i; then
warn "systemd-analyze verify $i failed"
poweroff
fi
done

View File

@@ -4,15 +4,15 @@ TEST_DESCRIPTION="root filesystem on a ext3 filesystem"
KVERSION="${KVERSION-$(uname -r)}"
# Uncomment this to debug failures
#DEBUGFAIL="rd.shell=1 rd.break"
#DEBUGFAIL="rd.shell=1 rd.break=pre-mount"
test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-m 256M -smp 2 -nographic \
-net none \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug init=/sbin/init rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
-append "panic=1 root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.shell=0 $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
}
@@ -24,9 +24,9 @@ test_setup() {
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
mkdir -p $initdir
. $basedir/dracut-init.sh
export initdir=$TESTDIR/overlay/source
mkdir -p $initdir
. $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
@@ -36,69 +36,70 @@ test_setup() {
done
mkdir -p -- var/lib/nfs/rpc_pipefs
)
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
mount dmesg dhclient mkdir cp ping dhclient \
umount strace less setsid
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
mount dmesg dhclient mkdir cp ping dhclient \
umount strace less setsid systemd-analyze
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
inst_multiple -o ${_terminfodir}/l/linux
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
inst_multiple grep
done
inst_multiple -o ${_terminfodir}/l/linux
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
inst_multiple grep
inst_simple /etc/os-release
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && inst_multiple plymouth
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && inst_multiple plymouth
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.ext3 poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.ext3 poweroff cp umount
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash udev-rules base rootfs-block fs-lib kernel-modules" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-m "dash udev-rules base rootfs-block fs-lib kernel-modules" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
--nomdadmconf \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf -- $TESTDIR/overlay
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-m 256M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1
(
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
inst_hook pre-pivot 000 ./systemd-analyze.sh
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-a "debug systemd" \
-o "network kernel-network-modules" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-a "debug systemd" \
-o "network kernel-network-modules" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
-f $TESTDIR/initramfs.testing $KVERSION || return 1
# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
# -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
}
test_cleanup() {

View File

@@ -18,7 +18,7 @@ client_run() {
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
-drive format=raw,index=2,media=disk,file=$TESTDIR/result \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-watchdog i6300esb -watchdog-action poweroff \
-no-reboot \
@@ -115,7 +115,7 @@ test_setup() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
-m 256M -smp 2 -nographic -net none \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.btrfs || return 1

View File

@@ -20,7 +20,7 @@ client_run() {
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
-drive format=raw,index=2,media=disk,file=$TESTDIR/result \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=LABEL=dracut $client_opts rd.retry=3 console=ttyS0,115200n81 selinux=0 $DEBUGOUT rd.shell=0 $DEBUGFAIL" \
@@ -252,7 +252,7 @@ EOF
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
-drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
-m 256M -smp 2 -nographic -net none \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.btrfs || return 1

View File

@@ -10,7 +10,7 @@ test_run() {
DISKIMAGE=$TESTDIR/TEST-10-RAID-root.img
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=/dev/dracut/root rd.auto rw rd.retry=10 console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
@@ -77,7 +77,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
-m 256M -smp 2 -nographic -net none \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/cannotreach rw rootfstype=ext2 console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $DISKIMAGE || return 1

View File

@@ -7,10 +7,10 @@ rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
# save a partition at the beginning for future flagging purposes
sfdisk /dev/sda <<EOF
,1M
,10M
,10M
,10M
,2M
,20M
,20M
,20M
EOF
udevadm settle
for i in sda2 sda3 sda4; do

View File

@@ -9,7 +9,7 @@ KVERSION=${KVERSION-$(uname -r)}
test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
@@ -19,7 +19,7 @@ test_run() {
test_setup() {
# Create the blank file to use as a root filesystem
dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=40
dd if=/dev/null of=$TESTDIR/root.ext2 bs=1M seek=80
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
@@ -72,7 +72,7 @@ test_setup() {
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf -- $TESTDIR/overlay
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1

View File

@@ -8,6 +8,8 @@ for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
udevadm settle
sleep 1
# save a partition at the beginning for future flagging purposes
sfdisk /dev/sda <<EOF
,5M

View File

@@ -1,3 +1,4 @@
#!/bin/sh
sleep 10
getargbool 0 rd.shell || poweroff -f
! getargbool 0 rd.break && getargbool 0 failme && poweroff -f

View File

@@ -15,16 +15,16 @@ client_run() {
cp --sparse=always --reflink=auto $TESTDIR/disk3.img $TESTDIR/disk3.img.new
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -nographic -smp 2 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img.new \
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img.new \
-net none \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -nographic -smp 2 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img.new \
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img.new \
-net none \
-no-reboot \
-append "panic=1 $* root=LABEL=root rw rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL " \
-initrd $TESTDIR/initramfs.testing
-append "panic=1 $* systemd.log_target=kmsg loglevel=7 root=LABEL=root rw rd.retry=20 rd.info console=ttyS0,115200n81 log_buf_len=2M selinux=0 rd.debug rd.shell=0 $DEBUGFAIL " \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q dracut-root-block-success $TESTDIR/root.ext2; then
echo "CLIENT TEST END: $@ [FAIL]"
return 1;
echo "CLIENT TEST END: $@ [FAIL]"
return 1;
fi
sed -i -e 's#dracut-root-block-success#dracut-root-block-xxxxxxx#' $TESTDIR/root.ext2
@@ -66,9 +66,9 @@ test_setup() {
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
. $basedir/dracut-init.sh
(
export initdir=$TESTDIR/overlay/source
. $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
@@ -76,50 +76,50 @@ test_setup() {
ln -sfnr usr/$i $i
done
)
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
mount dmesg dhclient mkdir cp ping dhclient
inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
mount dmesg dhclient mkdir cp ping dhclient
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
inst_multiple -o ${_terminfodir}/l/linux
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
inst_multiple grep
[ -f ${_terminfodir}/l/linux ] && break
done
inst_multiple -o ${_terminfodir}/l/linux
inst "$basedir/modules.d/40network/dhclient-script.sh" "/sbin/dhclient-script"
inst "$basedir/modules.d/40network/ifup.sh" "/sbin/ifup"
inst_multiple grep
inst_simple /etc/os-release
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && inst_multiple plymouth
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
inst ./test-init.sh /sbin/init
find_binary plymouth >/dev/null && inst_multiple plymouth
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount dd grep
inst_hook initqueue 01 ./create-root.sh
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple sfdisk mke2fs poweroff cp umount dd grep
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf -- $TESTDIR/overlay
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1.img \
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img \
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img \
-m 256M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1.img \
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img \
-drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
eval $(grep -F --binary-files=text -m 1 MD_UUID $TESTDIR/root.ext2)
@@ -127,13 +127,13 @@ test_setup() {
echo $ID_FS_UUID > $TESTDIR/luksuuid
(
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask.sh /sbin/cryptroot-ask
mkdir -p $initdir/etc
echo "ARRAY /dev/md0 level=raid5 num-devices=3 UUID=$MD_UUID" > $initdir/etc/mdadm.conf
echo "luks-$ID_FS_UUID UUID=$ID_FS_UUID /etc/key" > $initdir/etc/crypttab
@@ -141,11 +141,11 @@ test_setup() {
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "plymouth network kernel-network-modules" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
-o "plymouth network kernel-network-modules" \
-a "debug" \
-d "piix ide-gd_mod ata_piix ext2 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
}
test_cleanup() {

View File

@@ -17,7 +17,7 @@ test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=/dev/dracut/root rw rd.auto rd.retry=20 console=ttyS0,115200n81 selinux=0 rd.debug rootwait $LUKSARGS rd.shell=0 $DEBUGFAIL" \
@@ -31,7 +31,7 @@ test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=20 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
@@ -45,7 +45,7 @@ test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/check-success.img \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=/dev/dracut/root rw quiet rd.auto rd.retry=10 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL rd.luks.uuid=failme" \
@@ -111,7 +111,7 @@ test_setup() {
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf -- $TESTDIR/overlay
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1

View File

@@ -13,7 +13,7 @@ client_run() {
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 $* root=LABEL=root rw debug rd.retry=5 rd.debug console=ttyS0,115200n81 selinux=0 rd.info rd.shell=0 $DEBUGFAIL" \
@@ -104,7 +104,7 @@ test_setup() {
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/disk1 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
-m 256M -nographic -net none \
-m 512M -nographic -net none \
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1

View File

@@ -9,7 +9,7 @@ test_run() {
DISKIMAGE=$TESTDIR/TEST-15-BTRFSRAID-root.img
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=LABEL=root rw rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
@@ -78,7 +78,7 @@ test_setup() {
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$DISKIMAGE \
-m 256M -smp 2 -nographic -net none \
-m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1

View File

@@ -19,7 +19,7 @@ test_run() {
-boot order=d \
-drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
-drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
-m 256M -smp 2 \
-m 512M -smp 2 \
-nographic \
-net none \
-no-reboot \
@@ -30,7 +30,7 @@ test_run() {
# "$testdir"/run-qemu \
# -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
# -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
# -m 256M -smp 2 \
# -m 512M -smp 2 \
# -net none \
# -append "root=live:CDLABEL=LiveCD live quiet rhgb selinux=0 rd.live.check" \
# -initrd "$TESTDIR"/initramfs.testing

View File

@@ -9,7 +9,7 @@ KVERSION=${KVERSION-$(uname -r)}
test_run() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net none \
-no-reboot \
-append "panic=1 root=/dev/dracut/root rw rd.auto=1 quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug rd.shell=0 $DEBUGFAIL" \
@@ -72,7 +72,7 @@ test_setup() {
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf -- $TESTDIR/overlay
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 256M -smp 2 -nographic -net none \
$testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 -m 512M -smp 2 -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1

View File

@@ -14,7 +14,7 @@ run_server() {
fsck -a $TESTDIR/server.ext3 || return 1
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
-m 256M -smp 2 \
-m 512M -smp 2 \
-display none \
-net socket,listen=127.0.0.1:12320 \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
@@ -52,7 +52,7 @@ client_test() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \
-m 256M -smp 2 -nographic \
-m 512M -smp 2 -nographic \
-net nic,macaddr=$mac,model=e1000 \
-net socket,connect=127.0.0.1:12320 \
-watchdog i6300esb -watchdog-action poweroff \
@@ -210,7 +210,7 @@ test_run() {
test_setup() {
# Make server root
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=120
mke2fs -j -F $TESTDIR/server.ext3
mkdir $TESTDIR/mnt
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt

View File

@@ -73,52 +73,9 @@ do_test_run() {
run_client "netroot=iscsi target0"\
"root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
"ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens3:off" \
"rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
|| return 1
run_client "netroot=iscsi target1 target2" \
"root=LABEL=sysroot" \
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
"rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
|| return 1
# run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
# "root=LABEL=sysroot" \
# "ip=192.168.50.101:::255.255.255.0::ens3:off" \
# "ip=192.168.51.101:::255.255.255.0::ens4:off" \
# "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
# "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
# "rd.iscsi.firmware" \
# "rd.iscsi.initiator=$initiator" \
# "rd.iscsi.waitnet=0" \
# || return 1
run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
"root=LABEL=sysroot" \
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
"rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
"rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
|| :
run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \
"root=LABEL=sysroot" \
"ip=192.168.50.101::192.168.50.1:255.255.255.0::ens3:off" \
"ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
"rd.iscsi.firmware" \
"rd.iscsi.initiator=$initiator" \
"rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
|| :
echo "All tests passed [OK]"
return 0
@@ -207,7 +164,7 @@ test_setup() {
-drive format=raw,index=1,media=disk,file=$TESTDIR/client.img \
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
-smp 2 -m 256M -nographic -net none \
-smp 2 -m 512M -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1

View File

@@ -0,0 +1,8 @@
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"

View File

@@ -0,0 +1 @@
-include ../Makefile.testdir

View File

@@ -0,0 +1,115 @@
#!/bin/sh
getcmdline() {
while read -r _line || [ -n "$_line" ]; do
printf "%s" "$_line"
done </proc/cmdline;
}
_dogetarg() {
local _o _val _doecho
unset _val
unset _o
unset _doecho
CMDLINE=$(getcmdline)
for _o in $CMDLINE; do
if [ "${_o%%=*}" = "${1%%=*}" ]; then
if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
# if $1 has a "=<value>", we want the exact match
if [ "$_o" = "$1" ]; then
_val="1";
unset _doecho
fi
continue
fi
if [ "${_o#*=}" = "$_o" ]; then
# if cmdline argument has no "=<value>", we assume "=1"
_val="1";
unset _doecho
continue
fi
_val="${_o#*=}"
_doecho=1
fi
done
if [ -n "$_val" ]; then
[ "x$_doecho" != "x" ] && echo "$_val";
return 0;
fi
return 1;
}
getarg() {
local _deprecated _newoption
while [ $# -gt 0 ]; do
case $1 in
-d) _deprecated=1; shift;;
-y) if _dogetarg $2 >/dev/null; then
if [ "$_deprecated" = "1" ]; then
[ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
fi
echo 1
return 0
fi
_deprecated=0
shift 2;;
-n) if _dogetarg $2 >/dev/null; then
echo 0;
if [ "$_deprecated" = "1" ]; then
[ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
fi
return 1
fi
_deprecated=0
shift 2;;
*) if [ -z "$_newoption" ]; then
_newoption="$1"
fi
if _dogetarg $1; then
if [ "$_deprecated" = "1" ]; then
[ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
fi
return 0;
fi
_deprecated=0
shift;;
esac
done
return 1
}
getargbool() {
local _b
unset _b
local _default
_default="$1"; shift
_b=$(getarg "$@")
[ $? -ne 0 -a -z "$_b" ] && _b="$_default"
if [ -n "$_b" ]; then
[ $_b = "0" ] && return 1
[ $_b = "no" ] && return 1
[ $_b = "off" ] && return 1
fi
return 0
}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exec >/dev/console 2>&1
strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."
while read dev fs fstype opts rest || [ -n "$dev" ]; do
[ "$fstype" != "ext3" ] && continue
echo "iscsi-OK $dev $fstype $opts" > /dev/sda
break
done < /proc/mounts
#sh -i
if getargbool 0 rd.shell; then
strstr "$(setsid --help)" "control" && CTTY="-c"
setsid $CTTY sh -i
fi
poweroff -f

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# don't let udev and this script step on eachother's toes
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
> "/etc/udev/rules.d/$x"
done
rm -f -- /etc/lvm/lvm.conf
udevadm control --reload
mkfs.ext3 -j -L singleroot -F /dev/sda && \
mkdir -p /sysroot && \
mount /dev/sda /sysroot && \
cp -a -t /sysroot /source/* && \
umount /sysroot && \
mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd && \
mdadm -W /dev/md0 || : && \
lvm pvcreate -ff -y /dev/md0 && \
lvm vgcreate dracut /dev/md0 && \
lvm lvcreate -l 100%FREE -n root dracut && \
lvm vgchange -ay && \
mkfs.ext3 -j -L sysroot /dev/dracut/root && \
mount /dev/dracut/root /sysroot && \
cp -a -t /sysroot /source/* && \
umount /sysroot && \
lvm lvchange -a n /dev/dracut/root && \
echo "dracut-root-block-created" >/dev/sdb
poweroff -f

View File

@@ -0,0 +1,48 @@
ddns-update-style none;
use-host-decl-names true;
subnet 192.168.50.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option routers 192.168.50.1;
next-server 192.168.50.1;
server-identifier 192.168.50.1;
option domain-name-servers 192.168.50.1;
option domain-search "example.com";
option domain-name "other.com";
# MAC numbering scheme:
# NFSv3: last octect starts at 0x00 and works up
group {
option root-path "iscsi:192.168.50.1:::1:iqn.2009-06.dracut:target0";
host iscsi-1 {
hardware ethernet 52:54:00:12:34:00;
fixed-address 192.168.50.101;
}
}
}
subnet 192.168.51.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option routers 192.168.51.1;
next-server 192.168.51.1;
server-identifier 192.168.51.1;
option domain-name-servers 192.168.51.1;
option domain-search "example.com";
option domain-name "other.com";
# MAC numbering scheme:
# NFSv3: last octect starts at 0x00 and works up
group {
option root-path "iscsi:192.168.51.1:::1:iqn.2009-06.dracut:target1";
host iscsi-2 {
hardware ethernet 52:54:00:12:34:01;
fixed-address 192.168.51.101;
}
}
}

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exit 1

View File

@@ -0,0 +1,3 @@
#!/bin/sh
getargbool 0 rd.shell || poweroff -f
getargbool 0 failme && poweroff -f

View File

@@ -0,0 +1,8 @@
127.0.0.1 localhost
192.168.50.1 server
192.168.50.2 server-ip
192.168.50.3 server-proto-ip
192.168.50.100 workstation1
192.168.50.101 workstation2
192.168.50.102 workstation3
192.168.50.103 workstation4

View File

@@ -0,0 +1,41 @@
#!/bin/sh
exec </dev/console >/dev/console 2>&1
set -x
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
export PS1='nfstest-server:\w\$ '
stty sane
echo "made it to the rootfs!"
echo server > /proc/sys/kernel/hostname
ip addr add 127.0.0.1/8 dev lo
ip link set lo up
ip link set dev eth0 name ens3
ip addr add 192.168.50.1/24 dev ens3
ip link set ens3 up
ip link set dev eth1 name ens4
ip addr add 192.168.51.1/24 dev ens4
ip link set ens4 up
>/var/lib/dhcpd/dhcpd.leases
chmod 777 /var/lib/dhcpd/dhcpd.leases
dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
tgtd
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2009-06.dracut:target0
tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2009-06.dracut:target1
tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2009-06.dracut:target2
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /dev/sdb
tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 -b /dev/sdc
tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 -b /dev/sdd
tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
# Wait forever for the VM to die
echo "Serving iSCSI"
while :; do
[ -n "$(jobs -rp)" ] && echo > /dev/watchdog
sleep 10
done
mount -n -o remount,ro /
poweroff -f

243
test/TEST-31-ISCSI-MULTI/test.sh Executable file
View File

@@ -0,0 +1,243 @@
#!/bin/bash
TEST_DESCRIPTION="root filesystem over iSCSI"
KVERSION=${KVERSION-$(uname -r)}
DEBUGFAIL="loglevel=1"
#DEBUGFAIL="rd.shell rd.break rd.debug loglevel=7 "
#DEBUGFAIL="rd.debug loglevel=7 "
#SERVER_DEBUG="rd.debug loglevel=7"
#SERIAL="tcp:127.0.0.1:9999"
run_server() {
# Start server first
echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/root.ext3 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
-m 512M -smp 2 \
-display none \
${SERIAL:+-serial "$SERIAL"} \
${SERIAL:--serial file:"$TESTDIR"/server.log} \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
-net nic,macaddr=52:54:00:12:34:57,model=e1000 \
-net socket,listen=127.0.0.1:12330 \
-no-reboot \
-append "panic=1 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
-initrd $TESTDIR/initramfs.server \
-pidfile $TESTDIR/server.pid -daemonize || return 1
sudo chmod 644 $TESTDIR/server.pid || return 1
# Cleanup the terminal if we have one
tty -s && stty sane
echo Sleeping 20 seconds to give the server a head start
sleep 20
}
run_client() {
local test_name=$1; shift
echo "CLIENT TEST START: $test_name"
dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/client.img \
-m 512M -smp 2 -nographic \
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net nic,macaddr=52:54:00:12:34:01,model=e1000 \
-net socket,connect=127.0.0.1:12330 \
-no-reboot \
-append "panic=1 rw rd.auto rd.retry=50 console=ttyS0,115200n81 selinux=0 rd.debug=0 rd.shell=0 $DEBUGFAIL $*" \
-initrd $TESTDIR/initramfs.testing
if ! grep -F -m 1 -q iscsi-OK $TESTDIR/client.img; then
echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
return 1
fi
echo "CLIENT TEST END: $test_name [OK]"
return 0
}
do_test_run() {
initiator=$(iscsi-iname)
run_client "netroot=iscsi target1 target2" \
"root=LABEL=sysroot" \
"ip=192.168.50.101:::255.255.255.0::ens3:off" \
"ip=192.168.51.101:::255.255.255.0::ens4:off" \
"netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
"netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
"rd.iscsi.initiator=$initiator" \
|| return 1
echo "All tests passed [OK]"
return 0
}
test_run() {
if ! run_server; then
echo "Failed to start server" 1>&2
return 1
fi
do_test_run
ret=$?
if [[ -s $TESTDIR/server.pid ]]; then
sudo kill -TERM $(cat $TESTDIR/server.pid)
rm -f -- $TESTDIR/server.pid
fi
return $ret
}
test_setup() {
if ! command -v tgtd &>/dev/null || ! command -v tgtadm &>/dev/null; then
echo "Need tgtd and tgtadm from scsi-target-utils"
return 1
fi
# Create the blank file to use as a root filesystem
dd if=/dev/null of=$TESTDIR/root.ext3 bs=1M seek=20
dd if=/dev/null of=$TESTDIR/iscsidisk2.img bs=1M seek=20
dd if=/dev/null of=$TESTDIR/iscsidisk3.img bs=1M seek=20
kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
(
export initdir=$TESTDIR/overlay/source
. $basedir/dracut-init.sh
(
cd "$initdir"
mkdir -p -- dev sys proc etc var/run tmp
mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin
for i in bin sbin lib lib64; do
ln -sfnr usr/$i $i
done
mkdir -p -- var/lib/nfs/rpc_pipefs
)
inst_multiple sh shutdown poweroff stty cat ps ln ip \
mount dmesg mkdir cp ping grep setsid
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
inst_multiple -o ${_terminfodir}/l/linux
inst_simple /etc/os-release
inst ./client-init.sh /sbin/init
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
)
# second, install the files needed to make the root filesystem
(
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple sfdisk mkfs.ext3 poweroff cp umount setsid
inst_hook initqueue 01 ./create-root.sh
inst_hook initqueue/finished 01 ./finished-false.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \
-d "piix ide-gd_mod ata_piix ext3 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.makeroot $KVERSION || return 1
rm -rf -- $TESTDIR/overlay
# Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
if ! dd if=/dev/null of=$TESTDIR/client.img bs=1M seek=1; then
echo "Unable to make client sdb image" 1>&2
return 1
fi
# Invoke KVM and/or QEMU to actually create the target filesystem.
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/client.img \
-drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
-drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
-smp 2 -m 512M -nographic -net none \
-append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
grep -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
rm -- $TESTDIR/client.img
(
export initdir=$TESTDIR/overlay
. $basedir/dracut-init.sh
inst_multiple poweroff shutdown
inst_hook shutdown-emergency 000 ./hard-off.sh
inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-o "dash plymouth dmraid nfs" \
-a "debug" \
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.testing $KVERSION || return 1
# Make server root
dd if=/dev/null of=$TESTDIR/server.ext3 bs=1M seek=60
mkfs.ext3 -j -F $TESTDIR/server.ext3
mkdir $TESTDIR/mnt
sudo mount -o loop $TESTDIR/server.ext3 $TESTDIR/mnt
kernel=$KVERSION
(
export initdir=$TESTDIR/mnt
. $basedir/dracut-init.sh
(
cd "$initdir";
mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
)
inst /etc/passwd /etc/passwd
inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
dmesg mkdir cp ping \
modprobe tcpdump setsid \
/etc/services sleep mount chmod
inst_multiple tgtd tgtadm
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
done
inst_multiple -o ${_terminfodir}/l/linux
instmods iscsi_tcp crc32c ipv6
[ -f /etc/netconfig ] && inst_multiple /etc/netconfig
type -P dhcpd >/dev/null && inst_multiple dhcpd
[ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
inst_simple /etc/os-release
inst ./server-init.sh /sbin/init
inst ./hosts /etc/hosts
inst ./dhcpd.conf /etc/dhcpd.conf
inst_multiple /etc/nsswitch.conf /etc/rpc /etc/protocols
inst /etc/group /etc/group
cp -a /etc/ld.so.conf* $initdir/etc
sudo ldconfig -r "$initdir"
dracut_kernel_post
)
sudo umount $TESTDIR/mnt
rm -fr -- $TESTDIR/mnt
# Make server's dracut image
$basedir/dracut.sh -l -i $TESTDIR/overlay / \
-a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
-d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
--no-hostonly-cmdline -N \
-f $TESTDIR/initramfs.server $KVERSION || return 1
}
test_cleanup() {
if [[ -s $TESTDIR/server.pid ]]; then
sudo kill -TERM $(cat $TESTDIR/server.pid)
rm -f -- $TESTDIR/server.pid
fi
}
. $testdir/test-functions

View File

@@ -5,7 +5,7 @@ TEST_DESCRIPTION="root filesystem on NBD"
KVERSION=${KVERSION-$(uname -r)}
# Uncomment this to debug failures
#DEBUGFAIL="rd.shell rd.break rd.debug"
#DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_target=console loglevel=7 systemd.log_level=debug"
#SERIAL="tcp:127.0.0.1:9999"
run_server() {
@@ -16,7 +16,7 @@ run_server() {
-drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext2 \
-drive format=raw,index=1,media=disk,file=$TESTDIR/nbd.ext2 \
-drive format=raw,index=2,media=disk,file=$TESTDIR/encrypted.ext2 \
-m 256M -smp 2 \
-m 512M -smp 2 \
-display none \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
-net socket,listen=127.0.0.1:12340 \
@@ -187,7 +187,7 @@ client_run() {
make_encrypted_root() {
# Create the blank file to use as a root filesystem
dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=20
dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=40
dd if=/dev/null of=$TESTDIR/flag.img bs=1M seek=1
kernel=$KVERSION
@@ -249,7 +249,7 @@ make_encrypted_root() {
$testdir/run-qemu \
-drive format=raw,index=0,media=disk,file=$TESTDIR/flag.img \
-drive format=raw,index=1,media=disk,file=$TESTDIR/encrypted.ext2 \
-m 256M -smp 2\
-m 512M -smp 2\
-nographic -net none \
-append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
-initrd $TESTDIR/initramfs.makeroot || return 1
@@ -258,7 +258,7 @@ make_encrypted_root() {
}
make_client_root() {
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=30
dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=60
mke2fs -F -j $TESTDIR/nbd.ext2
mkdir $TESTDIR/mnt
sudo mount -o loop $TESTDIR/nbd.ext2 $TESTDIR/mnt
@@ -299,7 +299,7 @@ make_client_root() {
}
make_server_root() {
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=30
dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=60
mke2fs -F $TESTDIR/server.ext2
mkdir $TESTDIR/mnt
sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt

View File

@@ -51,10 +51,12 @@ client_test() {
fi
$testdir/run-qemu -drive format=raw,index=0,media=disk,file="$TESTDIR"/client.img -m 512M -smp 2 -nographic \
-net socket,connect=127.0.0.1:12350 \
-net nic,macaddr=52:54:00:12:34:$mac1,model=e1000 \
-net nic,macaddr=52:54:00:12:34:$mac2,model=e1000 \
-net nic,macaddr=52:54:00:12:34:$mac3,model=e1000 \
-net socket,vlan=0,connect=127.0.0.1:12350 \
-net nic,vlan=0,macaddr=52:54:00:12:34:$mac1,model=e1000 \
-net nic,vlan=0,macaddr=52:54:00:12:34:$mac2,model=e1000 \
-net nic,vlan=0,macaddr=52:54:00:12:34:$mac3,model=e1000 \
-net nic,vlan=1,macaddr=52:54:00:12:34:98,model=e1000 \
-net nic,vlan=2,macaddr=52:54:00:12:34:99,model=e1000 \
-watchdog i6300esb -watchdog-action poweroff \
-no-reboot \
-append "panic=1 rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console loglevel=7" \
@@ -146,14 +148,14 @@ test_client() {
client_test "MULTINIC bridging" \
00 01 02 \
"root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens4,ens5" \
"root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens6,ens7" \
"bridge0" || return 1
return 0
}
test_setup() {
# Make server root
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120
mke2fs -j -F -- "$TESTDIR"/server.ext3
mkdir -- "$TESTDIR"/mnt
sudo mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt

View File

@@ -18,10 +18,10 @@ run_server() {
-hda "$TESTDIR"/server.ext3 \
-m 512M -smp 2 \
-display none \
-net socket,vlan=0,listen=127.0.0.1:12350 \
-net socket,vlan=1,listen=127.0.0.1:12351 \
-net socket,vlan=2,listen=127.0.0.1:12352 \
-net socket,vlan=3,listen=127.0.0.1:12353 \
-net socket,vlan=0,listen=127.0.0.1:12370 \
-net socket,vlan=1,listen=127.0.0.1:12371 \
-net socket,vlan=2,listen=127.0.0.1:12372 \
-net socket,vlan=3,listen=127.0.0.1:12373 \
-net nic,vlan=0,macaddr=52:54:01:12:34:56,model=e1000 \
-net nic,vlan=1,macaddr=52:54:01:12:34:57,model=e1000 \
-net nic,vlan=2,macaddr=52:54:01:12:34:58,model=e1000 \
@@ -59,11 +59,11 @@ client_test() {
return 1
fi
$testdir/run-qemu -hda "$TESTDIR"/client.img -m 256M -smp 2 -nographic \
-net socket,vlan=0,connect=127.0.0.1:12350 \
${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12351} \
-net socket,vlan=2,connect=127.0.0.1:12352 \
${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12353} \
$testdir/run-qemu -hda "$TESTDIR"/client.img -m 512M -smp 2 -nographic \
-net socket,vlan=0,connect=127.0.0.1:12370 \
${do_vlan13:+-net socket,vlan=1,connect=127.0.0.1:12371} \
-net socket,vlan=2,connect=127.0.0.1:12372 \
${do_vlan13:+-net socket,vlan=3,connect=127.0.0.1:12373} \
-net nic,vlan=0,macaddr=52:54:00:12:34:01,model=e1000 \
-net nic,vlan=0,macaddr=52:54:00:12:34:02,model=e1000 \
-net nic,vlan=1,macaddr=52:54:00:12:34:03,model=e1000 \
@@ -160,7 +160,7 @@ root=nfs:192.168.50.1:/nfs/client bootdev=br0
test_setup() {
# Make server root
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=60
dd if=/dev/null of="$TESTDIR"/server.ext3 bs=1M seek=120
mke2fs -j -F -- "$TESTDIR"/server.ext3
mkdir -- "$TESTDIR"/mnt
mount -o loop -- "$TESTDIR"/server.ext3 "$TESTDIR"/mnt

View File

@@ -8,6 +8,7 @@ $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu "
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS=""
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS=""
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS=""
[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-enable-kvm"
[[ $BIN ]] || {
echo "Could not find a working KVM or QEMU to test with!" >&2