Compare commits

..

156 Commits
024 ... 026

Author SHA1 Message Date
Harald Hoyer
19d69051a3 NEWS: dracut-026 2013-03-08 07:07:48 +01:00
Harald Hoyer
31737a05e1 systemd: add version check in install() 2013-03-08 07:07:01 +01:00
Harald Hoyer
1161f03777 fips: add lzo module 2013-03-08 07:05:55 +01:00
Harald Hoyer
cf24ac8c19 crypt, dmraid, mdraid: use for_each_host_dev_and_slaves_all()
To catch _all_ UUIDs and not only the first one, use
for_each_host_dev_and_slaves_all
2013-03-07 16:00:00 +01:00
Harald Hoyer
af3ef92a6b dmsquash-live: add iso9660 kernel module 2013-03-07 15:49:24 +01:00
Harald Hoyer
c46cda8260 split 95udev-rules/59-persistent-storage.rules to md and dm modules 2013-03-07 15:01:47 +01:00
Harald Hoyer
34bd2be23f dracut-functions.sh: fix inst_rule_programs()
Logic for the $env{.*} check was reversed and env was missing.

Thanks Colin Guthrie!
2013-03-07 15:01:47 +01:00
Harald Hoyer
c3dd68fcf1 iscsi: run iscsiroot even if no network configured
Also inject finished hooks for every iscsiroot netroot
2013-03-07 14:17:49 +01:00
Harald Hoyer
3e35441f18 kernel-modules: better match for arm architecure 2013-03-07 14:17:33 +01:00
Harald Hoyer
dde2db3da9 lsinitrd: use /boot/<machine-id>/<kernel-version>/initrd as the default image
if /boot/<machine-id> exists; then
use /boot/<machine-id>/<kernel-version>/initrd as the default image;
else fallback to /boot/initramfs-<kernel-version>.img
2013-03-07 13:03:24 +01:00
Harald Hoyer
cbc21754e5 kernel-modules: move some kernel modules out of unconditional install 2013-03-07 12:10:53 +01:00
Harald Hoyer
eb2dc8c34b systemd: add missing dracut-mount.service dracut-pre-mount.service 2013-03-07 11:47:00 +01:00
Harald Hoyer
c4e098a514 document /usr/lib/dracut/dracut.conf.d 2013-03-07 11:44:44 +01:00
Harald Hoyer
72875215a3 dracut.conf: move default settings to distro example 2013-03-07 11:44:16 +01:00
Harald Hoyer
335bc217b3 dracut.sh: rename source_dirs_prio() to dropindirs_sort() 2013-03-07 11:43:52 +01:00
Harald Hoyer
510aecdbd8 systemd: add missing dracut-mount.sh dracut-pre-mount.sh dracut.target 2013-03-07 10:35:06 +01:00
Harald Hoyer
9dd9d81fc6 add 50-dracut.install 2013-03-07 10:08:35 +01:00
Harald Hoyer
a5b48ce798 add systemd-bootchart module 2013-03-07 09:56:30 +01:00
Harald Hoyer
59afbd8e73 add missing systemd service man pages 2013-03-07 09:42:00 +01:00
Harald Hoyer
348baca3e4 dracut.conf.d/fedora.conf.example: turn off rd.auto
realinitpath is not needed anymore for systemd >= 198
2013-03-06 17:29:12 +01:00
Harald Hoyer
83691c413f testsuite fixup 2013-03-06 17:29:12 +01:00
Harald Hoyer
ca36b9b8f8 base: save host_devs which we need bring up and process them with wait_for_dev 2013-03-06 17:29:12 +01:00
Harald Hoyer
a9c7dc74c4 base: in systemd mode parse-root-opts.sh is in the services 2013-03-06 17:29:12 +01:00
Harald Hoyer
ce862de624 base/dracut-lib.sh: reset /etc/profile 2013-03-06 17:29:12 +01:00
Harald Hoyer
500861cd05 base/init.sh: reset main loop counter, if work is in initqueue 2013-03-06 17:29:12 +01:00
Harald Hoyer
44d26d9209 base/dracut-lib.sh: extend wait_for_dev() for systemd 2013-03-06 17:29:12 +01:00
Harald Hoyer
35270e34d0 rootfs-block/parse-block.sh: wait_for_dev 2013-03-06 17:29:12 +01:00
Harald Hoyer
fe654ff0aa usrmount: in systemd mode, functionality is in systemd 2013-03-06 17:29:12 +01:00
Harald Hoyer
5e1e1ec060 iscsi, nbd: call write_fs_tab() and write /etc/fstab 2013-03-06 17:29:12 +01:00
Harald Hoyer
2673ff1932 rootfs-block: in systemd mode, functionality is in the dracut services 2013-03-06 17:29:11 +01:00
Harald Hoyer
e8f7ea6794 resume: generate rules already in parse-resume.sh 2013-03-06 17:29:11 +01:00
Harald Hoyer
3899211bfc resume: in systemd mode move functionality in the dracut services 2013-03-06 17:29:11 +01:00
Harald Hoyer
6e0c1c448d nfs/nfsroot.sh: trigger nfs mount with cat'ing /etc/fstab
otherwise the whole nfs communication can take too long for the
systemd-fstab-generator
2013-03-06 17:29:11 +01:00
Harald Hoyer
6ae68b4674 kernel-modules: handle rd.driver.* in systemd mode in dracut-pre-udev 2013-03-06 17:29:11 +01:00
Harald Hoyer
41eba87b32 dracut_need_initqueue 2013-03-06 17:29:11 +01:00
Harald Hoyer
a1084c02fd fs-lib/fs-lib.sh: add write_fs_tab() 2013-03-06 17:29:11 +01:00
Harald Hoyer
5ac8420abc crypt/parse-crypt.sh: don't generate luks rules in systemd mode 2013-03-06 17:29:11 +01:00
Harald Hoyer
24d009507f btrfs: no need for btrfs_timeout in systemd mode 2013-03-06 17:29:11 +01:00
Harald Hoyer
e9020221a7 crypt: do not cleanup in systemd mode 2013-03-06 17:29:11 +01:00
Harald Hoyer
b59e9e5724 network/netroot.sh: remove the dhcp finished hook, if we have a handler 2013-03-06 17:22:09 +01:00
Harald Hoyer
b5859d6359 i18n: no manual setup needed if systemd is in the game 2013-03-06 17:22:09 +01:00
Harald Hoyer
dbfaae0e34 systemd: changes for new initrd services
Requires systemd >= 198
2013-03-06 17:21:47 +01:00
Harald Hoyer
8d85429a44 dracut-functions.sh: add dracut_need_initqueue() dracut_module_included()
for all rules files, which reference initqueue also call
dracut_need_initqueue()
2013-03-06 16:04:03 +01:00
Harald Hoyer
3e4ab73cd4 test: make testsuite work with systemd 2013-03-02 13:27:08 +01:00
Harald Hoyer
4e32b2e916 test: removed unused cryptroot-ask.sh scripts 2013-03-02 13:22:29 +01:00
Harald Hoyer
356333b331 test: add finished-false.sh for create-root.sh initqueue job 2013-03-02 13:20:59 +01:00
Harald Hoyer
f62f3a2191 reset initqueue loop counter only if new uevents exist 2013-03-02 13:19:20 +01:00
Harald Hoyer
389333396a resume: move resume hook from mount to pre-mount 2013-03-02 13:11:38 +01:00
Harald Hoyer
cfb7410cd0 mdraid/mdraid_start.sh: remove mdmon workaround 2013-03-02 13:10:57 +01:00
Harald Hoyer
f672b1c399 btrfs/btrfs_timeout.sh: do not "exit 0" 2013-03-02 13:10:04 +01:00
Harald Hoyer
f12f694355 btrfs: Use upstream 64-btrfs.rules 2013-02-22 11:14:04 +01:00
Lars R. Damerow
9a9c6e1256 dracut: write initramfs to temp file then move into place
We've been finding cases where multiple instances of dracut can be launched
simultaneously, resulting in a corrupted initramfs file. This patch makes
dracut write the initramfs to a new file, then move it into place atomically.
2013-02-22 11:05:29 +01:00
Harald Hoyer
9c65c125a9 systemd: change path of switch-root.conf
we do not have to clean it up for /etc/switch-root.conf
2013-02-21 12:18:21 +01:00
Harald Hoyer
7d4d3f8da6 lvm/module-setup.sh: use for_each_host_dev_and_slaves_all
Use for_each_host_dev_and_slaves_all to get all lvm setups for the
host-only case.

Thanks to Olivier Thauvin
2013-02-21 12:13:56 +01:00
Harald Hoyer
569ffe77bf systemd: add systemd-modules-load.service and hook dirs 2013-02-21 12:13:09 +01:00
Harald Hoyer
a42b2b8133 introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
filenames in /etc/dracut.conf.d.

Packages should use /usr/lib/dracut/dracut.conf.d rather than
/etc/dracut.conf.d. /etc/dracut.conf.d belongs to the system
administrator.
2013-02-19 17:46:24 +01:00
Harald Hoyer
31ba4de21d url-lib/url-lib.sh: remove bashism
remove the forgotten bashism "+="
2013-02-19 16:13:49 +01:00
Stefan Reimer
a005c47763 base/init.sh: create /run/log
If the systemd module is not used /run/log is not created which results
in dangeling softlink from /var/log which causes stuff to fail.
2013-02-18 12:05:23 +01:00
Harald Hoyer
5db6ca5a4b dracut: enable initramfs building without kernel modules 2013-02-18 12:03:02 +01:00
Harald Hoyer
1a6fdf2417 btrfs: use "btrfs device ready" 2013-02-18 11:58:11 +01:00
Harald Hoyer
27a2c3a406 systemd: services got renamed 2013-02-14 12:32:12 +01:00
Harald Hoyer
b347edfa23 dracut-emergency.service: wants systemd-vconsole-setup.service 2013-02-14 12:32:04 +01:00
Colin Guthrie
3ed09d970e resume: Ensure we remove the timout job when we find the resume device 2013-02-13 17:46:24 +01:00
Thomas Backlund
a28e2aeefe kernel-modules: Add ehci support for kernel 3.8+
Kernel 3.8 split ehci-hcd into ehci-hcd, ehci-pci and ehci-platform,
so adapt the list to cope with this change.
2013-02-13 17:42:32 +01:00
Wim Muskee
c6a71c7b8a make nbd port check more robust
The following change makes the check for the nbd port or named export
more robust.
I wasn't sure whether to include sed in the dracut_install() of
module-setup.sh since net already does that (and nbd depends on that).
2013-02-11 15:44:11 +01:00
Harald Hoyer
6ecb9a2d68 url-lib/url-lib.sh: add proxy support for curl 2013-02-11 13:56:04 +01:00
Harald Hoyer
918a6874df url-lib/url-lib.sh: remove bashisms 2013-02-11 13:55:44 +01:00
Harald Hoyer
2663232a01 systemd/dracut-initqueue.sh: call udevadm settle directly 2013-02-11 11:49:19 +01:00
Harald Hoyer
cebab07e68 systemd/dracut-initqueue: run after cryptsetup.target 2013-02-11 11:49:19 +01:00
Harald Hoyer
a04f3077cd systemd/dracut-pre-pivot.sh: remove /dev/root symlink after shell 2013-02-11 11:49:19 +01:00
Harald Hoyer
04b873598b systemd: set udev debug/info via config file and report obsolete options 2013-02-11 11:49:19 +01:00
Harald Hoyer
22137f9cac systemd/dracut-pre-trigger.sh: enable rd.break=pre-trigger debug shell 2013-02-11 11:49:19 +01:00
Harald Hoyer
54665349ec systemd/dracut-cmdline.sh: create /run/log subdir 2013-02-11 11:49:19 +01:00
Harald Hoyer
f251a89772 systemd/dracut-pre-trigger.service: load service on demand 2013-02-11 11:49:19 +01:00
Harald Hoyer
fbdfa57746 systemd/dracut-pre-udev.service: load service on demand 2013-02-11 11:49:19 +01:00
Harald Hoyer
6b095274fb systemd: trigger systemd-vconsole-setup.service only on demand 2013-02-11 11:49:19 +01:00
Harald Hoyer
11174408e8 systemd/dracut-initqueue.sh: replace $UDEV_QUEUE_EMPTY
for systemd-udevd the version of udevd is high enough
2013-02-11 11:49:19 +01:00
Harald Hoyer
c2117747fd virtfs: add virtio_pci kernel module 2013-02-11 11:49:19 +01:00
Harald Hoyer
4f6e293308 udev-rules: modify udev rules on initramfs creation time 2013-02-11 11:49:19 +01:00
Harald Hoyer
d9076cac19 btrfs/btrfs_finished.sh: use btrfs device ready for probing 2013-02-08 16:52:38 +01:00
Harald Hoyer
ff52ca1b57 btrfs/80-btrfs.rules: remove modprobe of btrfs module
this should be automatically modprobed by the kernel on demand
2013-02-08 16:52:38 +01:00
Harald Hoyer
8a3c4957fc drm/module-setup.sh: make drm module only install on dependency 2013-02-08 16:52:38 +01:00
Harald Hoyer
3f54a83ca8 dracut.sh: make /var/log a symlink to /run/log 2013-02-08 16:52:38 +01:00
Harald Hoyer
7fa3b9e376 url-lib/url-lib.sh: turn off curl globbing
https://bugzilla.redhat.com/show_bug.cgi?id=907497
2013-02-08 16:52:38 +01:00
Harald Hoyer
39135af155 network/ifup.sh: echo in get_vid() instead of using the return value
The return value is module 256, so VLAN ids > 255 could not be returned.
2013-02-08 16:52:38 +01:00
Dan Horák
02640e8e65 set peer for point-to-point connections
network/net-lib.sh: only set net vars, if they have a value
2013-02-08 16:52:30 +01:00
Frederick Grose
579f385384 Provide devices to enable booting with rd.live.overlay.readonly=1 2013-02-06 13:52:30 +01:00
Kevin Yung
56d60c4b2d network/ifup.sh: enable bridged vlan interfaces
To use vlan for net boot, you need to specify vlan and ip kernel options
for the boot interface. For example,

 vlan=eth1.1:eth1 bootdev=eth1.1
 ip=1.2.3.4:1.2.3.4::255.255.255.0:my-hostname:eth1:none

To use bridge for net boot, you need to specify bridge and ip kernel
option for the boot interface. For example

 bridge=br1:eth1 bootdev=br1
 ip=1.2.3.4:1.2.3.4::255.255.255.0:my-hostname:eth1:none

In my environment, I needs to boot machines from network within
a vlan or on a bridged network.	I found curent dracut release
if-up.sh script in 40network module bypass ip setting for both
bridge and vlan interface.
2013-02-06 13:52:30 +01:00
Dan Horák
62fd2b3644 fix CTC example in rd.znet
The CTC interface uses 2 channels.
2013-02-06 13:52:30 +01:00
Colin Guthrie
cd9072d342 Mount /proc before including dracut-lib.sh.
When dracut-lib.sh is sourced it checks the command line (when not using systemd)
as part of the check_quiet() call.

Therefore mount /proc earlier in init.

Avoids the error:

init: 77: /lib/dracut-lib.sh: /proc/cmdline: No such file or directory
2013-02-06 13:52:30 +01:00
Harald Hoyer
19bab59c48 dracut.sh: reverting return value change
reverting _get_fs_type() return values of patch
c8d685c9d3
2013-02-05 16:45:42 +01:00
Harald Hoyer
d8b627b9dc shutdown: call "losetup -D" on shutdown 2013-02-05 11:04:02 +01:00
Harald Hoyer
6320d072a1 mdmon: renamed mdmon-offroot@.service to mdmon@.service 2013-02-05 10:58:06 +01:00
Harald Hoyer
7abeb49878 TODO: updated 2013-02-05 10:58:05 +01:00
Harald Hoyer
14fcfbec3e network/net-genrules.sh: remove some bashisms 2013-01-30 17:22:25 +01:00
Joe Lawrence
fa9f15e3be Support out-of-tree and updated drivers in initramfs creation
The find_kernel_modules_by_path function shouldn't filter out modules not
located underneath the /lib/modules/ver/kernel directory as out-of-tree
drivers may reside in /lib/modules/ver/extra and updated drivers in
/lib/modules/ver/updates.

Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
2013-01-25 13:07:59 +01:00
Harald Hoyer
ae4758ce0d rootfs-block/mount-root.sh: fixup for 8b6bf0ef5
not only fix the warning message, but the real mount arguments, too
2013-01-23 16:24:33 +01:00
Harald Hoyer
66f01450a8 NEWS: update for version 025 2013-01-23 16:12:18 +01:00
Harald Hoyer
e5786ed1b7 version 025 2013-01-23 15:38:48 +01:00
Harald Hoyer
b47517140b dracut.spec: add drm module 2013-01-23 15:38:48 +01:00
Colin Guthrie
3de6001e1e Include crc32c module for xfs.
Just like btrfs, xfs now requires CRC module that cannot be resolved via
normal module resolving.

Move this hack into fs-lib and remove it from btrfs module.

https://bugs.mageia.org/show_bug.cgi?id=8676
2013-01-23 15:24:27 +01:00
Harald Hoyer
c8d685c9d3 dracut-functions.sh: cope with optional field #7 in mountinfo
also handle fstab entries with LABEL=, UUID= and PARTUUID=
2013-01-23 15:24:27 +01:00
Harald Hoyer
d6d3173916 network/dhclient-script.sh: also touch "/tmp/setup_net_<mac>.ok" 2013-01-23 15:24:27 +01:00
Harald Hoyer
8b6bf0ef57 romount fix 2013-01-23 15:24:27 +01:00
Dave Young
7bd8f23303 Add memory usage trace to diffrent hook points
Hi, Here is an update of this patch, fixed the local variable issue.
2013-01-23 15:24:27 +01:00
dyoung@redhat.com
a08ea34aba add function getargnum
For cmdline argument with numeric value, add a new function getargnum
It will get proper value with default value as $1, min value as $2,
max value as $3, and param name as $4. valid result will be echo to stdout.
for nul or value not valid it will just echo the default value.
Note: The values should be >=0

[v1->v2]: add arg <minval>
[v2->v3]: do not use bash string match =~

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Dave Young
6cb77ea91f use linkup in dhclient-script.sh
linkup is a wrapper function for waiting interface ready and up.
change to use linkup as what we do in ifup script.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Colin Guthrie
c586b033a7 Extend 52f1b041 to allow devices to be specified in config files as well as cmdline.
This also changes the command line switch to be --add-device and the
config directive is set to add_device. This was chosen as device= in the
config file seems too generic and not quite as consistent with other
directives (i.e. drivers/add_drivers)

The --device command line is still supported but it should be considered
deprecated in favour of --add-device.
2013-01-23 15:24:27 +01:00
Jiri Pirko
a9f634f815 fix teamd exec in case config does not include devname
In case that configuration file did not include name of team device,
teamd would not start. Fix this by adding "-t" parameter.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-01-23 15:24:27 +01:00
Harald Hoyer
551c2dd71f shutdown: kill all processes and report remaining ones 2013-01-22 15:31:45 +01:00
Harald Hoyer
ffc4f173b6 mdraid: add mdmon-offroot@.service and takeover mdmon in shutdown 2013-01-22 15:31:41 +01:00
Harald Hoyer
ebd1d65a1b shutdown: source pre-shutdown hook and force quit plymouth before umount 2013-01-22 15:31:22 +01:00
Harald Hoyer
5b68300899 dracut-lib.sh: force hide plymouth in shutdown emergency shell 2013-01-22 15:31:19 +01:00
Harald Hoyer
2b6dd6a1fc dracut-functions.sh: add pre-shutdown hook 2013-01-22 15:31:16 +01:00
Harald Hoyer
1d22c670b0 dracut.asc: document shutdown procedure 2013-01-18 10:13:14 +01:00
Harald Hoyer
0ae480dcbf dracut.asc: s/rd.ip/ip/g 2013-01-07 18:00:06 +01:00
Harald Hoyer
256cba18c3 dracut-functions.sh: fixed inst_rules search path 2013-01-03 09:29:05 +01:00
Harald Hoyer
e6fcec9173 usrmount/mount-usr.sh: filter "subvol=" from root rflags
https://bugzilla.redhat.com/show_bug.cgi?id=890577
2013-01-02 14:06:44 +01:00
Harald Hoyer
1db3d2615d kernel-modules: create /etc/modprobe.d if it does not yet exist
https://bugzilla.redhat.com/show_bug.cgi?id=873220
2013-01-02 13:57:40 +01:00
Harald Hoyer
5204d1d36d dmsquash-live: fixed checkisomd5 service call 2013-01-02 13:56:27 +01:00
dyoung@redhat.com
3fa59d171d Wait for interface up at the early stage
In case long delay of network driver initqueue will exit before net dev is
ready. We have no chance to setup it then.
For dhcp, when we finish the setup there will be a setup_net_<dev>.ok. Doing
same for static ip case. Also add a check to initqueue when we generate udev
rules to ensure it's early enough.

[v1->v2]: only wait for bootdev or it's possible to cause boot fail for
waiting for non-bootdev. For example bond0->eth0, set bond0 as bootdev and
dhcp, we only need to wait bond0 setup ok.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:09:00 +01:00
dyoung@redhat.com
d7264a3cc0 Get ifaces for udev rule use
In case BOOTIF is not set and IFACES are not set in bonding/vlan/bridge code,
net-genrule.sh will fall to bring up all net interfaces.

Here add a failsafe option to read IFACES from /tmp/net.ifaces

[v1->v2]: move IFACES reading from net.ifaces after bonding/vlan/bridge info
code chunks.
[v2->v3]: [ -n "$IFACES" ] should be  [ -z "$IFACES" ]

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
9078167927 Wait for link ready before use the interface
Some network driver will take long time to initialize. We have an example
in a HP machine which take about one minute for this. The callback such as
"ip link set <dev> up" will fail, afterwards setup for network will also
fail.

Fix this by add a new function wait_for_if_link, wait the link ready before
use it.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
3bd7fba7af Change to use linkup function in network scripts
Update ifup.sh and fcoe-up.sh, use linkup function instead of directly
call ip command.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
b455451f49 Add function linkup
set link up usually include two steps, ip link set <dev> up and
wait_for_if_up <dev>. Now do these two steps in one function linkup.
Later patch will add other code into it.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
efa5eb424d Move wait for if functions to net lib
net-lib.sh are created for net related functions, move the wait_for_if* to
net-lib.sh naturally.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
Cong Wang
3baa150bd4 dracut: add team device support
V2: merge patch 2/2
    fix active-backup mode by adding slaves one by one
    sync with the latest teamd
    improve the comments
    wait for team ports to come up
    install /etc/libnl/classid too

This patch adds the initial support for team device [1].
A new cmdline team= is introduced for it.

Note, currently we don't support stacked devices
on/under team, it is tricky and can be added on request.

1. http://www.libteam.org/

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <amwang@redhat.com>
2012-12-14 09:06:51 +01:00
Harald Hoyer
43cc4d84bc change for "udevadm control": s/--reload-rules/--reload/g 2012-12-14 09:04:56 +01:00
Harald Hoyer
6b84015e67 iscsi/iscsiroot.sh: reload rules after adding 99-iscsi-root.rules 2012-12-14 09:04:56 +01:00
Harald Hoyer
60bbb8fcc9 cms/cms-write-ifcfg.sh: also fill in /etc/hostname 2012-12-14 09:04:56 +01:00
Harald Hoyer
16c84f2873 udev-rules/udev-rules-prepare.sh: get UDEVVERSION, if unset 2012-12-14 09:04:56 +01:00
Amadeusz Żołnowski
579238a3ac Fallback to external blkid and path_id in udev rules for <udev-176.
Starting with commit 24a38bc1cb dracut
uses udev builtins but still depends on >=udev-166 in dracut.spec.  This
patch makes dracut work with older udev again.

All credits go to Alexander Tsoy <alexander@tsoy.me>; see

  https://bugs.gentoo.org/show_bug.cgi?id=437700
2012-12-14 09:04:56 +01:00
Harald Hoyer
2b5cd3dbf8 nfs/nfsroot-cleanup.sh: mount --bind instead of --move 2012-12-14 09:04:55 +01:00
Harald Hoyer
3d8a164d0e dracut.spec: add iputils and iproute requirement for dracut-network 2012-12-14 09:04:55 +01:00
Nicolas Chauvet
00ae54f00a Fix rd.blacklist.driver when no /etc/modprobe.d exists
This bug was reported as http://bugzilla.redhat.com/873220#c2

As the /etc/modprobe.d isn't created in the boot process
nor bundled within the initramfs, the initramfsblacklist.conf
cannot be created.

Instead, the /usr/lib/modprobe.d directory is available and using it
will restore the blacklist behavior.
2012-12-14 09:04:55 +01:00
Will Woods
488d55c546 add 'swapoff' to initramfs to fix shutdown/reboot
systemd shutdown/reboot won't work unless 'swapoff' is available.
2012-12-14 09:04:55 +01:00
Will Woods
9d6165f235 drop NEWROOT from module-setup.sh
This was almost certainly copy-pasted from mount-root.sh, but it's not
valid here - dracut doesn't use NEWROOT outside of the initramfs.
2012-12-14 09:04:55 +01:00
Dave Young
2258f00e91 split plymouth module
Kdump module will need the drm and kms kernel modules so user can see the
emergency shell at least.

Fix this by split 50plymouth module to 50drm and 50plymouth. Moving the
installkernel part to 50drm so user can use drm directly without adding
extra plymouth utils.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Chao Wang <chaowang@redhat.com>
2012-12-14 09:04:55 +01:00
Harald Hoyer
2bac2d6d76 systemd/dracut-cmdline.service: run before systemd-vconsole-setup
cmdline does generate vconsole.conf, which is needed by vconsole-setup
2012-12-14 09:04:55 +01:00
Harald Hoyer
b6b895bab5 systemd/service-to-run.sh: silence "cp" errors 2012-12-14 09:04:55 +01:00
Harald Hoyer
fdeae2a3ac crypt/crypt-run-generator.sh: do not timeout for LUKS passwords with systemd 2012-12-14 09:04:55 +01:00
Harald Hoyer
040f388331 dmsquash-live: add systemd checkisomd5 service 2012-12-14 09:04:55 +01:00
Harald Hoyer
7990578443 network: fixed MAC address assignment 2012-11-26 13:49:38 +01:00
Harald Hoyer
528ae4f46c systemd/module-setup.sh: turn off RateLimit for the journal 2012-11-26 13:49:19 +01:00
Harald Hoyer
0fb7b847c5 cms/cmssetup.sh: sync udev rules names with network/net-genrules.sh
https://bugzilla.redhat.com/show_bug.cgi?id=825199
2012-11-22 12:32:19 +01:00
Harald Hoyer
a67a6f957d nfs/nfs-start-rpc.sh: prevent mount error, if sunrpc kernel module is not in the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=870632
2012-11-22 12:29:43 +01:00
Harald Hoyer
965edeb63b i18n/parse-i18n.sh: fix locale.conf caused by 4dbc1d1bb3
https://bugzilla.redhat.com/show_bug.cgi?id=870632
2012-11-22 11:59:10 +01:00
Harald Hoyer
329bbd797f crypt/crypt-run-generator.sh: fixup last commit 065fc56ab2 2012-11-21 16:36:37 +01:00
Robert Buchholz
065fc56ab2 Make short uuid specification for allow-discards work
1) strstr " $discarduuids " did not remove the optional
'luks-' prefix from the argument as the documentation says.

2) The lookup seems backwards. $luksdev ($luks in the other code copy)
is the full uuid and thus one should check whether the user-supplied
argument (short form) is contained therein, not the other way around.

Before this commit, the only way to trigger allow-discards was to
specify the full uuid without the 'luks-' prefix.
2012-11-21 16:01:45 +01:00
Harald Hoyer
64d144aece Add sosreport script and generate /run/initramfs/sosreport.txt 2012-11-21 14:17:43 +01:00
Harald Hoyer
2d9b156e9e dracut.sh: do not strip signed kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=873796
2012-11-21 14:07:32 +01:00
Harald Hoyer
2b9be6f707 [nfs|cifs]root.sh: make "/dev/root" a symlink, so it gets cleaned up later on 2012-11-19 17:03:55 +01:00
Harald Hoyer
b26897fb60 dracut.sh: only 'warn' not 'error', if we don't strip 2012-10-19 11:20:30 +02:00
WANG Chao
8bf25df640 40network/ifup.sh: do_static() and do_ipv6auto return 0 if no errors.
Commit a0be1ed removes some lines from do_static() and do_ipv6auto().

When $hostname is empty, do_static() and do_ipv6auto() will return 1
and fails to run setup_net at the last of ifup.sh

Signed-off-by: WANG Chao <chaowang@redhat.com>
2012-10-19 11:10:52 +02:00
Harald Hoyer
e743cfdd4b dracut.conf.d/fedora.conf.example: s/kernelcmdline/kernel_cmdline 2012-10-19 11:10:03 +02:00
Harald Hoyer
636e5cd2d5 dracut.sh: only save $kernel_cmdline, if set 2012-10-19 11:09:38 +02:00
162 changed files with 2096 additions and 731 deletions

16
50-dracut.install Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
ret=0
case "$1" in
add)
dracut "$3"/initrd "$2"
ret=$?
;;
remove)
rm -f "$3"/initrd
ret=$?
;;
esac
exit $ret

View File

@@ -1,4 +1,4 @@
VERSION=024
VERSION=026
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
-include Makefile.inc
@@ -24,10 +24,11 @@ man8pages = dracut.8 \
mkinitrd.8 \
modules.d/98systemd/dracut-cmdline.service.8 \
modules.d/98systemd/dracut-initqueue.service.8 \
modules.d/98systemd/dracut-mount.service.8 \
modules.d/98systemd/dracut-pre-mount.service.8 \
modules.d/98systemd/dracut-pre-pivot.service.8 \
modules.d/98systemd/dracut-pre-trigger.service.8 \
modules.d/98systemd/dracut-pre-udev.service.8 \
modules.d/98systemd/initrd-switch-root.service.8 \
modules.d/98systemd/udevadm-cleanup-db.service.8
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
@@ -91,6 +92,7 @@ install: dracut-version.sh
install -m 0755 lsinitrd.sh $(DESTDIR)$(bindir)/lsinitrd
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
@@ -114,6 +116,8 @@ endif
if [ -f install/dracut-install ]; then \
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
fi
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
dracut-version.sh:
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh

42
NEWS
View File

@@ -1,3 +1,45 @@
dracut-026
==========
- introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
filenames in /etc/dracut.conf.d.
Packages should use /usr/lib/dracut/dracut.conf.d rather than
/etc/dracut.conf.d for drop-in configuration files.
/etc/dracut.conf and /etc/dracut.conf.d belong to the system administrator.
- uses systemd-198 native initrd units
- totally rely on the fstab-generator in systemd mode for block devices
- dracut systemd now uses dracut.target rather than basic.target
- dracut systemd services optimize themselves away
- fixed hostonly parameter generation
- turn off curl globbing (fixes IPv6)
- modify the udev rules on install and not runtime time
- enable initramfs building without kernel modules (fixed regression)
- in the initqueue/timeout,
reset the main loop counter, as we see new udev events or initqueue/work
- fixed udev rule installation
dracut-025
==========
- do not strip signed kernel modules
- add sosreport script and generate /run/initramfs/sosreport.txt
- make short uuid specification for allow-discards work
- turn off RateLimit for the systemd journal
- fixed MAC address assignment
- add systemd checkisomd5 service
- splitout drm kernel modules from plymouth module
- add 'swapoff' to initramfs to fix shutdown/reboot
- add team device support
- add pre-shutdown hook
- kill all processes in shutdown and report remaining ones
- "--device" changed to "--add-device" and "add_device=" added for conf files
- add memory usage trace to different hook points
- cope with optional field #7 in /proc/self/mountinfo
- lots of small bugfixes
dracut-024
==========
- new dracut option "--device"

3
TODO
View File

@@ -7,7 +7,6 @@ Items are ordered in priority.
INITRAMFS TODO
- use info and warn prefix
- add sosreport
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
- put "root=" parsing hooks in separate hook dir
- call "root=" parsing hooks after getting new rootpath from dhcp
@@ -20,10 +19,10 @@ INITRAMFS TODO
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
- iscsi livecd boot
GENERATOR TODO
- add presets (predefined set of modules)
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
- provide "installkernel" and "new-kernel-pkg"
- add mechanism for module specific command line options

View File

@@ -106,10 +106,18 @@ fi
hookdirs="cmdline pre-udev pre-trigger netroot "
hookdirs+="initqueue initqueue/settled initqueue/online initqueue/finished initqueue/timeout "
hookdirs+="pre-mount pre-pivot cleanup mount "
hookdirs+="emergency shutdown-emergency shutdown "
hookdirs+="emergency shutdown-emergency pre-shutdown shutdown "
export hookdirs
}
dracut_need_initqueue() {
>"$initdir/lib/dracut/need-initqueue"
}
dracut_module_included() {
strstr "$mods_to_load $modules_loaded" "$@"
}
# Create all subdirectories for given path without creating the last element.
# $1 = path
mksubdirs() { [[ -e ${1%/*} ]] || mkdir -m 0755 -p ${1%/*}; }
@@ -311,10 +319,17 @@ get_maj_min() {
# $ find_block_device /usr
# 8:4
find_block_device() {
local _x _mpt _majmin _dev _fs _maj _min
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
_find_mpt="$1"
if [[ $use_fstab != yes ]]; then
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
[[ $_mpt = $1 ]] || continue
while read _x; do
set -- $_x
_majmin="$3"
_mpt="$5"
[[ $8 = "-" ]] && shift
_fs="$8"
_dev="$9"
[[ $_mpt = $_find_mpt ]] || continue
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
@@ -332,7 +347,7 @@ find_block_device() {
while read _dev _mpt _fs _x; do
[ "${_dev%%#*}" != "$_dev" ] && continue
if [[ $_mpt = $1 ]]; then
if [[ $_mpt = $_find_mpt ]]; then
[[ $_fs = nfs ]] && { echo $_dev; return 0;}
[[ $_fs = nfs3 ]] && { echo $_dev; return 0;}
[[ $_fs = nfs4 ]] && { echo $_dev; return 0;}
@@ -355,16 +370,40 @@ find_block_device() {
# $ find_dev_fstype /dev/sda2;echo
# ext4
find_dev_fstype() {
local _x _mpt _majmin _dev _fs _maj _min
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
[[ $_dev = $1 ]] || continue
local _x _mpt _majmin _dev _fs _maj _min _find_dev
_find_dev="$1"
strstr "$_find_dev" "/dev" || _find_dev="/dev/block/$_find_dev"
while read _x; do
set -- $_x
_majmin="$3"
_mpt="$5"
[[ $8 = "-" ]] && shift
_fs="$8"
_dev="$9"
strstr "$_dev" "/dev" || continue
[[ $_dev -ef $_find_dev ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs;
return 0;
done < /proc/self/mountinfo
# fall back to /etc/fstab
while read _dev _mpt _fs _x; do
[[ $_dev = $1 ]] || continue
[ "${_dev%%#*}" != "$_dev" ] && continue
case "$_dev" in
LABEL=*)
_dev="$(echo $_dev | sed 's,/,\\x2f,g')"
_dev="/dev/disk/by-label/${_dev#LABEL=}"
;;
UUID=*)
_dev="/dev/disk/by-uuid/${_dev#UUID=}"
;;
PARTUUID=*)
_dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
;;
esac
[[ $_dev -ef $_find_dev ]] || continue
echo -n $_fs;
return 0;
done < /etc/fstab
@@ -381,16 +420,25 @@ find_dev_fstype() {
# $ find_mp_fstype /;echo
# ext4
find_mp_fstype() {
local _x _mpt _majmin _dev _fs _maj _min
while read _x _x _majmin _x _mpt _x _x _fs _dev _x; do
[[ $_mpt = $1 ]] || continue
local _x _mpt _majmin _dev _fs _maj _min _find_mpt
_find_mpt="$1"
while read _x; do
set -- $_x
_majmin="$3"
_mpt="$5"
[[ $8 = "-" ]] && shift
_fs="$8"
_dev="$9"
[[ $_mpt = $_find_mpt ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs;
return 0;
done < /proc/self/mountinfo
# fall back to /etc/fstab
while read _dev _mpt _fs _x; do
[[ $_mpt = $1 ]] || continue
[ "${_dev%%#*}" != "$_dev" ] && continue
[[ $_mpt = $_find_mpt ]] || continue
echo -n $_fs;
return 0;
done < /etc/fstab
@@ -830,7 +878,7 @@ inst_rule_programs() {
_bin=""
if [ -x ${udevdir}/$_prog ]; then
_bin=${udevdir}/$_prog
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
_bin=$(find_binary "$_prog") || {
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
continue;
@@ -845,7 +893,7 @@ inst_rule_programs() {
_bin=""
if [ -x ${udevdir}/$_prog ]; then
_bin=${udevdir}/$_prog
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
_bin=$(find_binary "$_prog") || {
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
continue;
@@ -860,7 +908,7 @@ inst_rule_programs() {
_bin=""
if [ -x ${udevdir}/$_prog ]; then
_bin=${udevdir}/$_prog
elif [[ "${_prog/\$\{/}" != "$_prog" ]]; then
elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
_bin=$(find_binary "$_prog") || {
dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
continue;
@@ -892,6 +940,12 @@ inst_rule_group_owner() {
fi
}
inst_rule_initqueue() {
if grep -q -F initqueue "$1"; then
dracut_need_initqueue
fi
}
# udev rules always get installed in the same place, so
# create a function to install them to make life simpler.
inst_rules() {
@@ -900,12 +954,13 @@ inst_rules() {
inst_dir "${udevdir}/rules.d"
inst_dir "$_target"
for _rule in "$@"; do
if [ "${rule#/}" = "$rule" ]; then
if [ "${_rule#/}" = "$_rule" ]; then
for r in ${udevdir}/rules.d /etc/udev/rules.d; do
if [[ -f $r/$_rule ]]; then
_found="$r/$_rule"
inst_rule_programs "$_found"
inst_rule_group_owner "$_found"
inst_rule_initqueue "$_found"
inst_simple "$_found"
fi
done
@@ -915,6 +970,7 @@ inst_rules() {
_found="${r}$_rule"
inst_rule_programs "$_found"
inst_rule_group_owner "$_found"
inst_rule_initqueue "$_found"
inst_simple "$_found" "$_target/${_found##*/}"
fi
done
@@ -922,6 +978,33 @@ inst_rules() {
done
}
prepare_udev_rules() {
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
for f in "$@"; do
f="${initdir}/etc/udev/rules.d/$f"
[ -e "$f" ] || continue
while read line; do
if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
if [ $UDEVVERSION -ge 174 ]; then
printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
else
printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
fi
elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
if [ $UDEVVERSION -ge 176 ]; then
printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
else
printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}"
fi
else
echo "$line"
fi
done < "${f}" > "${f}.new"
mv "${f}.new" "$f"
done
}
# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
@@ -1459,13 +1542,16 @@ module_is_host_only() (
find_kernel_modules_by_path () (
local _OLDIFS
_OLDIFS=$IFS
IFS=:
while read a rest; do
[[ $a = kernel*/$1/* ]] || continue
echo $srcmods/$a
done < $srcmods/modules.dep
IFS=$_OLDIFS
[[ -f $srcmods/modules.dep ]] || return 0
_OLDIFS=$IFS
IFS=:
while read a rest; do
[[ $a = */$1/* ]] || continue
echo $srcmods/$a
done < $srcmods/modules.dep
IFS=$_OLDIFS
return 0
)

View File

@@ -30,6 +30,13 @@ early userspace.
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/sosreport.txt_ is created, which can be safed to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.
EXAMPLE
-------
@@ -325,8 +332,11 @@ provide a valid _/etc/fstab_.
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
options>_ in the initramfs
**--device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM or an encrypted partition.
[NB --device can be used for compatibility with earlier releases]
**-i, --include** _<SOURCE>_ _<TARGET>_::
include the files in the SOURCE directory into the
@@ -414,6 +424,9 @@ _/etc/dracut.conf_::
_/etc/dracut.conf.d/*.conf_::
see dracut.conf5
_/usr/lib/dracut/dracut.conf.d/*.conf_::
see dracut.conf5
Configuration in the initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::

View File

@@ -79,7 +79,7 @@ udev pulls in modules matching the computer's detected hardware.
initialized and a user-space helper started to paint animations onto the display
in lockstep with the boot process.
* If the root file system is on NFS, dracut does then:
* If the root file system is on NFS, dracut does then:
** Bring up the primary network interface.
** Invoke a DHCP client, with which it can obtain a DHCP lease.
** Extract the name of the NFS share and the address of the NFS server from the
@@ -120,6 +120,26 @@ final cleanup tasks. On an initramfs, the initial root file system cannot be
rotated away. Instead, it is simply emptied and the final root file system
mounted over the top.
== Dracut on shutdown
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
The following steps are executed during a shutdown:
* systemd switches to the shutdown.target
* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
which unpacks the initramfs to /run/initramfs
* systemd finishes shutdown.target
* systemd kills all processes
* systemd tries to unmount everything and mounts the remaining read-only
* systemd checks, if there is a /run/initramfs/shutdown executable
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules
This ensures, that all devices are disassembled and unmounted cleanly.
= User Manual
== Creating an initramfs Image
@@ -391,7 +411,7 @@ How to setup your PXE/TFTP server can be found in the
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
Hat Enterprise Linux Storage Administration Guide].
If you specify rd.ip=auto on the kernel command line, then dracut asks a dhcp
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
@@ -466,6 +486,7 @@ dracut shell commands are printed as they are executed
----
# journalctl -ab
----
. With dracut >= 025 the file /run/initramfs/sosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
Then you can store the output for later inspection.

View File

@@ -124,6 +124,12 @@ Misc
[[dracutkerneldebug]]
Debug
~~~~~
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.
**rd.info**::
print informational output though "quiet" is set
@@ -131,8 +137,15 @@ Debug
allow dropping to a shell, if root mounting fails
**rd.debug**::
set -x for the dracut shell and logs to dmesg, console and
_/run/initramfs/init.log_
set -x for the dracut shell.
If systemd is active in the initramfs, all output is logged to the systemd journal,
which you can inspect with "journalctl -ab".
If systemd is not active, the logs are written to dmesg and _/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.
**rd.memdebug=[0-3]**::
print memory usage debug info, set the verbose level from 1 to 3
print nothing when set rd.memdebug=0
**rd.break**::
drop to a shell at the end
@@ -411,6 +424,10 @@ interface name. Better name it "bootnet" or "bluesocket".
then its values should be separated by semicolon.
Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
**team =_<teammaster>_:_<teamslaves>_**::
Setup team device <teammaster> on top of <teamslaves>.
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
**bridge=_<bridgename>_:_<ethnames>_**::
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
list of physical (ethernet) interfaces. Bridge without parameters assumes bridge=br0:eth0
@@ -583,7 +600,7 @@ ZNET
+
----
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
----
Plymouth Boot Splash

View File

@@ -1,11 +1,11 @@
# PUT YOUR CONFIG HERE OR IN separate files named *.conf
# in /etc/dracut.conf.d
# /etc/dracut.conf.d/*.conf will override the settings in here
# SEE man dracut.conf(5)
# Sample dracut config file
logfile=/var/log/dracut.log
fileloglvl=6
#logfile=/var/log/dracut.log
#fileloglvl=6
# Exact list of dracut modules to use. Modules not listed here are not going
# to be included. If you only want to add some optional modules use
@@ -29,10 +29,10 @@ fileloglvl=6
#
# install local /etc/mdadm.conf
mdadmconf="yes"
#mdadmconf="no"
# install local /etc/lvm/lvm.conf
lvmconf="yes"
#lvmconf="no"
# A list of fsck tools to install. If it's not specified, module's hardcoded
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check

View File

@@ -10,17 +10,24 @@ dracut.conf - configuration file(s) for dracut
SYNOPSIS
--------
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/dracut.conf.d/*.conf_
Description
-----------
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
parameter will overwrite any values set here. _dracut.conf.d/*.conf_ files are
read in alphanumerical order and will overwrite parameters set in
parameter will overwrite any values set here.
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and /etc/dracut.conf.d.
Files with the same name in /etc/dracut.conf.d will replace files in /usr/lib/dracut/dracut.conf.d.
The files are then read in alphanumerical order and will overwrite parameters set in
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
indicates the beginning of a comment; following characters, up to the end of the
line are not interpreted.
dracut command line options will overwrite any values set here.
Configuration files must have the extension .conf; other extensions are ignored.
*dracutmodules+=*" __<dracut modules>__ "::
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
@@ -82,6 +89,11 @@ If chrooted to another root other than the real root device, use --fstab and pro
*add_fstab+=*" __<filename>__ "::
Add entries of __<filename>__ to the initramfs /etc/fstab.
*add_device+=*" __<device>__ "::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM an encrypted partition.
*mdadmconf=*"__{yes|no}__"::
Include local _/etc/mdadm.conf_ (default=yes)
@@ -122,7 +134,7 @@ If chrooted to another root other than the real root device, use --fstab and pro
Path to log file.
*show_modules=*"__{yes|no}__"::
Print included module's name to standard output during build.
Print the name of the included modules to standard output during build.
Files
-----

View File

@@ -2,13 +2,13 @@
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
omit_drivers+=" .*/fs/ocfs/.* i2o_scsi"
omit_drivers+=' .*/fs/ocfs/.* i2o_scsi'
stdloglvl=3
logfile=/var/log/dracut.log
fileloglvl=6
install_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
udevdir=/usr/lib/udev
add_dracutmodules+=" systemd "
realinitpath="/usr/lib/systemd/systemd"
kernelcmdline+=" rd.auto=1 "

View File

@@ -134,7 +134,7 @@ Creates initial ramdisk images for preloading modules
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
Mount device [DEV] on mountpoint [MP] with filesystem
[FSTYPE] and options [FSOPTS] in the initramfs
--device "[DEV]" Bring up [DEV] in initramfs
--add-device "[DEV]" Bring up [DEV] in initramfs
-i, --include [SOURCE] [TARGET]
Include the files in the SOURCE directory into the
Target directory in the final initramfs.
@@ -235,6 +235,30 @@ read_arg() {
fi
}
dropindirs_sort()
{
suffix=$1; shift
args=("$@")
files=$(
while (( $# > 0 )); do
for i in ${1}/*${suffix}; do
[[ -f $i ]] && echo ${i##*/}
done
shift
done | sort -Vu
)
for f in $files; do
for d in "${args[@]}"; do
if [[ -f "$d/$f" ]]; then
echo "$d/$f"
continue 2
fi
done
done
}
verbosity_mod_l=0
unset kernel
unset outfile
@@ -331,7 +355,8 @@ while :; do
--fscks) push fscks_l "$2"; shift;;
--add-fstab) push add_fstab_l "$2"; shift;;
--mount) push fstab_lines "$2"; shift;;
--device) push host_devs "$2"; shift;;
--add-device|--device)
push add_device_l "$2"; shift;;
--kernel-cmdline) push kernel_cmdline_l "$2"; shift;;
--nofscks) nofscks_l="yes";;
--ro-mnt) ro_mnt_l="yes";;
@@ -464,11 +489,9 @@ fi
[[ -f $conffile ]] && . "$conffile"
# source our config dir
if [[ $confdir && -d $confdir ]]; then
for f in "$confdir"/*.conf; do
[[ -e $f ]] && . "$f"
done
fi
for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
[[ -e $f ]] && . "$f"
done
# these optins add to the stuff in the config file
if (( ${#add_dracutmodules_l[@]} )); then
@@ -688,10 +711,11 @@ esac
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
[[ -f $srcmods/modules.dep ]] || {
dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
exit 1
}
if [[ -d $srcmods ]]; then
[[ -f $srcmods/modules.dep ]] || {
dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
}
fi
if [[ -f $outfile && ! $force ]]; then
dfatal "Will not override existing initramfs ($outfile) without --force"
@@ -734,6 +758,16 @@ for f in $add_fstab; do
done < $f
done
if (( ${#add_device_l[@]} )); then
while pop add_device_l val; do
add_device+=" $val "
done
fi
for dev in $add_device; do
push host_devs $dev
done
if [[ $hostonly ]]; then
# in hostonly mode, determine all devices, which have to be accessed
# and examine them for filesystem types
@@ -822,7 +856,7 @@ if [[ $prefix ]]; then
fi
if [[ $kernel_only != yes ]]; then
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var var/log $libdirs; do
for d in usr/bin usr/sbin bin etc lib sbin tmp usr var $libdirs; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -L "/$d" ]; then
inst_symlink "/$d" "${prefix}/$d"
@@ -841,6 +875,7 @@ if [[ $kernel_only != yes ]]; then
ln -sfn ../run "$initdir/var/run"
ln -sfn ../run/lock "$initdir/var/lock"
ln -sfn ../run/log "$initdir/var/log"
else
for d in lib "$libdir"; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
@@ -937,7 +972,7 @@ fi
if [[ $kernel_only != yes ]]; then
(( ${#install_items[@]} > 0 )) && dracut_install ${install_items[@]}
echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
[[ $kernel_cmdline ]] && echo "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
while pop fstab_lines line; do
echo "$line 0 0" >> "${initdir}/etc/fstab"
@@ -1031,7 +1066,7 @@ fi
if [[ $do_strip = yes ]] ; then
for p in strip xargs find; do
if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
dwarn "Could not find '$p'. Not stripping the initramfs."
do_strip=no
fi
done
@@ -1041,31 +1076,38 @@ if [[ $do_strip = yes ]] ; then
dinfo "*** Stripping files ***"
if [[ $DRACUT_FIPS_MODE ]]; then
find "$initdir" -type f \
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
-or -path '*/lib/modules/*.ko' ')' -print0 \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f; do
if ! [[ -e "${f%/*}/.${f##*/}.hmac" ]] \
&& ! [[ -e "/lib/fipscheck/${f##*/}.hmac" ]] \
&& ! [[ -e "/lib64/fipscheck/${f##*/}.hmac" ]]; then
echo -n "$f"; echo -n -e "\000"
fi
done |xargs -r -0 strip -g 2>/dev/null
done | xargs -r -0 strip -g 2>/dev/null
else
find "$initdir" -type f \
'(' -perm -0100 -or -perm -0010 -or -perm -0001 \
-or -path '*/lib/modules/*.ko' ')' -print0 \
-executable -not -path '*/lib/modules/*.ko' -print0 \
| xargs -r -0 strip -g 2>/dev/null
fi
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f; do
SIG=$(tail -c 28 "$f")
[[ $SIG == '~Module signature appended~' ]] || { echo -n "$f"; echo -n -e "\000"; }
done | xargs -r -0 strip -g
dinfo "*** Stripping files done ***"
fi
rm -f "$outfile"
dinfo "*** Creating image file ***"
if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
$compress > "$outfile"; ); then
dfatal "dracut: creation of $outfile failed"
$compress > "$outfile.$$"; ); then
dfatal "dracut: creation of $outfile.$$ failed"
exit 1
fi
mv $outfile.$$ $outfile
dinfo "*** Creating image file done ***"
dinfo "Wrote $outfile:"

View File

@@ -86,7 +86,7 @@ Requires: udev > 166
Requires: kbd kbd-misc
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Conflicts: systemd < 187
Conflicts: systemd < 198
%else
Requires: util-linux-ng >= 2.21
%endif
@@ -96,6 +96,8 @@ Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
%endif
Conflicts: mdadm < 3.2.6-14
%description
dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible
@@ -106,6 +108,8 @@ NFS, iSCSI, NBD, FCoE with the dracut-network package.
%package network
Summary: dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
Requires: iputils
Requires: iproute
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
@@ -192,6 +196,11 @@ rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
%if %{defined _unitdir}
# for systemd, better use systemd-bootchart
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
%endif
# we do not support dash in the initramfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
@@ -213,12 +222,12 @@ touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
%endif
%if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
@@ -256,9 +265,10 @@ rm -rf $RPM_BUILD_ROOT
%{dracutlibdir}/dracut-install
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%config /etc/dracut.conf.d/01-dist.conf
%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
@@ -268,12 +278,17 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man5/dracut.conf.5*
%if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart
%else
%{dracutlibdir}/modules.d/00bootchart
%endif
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/90btrfs
@@ -321,6 +336,9 @@ rm -rf $RPM_BUILD_ROOT
%{_unitdir}/dracut-shutdown.service
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
%endif
%if 0%{?fedora} || 0%{?rhel} > 6
%{_prefix}/lib/kernel/install.d/50-dracut.install
%endif
%files network
%defattr(-,root,root,0755)
@@ -340,7 +358,7 @@ rm -rf $RPM_BUILD_ROOT
%files fips
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/01fips
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
%{dracutlibdir}/dracut.conf.d/40-fips.conf
%endif
%files fips-aesni

View File

@@ -10,12 +10,13 @@ lsinitrd - tool to show the contents of an initramfs image
SYNOPSIS
--------
*lsinit* ['OPTION...'] [<image>]
*lsinitrd* ['OPTION...'] [<image>]
DESCRIPTION
-----------
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
lsinitrd uses the default image /boot/initramfs-<kernel version>.img.
lsinitrd uses the default image _/boot/<machine-id>/<kernel-version>/initrd_ or
_/boot/initramfs-<kernel-version>.img_.
OPTIONS
-------

View File

@@ -21,7 +21,13 @@
usage()
{
echo "Usage: $(${0##*/}) [-s] [<initramfs file> [<filename>]]"
{
echo "Usage: ${0##*/} [-s] [<initramfs file> [<filename>]]"
echo
echo "-h, --help print a help message and exit."
echo "-s, --size sort the contents of the initramfs by size."
echo
} >&2
}
[[ $# -le 2 ]] || { usage ; exit 1 ; }
@@ -36,8 +42,36 @@ while getopts "s" opt; do
done
shift $((OPTIND-1))
image="${1:-/boot/initramfs-$(uname -r).img}"
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
KERNEL_VERSION="$(uname -r)"
if [[ "$1" ]]; then
image="$1"
if ! [[ -f "$image" ]]; then
{
echo "$image does not exist"
echo
} >&2
usage
exit 1
fi
fi
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
else
image="/boot/initramfs-${KERNEL_VERSION}.img}"
fi
if ! [[ -f "$image" ]]; then
{
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
echo
} >&2
usage
exit 1
fi
CAT=zcat
FILE_T=$(file --dereference "$image")

View File

@@ -0,0 +1,18 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ "$mount_needs" ]] && return 1
[ -x $systemdutildir/systemd-bootchart ] || return 1
return 255
}
depends() {
return 0
}
install() {
inst_symlink /init /sbin/init
dracut_install $systemdutildir/systemd-bootchart
}

View File

@@ -14,7 +14,7 @@ installkernel() {
local _fipsmodules _mod
_fipsmodules="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt lzo"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"

View File

@@ -86,9 +86,11 @@ install() {
install_base() {
dracut_install setfont loadkeys kbd_mode stty
inst ${moddir}/console_init.sh /lib/udev/console_init
inst_rules ${moddir}/10-console.rules
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
if ! dracut_module_included "systemd"; then
inst ${moddir}/console_init.sh /lib/udev/console_init
inst_rules ${moddir}/10-console.rules
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
fi
}
install_all_kbd() {

View File

@@ -26,8 +26,8 @@ inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP
inst_key_val '' /etc/locale.conf LANG locale.LANG
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
inst_key_val '' /etc/locale.conf locale.LANG LANG
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL
if [ -f /etc/locale.conf ]; then
. /etc/locale.conf

View File

@@ -25,8 +25,7 @@ setup_interface() {
if ! ip link set $netif mtu $mtu ; then
ip link set $netif down
ip link set $netif mtu $mtu
ip link set $netif up
wait_for_if_up $netif
linkup $netif
fi
fi
@@ -51,6 +50,7 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PS4="dhclient.$interface.$$ + "
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# We already need a set netif here
netif=$interface
@@ -61,8 +61,7 @@ netif=$interface
case $reason in
PREINIT)
echo "dhcp: PREINIT $netif up"
ip link set $netif up
wait_for_if_up $netif
linkup $netif
;;
BOUND)
echo "dhcp: BOND setting $netif"
@@ -89,6 +88,7 @@ case $reason in
echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "> /tmp/setup_net_$netif.ok"
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
echo "rm -f $hookdir/initqueue/setup_net_$netif.sh"
} > $hookdir/initqueue/setup_net_$netif.sh

View File

@@ -17,6 +17,8 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# $netif reads easier than $1
netif=$1
use_bridge='false'
use_vlan='false'
# enslave this interface to bond?
if [ -e /tmp/bond.info ]; then
@@ -28,6 +30,15 @@ if [ -e /tmp/bond.info ]; then
done
fi
if [ -e /tmp/team.info ]; then
. /tmp/team.info
for slave in $teamslaves ; do
if [ "$netif" = "$slave" ] ; then
netif=$teammaster
fi
done
fi
# bridge this interface?
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
@@ -37,6 +48,7 @@ if [ -e /tmp/bridge.info ]; then
: # We need to really setup bond (recursive call)
else
netif="$bridgename"
use_bridge='true'
fi
fi
done
@@ -49,6 +61,7 @@ if [ -e /tmp/vlan.info ]; then
: # We need to really setup bond (recursive call)
else
netif="$vlanname"
use_vlan='true'
fi
fi
fi
@@ -84,30 +97,33 @@ do_ipv6auto() {
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
ip link set $netif up
wait_for_if_up $netif
linkup $netif
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
return 0
}
# Handle static ip configuration
do_static() {
strstr $ip '*:*:*' && load_ipv6
ip link set $netif up
wait_for_if_up $netif
[ -n "$macaddr" ] && ip link set address $macaddr
[ -n "$mtu" ] && ip link set mtu $mtu
linkup $netif
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
if strstr $ip '*:*:*'; then
# note no ip addr flush for ipv6
ip addr add $ip/$mask dev $netif
ip addr add $ip/$mask ${srv+peer $srv} dev $netif
else
ip addr flush dev $netif
ip addr add $ip/$mask brd + dev $netif
ip addr add $ip/$mask ${srv+peer $srv} brd + dev $netif
fi
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
> /tmp/setup_net_${netif}.ok
return 0
}
# loopback is always handled the same way
@@ -143,13 +159,12 @@ if [ -e /tmp/bond.info ]; then
fi
done
ip link set $netif up
linkup $netif
for slave in $bondslaves ; do
ip link set $slave down
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
ip link set $slave up
wait_for_if_up $slave
linkup $slave
done
# add the bits to setup the needed post enslavement parameters
@@ -163,6 +178,28 @@ if [ -e /tmp/bond.info ]; then
fi
fi
if [ -e /tmp/team.info ]; then
. /tmp/team.info
if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
# We shall only bring up those _can_ come up
# in case of some slave is gone in active-backup mode
working_slaves=""
for slave in $teamslaves ; do
ip link set $slave up 2>/dev/null
if wait_for_if_up $slave; then
working_slaves+="$slave "
fi
done
# Do not add slaves now
teamd -d -U -n -t $teammaster -f /etc/teamd/$teammaster.conf
for slave in $working_slaves; do
# team requires the slaves to be down before joining team
ip link set $slave down
teamdctl $teammaster port add $slave
done
ip link set $teammaster up
fi
fi
# XXX need error handling like dhclient-script
@@ -176,9 +213,8 @@ if [ -e /tmp/bridge.info ]; then
if [ "$ethname" = "$bondname" ] ; then
DO_BOND_SETUP=yes ifup $bondname -m
else
ip link set $ethname up
linkup $ethname
fi
wait_for_if_up $ethname
brctl addif $bridgename $ethname
done
fi
@@ -187,10 +223,10 @@ fi
get_vid() {
case "$1" in
vlan*)
return ${1#vlan}
echo ${1#vlan}
;;
*.*)
return ${1##*.}
echo ${1##*.}
;;
esac
}
@@ -200,10 +236,9 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
if [ "$phydevice" = "$bondname" ] ; then
DO_BOND_SETUP=yes ifup $phydevice -m
else
ip link set "$phydevice" up
linkup "$phydevice"
fi
wait_for_if_up "$phydevice"
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname; echo $?)"
ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)"
fi
# setup nameserver
@@ -225,6 +260,7 @@ if [ -z "$ip" ]; then
fi
fi
# Specific configuration, spin through the kernel command line
# looking for ip= lines
for p in $(getargs ip=); do
@@ -233,7 +269,9 @@ for p in $(getargs ip=); do
[ "$autoconf" = "ibft" ] && continue
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
[ -n "$dev" ] && [ "$dev" != "$netif" ] && \
[ "$use_bridge" != 'true' ] && \
[ "$use_vlan" != 'true' ] && continue
# Store config for later use
for i in ip srv gw mask hostname macaddr; do

View File

@@ -64,7 +64,8 @@ installkernel() {
{ find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \
| net_module_filter | instmods
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
#instmods() will take care of hostonly
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net =drivers/net/team
}
install() {
@@ -72,6 +73,8 @@ install() {
dracut_install ip arping dhclient sed
dracut_install -o ping ping6
dracut_install -o brctl
dracut_install -o teamd teamdctl teamnl
inst_simple /etc/libnl/classid
inst_script "$moddir/ifup.sh" "/sbin/ifup"
inst_script "$moddir/netroot.sh" "/sbin/netroot"
inst_script "$moddir/dhclient-script.sh" "/sbin/dhclient-script"
@@ -82,6 +85,7 @@ install() {
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 96 "$moddir/parse-team.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
@@ -91,5 +95,7 @@ install() {
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
dracut_need_initqueue
}

View File

@@ -24,19 +24,32 @@ fi
# bridge: attempt only the defined interface
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
IFACES+=" ${ethnames%% *}"
IFACES="$IFACES ${ethnames%% *}"
fi
# bond: attempt only the defined interface (override bridge defines)
if [ -e /tmp/bond.info ]; then
. /tmp/bond.info
# It is enough to fire up only one
IFACES+=" ${bondslaves%% *}"
IFACES="$IFACES ${bondslaves%% *}"
fi
if [ -e /tmp/team.info ]; then
. /tmp/team.info
IFACES="$IFACES ${teamslaves}"
fi
if [ -e /tmp/vlan.info ]; then
. /tmp/vlan.info
IFACES+=" $phydevice"
IFACES="$IFACES $phydevice"
fi
if [ -z "$IFACES" ]; then
[ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
fi
if [ -e /tmp/net.bootdev ]; then
bootdev=$(cat /tmp/net.bootdev)
fi
ifup='/sbin/ifup $env{INTERFACE}'
@@ -47,16 +60,23 @@ fi
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="%s"\n' "$BOOTIF" "/sbin/initqueue --onetime $ifup"
echo "[ -f /tmp/setup_net_${BOOTIF}.ok ]" >$hookdir/initqueue/finished/wait-${BOOTIF}.sh
# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="%s"\n' "$iface" "/sbin/initqueue --onetime $ifup"
if [ "$bootdev" = "$iface" ]; then
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi
done
# Default: We don't know the interface to use, handle all
# Fixme: waiting for the interface as well.
else
# if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
printf 'SUBSYSTEM=="net", RUN+="%s"\n' "/sbin/initqueue --onetime $ifup" > /etc/udev/rules.d/91-default-net.rules
fi
# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
} > /etc/udev/rules.d/90-net.rules

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
get_ip() {
local iface="$1" ip=""
@@ -269,10 +271,15 @@ ip_to_var() {
case $# in
0) autoconf="error" ;;
1) autoconf=$1 ;;
2) dev=$1; autoconf=$2 ;;
3) dev=$1; autoconf=$2; mtu=$3 ;;
4) dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
*) ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
2) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2 ;;
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7; [ -n "$8" ] && mtu=$8;
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
fi
;;
esac
# anaconda-style argument cluster
if strstr "$autoconf" "*.*.*.*"; then
@@ -315,3 +322,46 @@ parse_ifname_opts() {
esac
}
# some network driver need long time to initialize, wait before it's ready.
wait_for_if_link() {
local cnt=0
local li
while [ $cnt -lt 600 ]; do
li=$(ip -o link show dev $1 2>/dev/null)
[ -n "$li" ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
wait_for_if_up() {
local cnt=0
local li
while [ $cnt -lt 200 ]; do
li=$(ip -o link show up dev $1)
[ -n "$li" ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
wait_for_route_ok() {
local cnt=0
while [ $cnt -lt 200 ]; do
li=$(ip route show)
[ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
linkup() {
wait_for_if_link $1 2>/dev/null\
&& ip link set $1 up 2>/dev/null\
&& wait_for_if_up $1 2>/dev/null
}

View File

@@ -67,6 +67,7 @@ source_hook netroot $netif
# Run the handler; don't store the root, it may change from device to device
# XXX other variables to export?
if $handler $netif $netroot $NEWROOT; then
rm -f $hookdir/initqueue/finished/dhcp.sh
# Network rootfs mount successful - save interface info for ifcfg etc.
save_netinfo $netif
fi

View File

@@ -0,0 +1,44 @@
#!/bin/sh
#
# Format:
# team=<teammaster>:<teamslaves>
#
# teamslaves is a comma-separated list of physical (ethernet) interfaces
#
# return if team already parsed
[ -n "$teammaster" ] && return
# Check if team parameter is valid
if getarg team= >/dev/null ; then
:
fi
parseteam() {
local v=${1}:
set --
while [ -n "$v" ]; do
set -- "$@" "${v%%:*}"
v=${v#*:}
done
unset teammaster teamslaves
case $# in
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
*) die "team= requires two parameters" ;;
esac
}
unset teammaster teamslaves
if getarg team>/dev/null; then
# Read team= parameters if they exist
team="$(getarg team=)"
if [ ! "$team" = "team" ]; then
parseteam "$(getarg team=)"
fi
echo "teammaster=$teammaster" > /tmp/team.info
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
return
fi

View File

@@ -55,13 +55,16 @@ add_url_handler() {
export CURL_HOME="/run/initramfs/url-lib"
mkdir -p $CURL_HOME
curl_args="--location --retry 3 --fail --show-error"
getargbool 0 rd.noverifyssl && curl_args+=" --insecure"
getargbool 0 rd.noverifyssl && curl_args="$curl_args --insecure"
proxy=$(getarg proxy=)
[ -n "$proxy" ] && curl_args="$curl_args --proxy $proxy"
curl_fetch_url() {
local url="$1" outloc="$2"
echo "$url" > /proc/self/fd/0
if [ -n "$outloc" ]; then
curl $curl_args --output "$outloc" "$url" || return $?
curl --globoff $curl_args --output "$outloc" "$url" || return $?
else
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )

View File

@@ -0,0 +1,63 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
return 255
}
depends() {
return 0
}
installkernel() {
local _modname
# Include KMS capable drm drivers
drm_module_filter() {
local _drm_drivers='drm_crtc_init'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_drm_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
| drm_module_filter) ; do
# 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
# loading of the driver if needed
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
hostonly='' instmods $_modname
continue
fi
instmods $_modname
done
}

View File

@@ -8,59 +8,7 @@ check() {
}
depends() {
return 0
}
installkernel() {
local _modname
# Include KMS capable drm drivers
drm_module_filter() {
local _drm_drivers='drm_crtc_init'
local _ret
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_drm_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
return 0
}
for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \
| drm_module_filter) ; do
# 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
# loading of the driver if needed
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
hostonly='' instmods $_modname
continue
fi
instmods $_modname
done
echo drm
}
install() {

View File

@@ -32,6 +32,7 @@ function cms_write_config()
cat > /etc/sysconfig/network << EOF
HOSTNAME=$HOSTNAME
EOF
echo "$HOSTNAME" > /etc/hostname
if [ "$ipv6" ]; then
echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
else

View File

@@ -167,8 +167,8 @@ processcmsfile()
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
# remove the default net rules
rm -f /etc/udev/rules.d/61-default-net.rules
[[ -f /etc/udev/rules.d/60-net.rules ]] \
rm -f /etc/udev/rules.d/91-default-net.rules
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
znet_cio_free

View File

@@ -29,4 +29,5 @@ install() {
inst_libdir_file "gconv/*"
#inst /usr/lib/locale/locale-archive
dracut_need_initqueue
}

View File

@@ -1,11 +1,8 @@
SUBSYSTEM!="block", GOTO="btrfs_end"
ACTION!="add|change", GOTO="btrfs_end"
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
RUN+="/sbin/modprobe btrfs"
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
LABEL="btrfs_end"

View File

@@ -0,0 +1,21 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
btrfs_check_complete() {
local _rootinfo _dev
_dev="${1:-/dev/root}"
[ -e "$_dev" ] || return 0
_rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
info "Checking, if btrfs device complete"
btrfs device ready "$_dev" >/dev/null 2>&1
return $?
fi
return 0
}
btrfs_check_complete $1
exit $?

View File

@@ -5,5 +5,4 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
info "Scanning for all btrfs devices"
/sbin/btrfs device scan 2>&1 | vinfo
exit 0
/sbin/btrfs device scan >/dev/null 2>&1

View File

@@ -26,13 +26,25 @@ depends() {
}
installkernel() {
instmods btrfs crc32c
instmods btrfs
}
install() {
inst_rules "$moddir/80-btrfs.rules"
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
inst_script "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
if ! inst_rules 64-btrfs.rules; then
inst_rules "$moddir/80-btrfs.rules"
case "$(btrfs --help)" in
*device\ ready*)
inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished ;;
*)
inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished ;;
esac
fi
if ! dracut_module_included "systemd"; then
inst_script "$moddir/btrfs_timeout.sh" \
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
fi
dracut_install btrfsck
inst $(command -v btrfs) /sbin/btrfs
}

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh
@@ -11,18 +13,21 @@ if [ -f /etc/crypttab ]; then
done < /etc/crypttab
fi
allowdiscards="-"
# parse for allow-discards
if strstr "$(cryptsetup --help)" "allow-discards"; then
if discarduuids=$(getargs "rd.luks.allow-discards"); then
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
if strstr " $discarduuids " " ${luks##luks-}"; then
allowdiscards="allow-discards"
fi
elif getargbool rd.luks.allow-discards; then
allowdiscards="allow-discards"
allowdiscards="allow-discards"
fi
elif getargbool 0 rd.luks.allow-discards; then
allowdiscards="allow-discards"
fi
fi
echo "$luks $dev none $allowdiscards" >> /etc/crypttab
echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
if command -v systemctl >/dev/null; then
systemctl daemon-reload

View File

@@ -97,10 +97,11 @@ done
# parse for allow-discards
if strstr "$(cryptsetup --help)" "allow-discards"; then
if discarduuids=$(getargs "rd.luks.allow-discards"); then
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
if strstr " $discarduuids " " ${luksdev##luks-}"; then
allowdiscards="--allow-discards"
fi
elif getargbool rd.luks.allow-discards; then
elif getargbool 0 rd.luks.allow-discards; then
allowdiscards="--allow-discards"
fi
fi

View File

@@ -25,7 +25,7 @@ check() {
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_crypt || return 1
for_each_host_dev_and_slaves_all check_crypt || return 1
}
return 0
@@ -46,7 +46,9 @@ install() {
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
if ! dracut_module_included "systemd"; then
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
fi
[[ $hostonly ]] && inst_simple /etc/crypttab
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
@@ -60,4 +62,5 @@ install() {
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
systemd-ask-password systemd-tty-ask-password-agent
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
dracut_need_initqueue
}

View File

@@ -27,14 +27,6 @@ else
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
else
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- '--name crypt-run-generator-%%k %s ' $(command -v crypt-run-generator)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
} >> /etc/udev/rules.d/70-luks.rules.new
fi
uuid=$luksid

View File

@@ -0,0 +1,15 @@
SUBSYSTEM!="block", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
KERNEL!="dm-[0-9]*", GOTO="dm_end"
ACTION=="add", GOTO="dm_end"
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
ENV{DM_NAME}!="?*", GOTO="dm_end"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_end"
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_end"
IMPORT BLKID
LABEL="dm_end"

View File

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

View File

@@ -38,7 +38,7 @@ check() {
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_dmraid || return 1
for_each_host_dev_and_slaves_all check_dmraid || return 1
}
return 0

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Media check on %f
DefaultDependencies=no
Before=shutdown.target
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/bin/checkisomd5 --verbose %f
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
TimeoutSec=0

View File

@@ -32,7 +32,12 @@ fi
getarg rd.live.check -d check || check=""
if [ -n "$check" ]; then
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash
checkisomd5 --verbose $livedev
if [ -n "$DRACUT_SYSTEMD" ]; then
p=$(str_replace "$livedev" "-" '\x2d')
systemctl start checkisomd5@${p}.service
else
checkisomd5 --verbose $livedev
fi
if [ $? -ne 0 ]; then
die "CD check failed!"
exit 1
@@ -105,18 +110,34 @@ do_live_overlay() {
umount -l /run/initramfs/overlayfs || :
fi
if [ -z "$setup" ]; then
if [ -n "$devspec" -a -n "$pathspec" ]; then
if [ -z "$setup" -o -n "$readonly_overlay" ]; then
if [ -n "$setup" ]; then
warn "Using temporary overlay."
elif [ -n "$devspec" -a -n "$pathspec" ]; then
warn "Unable to find persistent overlay; using temporary"
sleep 5
fi
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024)) 2> /dev/null
losetup $OVERLAY_LOOPDEV /overlay
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
RO_OVERLAY_LOOPDEV=$( losetup -f )
losetup $RO_OVERLAY_LOOPDEV /overlay
else
losetup $OVERLAY_LOOPDEV /overlay
fi
fi
# set up the snapshot
echo 0 `blockdev --getsz $BASE_LOOPDEV` snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-rw
sz=$(blockdev --getsz $BASE_LOOPDEV)
if [ -n "$readonly_overlay" ]; then
echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV p 8 | dmsetup create $readonly_overlay live-ro
base="/dev/mapper/live-ro"
over=$RO_OVERLAY_LOOPDEV
else
base=$BASE_LOOPDEV
over=$OVERLAY_LOOPDEV
fi
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
}
# live cd helper function

View File

@@ -16,7 +16,7 @@ depends() {
}
installkernel() {
instmods squashfs loop
instmods squashfs loop iso9660
}
install() {
@@ -29,5 +29,6 @@ install() {
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
# should probably just be generally included
inst_rules 60-cdrom_id.rules
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
dracut_need_initqueue
}

View File

@@ -35,15 +35,21 @@ installkernel() {
return 0
}
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc ata_piix \
pcmcia firewire-ohci yenta_socket \
usb_storage sdhci sdhci-pci \
sdhci_esdhc_imx mmci sdhci_tegra mvsdio \
omap omapdrm omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv \
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
hid-logitech-dj hid-microsoft ehci-hcd ohci-hcd uhci-hcd xhci-hcd hid_generic \
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \
pcmcia usb_storage \
ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \
unix
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
hid-logitech-dj hid-microsoft firewire-ohci
if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
omap_hsmmc sdhci_dove ahci_platform pata_imx sata_mv
fi
# install virtual machine support
instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
"=drivers/pcmcia" =ide "=drivers/usb/storage"
@@ -71,6 +77,8 @@ installkernel() {
install() {
dracut_install -o /lib/modprobe.d/*.conf
[[ $hostonly ]] && dracut_install -o /etc/modprobe.d/*.conf /etc/modprobe.conf
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
if ! dracut_module_included "systemd"; then
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
fi
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
}

View File

@@ -2,6 +2,15 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
_modprobe_d=/etc/modprobe.d
if [ -d /usr/lib/modprobe.d ] ; then
_modprobe_d=/usr/lib/modprobe.d
elif [ -d /lib/modprobe.d ] ; then
_modprobe_d=/lib/modprobe.d
elif [ ! -d $_modprobe_d ] ; then
mkdir -p $_modprobe_d
fi
for i in $(getargs rd.driver.pre -d rdloaddriver=); do
(
IFS=,
@@ -11,19 +20,22 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do
)
done
[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
(
IFS=,
for p in $i; do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
done
)
done
for p in $(getargs rd.driver.post -d rdinsmodpost=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
unset _do_insmodpost
unset _do_insmodpost _modprobe_d

View File

@@ -14,5 +14,6 @@ install() {
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"
inst_script "$moddir/livenetroot.sh" "/sbin/livenetroot"
dracut_need_initqueue
}

View File

@@ -22,7 +22,7 @@ check() {
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves check_lvm || return 1
for_each_host_dev_and_slaves_all check_lvm || return 1
}
return 0

View File

@@ -0,0 +1,23 @@
SUBSYSTEM!="block", GOTO="md_end"
ACTION!="add|change", GOTO="md_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
# partitions have no md/{array_state,metadata_version}
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
TEST!="md/array_state", GOTO="md_end"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
LABEL="md_ignore_state"
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
IMPORT BLKID
OPTIONS+="link_priority=100"
OPTIONS+="watch"
LABEL="md_end"

View File

@@ -0,0 +1,16 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
_do_mdmon_takeover() {
local ret
mdmon --takeover --all
ret=$?
[ $ret -eq 0 ] && info "Taking over mdmon processes."
return $ret
}
if command -v mdmon >/dev/null; then
_do_mdmon_takeover $1
else
:
fi

View File

@@ -29,9 +29,6 @@ _md_force_run() {
_path_d="${_path_s%/*}/degraded"
[ ! -r "$_path_d" ] && continue
# workaround for mdmon bug
[ "$(cat "$_path_d")" -gt "0" ] && mdmon $_offroot --takeover "$md"
done
}

View File

@@ -27,7 +27,7 @@ check() {
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_mdraid || return 1
for_each_host_dev_and_slaves_all check_mdraid || return 1
}
return 0
@@ -48,23 +48,18 @@ install() {
inst $(command -v partx) /sbin/partx
inst $(command -v mdadm) /sbin/mdadm
# XXX: mdmon really needs to run as non-root?
# If so, write only the user it needs in the initrd's /etc/passwd (and maybe /etc/group)
# in a similar fashion to modules.d/95nfs. Do not copy /etc/passwd and /etc/group from
# the system into the initrd.
# dledford has hardware to test this, so he should be able to clean this up.
# inst /etc/passwd
# inst /etc/group
inst_rules 64-md-raid.rules
# remove incremental assembly from stock rules, so they don't shadow
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
# when we explicitly don't want certain components to be incrementally
# assembled
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
inst_rules 64-md-raid.rules
# remove incremental assembly from stock rules, so they don't shadow
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
# when we explicitly don't want certain components to be incrementally
# assembled
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
inst_rules "$moddir/65-md-incremental-imsm.rules"
inst_rules "$moddir/59-persistent-storage-md.rules"
prepare_udev_rules 59-persistent-storage-md.rules
# guard against pre-3.0 mdadm versions, that can't handle containers
if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
@@ -88,5 +83,8 @@ install() {
inst_hook shutdown 30 "$moddir/md-shutdown.sh"
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
if [ -e /lib/systemd/system/mdmon@.service ]; then
inst_simple /lib/systemd/system/mdmon@.service
fi
inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
}

View File

@@ -11,4 +11,5 @@ depends() {
install() {
dracut_install losetup
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
dracut_need_initqueue
}

View File

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

View File

@@ -43,4 +43,5 @@ install() {
inst_hook cmdline 90 "$moddir/parse-cifsroot.sh"
inst "$moddir/cifsroot.sh" "/sbin/cifsroot"
inst "$moddir/cifs-lib.sh" "/lib/cifs-lib.sh"
dracut_need_initqueue
}

View File

@@ -16,12 +16,12 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PS4="fcoe-up.$1.$$ + "
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
netif=$1
dcb=$2
ip link set "$netif" up
wait_for_if_up "$netif"
linkup "$netif"
netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
netdriver=${netdriver##*/}

View File

@@ -33,5 +33,6 @@ install() {
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
dracut_need_initqueue
}

View File

@@ -10,6 +10,7 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
@@ -43,6 +44,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload
write_fs_tab /dev/root
wait_for_dev /dev/root
fi
for p in $(getargs rd.iscsi.param -d iscsi_param); do
@@ -50,6 +53,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
done
iscsistart -b $iscsi_param
echo 'started' > "/tmp/iscsistarted-iscsi"
echo 'started' > "/tmp/iscsistarted-firmware"
exit 0
fi
@@ -135,14 +140,14 @@ handle_netroot()
if [ -z "$root" -o -n "${root%%block:*}" ]; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload
write_fs_tab /dev/root
wait_for_dev /dev/root
# install mount script
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
fi
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/iscsi-settle.sh
# force udevsettle to break
> $hookdir/initqueue/work
@@ -157,6 +162,10 @@ handle_netroot()
${iscsi_netdev_name+--param iface.net_ifacename=$iscsi_netdev_name} \
${iscsi_param} \
|| :
netroot_enc=$(str_replace "$1" '/' '\2f')
echo 'started' > "/tmp/iscsistarted-iscsi:${netroot_enc}"
}
# loop over all netroot parameter

View File

@@ -79,4 +79,5 @@ install() {
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
dracut_need_initqueue
}

View File

@@ -24,6 +24,8 @@
[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
# Root takes precedence over netroot
if [ "${root%%:*}" = "iscsi" ] ; then
if [ -n "$netroot" ] ; then
@@ -33,6 +35,8 @@ if [ "${root%%:*}" = "iscsi" ] ; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
root=/dev/root
write_fs_tab /dev/root
fi
# If it's not empty or iscsi we don't continue
@@ -58,6 +62,7 @@ if [ -n "$iscsi_firmware" ] ; then
netroot=${netroot:-iscsi}
modprobe -q iscsi_boot_sysfs 2>/dev/null
modprobe -q iscsi_ibft
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_firmware_started.sh
fi
# If it's not iscsi we don't continue
@@ -79,9 +84,17 @@ if ! [ -e /sys/module/iscsi_tcp ]; then
modprobe -q iscsi_tcp || die "iscsiroot requested but kernel/initrd does not support iscsi"
fi
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
fi
fi
netroot_enc=$(str_replace "$netroot" '/' '\2f')
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
# Done, all good!
rootok=1
# Shut up init error check
[ -z "$root" ] && root="iscsi"

View File

@@ -33,5 +33,6 @@ install() {
inst nbd-client
inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
inst_script "$moddir/nbdroot.sh" "/sbin/nbdroot"
dracut_need_initqueue
}

View File

@@ -31,7 +31,7 @@ nbdflags=${root%%:*}
nbdopts=${root#*:}
# If nbdport not an integer, then assume name based import
if [ "${nbdport%[0-9]}" = "$nbdport" ]; then
if [ ! -z $(echo "$nbdport" | sed 's/[0-9]//g') ]; then
nbdport="-N $nbdport"
fi
@@ -101,11 +101,14 @@ nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
# add the udev rules for mounting the nbd0 device
root=$(getarg root=)
if [ -z "$root" ] || strstr "$root" "nbd:" || strstr "$root" "dhcp"; then
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; :; };} && rm $job;' \
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; type systemctl >/dev/null 2>&1 && systemctl --no-block start sysroot.mount;:; };} && rm $job;' \
> $hookdir/initqueue/settled/nbd.sh
printf '/bin/mount -t %s -o %s %s %s\n' \
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
write_fs_tab /dev/nbd0 "$nbdfstype" "$fsopts"
printf '/bin/mount %s\n' \
"$NEWROOT" \
> $hookdir/mount/01-$$-nbd.sh
fi

View File

@@ -75,5 +75,6 @@ install() {
egrep -q '^rpc:' /etc/passwd \
&& egrep -q '^rpc:' /etc/group \
&& chown rpc.rpc "$initdir/var/lib/rpcbind"
dracut_need_initqueue
}

View File

@@ -2,16 +2,22 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# 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
[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
# Start rpc.statd as mount won't let us use locks on a NFSv4
# filesystem without talking to it. NFSv4 does locks internally,
# rpc.lockd isn't needed
[ -z "$(pidof rpc.statd)" ] && rpc.statd
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
# 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
# Start rpc.statd as mount won't let us use locks on a NFSv4
# filesystem without talking to it. NFSv4 does locks internally,
# rpc.lockd isn't needed
[ -z "$(pidof rpc.statd)" ] && rpc.statd
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
else
warn 'Kernel module "sunrpc" not in the initramfs, or support for filesystem "rpc_pipefs" missing!'
fi

View File

@@ -22,7 +22,9 @@ if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
mkdir -m 0755 -p $NEWROOT/$rpcpipefspath 2>/dev/null
if [ -d $NEWROOT/$rpcpipefspath ]; then
mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
# mount --move does not seem to work???
mount --bind /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
umount /var/lib/nfs/rpc_pipefs
else
umount /var/lib/nfs/rpc_pipefs
fi

View File

@@ -16,7 +16,9 @@ NEWROOT="$3"
nfs_to_var $root $netif
[ -z "$server" ] && die "Required parameter 'server' is missing"
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || >/dev/root ; }
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; }
cat $NEWROOT/etc/fstab > /dev/null
# inject new exit_if_exists
echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/nfs.sh

View File

@@ -14,8 +14,13 @@ install() {
}
done
inst_hook cmdline 10 "$moddir/parse-resume.sh"
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
inst_hook mount 10 "$moddir/resume.sh"
if ! dracut_module_included "systemd"; then
inst_hook cmdline 10 "$moddir/parse-resume.sh"
else
inst_script "$moddir/parse-resume.sh" /lib/dracut/parse-resume.sh
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
fi
inst_script "$moddir/resume.sh" /lib/dracut/resume.sh
}

View File

@@ -24,3 +24,51 @@ if splash=$(getarg splash=); then
else
unset splash
fi
case "$splash" in
quiet )
a_splash="-P splash=y"
;;
* )
a_splash="-P splash=n"
;;
esac
if [ -n "$resume" ]; then
{
printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"/dev/resume\"\n" \
${resume#/dev/};
} >> /etc/udev/rules.d/99-resume-link.rules
{
if [ -x /usr/sbin/resume ]; then
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
${resume#/dev/} "$a_splash" "$resume";
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
${resume#/dev/} "$a_splash" "$resume";
fi
printf "KERNEL==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
${resume#/dev/};
printf "SYMLINK==\"%s\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %%M:%%m > /sys/power/resume\"\n" \
${resume#/dev/};
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh
wait_for_dev "/dev/resume"
mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh
elif ! getarg noresume; then
{
if [ -x /usr/sbin/resume ]; then
printf "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \$tempnode\"\n" "$a_splash"
fi
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\"," \
" RUN+=\"/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume\"";
} >> /etc/udev/rules.d/99-resume.rules
fi

View File

@@ -32,8 +32,8 @@ if [ -n "$resume" ]; then
${resume#/dev/};
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; udevadm settle; }\n' \
"$resume" "$resume" >> $hookdir/initqueue/settled/resume.sh
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job" "%s/initqueue/timeout/resume.sh"; }\n' \
"$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh
printf 'warn "Cancelling resume operation. Device not found."; cancel_wait_for_dev /dev/resume; rm "$job" "%s/initqueue/settled/resume.sh";' \
"$hookdir" >> $hookdir/initqueue/timeout/resume.sh

View File

@@ -15,7 +15,7 @@ check() {
rootopts=$opts
break
fi
done < "$NEWROOT/etc/fstab"
done < /etc/fstab
[ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
[ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
@@ -23,7 +23,6 @@ check() {
echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
fi
return 0
}
depends() {
@@ -32,8 +31,10 @@ depends() {
install() {
dracut_install umount
inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
if ! dracut_module_included "systemd"; then
inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
fi
}

View File

@@ -26,6 +26,7 @@ mount_root() {
fi
_rflags_ro="$rflags,ro"
_rflags_ro="${_rflags_ro##,}"
while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"

View File

@@ -20,3 +20,5 @@ case "$root" in
root="block:${root}"
rootok=1 ;;
esac
[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"

View File

@@ -3,38 +3,7 @@ ACTION!="add|change", GOTO="ps_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end"
KERNEL=="cciss[0-9]*", IMPORT{builtin}="blkid"
KERNEL=="nbd[0-9]*", IMPORT{builtin}="blkid"
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
# partitions have no md/{array_state,metadata_version}
ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
TEST!="md/array_state", GOTO="md_end"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
LABEL="md_ignore_state"
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
IMPORT{builtin}="blkid"
OPTIONS+="link_priority=100"
OPTIONS+="watch"
LABEL="md_end"
KERNEL!="dm-[0-9]*", GOTO="ps_end"
ACTION=="add", GOTO="ps_end"
IMPORT{program}="/sbin/dmsetup info -c --nameprefixes --unquoted --rows --noheadings -o name,uuid,suspended,readonly,major,minor,open,tables_loaded,names_using_dev -j%M -m%m"
ENV{DM_NAME}!="?*", GOTO="ps_end"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="ps_end"
ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="ps_end"
ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="ps_end"
IMPORT{builtin}="blkid"
KERNEL=="cciss[0-9]*", IMPORT BLKID
KERNEL=="nbd[0-9]*", IMPORT BLKID
LABEL="ps_end"

View File

@@ -12,7 +12,7 @@ GOTO="pss_end"
LABEL="do_pss"
# by-path (parent device path)
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"

View File

@@ -34,6 +34,8 @@ install() {
"$moddir/59-persistent-storage.rules" \
"$moddir/61-persistent-storage.rules"
prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
inst_dir /run/udev
inst_dir /run/udev/rules.d
@@ -41,7 +43,7 @@ install() {
for i in cdrom tape dialout floppy; do
if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
if ! egrep "^$i:" /etc/group 2>/dev/null; then
case $i in
case $i in
cdrom) echo "$i:x:11:";;
dialout) echo "$i:x:18:";;
floppy) echo "$i:x:19:";;
@@ -74,5 +76,6 @@ install() {
inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
inst_libdir_file "libnss_files*"
}

View File

@@ -32,7 +32,7 @@ depends() {
}
installkernel() {
instmods 9p 9pnet_virtio
instmods 9p 9pnet_virtio virtio_pci
}
install() {

View File

@@ -35,5 +35,6 @@ install() {
mkdir -m 0755 -p ${initdir}/etc/templates
inst_simple "${moddir}/rsyslog.conf" /etc/templates
fi
dracut_need_initqueue
}

View File

@@ -12,9 +12,15 @@ Description=dracut cmdline hook
Documentation=man:dracut-cmdline.service(8)
DefaultDependencies=no
Before=dracut-pre-udev.service
Before=systemd-vconsole-setup.service
After=systemd-journald.socket
Wants=systemd-journald.socket
ConditionPathExists=/etc/initrd-release
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cmdline
ConditionKernelCommandLine=|rd.break=cmdline
ConditionKernelCommandLine=|resume
ConditionKernelCommandLine=|noresume
[Service]
Type=oneshot
@@ -23,6 +29,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.

View File

@@ -7,6 +7,7 @@ export NEWROOT="/sysroot"
[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
[ -d /run/lock ] || mkdir -p -m 0755 /run/lock
[ -d /run/log ] || mkdir -p -m 0755 /run/log
if [ -f /dracut-state.sh ]; then
. /dracut-state.sh 2>/dev/null
@@ -16,16 +17,62 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
[ -f /etc/initrd-release ] && . /etc/initrd-release
[ -n "$VERSION" ] && info "dracut-$VERSION"
getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf
getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf
source_conf /etc/conf.d
root=$(getarg root=)
rflags="$(getarg rootflags=)"
getargbool 0 ro && rflags="${rflags},ro"
getargbool 0 rw && rflags="${rflags},rw"
rflags="${rflags#,}"
fstype="$(getarg rootfstype=)"
if [ -z "$fstype" ]; then
fstype="auto"
fi
export root
export rflags
export fstype
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
# run scriptlets to parse the command line
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline
[ -f /lib/dracut/parse-resume.sh ] && . /lib/dracut/parse-resume.sh
case "$root" in
block:LABEL=*|LABEL=*)
root="${root#block:}"
root="$(echo $root | sed 's,/,\\x2f,g')"
root="block:/dev/disk/by-label/${root#LABEL=}"
rootok=1 ;;
block:UUID=*|UUID=*)
root="${root#block:}"
root="block:/dev/disk/by-uuid/${root#UUID=}"
rootok=1 ;;
block:PARTUUID=*|PARTUUID=*)
root="${root#block:}"
root="block:/dev/disk/by-partuuid/${root#PARTUUID=}"
rootok=1 ;;
/dev/*)
root="block:${root}"
rootok=1 ;;
esac
[ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
export root rflags fstype netroot NEWROOT
export -p > /dracut-state.sh
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -8,15 +8,16 @@
# See systemd.special(7) for details
[Unit]
Description=Emergency Shell
Description=Dracut Emergency Shell
DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
Conflicts=emergency.service emergency.target
[Service]
Environment=HOME=/
WorkingDirectory=/
ExecStartPre=-/bin/plymouth quit
ExecStartPre=-/bin/echo -e '\n\nEntering emergency mode. Exit the shell to continue.\nType "journalctl" to view system logs.\n'
ExecStart=-/bin/sh -i -l
ExecStart=/bin/dracut-emergency
ExecStopPost=-/bin/rm -f /.console_lock
Type=oneshot
StandardInput=tty-force

View File

@@ -0,0 +1,41 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
. /dracut-state.sh 2>/dev/null
fi
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
[ -x /bin/plymouth ] && /bin/plymouth quit
export _rdshell_name="dracut" action="Boot" hook="emergency"
source_hook "$hook"
if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
echo
sosreport
echo
echo
echo 'Entering emergency mode. Exit the shell to continue.'
echo 'Type "journalctl" to view system logs.'
echo 'You might want to save "/run/initramfs/sosreport.txt" to a USB stick or /boot'
echo 'after mounting them and attach it to a bug report.'
echo
echo
[ -f /etc/profile ] && . /etc/profile
[ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
exec sh -i -l
else
warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
exit 1
fi
/bin/rm -f /.console_lock
exit 0

View File

@@ -14,6 +14,9 @@ DefaultDependencies=no
After=systemd-udev-trigger.service
Wants=systemd-udev-trigger.service
ConditionPathExists=/etc/initrd-release
ConditionPathExists=|/lib/dracut/need-initqueue
ConditionPathExistsGlob=|/lib/dracut/hooks/initqueue/*.sh
ConditionKernelCommandLine=|rd.break=pre-mount
[Service]
Type=oneshot
@@ -22,6 +25,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.

View File

@@ -10,10 +10,11 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
RDRETRY=${RDRETRY:-30}
RDRETRY=${RDRETRY:-180}
RDRETRY=$(($RDRETRY*2))
export RDRETRY
@@ -24,7 +25,7 @@ while :; do
check_finished && break
udevsettle
udevadm settle --exit-if-exists=$hookdir/initqueue/work
check_finished && break
@@ -38,7 +39,7 @@ while :; do
check_finished && break 2
done
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
udevadm settle --timeout=0 >/dev/null 2>&1 || continue
for job in $hookdir/initqueue/settled/*.sh; do
[ -e "$job" ] || break
@@ -46,17 +47,17 @@ while :; do
check_finished && break 2
done
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
udevadm settle --timeout=0 >/dev/null 2>&1 || continue
# no more udev jobs and queues empty.
sleep 0.5
if [ $main_loop -gt $((2*$RDRETRY/3)) ]; then
for job in $hookdir/initqueue/timeout/*.sh; do
[ -e "$job" ] || break
job=$job . $job
main_loop=0
udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
[ -f $hookdir/initqueue/work ] && main_loop=0
done
fi
@@ -69,42 +70,8 @@ unset queuetriggered
unset main_loop
unset RDRETRY
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
source_hook pre-mount
getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
if ismounted "$NEWROOT"; then
usable_root "$NEWROOT" && break;
umount "$NEWROOT"
fi
for f in $hookdir/mount/*.sh; do
[ -f "$f" ] && . "$f"
if ismounted "$NEWROOT"; then
usable_root "$NEWROOT" && break;
warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
umount "$NEWROOT"
rm -f "$f"
fi
done
i=$(($i+1))
[ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
done
{
echo -n "Mounted root filesystem "
while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
export -p > /dracut-state.sh
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -0,0 +1,31 @@
# This file is part of systemd.
#
# 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
[Unit]
Description=dracut mount hook
Documentation=man:dracut-mount.service(8)
DefaultDependencies=no
After=dracut-pre-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target
Wants=local-fs.target
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/mount
ConditionKernelCommandLine=|rd.break=mount
[Service]
Type=oneshot
ExecStart=-/bin/dracut-mount
StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP

View File

@@ -0,0 +1,25 @@
DRACUT-MOUNT.SERVICE(8)
=======================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut-mount.service - runs the dracut hooks after /sysroot is mounted
SYNOPSIS
--------
dracut-mount.service
DESCRIPTION
-----------
This service runs all dracut hooks after the real root is mounted on /sysroot.
AUTHORS
-------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

View File

@@ -0,0 +1,41 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
. /dracut-state.sh 2>/dev/null
fi
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
make_trace_mem "hook mount" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
if ismounted "$NEWROOT"; then
usable_root "$NEWROOT" && break;
umount "$NEWROOT"
fi
for f in $hookdir/mount/*.sh; do
[ -f "$f" ] && . "$f"
if ismounted "$NEWROOT"; then
usable_root "$NEWROOT" && break;
warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
umount "$NEWROOT"
rm -f "$f"
fi
done
i=$(($i+1))
[ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
done
export -p > /dracut-state.sh
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -0,0 +1,32 @@
# This file is part of systemd.
#
# 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
[Unit]
Description=dracut pre-mount hook
Documentation=man:dracut-pre-mount.service(8)
DefaultDependencies=no
Before=sysroot.mount local-fs.target
After=dracut-initqueue.service
After=cryptsetup.target
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-mount
ConditionKernelCommandLine=|rd.break=pre-mount
[Service]
Type=oneshot
ExecStart=-/bin/dracut-pre-mount
StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP

View File

@@ -0,0 +1,25 @@
DRACUT-PRE-MOUNT.SERVICE(8)
===========================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut-pre-mount.service - runs the dracut hooks before /sysroot is mounted
SYNOPSIS
--------
dracut-pre-mount.service
DESCRIPTION
-----------
This service runs all dracut hooks before the real root is mounted on /sysroot.
AUTHORS
-------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

View File

@@ -0,0 +1,22 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
export DRACUT_SYSTEMD=1
if [ -f /dracut-state.sh ]; then
. /dracut-state.sh 2>/dev/null
fi
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
source_hook pre-mount
export -p > /dracut-state.sh
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -11,13 +11,16 @@
Description=dracut pre-pivot and cleanup hook
Documentation=man:dracut-pre-pivot.service(8)
DefaultDependencies=no
After=dracut-initqueue.service
After=dracut-mount.service dracut-initqueue.service initrd-parse-etc.service local-fs.target
Wants=local-fs.target
Before=initrd-cleanup.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
ConditionKernelCommandLine=|rd.break=pre-pivot
[Service]
Type=oneshot
ExecStart=-/bin/dracut-pre-pivot
ExecStopPost=-/usr/bin/systemctl --no-block isolate initrd-switch-root.target
StandardInput=null
StandardOutput=syslog
StandardError=syslog+console

View File

@@ -10,6 +10,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
@@ -19,25 +20,11 @@ source_hook pre-pivot
getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
source_hook cleanup
# By the time we get here, the root filesystem should be mounted.
# Try to find init.
for i in "$(getarg real_init=)" "$(getarg init=)"; do
[ -n "$i" ] || continue
__p=$(readlink -f "${NEWROOT}/${i}")
if [ -x "$__p" ]; then
INIT="$i"
echo "NEWINIT=\"$INIT\"" > /run/initramfs/switch-root.conf
break
fi
done
echo "NEWROOT=\"$NEWROOT\"" >> /run/initramfs/switch-root.conf
getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
# remove helper symlink
[ -h /dev/root ] && rm -f /dev/root
getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -15,6 +15,8 @@ Before=systemd-udev-trigger.service dracut-initqueue.service
After=dracut-pre-udev.service systemd-udevd.service
Wants=dracut-pre-udev.service systemd-udevd.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-trigger
ConditionKernelCommandLine=|rd.break=pre-trigger
[Service]
Type=oneshot
@@ -23,6 +25,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.

View File

@@ -10,13 +10,16 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
getargbool 0 rd.udev.info -n -y rdudevinfo && udevadm control --log-priority=info
getargbool 0 rd.udev.debug -n -y rdudevdebug && udevadm control --log-priority=debug
udevproperty "hookdir=$hookdir"
make_trace_mem "hook pre-trigger" "1:shortmem" "2+:mem" "3+:slab"
source_hook pre-trigger
getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break pre-trigger"
udevadm control --reload >/dev/null 2>&1 || :
export -p > /dracut-state.sh
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -15,6 +15,11 @@ Before=systemd-udevd.service dracut-pre-trigger.service
After=dracut-cmdline.service
Wants=dracut-cmdline.service
ConditionPathExists=/etc/initrd-release
ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-udev
ConditionKernelCommandLine=|rd.break=pre-udev
ConditionKernelCommandLine=|rd.driver.blacklist
ConditionKernelCommandLine=|rd.driver.pre
ConditionKernelCommandLine=|rd.driver.post
[Service]
Type=oneshot
@@ -23,6 +28,7 @@ StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
KillMode=process
RemainAfterExit=yes
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.

View File

@@ -9,10 +9,52 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break pre-udev"
source_hook pre-udev
_modprobe_d=/etc/modprobe.d
if [ -d /usr/lib/modprobe.d ] ; then
_modprobe_d=/usr/lib/modprobe.d
elif [ -d /lib/modprobe.d ] ; then
_modprobe_d=/lib/modprobe.d
elif [ ! -d $_modprobe_d ] ; then
mkdir -p $_modprobe_d
fi
for i in $(getargs rd.driver.pre -d rdloaddriver=); do
(
IFS=,
for p in $i; do
modprobe $p 2>&1 | vinfo
done
)
done
[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
(
IFS=,
for p in $i; do
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
done
)
done
for p in $(getargs rd.driver.post -d rdinsmodpost=); do
echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
unset _do_insmodpost _modprobe_d
unset i
export -p > /dracut-state.sh
service="${0##*/}"
cp "/etc/systemd/system/${service%.sh}.service" /run/systemd/system/
exit 0

View File

@@ -0,0 +1,11 @@
[Unit]
Description=dracut
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes
OnFailure=emergency.target
OnFailureIsolate=yes
[Install]
Alias=default.target

View File

@@ -0,0 +1,30 @@
# This file is part of systemd.
#
# 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
[Unit]
Description=Emergency Shell
DefaultDependencies=no
After=systemd-vconsole-setup.service
Wants=systemd-vconsole-setup.service
[Service]
Environment=HOME=/
WorkingDirectory=/
ExecStart=/bin/dracut-emergency
ExecStopPost=-/usr/bin/systemctl --no-block isolate dracut.target
Type=oneshot
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
KillMode=process
IgnoreSIGPIPE=no
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP

View File

@@ -1,26 +0,0 @@
# This file is part of systemd.
#
# 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.
[Unit]
Description=Switch Root
Documentation=man:initrd-switch-root.service(8)
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.service
After=initrd-switch-root.target
AllowIsolate=yes
[Service]
Type=oneshot
EnvironmentFile=/run/initramfs/switch-root.conf
# we have to use "--force" here, otherwise systemd would umount /run
ExecStart=-/usr/bin/systemctl --no-block --force switch-root ${NEWROOT} ${NEWINIT}
ExecStopPost=-/bin/rm -f /run/initramfs/switch-root.conf
StandardInput=null
StandardOutput=null
StandardError=null
KillMode=none

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