Compare commits
276 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3f7d943141 | ||
![]() |
f2558ddcc1 | ||
![]() |
b9372137fd | ||
![]() |
4f992675ae | ||
![]() |
6914b67545 | ||
![]() |
4c88c2859e | ||
![]() |
c984ddda6a | ||
![]() |
368f08cb7e | ||
![]() |
7bbee6ac49 | ||
![]() |
0b7fad2837 | ||
![]() |
b96ce4a6fd | ||
![]() |
509a3b2c33 | ||
![]() |
20700e3dea | ||
![]() |
8964abbd40 | ||
![]() |
eeb68f0a16 | ||
![]() |
c4c24171bf | ||
![]() |
0630273048 | ||
![]() |
aa5313ca0e | ||
![]() |
815ab93fe9 | ||
![]() |
c5c57f3f19 | ||
![]() |
b44b3ed036 | ||
![]() |
49a23aa426 | ||
![]() |
efaa5b05df | ||
![]() |
4fa660ba8f | ||
![]() |
19bb8937ed | ||
![]() |
17c1f640fa | ||
![]() |
e03b09212a | ||
![]() |
f86fa29cda | ||
![]() |
f2c5c5c961 | ||
![]() |
81a6e87f0f | ||
![]() |
52923f5f2a | ||
![]() |
c46be83492 | ||
![]() |
c2ce987e38 | ||
![]() |
564c0c4577 | ||
![]() |
5648ff27e2 | ||
![]() |
8715aa00a9 | ||
![]() |
828fd83bc1 | ||
![]() |
4de30f02c8 | ||
![]() |
1e03d8eb64 | ||
![]() |
2a1bdab6e8 | ||
![]() |
c504204de5 | ||
![]() |
e502fd3099 | ||
![]() |
1e9926c12d | ||
![]() |
7b8f2e7a7b | ||
![]() |
8bf70609de | ||
![]() |
bb232c88fa | ||
![]() |
0c81abbe79 | ||
![]() |
17e74416c8 | ||
![]() |
932169bc34 | ||
![]() |
b201a3f405 | ||
![]() |
ef6665ec41 | ||
![]() |
9c2daa5d3a | ||
![]() |
f679f53b2a | ||
![]() |
6a9d47ce27 | ||
![]() |
49fe9bc014 | ||
![]() |
491dbfe072 | ||
![]() |
8c1807bc97 | ||
![]() |
7cab5fbf59 | ||
![]() |
6db59a1630 | ||
![]() |
98b104e887 | ||
![]() |
b66bfd5b98 | ||
![]() |
962bb11663 | ||
![]() |
5f5c07eca2 | ||
![]() |
9c45cb9c11 | ||
![]() |
2fed6038bb | ||
![]() |
e23057d537 | ||
![]() |
40a5d2c029 | ||
![]() |
e92a7a2532 | ||
![]() |
1175816c30 | ||
![]() |
2a20064e44 | ||
![]() |
ec158d758b | ||
![]() |
705c84321d | ||
![]() |
d38488e8d5 | ||
![]() |
a2a9a17cc6 | ||
![]() |
e5f6899a55 | ||
![]() |
0506080aee | ||
![]() |
b990775b6f | ||
![]() |
251d5b65e3 | ||
![]() |
915618bc4f | ||
![]() |
f077a20056 | ||
![]() |
e1021bd2c1 | ||
![]() |
f1ea5376ed | ||
![]() |
4b07c26d33 | ||
![]() |
07c4a2fce5 | ||
![]() |
4c2d48d5c4 | ||
![]() |
db1b5a38e9 | ||
![]() |
69acbc4735 | ||
![]() |
7031115695 | ||
![]() |
42896820ba | ||
![]() |
bdb6683d6f | ||
![]() |
c2196a25b7 | ||
![]() |
9d75fd3b62 | ||
![]() |
89f2586ae9 | ||
![]() |
af1154fdce | ||
![]() |
84c66ac857 | ||
![]() |
711030d61d | ||
![]() |
e2e32cd02f | ||
![]() |
dccf47fd55 | ||
![]() |
e96c010011 | ||
![]() |
8482be832c | ||
![]() |
d52c4a761a | ||
![]() |
61bad12d44 | ||
![]() |
853897808a | ||
![]() |
30e2074447 | ||
![]() |
54c9094e2e | ||
![]() |
61fe003168 | ||
![]() |
ea6bc75ccb | ||
![]() |
5a3b267d06 | ||
![]() |
c2c437edba | ||
![]() |
81c9e22482 | ||
![]() |
da41507de9 | ||
![]() |
a367bed836 | ||
![]() |
6381b94459 | ||
![]() |
346fab9500 | ||
![]() |
84dfea4d2a | ||
![]() |
64c88c2f1d | ||
![]() |
9bbea8caf8 | ||
![]() |
361eaeaf07 | ||
![]() |
99ed45c218 | ||
![]() |
80f75fed99 | ||
![]() |
37a09c9cb6 | ||
![]() |
054447fa23 | ||
![]() |
0c0ca2d9bc | ||
![]() |
226004e007 | ||
![]() |
dc662386dc | ||
![]() |
36d3274050 | ||
![]() |
d802e985ae | ||
![]() |
3bb36e4512 | ||
![]() |
c26eb3eb3a | ||
![]() |
8bde20bc65 | ||
![]() |
c127eb8021 | ||
![]() |
5676a6d877 | ||
![]() |
3d47b5124c | ||
![]() |
b397bb7c19 | ||
![]() |
b4b60da8dc | ||
![]() |
c6fe81559e | ||
![]() |
286fbebdaf | ||
![]() |
27acb483e8 | ||
![]() |
657e832da0 | ||
![]() |
40cf35ef4e | ||
![]() |
f812e271cb | ||
![]() |
2f117f4db3 | ||
![]() |
37a18fda11 | ||
![]() |
ade113d75b | ||
![]() |
815b9c16a4 | ||
![]() |
eb7c58eced | ||
![]() |
a3dc6a7218 | ||
![]() |
87862728da | ||
![]() |
0d4bb7ce89 | ||
![]() |
b1cdf7c5d4 | ||
![]() |
a0b85db18e | ||
![]() |
dfaeee7341 | ||
![]() |
74c9df58f2 | ||
![]() |
3c4e663251 | ||
![]() |
56a5975f91 | ||
![]() |
6c7c8d8a07 | ||
![]() |
d110129695 | ||
![]() |
0ab5e8adc8 | ||
![]() |
9d47a90b12 | ||
![]() |
779f980658 | ||
![]() |
9bdbbe90ef | ||
![]() |
5183c9a588 | ||
![]() |
834f33440f | ||
![]() |
254f437848 | ||
![]() |
aa6ab27471 | ||
![]() |
cb97abc7bb | ||
![]() |
d1e9a5e384 | ||
![]() |
81564fcefc | ||
![]() |
82286609c9 | ||
![]() |
ea9b961e8c | ||
![]() |
7faae1264d | ||
![]() |
866e663fbd | ||
![]() |
9a177f8d51 | ||
![]() |
04220f9aff | ||
![]() |
db110a036a | ||
![]() |
937456c65b | ||
![]() |
998f4bb720 | ||
![]() |
a34d3dcaa8 | ||
![]() |
793beab60c | ||
![]() |
be10aecb17 | ||
![]() |
a1e9e9364a | ||
![]() |
53b20afabb | ||
![]() |
5a36d29f8a | ||
![]() |
8d7bd6af19 | ||
![]() |
d014032c62 | ||
![]() |
90441c4476 | ||
![]() |
dac45f997e | ||
![]() |
ff3d291a68 | ||
![]() |
411d2aedd6 | ||
![]() |
7f61e2c895 | ||
![]() |
32c431bb48 | ||
![]() |
7aa989a4fd | ||
![]() |
34397fe702 | ||
![]() |
243b8e14a2 | ||
![]() |
fb67162559 | ||
![]() |
15962471fe | ||
![]() |
e590f5beec | ||
![]() |
05b79aaa9d | ||
![]() |
1dd604efb1 | ||
![]() |
52592ce022 | ||
![]() |
03bf7758aa | ||
![]() |
20ff2d37cc | ||
![]() |
65ba6c44d8 | ||
![]() |
c35826c0e7 | ||
![]() |
ccad388c25 | ||
![]() |
eb27e4cc31 | ||
![]() |
ee916b72cc | ||
![]() |
352a49a21d | ||
![]() |
8eee542b40 | ||
![]() |
37e899aad1 | ||
![]() |
88fc0b8750 | ||
![]() |
9bd3573ddb | ||
![]() |
123feea1fa | ||
![]() |
8e3620568c | ||
![]() |
1a21ed8d1d | ||
![]() |
84fe197fac | ||
![]() |
86fff83927 | ||
![]() |
f0df0f3fcd | ||
![]() |
52d3c1b726 | ||
![]() |
6ea78f9f4e | ||
![]() |
4584826e9a | ||
![]() |
1b827040f8 | ||
![]() |
4fde4d0647 | ||
![]() |
fdaa69db20 | ||
![]() |
31b89c8c2b | ||
![]() |
a5659901e8 | ||
![]() |
32b970339f | ||
![]() |
d87da4c777 | ||
![]() |
cf9f56be9c | ||
![]() |
eaa4d30d5a | ||
![]() |
54011e3591 | ||
![]() |
ebc7f823c0 | ||
![]() |
ff33b57676 | ||
![]() |
4b1aa19fa0 | ||
![]() |
764b520994 | ||
![]() |
96f48da50c | ||
![]() |
72ce014bc7 | ||
![]() |
af34b26047 | ||
![]() |
da63c0de56 | ||
![]() |
ffecc45232 | ||
![]() |
d8cc8c0499 | ||
![]() |
36b2e5e2c2 | ||
![]() |
3c4315fa13 | ||
![]() |
d97d130da9 | ||
![]() |
e0aa98a1df | ||
![]() |
84bc192946 | ||
![]() |
e684eab878 | ||
![]() |
debf483d4d | ||
![]() |
d681df8e5f | ||
![]() |
540a5169b9 | ||
![]() |
12beb05a73 | ||
![]() |
e6aafacb23 | ||
![]() |
8d3d72a68c | ||
![]() |
b2fab575dc | ||
![]() |
de74e1ef41 | ||
![]() |
f2cbd4cbd6 | ||
![]() |
5ecc117a25 | ||
![]() |
00ed3ccfd9 | ||
![]() |
6a877a79c4 | ||
![]() |
cb73315dd6 | ||
![]() |
8552a3270c | ||
![]() |
281327f72c | ||
![]() |
da119ab18c | ||
![]() |
87bd8907a6 | ||
![]() |
a242ef13e0 | ||
![]() |
2b9d8f65a6 | ||
![]() |
ffc68f357e | ||
![]() |
ace51ef520 | ||
![]() |
93b02f502e | ||
![]() |
49c062821a | ||
![]() |
c504d8b435 | ||
![]() |
39fe00ef60 | ||
![]() |
bae44febb5 | ||
![]() |
5c274467d6 | ||
![]() |
c82a11334d | ||
![]() |
f34e1d6b0e |
2
.dir-locals.el
Normal file
2
.dir-locals.el
Normal file
@@ -0,0 +1,2 @@
|
||||
(setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
1
.kateconfig
Normal file
1
.kateconfig
Normal file
@@ -0,0 +1 @@
|
||||
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
|
9
.kateproject
Normal file
9
.kateproject
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "Kate"
|
||||
, "files": [ { "git": 1 } ]
|
||||
, "build": {
|
||||
"directory": "build"
|
||||
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
|
||||
, "clean": "make clean"
|
||||
}
|
||||
}
|
@@ -22,7 +22,7 @@ done
|
||||
ret=0
|
||||
case "$1" in
|
||||
add)
|
||||
dracut ${noimageifnotneeded+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
dracut ${noimageifnotneeded:+--noimageifnotneeded} "$3"/initrd "$2"
|
||||
ret=$?
|
||||
;;
|
||||
remove)
|
||||
|
27
Makefile
27
Makefile
@@ -21,7 +21,8 @@ man1pages = lsinitrd.1
|
||||
man5pages = dracut.conf.5
|
||||
|
||||
man7pages = dracut.cmdline.7 \
|
||||
dracut.bootup.7
|
||||
dracut.bootup.7 \
|
||||
dracut.modules.7
|
||||
|
||||
man8pages = dracut.8 \
|
||||
dracut-catimages.8 \
|
||||
@@ -37,10 +38,9 @@ man8pages = dracut.8 \
|
||||
|
||||
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
|
||||
|
||||
|
||||
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
|
||||
|
||||
all: dracut-version.sh dracut-install
|
||||
all: dracut-version.sh dracut-install skipcpio/skipcpio
|
||||
|
||||
DRACUT_INSTALL_OBJECTS = \
|
||||
install/dracut-install.o \
|
||||
@@ -61,8 +61,15 @@ install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
dracut-install: install/dracut-install
|
||||
ln -fs $< $@
|
||||
|
||||
SKIPCPIO_OBJECTS= \
|
||||
skipcpio/skipcpio.o
|
||||
|
||||
skipcpio/skipcpio.o: skipcpio/skipcpio.c
|
||||
skipcpio/skipcpio: skipcpio/skipcpio.o
|
||||
|
||||
indent:
|
||||
indent -i8 -nut -br -linux -l120 install/dracut-install.c
|
||||
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
|
||||
|
||||
doc: $(manpages) dracut.html
|
||||
|
||||
@@ -76,11 +83,13 @@ endif
|
||||
%.xml: %.asc
|
||||
asciidoc -d manpage -b docbook -o $@ $<
|
||||
|
||||
dracut.html: dracut.asc $(manpages)
|
||||
dracut.8: dracut.usage.asc dracut.8.asc
|
||||
|
||||
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam html.stylesheet \
|
||||
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
--stringparam generate.css.header 1 \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
|
||||
rm -f -- dracut.xml
|
||||
|
||||
@@ -134,6 +143,9 @@ endif
|
||||
if [ -f install/dracut-install ]; then \
|
||||
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
|
||||
fi
|
||||
if [ -f skipcpio/skipcpio ]; then \
|
||||
install -m 0755 skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
|
||||
fi
|
||||
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
|
||||
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
|
||||
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
@@ -153,6 +165,7 @@ clean:
|
||||
$(RM) dracut-*.rpm dracut-*.tar.bz2
|
||||
$(RM) dracut-version.sh
|
||||
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
|
||||
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
@@ -204,7 +217,7 @@ testimages: all
|
||||
@echo wrote test-dracut.img
|
||||
|
||||
hostimage: all
|
||||
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r)
|
||||
@echo wrote test-$(shell uname -r).img
|
||||
|
||||
AUTHORS:
|
||||
|
18
NEWS
18
NEWS
@@ -1,3 +1,21 @@
|
||||
dracut-033
|
||||
==========
|
||||
- improved hostonly device recognition
|
||||
- improved hostonly module recognition
|
||||
- add dracut.css for dracut.html
|
||||
- do not install udev rules from /etc in generic mode
|
||||
- fixed LABEL= parsing for swap devices
|
||||
- fixed iBFT network setup
|
||||
- url-lib.sh: handle 0-size files with curl
|
||||
- dracut.asc: document debugging dracut on shutdown
|
||||
- if rd.md=0, use dmraid for imsm and ddf
|
||||
- skip empty dracut modules
|
||||
- removed caching of kernel cmdline
|
||||
- fixed iso-scan, if the loop device driver is a kernel module
|
||||
- bcache: support new blkid
|
||||
- fixed ifup udev rules
|
||||
- ifup with dhcp, if no "ip=" specified for the interface
|
||||
|
||||
dracut-032
|
||||
==========
|
||||
- add parameter --print-cmdline
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
@@ -34,7 +34,7 @@ _dracut() {
|
||||
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
|
||||
--xz --no-compress --gzip --list-modules --show-modules --keep
|
||||
--printsize --regenerate-all --noimageifnotneeded --early-microcode
|
||||
--no-early-microcode --print-cmdline'
|
||||
--no-early-microcode --print-cmdline --prelink --noprelink'
|
||||
|
||||
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
|
||||
--omit-drivers --modules --omit --drivers --filesystems --install
|
||||
|
@@ -60,9 +60,9 @@ ldconfig_paths()
|
||||
local a i
|
||||
declare -A a
|
||||
for i in $(
|
||||
ldconfig -pN 2>/dev/null | while read a b c d; do
|
||||
[[ "$c" != "=>" ]] && continue
|
||||
printf "%s\n" ${d%/*};
|
||||
ldconfig -pN 2>/dev/null | grep -F '=>' | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | while read a b c d; do
|
||||
d=${d%/*}
|
||||
printf "%s\n" "$d";
|
||||
done
|
||||
); do
|
||||
a["$i"]=1;
|
||||
@@ -81,7 +81,7 @@ if ! [[ $libdirs ]] ; then
|
||||
[[ -d /usr/lib ]] && libdirs+=" /usr/lib"
|
||||
fi
|
||||
|
||||
libdirs+="$(ldconfig_paths)"
|
||||
libdirs+=" $(ldconfig_paths)"
|
||||
|
||||
export libdirs
|
||||
fi
|
||||
@@ -175,7 +175,7 @@ print_vars() {
|
||||
|
||||
for _var in "$@"
|
||||
do
|
||||
eval printf -v _value "%s" "\$$_var"
|
||||
eval printf -v _value "%s" \""\$$_var"\"
|
||||
[[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
|
||||
done
|
||||
}
|
||||
@@ -296,6 +296,23 @@ get_maj_min() {
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
|
||||
|
||||
# get_devpath_block <device>
|
||||
# get the DEVPATH in /sys of a block device
|
||||
get_devpath_block() {
|
||||
local _majmin _i
|
||||
_majmin=$(get_maj_min "$1")
|
||||
|
||||
for _i in /sys/block/*/dev /sys/block/*/*/dev; do
|
||||
[[ -e "$_i" ]] || continue
|
||||
if [[ "$_majmin" == "$(<"$_i")" ]]; then
|
||||
printf "%s" "${_i%/dev}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# get a persistent path from a device
|
||||
get_persistent_dev() {
|
||||
local i _tmp _dev
|
||||
@@ -313,6 +330,7 @@ get_persistent_dev() {
|
||||
/dev/disk/by-id/* \
|
||||
/dev/disk/by-path/* \
|
||||
; do
|
||||
[[ -e "$i" ]] || continue
|
||||
[[ $i == /dev/mapper/control ]] && continue
|
||||
[[ $i == /dev/mapper/mpath* ]] && continue
|
||||
_tmp=$(get_maj_min "$i")
|
||||
@@ -323,19 +341,43 @@ get_persistent_dev() {
|
||||
done
|
||||
}
|
||||
|
||||
expand_persistent_dev() {
|
||||
local _dev=$1
|
||||
|
||||
case "$_dev" in
|
||||
LABEL=*)
|
||||
_dev="/dev/disk/by-label/${_dev#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
_dev="${_dev#UUID=}"
|
||||
_dev="${_dev,,}"
|
||||
_dev="/dev/disk/by-uuid/${_dev}"
|
||||
;;
|
||||
PARTUUID=*)
|
||||
_dev="${_dev#PARTUUID=}"
|
||||
_dev="${_dev,,}"
|
||||
_dev="/dev/disk/by-partuuid/${_dev}"
|
||||
;;
|
||||
PARTLABEL=*)
|
||||
_dev="/dev/disk/by-partlabel/${_dev#PARTLABEL=}"
|
||||
;;
|
||||
esac
|
||||
printf "%s" "$_dev"
|
||||
}
|
||||
|
||||
shorten_persistent_dev() {
|
||||
local dev="$1"
|
||||
case "$dev" in
|
||||
local _dev="$1"
|
||||
case "$_dev" in
|
||||
/dev/disk/by-uuid/*)
|
||||
printf "%s" "UUID=${dev##*/}";;
|
||||
printf "%s" "UUID=${_dev##*/}";;
|
||||
/dev/disk/by-label/*)
|
||||
printf "%s" "LABEL=${dev##*/}";;
|
||||
printf "%s" "LABEL=${_dev##*/}";;
|
||||
/dev/disk/by-partuuid/*)
|
||||
printf "%s" "PARTUUID=${dev##*/}";;
|
||||
printf "%s" "PARTUUID=${_dev##*/}";;
|
||||
/dev/disk/by-partlabel/*)
|
||||
printf "%s" "PARTLABEL=${dev##*/}";;
|
||||
printf "%s" "PARTLABEL=${_dev##*/}";;
|
||||
*)
|
||||
printf "%s" "$dev";;
|
||||
printf "%s" "$_dev";;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -537,7 +579,7 @@ host_fs_all()
|
||||
check_block_and_slaves() {
|
||||
local _x
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
"$1" $2 && return
|
||||
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
if [[ -f /sys/dev/block/$2/../dev ]]; then
|
||||
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
|
||||
@@ -553,7 +595,7 @@ check_block_and_slaves() {
|
||||
check_block_and_slaves_all() {
|
||||
local _x _ret=1
|
||||
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
||||
if "$1" $2; then
|
||||
if ! lvm_internal_dev $2 && "$1" $2; then
|
||||
_ret=0
|
||||
fi
|
||||
check_vol_slaves "$@" && return 0
|
||||
@@ -664,37 +706,37 @@ fi
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
|
||||
}
|
||||
|
||||
inst() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
#dinfo "$DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@" || :
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_multiple() {
|
||||
local ret
|
||||
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
ret=$?
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
(($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
return $ret
|
||||
}
|
||||
|
||||
@@ -705,18 +747,18 @@ dracut_install() {
|
||||
inst_library() {
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
$DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
|
||||
}
|
||||
|
||||
# find symlinks linked to given library file
|
||||
@@ -830,8 +872,8 @@ inst_rules() {
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in ${udevdir}/rules.d /etc/udev/rules.d; do
|
||||
if [[ -f $r/$_rule ]]; then
|
||||
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
|
||||
if [[ -e $r/$_rule ]]; then
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
inst_rule_group_owner "$_found"
|
||||
@@ -840,7 +882,10 @@ inst_rules() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
for r in '' ./ $dracutbasedir/rules.d/; do
|
||||
for r in '' $dracutbasedir/rules.d/; do
|
||||
# skip rules without an absolute path
|
||||
[[ "${r}$_rule" != /* ]] && continue
|
||||
|
||||
if [[ -f ${r}$_rule ]]; then
|
||||
_found="${r}$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
@@ -1170,13 +1215,17 @@ check_mount() {
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& dracutmodules+=" $_moddep "
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
@@ -1214,7 +1263,7 @@ check_module() {
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
@@ -1225,7 +1274,11 @@ check_module() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod || return 1
|
||||
module_check $_mod; ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
fi
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
@@ -1234,10 +1287,15 @@ check_module() {
|
||||
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& dracutmodules+=" $_moddep "
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& add_dracutmodules+=" $_moddep "
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
||||
&& force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
if ! check_module $_moddep; then
|
||||
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
||||
@@ -1260,17 +1318,28 @@ for_each_module_dir() {
|
||||
local _func
|
||||
_func=$1
|
||||
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
[[ -d $_moddir ]] || continue;
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
_modcheck="$add_dracutmodules $force_add_dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules"
|
||||
for _mod in $_modcheck; do
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && continue
|
||||
[[ " $omit_dracutmodules " == *\ $_mod\ * ]] && continue
|
||||
|
||||
[[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_mod\ * ]] \
|
||||
&& [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& continue
|
||||
|
||||
derror "dracut module '$_mod' cannot be found or installed."
|
||||
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
[[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1362,7 +1431,7 @@ dracut_kernel_post() {
|
||||
local _pid
|
||||
|
||||
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
|
||||
xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} \
|
||||
xargs -r modprobe -a ${_moddirname:+-d ${_moddirname}/} \
|
||||
--ignore-install --show-depends --set-version $kernel \
|
||||
< "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
|
||||
| sort -u \
|
||||
@@ -1373,7 +1442,7 @@ dracut_kernel_post() {
|
||||
|
||||
(
|
||||
if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
|
||||
xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
|
||||
else
|
||||
while read _modpath; do
|
||||
local _destpath=$_modpath
|
||||
@@ -1392,7 +1461,7 @@ dracut_kernel_post() {
|
||||
for _fwdir in $fw_dir; do
|
||||
echo $_fwdir/$line;
|
||||
done;
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
|
||||
done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a -o
|
||||
else
|
||||
for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
|
||||
for _fwdir in $fw_dir; do
|
||||
@@ -1407,13 +1476,6 @@ dracut_kernel_post() {
|
||||
wait $_pid
|
||||
fi
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin; do
|
||||
[[ $srcmods/$_f ]] && break
|
||||
done || {
|
||||
dfatal "No modules.builtin.bin and modules.builtin found!"
|
||||
return 1
|
||||
}
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
done
|
||||
@@ -1428,23 +1490,47 @@ dracut_kernel_post() {
|
||||
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR"
|
||||
}
|
||||
|
||||
[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
||||
|
||||
module_is_host_only() {
|
||||
local _mod=$1
|
||||
local _modenc a i _k _s _v _aliases
|
||||
_mod=${_mod##*/}
|
||||
_mod=${_mod%.ko}
|
||||
_modenc=${_mod//-/_}
|
||||
|
||||
[[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
|
||||
|
||||
# check if module is loaded
|
||||
for i in /sys/module/${_mod//-/_}; do
|
||||
[[ -d $i ]] && return 0
|
||||
done
|
||||
[[ ${host_modules["$_modenc"]} ]] && return 0
|
||||
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
modinfo -F filename "$_mod" &>/dev/null || return 0
|
||||
[[ "$kernel_current" ]] || export kernel_current=$(uname -r)
|
||||
|
||||
if [[ "$kernel_current" != "$kernel" ]]; then
|
||||
# check if module is loadable on the current kernel
|
||||
# this covers the case, where a new module is introduced
|
||||
# or a module was renamed
|
||||
# or a module changed from builtin to a module
|
||||
|
||||
if [[ -d /lib/modules/$kernel_current ]]; then
|
||||
# if the modinfo can be parsed, but the module
|
||||
# is not loaded, then we can safely return 1
|
||||
modinfo -F filename "$_mod" &>/dev/null && return 1
|
||||
fi
|
||||
|
||||
_aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null)
|
||||
|
||||
# if the module has no aliases, install it
|
||||
[[ $_aliases ]] || return 0
|
||||
|
||||
# finally check all modalias
|
||||
for a in $_aliases; do
|
||||
for i in "${!host_modalias[@]}"; do
|
||||
[[ $i == $a ]] && return 0
|
||||
done
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -1457,7 +1543,7 @@ find_kernel_modules_by_path () {
|
||||
_OLDIFS=$IFS
|
||||
IFS=:
|
||||
while read a rest; do
|
||||
[[ $a = */$1/* ]] || continue
|
||||
[[ $a = */$1/* ]] || [[ $a = updates/* ]] || [[ $a = extra/* ]] || [[ $a = weak-updates/* ]] ||continue
|
||||
printf "%s\n" "$srcmods/$a"
|
||||
done < "$srcmods/modules.dep"
|
||||
IFS=$_OLDIFS
|
||||
@@ -1606,3 +1692,15 @@ get_ucode_file ()
|
||||
printf "%02x-%02x-%02x" ${family} ${model} ${stepping}
|
||||
fi
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
local dev_dm_dir=/sys/dev/block/$1/dm
|
||||
[[ ! -f $dev_dm_dir/uuid || $(<$dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
|
||||
local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(<$dev_dm_dir/name)" 2>/dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
|
||||
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,10 @@ set -e
|
||||
|
||||
KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
[[ -x $SKIP ]] || SKIP=cat
|
||||
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
|
||||
@@ -16,9 +20,11 @@ fi
|
||||
cd /run/initramfs
|
||||
|
||||
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
|
||||
if zcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
|
||||
elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
|
||||
rm -f -- .need_shutdown
|
||||
else
|
||||
# something failed, so we clean up
|
||||
|
@@ -140,16 +140,25 @@ dlog_init() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $UID != 0 )); then
|
||||
kmsgloglvl=0
|
||||
sysloglvl=0
|
||||
fi
|
||||
|
||||
if (( $sysloglvl > 0 )); then
|
||||
if [[ -d /run/systemd/journal ]] && type -P systemd-cat &>/dev/null && (( $UID == 0 )) ; then
|
||||
if [[ -d /run/systemd/journal ]] \
|
||||
&& type -P systemd-cat &>/dev/null \
|
||||
&& systemctl --quiet is-active systemd-journald.socket &>/dev/null \
|
||||
&& { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
|
||||
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
|
||||
readonly _systemdcatfile="$_dlogdir/systemd-cat"
|
||||
mkfifo "$_systemdcatfile"
|
||||
readonly _dlogfd=15
|
||||
systemd-cat -t 'dracut' <"$_systemdcatfile" &
|
||||
systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
|
||||
exec 15>"$_systemdcatfile"
|
||||
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
|
||||
# We cannot log to syslog, so turn this facility off.
|
||||
kmsgloglvl=$sysloglvl
|
||||
sysloglvl=0
|
||||
ret=1
|
||||
errmsg="No '/dev/log' or 'logger' included for syslog logging"
|
||||
@@ -321,7 +330,7 @@ _do_dlog() {
|
||||
|
||||
if (( $lvl <= $sysloglvl )); then
|
||||
if [[ "$_dlogfd" ]]; then
|
||||
echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd
|
||||
printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
|
||||
else
|
||||
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
|
||||
fi
|
||||
|
121
dracut.8.asc
121
dracut.8.asc
@@ -10,7 +10,7 @@ dracut - low-level tool for generating an initramfs image
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
*dracut* ['OPTION...'] [<image> [_<kernel version>_]]
|
||||
*dracut* [__OPTION...__] [__<image>__ [__<kernel version>__]]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -33,57 +33,14 @@ 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/rdsosreport.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/rdsosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
Additional debugging info can be produced by adding **rd.debug** to the kernel
|
||||
command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
|
||||
of some tools. It should be attached to any report about dracut problems.
|
||||
|
||||
EXAMPLE
|
||||
-------
|
||||
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
This will generate a general purpose initramfs image, with all possible
|
||||
functionality resulting of the combination of the installed dracut modules and
|
||||
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --hostonly or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--hostonly option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
USAGE
|
||||
-----
|
||||
|
||||
include::dracut.usage.asc[]
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
@@ -269,6 +226,12 @@ example:
|
||||
**--nostrip**::
|
||||
do not strip binaries in the initramfs
|
||||
|
||||
**--prelink**::
|
||||
prelink binaries in the initramfs (default)
|
||||
|
||||
**--noprelink**::
|
||||
do not prelink binaries in the initramfs
|
||||
|
||||
**--hardlink**::
|
||||
hardlink files in the initramfs (default)
|
||||
|
||||
@@ -312,6 +275,12 @@ Default:
|
||||
|
||||
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
|
||||
|
||||
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
|
||||
the configuration files.
|
||||
+
|
||||
Default:
|
||||
_/var/log/dracut.log_
|
||||
|
||||
**-l, --local**::
|
||||
activates the local mode. dracut will use modules from the current working
|
||||
directory instead of the system-wide installed modules in
|
||||
@@ -331,7 +300,13 @@ provide a valid _/etc/fstab_.
|
||||
**-N, --no-hostonly**::
|
||||
Disable Host-Only mode
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
**--hostonly-cmdline**:
|
||||
Store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--no-hostonly-cmdline**:
|
||||
Do not store kernel command line arguments needed in the initramfs
|
||||
|
||||
**--persistent-policy** _<policy>_::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
E.g. "by-uuid", "by-label"
|
||||
@@ -339,12 +314,16 @@ provide a valid _/etc/fstab_.
|
||||
**--fstab**::
|
||||
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
|
||||
|
||||
**--add-fstab** _<filename>_ ::
|
||||
**--add-fstab** _<filename>_::
|
||||
Add entries of _<filename>_ to the initramfs /etc/fstab.
|
||||
|
||||
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
|
||||
options>_ in the initramfs
|
||||
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
|
||||
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
|
||||
initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
|
||||
be specified, see fstab manpage for the details.
|
||||
The default _<filesystem options>_ is "defaults".
|
||||
The default _<dump frequency>_ is "0".
|
||||
the default _<fsck order>_ is "2".
|
||||
|
||||
**--add-device** _<device>_ ::
|
||||
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
|
||||
@@ -352,13 +331,13 @@ provide a valid _/etc/fstab_.
|
||||
LVM or an encrypted partition.
|
||||
[NB --device can be used for compatibility with earlier releases]
|
||||
|
||||
**-i, --include** _<SOURCE>_ _<TARGET>_::
|
||||
**-i, --include** _<SOURCE>_ _<TARGET>_::
|
||||
include the files in the SOURCE directory into the
|
||||
TARGET directory in the final initramfs. If SOURCE is a file, it will be
|
||||
installed to TARGET in the final initramfs. This parameter can be specified
|
||||
multiple times.
|
||||
|
||||
**-I, --install** _<file list>_::
|
||||
**-I, --install** _<file list>_::
|
||||
install the space separated list of files into the initramfs.
|
||||
+
|
||||
[NOTE]
|
||||
@@ -399,7 +378,24 @@ will not be able to boot. Equivalent to "lzma --compress=lzma -9"
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has xz decompression support compiled in, otherwise you
|
||||
will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
|
||||
will not be able to boot. Equivalent to
|
||||
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
|
||||
====
|
||||
|
||||
**--lzo**::
|
||||
Compress the generated initramfs using lzop.
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has lzo decompression support compiled in, otherwise you
|
||||
will not be able to boot.
|
||||
====
|
||||
|
||||
**--lz4**::
|
||||
Compress the generated initramfs using lz4.
|
||||
[WARNING]
|
||||
====
|
||||
Make sure your kernel has lz4 decompression support compiled in, otherwise you
|
||||
will not be able to boot.
|
||||
====
|
||||
|
||||
**--compress** _<compressor>_::
|
||||
@@ -444,8 +440,8 @@ will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma
|
||||
----
|
||||
|
||||
**--regenerate-all**::
|
||||
Regenerate all initramfs images at the default location with the kernel versions found on the system.
|
||||
Additional parameters are passed through.
|
||||
Regenerate all initramfs images at the default location with the kernel
|
||||
versions found on the system. Additional parameters are passed through.
|
||||
|
||||
FILES
|
||||
-----
|
||||
@@ -473,9 +469,10 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
Can contain additional command line options. Deprecated, better use
|
||||
/etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf::
|
||||
_/etc/cmdline.d/*.conf_::
|
||||
Can contain additional command line options.
|
||||
|
||||
AVAILABILITY
|
||||
|
883
dracut.asc
883
dracut.asc
@@ -1,7 +1,7 @@
|
||||
dracut
|
||||
======
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
v2.0, March 2011
|
||||
v3.0, October 2013
|
||||
|
||||
:language: bash
|
||||
|
||||
@@ -125,12 +125,14 @@ started looks like <<dracutbootup7>>.
|
||||
|
||||
== Dracut on shutdown
|
||||
|
||||
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure.
|
||||
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
|
||||
* 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
|
||||
@@ -138,875 +140,19 @@ The following steps are executed during a shutdown:
|
||||
* 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
|
||||
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
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
This will generate a general purpose initramfs image, with all possible
|
||||
functionality resulting of the combination of the installed dracut modules and
|
||||
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --host-only or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--host-only option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
|
||||
=== Inspecting the Contents
|
||||
To see the contents of the image created by dracut, you can use the lsinitrd tool.
|
||||
----
|
||||
# lsinitrd /boot/initramfs-$(uname -r).img | less
|
||||
----
|
||||
|
||||
To display the contents of a file in the initramfs also use the lsinitrd tool:
|
||||
----
|
||||
# lsinitrd /boot/initramfs-$(uname -r).img /etc/ld.so.conf
|
||||
include ld.so.conf.d/*.conf
|
||||
----
|
||||
|
||||
=== Adding dracut Modules
|
||||
Some dracut modules are turned off by default and have to be activated manually.
|
||||
You can do this by adding the dracut modules to the configuration file
|
||||
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See <<dracutconf5>>.
|
||||
You can also add dracut modules on the command line
|
||||
by using the -a or --add option:
|
||||
----
|
||||
# dracut --add bootchart initramfs-bootchart.img
|
||||
----
|
||||
|
||||
To see a list of available dracut modules, use the --list-modules option:
|
||||
----
|
||||
# dracut --list-modules
|
||||
----
|
||||
|
||||
or, if you have a dracut version earlier than +008+, issue the command:
|
||||
----
|
||||
# for mod in /usr/lib/dracut/modules.d/*; do echo ${mod##*/??}; done
|
||||
----
|
||||
|
||||
=== Omitting dracut Modules
|
||||
Sometimes you don't want a dracut module to be included for reasons of speed,
|
||||
size or functionality. To do this, either specify the omit_dracutmodules
|
||||
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
|
||||
file (see <<dracutconf5>>), or use the -o or --omit option
|
||||
on the command line:
|
||||
----
|
||||
# dracut -o "multipath lvm" no-multipath-lvm.img
|
||||
----
|
||||
|
||||
=== Adding Kernel Modules
|
||||
If you need a special kernel module in the initramfs, which is not
|
||||
automatically picked up by dracut, you have the use the --add-drivers option
|
||||
on the command line or the drivers vaiable in the _/etc/dracut.conf_
|
||||
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see <<dracutconf5>>):
|
||||
----
|
||||
# dracut --add-drivers mymod initramfs-with-mymod.img
|
||||
----
|
||||
|
||||
== Boot parameters
|
||||
The generated initramfs.img file normally does not contain any system
|
||||
configuration files (except for some special exceptions), so the configuration
|
||||
has to be done on the kernel command line. With this flexibility, you can easily
|
||||
boot from a changed root partition, without the need to recompile the initramfs
|
||||
image. So, you could completly change your root partition (move it inside a md
|
||||
raid with encryption and LVM on top), as long as you specify the correct
|
||||
filesystem LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
|
||||
The kernel command line usually can be configured in _/boot/grub/grub.conf_, if
|
||||
grub is your bootloader and it also can be edited in the real boot process in
|
||||
the grub menu.
|
||||
|
||||
The kernel command line can also be provided by the dhcp server with the
|
||||
root-path option. See <<NetworkBoot>>.
|
||||
|
||||
For a full reference of all kernel command line parameters, see <<dracut8>>.
|
||||
|
||||
=== Specifying the root Device
|
||||
This is the only option dracut really needs to boot from your root partition.
|
||||
Because your root partition can live in various environments, there are a lot of
|
||||
formats for the root= option. The most basic one is root=_++<path to device
|
||||
node>++_:
|
||||
----
|
||||
root=/dev/sda2
|
||||
----
|
||||
|
||||
Because device node names can change, dependent on the drive ordering, you are
|
||||
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
|
||||
to specify your root partition:
|
||||
----
|
||||
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
root=LABEL=myrootpartitionlabel
|
||||
----
|
||||
|
||||
To see all UUIDs or LABELs on your system, do:
|
||||
----
|
||||
# ls -l /dev/disk/by-uuid
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
# ls -l /dev/disk/by-label
|
||||
----
|
||||
|
||||
If your root partition is on the network see <<NetworkBoot>>.
|
||||
|
||||
=== Keyboard Settings
|
||||
If you have to input passwords for encrypted disk volumes, you might want to set
|
||||
the keyboard layout and specify a display font.
|
||||
|
||||
A typical german kernel command would contain:
|
||||
----
|
||||
vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
a modern init system, like systemd.
|
||||
|
||||
For dracut versions prior to version +008+ the line would look like:
|
||||
----
|
||||
LANG=de_DE.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys
|
||||
----
|
||||
|
||||
=== Blacklisting Kernel Modules
|
||||
Sometimes it is required to prevent the automatic kernel module loading of a
|
||||
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
|
||||
name>++_, with _++<kernel module name>++_ not containing the _.ko_
|
||||
suffix, to the kernel command line. For example:
|
||||
----
|
||||
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
|
||||
----
|
||||
|
||||
The option can be specified multiple times on the kernel command line.
|
||||
|
||||
=== Speeding up the Boot Process
|
||||
If you want to speed up the boot process, you can specify as much information
|
||||
for dracut on the kernel command as possible. For example, you can tell dracut,
|
||||
that you root partition is not on a LVM volume or not on a raid partition, or
|
||||
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
|
||||
searches everywhere. A typical dracut kernel command line for a plain primary or
|
||||
logical partition would contain:
|
||||
----
|
||||
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
|
||||
----
|
||||
|
||||
On systems with dracut version prior to +008+ the line would look like:
|
||||
----
|
||||
rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM
|
||||
----
|
||||
|
||||
This turns off every automatic assembly of LVM, MD raids, DM raids and crypto LUKS.
|
||||
|
||||
Of course, you could also omit the dracut modules in the initramfs creation
|
||||
process, but then you would lose the posibility to turn it on on demand.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
=== Injecting custom Files
|
||||
To add your own files to the initramfs image, you have several possibilities.
|
||||
|
||||
The --include option let you specify a source path and a target path. For example
|
||||
----
|
||||
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
|
||||
----
|
||||
will create an initramfs image, where the file cmdline-preset will be copied
|
||||
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only be specified once.
|
||||
|
||||
|
||||
----
|
||||
# mkdir rd.live.overlay
|
||||
# mkdir rd.live.overlay/etc
|
||||
# mkdir rd.live.overlay/etc/conf.d
|
||||
# mkdir rd.live.overlay/etc/cmdline.d
|
||||
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
└── etc
|
||||
├── cmdline.d
|
||||
│ └── mycmdline.conf
|
||||
└── conf.d
|
||||
└── testvar.conf
|
||||
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
|
||||
----
|
||||
|
||||
This will put the contents of the rd.live.overlay directory into the root of the
|
||||
initramfs image.
|
||||
|
||||
The --install option let you specify several files, which will get installed in
|
||||
the initramfs image at the same location, as they are present on initramfs
|
||||
creation time.
|
||||
|
||||
|
||||
----
|
||||
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
|
||||
----
|
||||
|
||||
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
|
||||
together with the libraries needed to start those. The --install option can be
|
||||
specified multiple times.
|
||||
|
||||
|
||||
[[NetworkBoot]]
|
||||
== Network Boot
|
||||
|
||||
If your root partition is on a network drive, you have to have the network
|
||||
dracut modules installed to create a network aware initramfs image.
|
||||
|
||||
On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
|
||||
the _dracut-network_ rpm package:
|
||||
|
||||
|
||||
----
|
||||
# yum install dracut-network
|
||||
----
|
||||
|
||||
The resulting initramfs image can be served by a boot manager residing on your
|
||||
local hard drive or it can be served by a PXE/TFTP server.
|
||||
|
||||
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 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
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a method described
|
||||
in <<Injecting>>.
|
||||
|
||||
|
||||
|
||||
|
||||
=== Reducing the Image Size
|
||||
|
||||
To reduce the size of the initramfs, you should create it with by ommitting all
|
||||
dracut modules, which you know, you don't need to boot the machine.
|
||||
|
||||
You can also specify the exact dracut and kernel modules to produce a very tiny
|
||||
initramfs image.
|
||||
|
||||
For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
Then you would boot from this image with your target machine and reduce the size
|
||||
once more by creating it on the target machine with the --host-only option:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
|
||||
----
|
||||
|
||||
This will reduce the size of the initramfs image significantly.
|
||||
|
||||
|
||||
|
||||
=== NFS Root Device
|
||||
|
||||
FIXME
|
||||
|
||||
=== iSCSI Root Device
|
||||
|
||||
FIXME
|
||||
|
||||
=== FCoE Root Device
|
||||
|
||||
FIXME
|
||||
|
||||
== Troubleshooting
|
||||
|
||||
If the boot process does not succeed, you have several options to debug the
|
||||
situation. Some of the basic operations are covered here. For more information
|
||||
you should also visit:
|
||||
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
|
||||
|
||||
|
||||
[[identifying-your-problem-area]]
|
||||
=== Identifying your problem area
|
||||
. Remove ''rhgb'' and ''quiet'' from the kernel command line
|
||||
. Add ''rd.shell'' to the kernel command line. This will present a shell should
|
||||
dracut be unable to locate your root device
|
||||
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
|
||||
dracut shell commands are printed as they are executed
|
||||
. With dracut >= 002-11, you can inspect the rd.debug output with:
|
||||
+
|
||||
----
|
||||
# less /run/initramfs/init.log
|
||||
# dmesg | less
|
||||
----
|
||||
. With dracut >= 022 and systemd, you can inspect the rd.debug output with:
|
||||
----
|
||||
# journalctl -ab
|
||||
----
|
||||
. With dracut >= 025 the file /run/initramfs/rdsosreport.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.
|
||||
|
||||
[[information-to-include-in-your-report]]
|
||||
=== Information to include in your report
|
||||
|
||||
[[all-bug-reports]]
|
||||
==== All bug reports
|
||||
In all cases, the following should be mentioned and attached to your bug report:
|
||||
|
||||
* The exact kernel command-line used. Typically from the bootloader
|
||||
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* A device listing from device-mapper. This can be obtained by running the
|
||||
command
|
||||
+
|
||||
----
|
||||
# dmsetup ls --tree
|
||||
----
|
||||
+
|
||||
* A list of block device attributes. This can be obtained by running the commands:
|
||||
+
|
||||
----
|
||||
# blkid -p
|
||||
# blkid -p -o udev
|
||||
----
|
||||
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
|
||||
all relevant information from the boot log. This can be obtained by running the
|
||||
command
|
||||
+
|
||||
----
|
||||
# dmesg|grep dracut
|
||||
----
|
||||
+
|
||||
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
|
||||
all files in _/etc/dracut.conf.d/*.conf_
|
||||
|
||||
[[logical-volume-management-related-problems]]
|
||||
==== Logical Volume Management related problems
|
||||
As well as the information from <<all-bug-reports>> include the following
|
||||
information:
|
||||
|
||||
* Include physical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm pvdisplay
|
||||
----
|
||||
+
|
||||
* Include volume group information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm vgdisplay
|
||||
----
|
||||
+
|
||||
* Include logical volume information by running the command:
|
||||
+
|
||||
----
|
||||
# lvm lvdisplay
|
||||
----
|
||||
|
||||
[[software-raid-related-problems]]
|
||||
==== Software RAID related problems
|
||||
As well as the information from <<all-bug-reports>>, include the following
|
||||
information:
|
||||
|
||||
* If using software RAID disk partitions, please include the output of
|
||||
+
|
||||
----
|
||||
# cat /proc/mdstat
|
||||
----
|
||||
|
||||
[[network-root-device-related-problems]]
|
||||
==== Network root device related problems
|
||||
This section details information to include when experiencing problems on a
|
||||
system whose root device is located on a network attached volume (e.g. iSCSI,
|
||||
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
|
||||
following information:
|
||||
|
||||
|
||||
* Please include the output of
|
||||
+
|
||||
----
|
||||
# /sbin/ifup <interfacename>
|
||||
# ip addr show
|
||||
----
|
||||
|
||||
[[debugging-dracut]]
|
||||
=== Debugging dracut
|
||||
|
||||
|
||||
[[configure-a-serial-console]]
|
||||
==== Configure a serial console
|
||||
|
||||
Successfully debugging dracut will require some form of console
|
||||
logging during the system boot. This section documents configuring a
|
||||
serial console connection to record boot messages.
|
||||
|
||||
. First, enable serial console output for both the kernel and the bootloader.
|
||||
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
|
||||
the following:
|
||||
+
|
||||
----
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
console=tty0 console=ttyS0,9600
|
||||
----
|
||||
+
|
||||
. When finished, the _/etc/grub.conf_ file should look similar to the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. More detailed information on how to configure the kernel for console output
|
||||
can be found at
|
||||
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
|
||||
. Redirecting non-interactive output
|
||||
+
|
||||
--
|
||||
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
|
||||
will put it out on the console when it reaches the kernel buffer by doing
|
||||
|
||||
----
|
||||
# exec >/dev/kmsg 2>&1 </dev/console
|
||||
----
|
||||
--
|
||||
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
|
||||
dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
(e.g. _/etc/grub.conf_)
|
||||
. Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
+
|
||||
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. If system boot fails, you will be dropped into a shell as seen in the example below.
|
||||
+
|
||||
----
|
||||
No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
#
|
||||
----
|
||||
+
|
||||
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
|
||||
|
||||
[[accessing-the-root-volume-from-the-dracut-shell]]
|
||||
==== Accessing the root volume from the dracut shell
|
||||
From the dracut debug shell, you can manually perform the task of locating and
|
||||
preparing your root volume for boot. The required steps will depend on how your
|
||||
root volume is configured. Common scenarios include:
|
||||
|
||||
* A block device (e.g. _/dev/sda7_)
|
||||
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
|
||||
* An encrypted device (e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
|
||||
* A network attached device (e.g. netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.fedoraproject:for.all)
|
||||
|
||||
The exact method for locating and preparing will vary. However, to continue with
|
||||
a successful boot, the objective is to locate your root volume and create a
|
||||
symlink _/dev/root_ which points to the file system. For example, the following
|
||||
example demonstrates accessing and booting a root volume that is an encrypted
|
||||
LVM Logical volume.
|
||||
|
||||
. Inspect your partitions using parted
|
||||
+
|
||||
----
|
||||
# parted /dev/sda -s p
|
||||
Model: ATA HTS541060G9AT00 (scsi)
|
||||
Disk /dev/sda: 60.0GB
|
||||
Sector size (logical/physical): 512B/512B
|
||||
Partition Table: msdos
|
||||
Number Start End Size Type File system Flags
|
||||
1 32.3kB 10.8GB 107MB primary ext4 boot
|
||||
2 10.8GB 55.6GB 44.7GB logical lvm
|
||||
----
|
||||
+
|
||||
. You recall that your root volume was a LVM logical volume. Scan and activate
|
||||
any logical volumes.
|
||||
+
|
||||
----
|
||||
# lvm vgscan
|
||||
# lvm vgchange -ay
|
||||
----
|
||||
+
|
||||
. You should see any logical volumes now using the command blkid:
|
||||
+
|
||||
----
|
||||
# blkid
|
||||
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
|
||||
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
|
||||
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
|
||||
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
|
||||
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
|
||||
----
|
||||
+
|
||||
. From the output above, you recall that your root volume exists on an encrypted
|
||||
block device. Following the guidance disk encryption guidance from the
|
||||
Installation Guide, you unlock your encrypted root volume.
|
||||
+
|
||||
----
|
||||
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
|
||||
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
|
||||
Enter passphrase for /dev/mapper/linux-root:
|
||||
Key slot 0 unlocked.
|
||||
----
|
||||
+
|
||||
. Next, make a symbolic link to the unlocked root volume
|
||||
+
|
||||
----
|
||||
# ln -s /dev/mapper/luks-$UUID /dev/root
|
||||
----
|
||||
+
|
||||
. With the root volume available, you may continue booting the system by exiting
|
||||
the dracut shell
|
||||
+
|
||||
----
|
||||
# exit
|
||||
----
|
||||
|
||||
[[additional-dracut-boot-parameters]]
|
||||
==== Additional dracut boot parameters
|
||||
For more debugging options, see <<dracutkerneldebug>> in <<dracutcmdline7>>.
|
||||
|
||||
= Developer Manual
|
||||
|
||||
== dracut Components
|
||||
|
||||
dracut uses a modular system to build and extend the initramfs image. All
|
||||
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
|
||||
The most basic dracut module is _99base_. In _99base_ the initial shell script
|
||||
init is defined, which gets run by the kernel after initramfs loading. Although
|
||||
you can replace init with your own version of _99base_, this is not encouraged.
|
||||
Instead you should use, if possible, the hooks of dracut. All hooks, and the
|
||||
point of time in which they are executed, are described in <<stages>>.
|
||||
|
||||
The main script, which creates the initramfs is dracut itsself. It parses all
|
||||
arguments and sets up the directory, in which everything is installed. It then
|
||||
executes all check, install, installkernel scripts found in the modules, which
|
||||
are to be processed. After everything is installed, the install directory is
|
||||
archived and compressed to the final initramfs image. All helper functions used
|
||||
by check, install and installkernel are found in in the file _dracut-functions_.
|
||||
These shell functions are available to all module installer (install,
|
||||
installkernel) scripts, without the need to source _dracut-functions_.
|
||||
|
||||
A module can check the preconditions for install and installkernel with the
|
||||
check script. Also dependencies can be expressed with check. If a module passed
|
||||
check, install and installkernel will be called to install all of the necessary
|
||||
files for the module. To split between kernel and non-kernel parts of the
|
||||
installation, all kernel module related parts have to be in installkernel. All
|
||||
other files found in a module directory are module specific and mostly are hook
|
||||
scripts and udev rules.
|
||||
|
||||
|
||||
[[stages]]
|
||||
== Boot Process Stages
|
||||
|
||||
dracut modules can insert custom script at various points, to control the boot
|
||||
process.
|
||||
These hooks are plain directories containing shell scripts ending with ".sh",
|
||||
which are sourced by init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
=== Hook: cmdline
|
||||
|
||||
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
|
||||
and prepare the later actions, like setting up udev rules and configuration
|
||||
files.
|
||||
|
||||
In this hook the most important environment variable is defined: root. The
|
||||
second one is rootok, which indicates, that a module claimed to be able to parse
|
||||
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
|
||||
iscsi dracut module, which then sets rootok.
|
||||
|
||||
=== Hook: pre-udev
|
||||
|
||||
This hook is executed right after the cmdline hook and a check if root and
|
||||
rootok were set. Here modules can take action with the final root, and before
|
||||
udev has been run.
|
||||
|
||||
=== Start Udev
|
||||
|
||||
Now udev is started and the logging for udev is setup.
|
||||
|
||||
=== Hook: pre-trigger
|
||||
|
||||
In this hook, you can set udev environment variables with **udevadm control
|
||||
--property=KEY=_value_** or control the further execution of udev with
|
||||
udevadm.
|
||||
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
|
||||
=== Main Loop
|
||||
|
||||
In the main loop of dracut loops until udev has settled and
|
||||
all scripts in _initqueue/finished_ returned true.
|
||||
In this loop there are three hooks, where scripts can be inserted
|
||||
by calling /sbin/initqueue.
|
||||
|
||||
==== Initqueue
|
||||
|
||||
This hook gets executed every time a script is inserted here, regardless of the
|
||||
udev state.
|
||||
|
||||
==== Initqueue settled
|
||||
|
||||
This hooks (initqueue/settled) gets executed every time udev has settled.
|
||||
|
||||
|
||||
==== Initqueue timeout
|
||||
|
||||
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
|
||||
rd.retry counter.
|
||||
|
||||
==== Initqueue finished
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
||||
Before the root device is mounted all scripts in the hook pre-mount are
|
||||
executed. In some cases (e.g. NFS) the real root device is already mounted,
|
||||
though.
|
||||
|
||||
=== Hook: mount
|
||||
|
||||
This hook is mainly to mount the real root device.
|
||||
|
||||
=== Hook: pre-pivot
|
||||
|
||||
This hook is called before cleanup hook, This is a good place for
|
||||
actions other than cleanups which need to be called before pivot.
|
||||
|
||||
=== Hook: cleanup
|
||||
|
||||
This hook is the last hook and is called before init finally switches root to
|
||||
the real root device. This is a good place to clean up and kill processes not
|
||||
needed anymore.
|
||||
|
||||
|
||||
=== Cleanup and switch_root
|
||||
|
||||
Init (or systemd) kills all udev processes, cleans up the environment,
|
||||
sets up the arguments for the real init process and finally calls switch_root.
|
||||
switch_root removes the whole filesystem hierarchy of the initramfs,
|
||||
chroot()s to the real root device and calls /sbin/init with the specified arguments.
|
||||
|
||||
To ensure all files in the initramfs hierarchy can be removed, all processes
|
||||
still running from the initramfs should not have any open file descriptors left.
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
FIXME
|
||||
|
||||
== Writing a Module
|
||||
|
||||
A simple example module is _96insmodpost_, which modprobes a kernel module after
|
||||
udev has settled and the basic device drivers have been loaded.
|
||||
|
||||
All module installation information is in the file module-setup.sh.
|
||||
|
||||
First we create a check() function, which just exits with 0 indicating that this
|
||||
module should be included by default.
|
||||
|
||||
check():
|
||||
----
|
||||
return 0
|
||||
----
|
||||
|
||||
The we create the install() function, which installs a cmdline hook with
|
||||
priority number 20 called _parse-insmodpost.sh_. It also installs the
|
||||
_insmodpost.sh_ script in _/sbin_.
|
||||
|
||||
install():
|
||||
----
|
||||
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
----
|
||||
|
||||
The _pase-instmodpost.sh_ parses the kernel command line for a argument
|
||||
rd.driver.post, blacklists the module from being autoloaded and installs the
|
||||
hook _insmodpost.sh_ in the _initqueue/settled_.
|
||||
|
||||
_parse-insmodpost.sh_:
|
||||
----
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
||||
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
|
||||
----
|
||||
|
||||
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
|
||||
modprobe the kernel modules specified in all rd.driver.post kernel command line
|
||||
parameters. It runs after udev has settled and is only called once (--onetime).
|
||||
|
||||
_insmodpost.sh_:
|
||||
----
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
modprobe $p
|
||||
done
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
=== check()
|
||||
|
||||
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
|
||||
the initramfs.
|
||||
|
||||
$hostonly:: If the $hostonly variable is set, then the module check() function
|
||||
should be in "hostonly" mode, which means, that the check() should only return
|
||||
0, if the module is really needed to boot this specific host.
|
||||
|
||||
check() should return with:
|
||||
|
||||
0:: Include the dracut module in the initramfs.
|
||||
|
||||
1:: Do not include the dracut module. The requirements are not fullfilled
|
||||
(missing tools, etc.)
|
||||
|
||||
255:: Only include the dracut module, if another module requires it or if
|
||||
explicitly specified in the config file or on the argument list.
|
||||
|
||||
|
||||
|
||||
=== depends()
|
||||
|
||||
The function depends() should echo all other dracut module names the module
|
||||
depends on.
|
||||
|
||||
|
||||
|
||||
=== install()
|
||||
|
||||
inst_multiple
|
||||
|
||||
inst
|
||||
|
||||
inst_hook
|
||||
|
||||
inst_rules
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== installkernel()
|
||||
|
||||
instmods
|
||||
|
||||
|
||||
|
||||
=== Creation Functions
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Initramfs Functions
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Network Modules
|
||||
|
||||
FIXME
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutbootup7]]
|
||||
include::dracut.bootup.7.asc[]
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracut8]]
|
||||
include::dracut.8.asc[]
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutconf5]]
|
||||
include::dracut.conf.5.asc[]
|
||||
|
||||
@@ -1019,6 +165,15 @@ include::lsinitrd.1.asc[]
|
||||
[[mkinitrd8]]
|
||||
include::mkinitrd.8.asc[]
|
||||
|
||||
= Developer Manual
|
||||
|
||||
:leveloffset: 1
|
||||
[[dracutmodules7]]
|
||||
include::dracut.modules.7.asc[]
|
||||
|
||||
[[dracutbootup7]]
|
||||
include::dracut.bootup.7.asc[]
|
||||
|
||||
:leveloffset: 0
|
||||
[appendix]
|
||||
License
|
||||
|
@@ -11,7 +11,8 @@ dracut.bootup - boot ordering in the initramfs
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs.
|
||||
This flow chart illustrates the ordering of the services, if systemd is used in
|
||||
the dracut initramfs.
|
||||
----
|
||||
|
||||
systemd-journal.socket
|
||||
|
@@ -31,16 +31,16 @@ line is the value, which is honored.
|
||||
|
||||
Standard
|
||||
~~~~~~~~
|
||||
**init=**_<path to real init>_::
|
||||
**init=**__<path to real init>__::
|
||||
specify the path to the init programm to be started after the initramfs has
|
||||
finished
|
||||
|
||||
**root=**_<path to blockdevice>_::
|
||||
**root=**__<path to blockdevice>__::
|
||||
specify the block device to use as the root filesystem.
|
||||
+
|
||||
E.g.:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root=/dev/sda1
|
||||
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
root=/dev/disk/by-label/Root
|
||||
@@ -48,15 +48,17 @@ root=LABEL=Root
|
||||
root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
----
|
||||
--
|
||||
|
||||
**rootfstype=**_<filesystem type>_:: "auto" if not specified, e.g.:
|
||||
**rootfstype=**__<filesystem type>__:: "auto" if not specified.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rootfstype=ext3
|
||||
----
|
||||
--
|
||||
|
||||
**rootflags=**_<mount options>_::
|
||||
**rootflags=**__<mount options>__::
|
||||
specify additional mount options for the root filesystem. If not set,
|
||||
_/etc/fstab_ of the real root will be parsed for special mount options and
|
||||
mounted accordingly.
|
||||
@@ -69,24 +71,34 @@ rootfstype=ext3
|
||||
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
|
||||
See also ro option.
|
||||
|
||||
**rootfallback=**__<path to blockdevice>__::
|
||||
specify the block device to use as the root filesystem, if the normal root
|
||||
cannot be found. This can only be a simple block device with a simple file
|
||||
system, for which the filesystem driver is either compiled in, or added
|
||||
manually to the initramfs. This parameter can be specified multiple times.
|
||||
|
||||
**rd.auto** **rd.auto=1**::
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
|
||||
Default is off as of dracut version >= 024.
|
||||
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
|
||||
lvm. Default is off as of dracut version >= 024.
|
||||
|
||||
|
||||
**rd.cmdline=ask**::
|
||||
prompts the user for additional kernel command line parameters
|
||||
|
||||
**rd.fstab=0**::
|
||||
do not honor special mount options for the root filesystem found in
|
||||
_/etc/fstab_ of the real root.
|
||||
|
||||
**resume=**_<path to resume partition>_::
|
||||
**resume=**__<path to resume partition>__::
|
||||
resume from a swap partition
|
||||
+
|
||||
E.g.:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
resume=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
----
|
||||
--
|
||||
|
||||
**rd.skipfsck**::
|
||||
skip fsck for rootfs and _/usr_. If you're mounting _/usr_ read-only and
|
||||
@@ -96,19 +108,19 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
||||
|
||||
Misc
|
||||
~~~~
|
||||
**rd.driver.blacklist=**_<drivername>[,<drivername>,...]_::
|
||||
**rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
|
||||
do not load kernel module <drivername>. This parameter can be specified
|
||||
multiple times.
|
||||
|
||||
**rd.driver.pre=**_<drivername>[,<drivername>,...]_::
|
||||
**rd.driver.pre=**__<drivername>__[,__<drivername>__,...]::
|
||||
force loading kernel module <drivername>. This parameter can be specified
|
||||
multiple times.
|
||||
|
||||
**rd.driver.post=**_<drivername>[,<drivername>,...]_::
|
||||
**rd.driver.post=**__<drivername>__[,__<drivername>__,...]::
|
||||
force loading kernel module <drivername> after all automatic loading modules
|
||||
have been loaded. This parameter can be specified multiple times.
|
||||
|
||||
**rd.retry=**_<seconds>_::
|
||||
**rd.retry=**__<seconds>__::
|
||||
specify how long dracut should wait for devices to appear.
|
||||
The default is 30 seconds. After 2/3 of the time, degraded raids are force
|
||||
started. If you have hardware, which takes a very long time to announce its
|
||||
@@ -117,16 +129,17 @@ Misc
|
||||
**rd.noverifyssl**::
|
||||
accept self-signed certificates for ssl downloads.
|
||||
|
||||
**rd.ctty=**_<terminal device>_**::
|
||||
**rd.ctty=**__<terminal device>__::
|
||||
specify the controlling terminal for the console.
|
||||
This is useful, if you have multiple "console=" arguments.
|
||||
|
||||
[[dracutkerneldebug]]
|
||||
Debug
|
||||
~~~~~
|
||||
If you are dropped to an emergency shell, the file _/run/initramfs/rdsosreport.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.
|
||||
If you are dropped to an emergency shell, the file
|
||||
_/run/initramfs/rdsosreport.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/rdsosreport.txt_ contains all logs and the output of some tools.
|
||||
It should be attached to any report about dracut problems.
|
||||
|
||||
@@ -138,23 +151,28 @@ It should be attached to any report about dracut problems.
|
||||
|
||||
**rd.debug**::
|
||||
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 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 info at various points, set the verbose level from 0 to 3
|
||||
Print memory usage info at various points, set the verbose level from 0 to 3.
|
||||
+
|
||||
Higher level means more debugging output:
|
||||
+
|
||||
----
|
||||
0 - no output
|
||||
1 - partial /proc/meminfo
|
||||
2 - /proc/meminfo
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
----
|
||||
|
||||
**rd.break**::
|
||||
drop to a shell at the end
|
||||
|
||||
**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}_::
|
||||
**rd.break=**__{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}__::
|
||||
drop to a shell on defined breakpoint
|
||||
|
||||
**rd.udev.info**::
|
||||
@@ -165,50 +183,56 @@ It should be attached to any report about dracut problems.
|
||||
|
||||
I18N
|
||||
~~~~
|
||||
**vconsole.keymap=**_<keymap base file name>_::
|
||||
**rd.vconsole.keymap=**__<keymap base file name>__::
|
||||
keyboard translation table loaded by loadkeys; taken from keymaps directory;
|
||||
will be written as KEYMAP to _/etc/vconsole.conf_ in the initramfs, e.g.:
|
||||
will be written as KEYMAP to _/etc/vconsole.conf_ in the initramfs.
|
||||
+
|
||||
----
|
||||
vconsole.keymap=de-latin1-nodeadkeys
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.vconsole.keymap=de-latin1-nodeadkeys
|
||||
--
|
||||
|
||||
**vconsole.keymap.ext=**_<list of keymap base file names>_::
|
||||
**rd.vconsole.keymap.ext=**__<list of keymap base file names>__::
|
||||
list of extra keymaps to bo loaded (sep. by space); will be written as
|
||||
EXT_KEYMAP to _/etc/vconsole.conf_ in the initramfs
|
||||
|
||||
**vconsole.unicode**[=_{0|1}_]::
|
||||
**rd.vconsole.unicode**::
|
||||
boolean, indicating UTF-8 mode; will be written as UNICODE to
|
||||
_/etc/vconsole.conf_ in the initramfs
|
||||
|
||||
**vconsole.font=**_<font base file name>_::
|
||||
**rd.vconsole.font=**__<font base file name>__::
|
||||
console font; taken from consolefonts directory; will be written as FONT to
|
||||
_/etc/vconsole.conf_ in the initramfs; e.g.:
|
||||
_/etc/vconsole.conf_ in the initramfs.
|
||||
+
|
||||
----
|
||||
vconsole.font=LatArCyrHeb-16
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.vconsole.font=LatArCyrHeb-16
|
||||
--
|
||||
|
||||
**vconsole.font.map=**_<console map base file name>_::
|
||||
**rd.vconsole.font.map=**__<console map base file name>__::
|
||||
see description of '-m' parameter in setfont manual; taken from consoletrans
|
||||
directory; will be written as FONT_MAP to _/etc/vconsole.conf_ in the
|
||||
initramfs
|
||||
|
||||
**vconsole.font.unimap=**_<unicode table base file name>_::
|
||||
**rd.vconsole.font.unimap=**__<unicode table base file name>__::
|
||||
see description of '-u' parameter in setfont manual; taken from unimaps
|
||||
directory; will be written as FONT_UNIMAP to _/etc/vconsole.conf_ in the
|
||||
initramfs
|
||||
|
||||
**locale.LANG=**_<locale>_::
|
||||
**rd.locale.LANG=**__<locale>__::
|
||||
taken from the environment; if no UNICODE is defined we set its value in
|
||||
basis of LANG value (whether it ends with ".utf8" (or similar) or not); will
|
||||
be written as LANG to _/etc/locale.conf_ in the initramfs; e.g.:
|
||||
be written as LANG to _/etc/locale.conf_ in the initramfs.
|
||||
+
|
||||
----
|
||||
locale.LANG=pl_PL.utf8
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.locale.LANG=pl_PL.utf8
|
||||
--
|
||||
|
||||
**locale.LC_ALL=**_<locale>_::
|
||||
**rd.locale.LC_ALL=**__<locale>__::
|
||||
taken from the environment; will be written as LC_ALL to _/etc/locale.conf_
|
||||
in the initramfs
|
||||
|
||||
@@ -217,11 +241,11 @@ LVM
|
||||
**rd.lvm=0**::
|
||||
disable LVM detection
|
||||
|
||||
**rd.lvm.vg=**_<volume group name>_::
|
||||
**rd.lvm.vg=**__<volume group name>__::
|
||||
only activate the volume groups with the given name. rd.lvm.vg can be
|
||||
specified multiple times on the kernel command line.
|
||||
|
||||
**rd.lvm.lv=**_<logical volume name>_::
|
||||
**rd.lvm.lv=**__<logical volume name>__::
|
||||
only activate the logical volumes with the given name. rd.lvm.lv can be
|
||||
specified multiple times on the kernel command line.
|
||||
|
||||
@@ -233,18 +257,18 @@ crypto LUKS
|
||||
**rd.luks=0**::
|
||||
disable crypto LUKS detection
|
||||
|
||||
**rd.luks.uuid=**_<luks uuid>_::
|
||||
**rd.luks.uuid=**__<luks uuid>__::
|
||||
only activate the LUKS partitions with the given UUID. Any "luks-" of the
|
||||
LUKS UUID is removed before comparing to _<luks uuid>_.
|
||||
The comparisons also matches, if _<luks uuid>_ is only the beginning of the
|
||||
LUKS UUID, so you don't have to specify the full UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
**rd.luks.allow-discards=**_<luks uuid>_::
|
||||
Allow using of discards (TRIM) requests for LUKS partitions with the given UUID.
|
||||
Any "luks-" of the LUKS UUID is removed before comparing to _<luks uuid>_.
|
||||
The comparisons also matches, if _<luks uuid>_ is only the beginning of the
|
||||
LUKS UUID, so you don't have to specify the full UUID.
|
||||
**rd.luks.allow-discards=**__<luks uuid>__::
|
||||
Allow using of discards (TRIM) requests for LUKS partitions with the given
|
||||
UUID. Any "luks-" of the LUKS UUID is removed before comparing to
|
||||
_<luks uuid>_. The comparisons also matches, if _<luks uuid>_ is only the
|
||||
beginning of the LUKS UUID, so you don't have to specify the full UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
**rd.luks.allow-discards**::
|
||||
@@ -255,16 +279,28 @@ crypto LUKS
|
||||
|
||||
crypto LUKS - key on removable device support
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
**rd.luks.key=**_<keypath>:<keydev>:<luksdev>_::
|
||||
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_ ends with '.gpg' it's considered to be key encrypted symmetrically with GPG. You will be prompted for password on boot. GPG support comes with 'crypt-gpg' module which needs to be added explicitly.
|
||||
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
|
||||
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_
|
||||
ends with '.gpg' it's considered to be key encrypted symmetrically with GPG.
|
||||
You will be prompted for password on boot. GPG support comes with
|
||||
'crypt-gpg' module which needs to be added explicitly.
|
||||
+
|
||||
_keydev_ is a device on which key file resides. It might be kernel name of devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label (prefix with "LABEL="). You don't have to specify full UUID. Just its beginning will suffice, even if its ambiguous. All matching devices will be probed. This parameter is recommended, but not required. If not present, all block devices will be probed, which may significantly increase boot time.
|
||||
_keydev_ is a device on which key file resides. It might be kernel name of
|
||||
devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label
|
||||
(prefix with "LABEL="). You don't have to specify full UUID. Just its beginning
|
||||
will suffice, even if its ambiguous. All matching devices will be probed.
|
||||
This parameter is recommended, but not required. If not present, all block
|
||||
devices will be probed, which may significantly increase boot time.
|
||||
+
|
||||
If _luksdev_ is given, the specified key will only be applied for that LUKS device. Possible values are the same as for _keydev_. Unless you have several LUKS devices, you don't have to specify this parameter. The simplest usage is:
|
||||
If _luksdev_ is given, the specified key will only be applied for that LUKS
|
||||
device. Possible values are the same as for _keydev_. Unless you have several
|
||||
LUKS devices, you don't have to specify this parameter. The simplest usage is:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.luks.key=/foo/bar.key
|
||||
----
|
||||
--
|
||||
+
|
||||
As you see, you can skip colons in such a case.
|
||||
+
|
||||
@@ -275,20 +311,20 @@ to crypsetup luksFormat with _-d -_, too!
|
||||
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
----
|
||||
gpg --quiet --decrypt rootkey.gpg \
|
||||
| cryptsetup -d - -v \
|
||||
--cipher serpent-cbc-essiv:sha256 \
|
||||
[listing]
|
||||
--
|
||||
gpg --quiet --decrypt rootkey.gpg | \
|
||||
cryptsetup -d - -v --cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
----
|
||||
--
|
||||
|
||||
If you use plain keys, just add path to _-d_ option:
|
||||
|
||||
----
|
||||
cryptsetup -d rootkey.key -v \
|
||||
--cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
----
|
||||
[listing]
|
||||
--
|
||||
cryptsetup -d rootkey.key -v --cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
--
|
||||
===============================
|
||||
|
||||
MD RAID
|
||||
@@ -306,9 +342,10 @@ MD RAID
|
||||
ignore mdadm.conf included in initramfs
|
||||
|
||||
**rd.md.waitclean=1**::
|
||||
wait for any resync, recovery, or reshape activity to finish before continuing
|
||||
wait for any resync, recovery, or reshape activity to finish before
|
||||
continuing
|
||||
|
||||
**rd.md.uuid=**_<md raid uuid>_::
|
||||
**rd.md.uuid=**__<md raid uuid>__::
|
||||
only activate the raid sets with the given UUID. This parameter can be
|
||||
specified multiple times.
|
||||
|
||||
@@ -317,7 +354,7 @@ DM RAID
|
||||
**rd.dm=0**::
|
||||
disable DM RAID detection
|
||||
|
||||
**rd.dm.uuid=**_<dm raid uuid>_::
|
||||
**rd.dm.uuid=**__<dm raid uuid>__::
|
||||
only activate the raid sets with the given UUID. This parameter can be
|
||||
specified multiple times.
|
||||
|
||||
@@ -326,15 +363,17 @@ FIPS
|
||||
**rd.fips**::
|
||||
enable FIPS
|
||||
|
||||
**boot=**_<boot device>_::
|
||||
specify the device, where /boot is located. e.g.
|
||||
**boot=**__<boot device>__::
|
||||
specify the device, where /boot is located.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
boot=/dev/sda1
|
||||
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
boot=UUID=<uuid>
|
||||
boot=LABEL=<label>
|
||||
----
|
||||
--
|
||||
|
||||
**rd.fips.skipkernel**::
|
||||
skip checksum check of the kernel image. Useful, if the kernel image is not
|
||||
@@ -342,18 +381,76 @@ boot=LABEL=<label>
|
||||
|
||||
Network
|
||||
~~~~~~~
|
||||
**ip=**_{dhcp|on|any|dhcp6|auto6|ibft}_::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp, loop
|
||||
sequentially through all interfaces (eth0, eth1, ...) and use the first with
|
||||
a valid DHCP root-path.
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind an interface to a MAC with the **ifname**
|
||||
argument, or to use the systemd-udevd predictable network interface names.
|
||||
|
||||
Predictable network interface device names based on:
|
||||
|
||||
- firmware/bios-provided index numbers for on-board devices
|
||||
- firmware-provided pci-express hotplug slot index number
|
||||
- physical/geographical location of the hardware
|
||||
- the interface's MAC address
|
||||
|
||||
See:
|
||||
http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
|
||||
|
||||
Two character prefixes based on the type of interface:
|
||||
|
||||
en:: ethernet
|
||||
wl:: wlan
|
||||
ww:: wwan
|
||||
|
||||
Type of names:
|
||||
|
||||
o<index>:: on-board device index number
|
||||
s<slot>[f<function>][d<dev_id>]:: hotplug slot index number
|
||||
x<MAC>:: MAC address
|
||||
[P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]:: PCI geographical location
|
||||
[P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]:: USB port number chain
|
||||
|
||||
All multi-function PCI devices will carry the [f<function>] number in the
|
||||
device name, including the function 0 device.
|
||||
|
||||
When using PCI geography, The PCI domain is only prepended when it is not 0.
|
||||
|
||||
For USB devices the full chain of port numbers of hubs is composed. If the
|
||||
name gets longer than the maximum number of 15 characters, the name is not
|
||||
exported.
|
||||
The usual USB configuration == 1 and interface == 0 values are suppressed.
|
||||
|
||||
PCI ethernet card with firmware index "1"::
|
||||
* eno1
|
||||
|
||||
PCI ethernet card in hotplug slot with firmware index number::
|
||||
* ens1
|
||||
|
||||
PCI ethernet multi-function card with 2 ports::
|
||||
* enp2s0f0
|
||||
* enp2s0f1
|
||||
|
||||
PCI wlan card::
|
||||
* wlp3s0
|
||||
|
||||
USB built-in 3G modem::
|
||||
* wwp0s29u1u4i6
|
||||
|
||||
USB Android phone::
|
||||
* enp0s29u1u2
|
||||
=====================
|
||||
|
||||
**ip=**__{dhcp|on|any|dhcp6|auto6}__::
|
||||
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
|
||||
auto6::: IPv6 autoconfiguration
|
||||
|
||||
dhcp6::: IPv6 DHCP
|
||||
|
||||
ibft::: iBFT autoconfiguration
|
||||
|
||||
**ip=**_<interface>_:_{dhcp|on|any|dhcp6|auto6}_[:[_<mtu>_][:_<macaddr>_]]::
|
||||
**ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
|
||||
This parameter can be specified multiple times.
|
||||
+
|
||||
=====================
|
||||
@@ -364,19 +461,12 @@ cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind <interface> to a MAC with the **ifname**
|
||||
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
|
||||
|
||||
em<port>::: for embedded NICs
|
||||
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
|
||||
=====================
|
||||
|
||||
**ip=**_<client-IP>_:_<server-IP>_:_<gateway-IP>_:_<netmask>_:_<client_hostname>_:_<interface>_:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[_<mtu>_][:_<macaddr>_]]::
|
||||
**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[__<mtu>__][:__<macaddr>__]]::
|
||||
explicit network configuration. If you want do define a IPv6 address, put it
|
||||
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
|
||||
times.
|
||||
times. __<peer>__ is optional and is the address of the remote endpoint
|
||||
for pointopoint interfaces and it may be followed by a slash and a decimal
|
||||
number, encoding the network prefix length.
|
||||
+
|
||||
=====================
|
||||
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
|
||||
@@ -384,28 +474,44 @@ cannot be used in conjunction with the **ifname** argument for the
|
||||
same <interface>.
|
||||
=====================
|
||||
|
||||
[IMPORTANT]
|
||||
=====================
|
||||
It is recommended to either bind <interface> to a MAC with the **ifname**
|
||||
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
|
||||
**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<dns1>__][:__<dns2>__]]::
|
||||
explicit network configuration. If you want do define a IPv6 address, put it
|
||||
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
|
||||
times. __<peer>__ is optional and is the address of the remote endpoint
|
||||
for pointopoint interfaces and it may be followed by a slash and a decimal
|
||||
number, encoding the network prefix length.
|
||||
|
||||
em<port>::: for embedded NICs
|
||||
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
|
||||
=====================
|
||||
|
||||
**ifname=**_<interface>_:_<MAC>_::
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with MAC <MAC>.
|
||||
**ifname=**__<interface>__:__<MAC>__::
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with
|
||||
MAC <MAC>.
|
||||
+
|
||||
[IMPORTANT]
|
||||
|
||||
Do **not** use the default kernel naming scheme for the interface name,
|
||||
WARNING: Do **not** use the default kernel naming scheme for the interface name,
|
||||
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
|
||||
interface name. Better name it "bootnet" or "bluesocket".
|
||||
|
||||
**bootdev=**_<interface>_::
|
||||
**rd.route=**__<net>__/__<netmask>__:__<gateway>__[:__<interface>__]::
|
||||
Add a static route with route options, which are separated by a colon.
|
||||
IPv6 addresses have to be put in brackets.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.route=192.168.200.0/24:192.168.100.222:ens10
|
||||
rd.route=192.168.200.0/24:192.168.100.222
|
||||
rd.route=192.168.200.0/24::ens10
|
||||
rd.route=[2001:DB8:3::/8]:[2001:DB8:2::1]:ens10
|
||||
--
|
||||
|
||||
**bootdev=**__<interface>__::
|
||||
specify network interface to use routing and netroot information from.
|
||||
Required if multiple ip= lines are used.
|
||||
|
||||
**BOOTIF=**__<MAC>__::
|
||||
specify network interface to use routing and netroot information from.
|
||||
|
||||
**rd.bootif=0**::
|
||||
Disable BOOTIF parsing, which is provided by PXE
|
||||
|
||||
**nameserver=**__<IP>__ [**nameserver=**__<IP>__ ...]::
|
||||
specify nameserver(s) to use
|
||||
|
||||
@@ -415,81 +521,83 @@ interface name. Better name it "bootnet" or "bluesocket".
|
||||
**rd.neednet=1**::
|
||||
boolean, bring up network even without netroot set
|
||||
|
||||
**vlan=_<vlanname>_:_<phydevice>_**::
|
||||
**vlan=**__<vlanname>__:__<phydevice>__::
|
||||
Setup vlan device named <vlanname> on <phydeivce>.
|
||||
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
|
||||
DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5)
|
||||
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005),
|
||||
VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005),
|
||||
DEV_PLUS_VID_NO_PAD (eth0.5)
|
||||
|
||||
**bond=_<bondname>_[:_<bondslaves>_:[:_<options>_]]**::
|
||||
**bond=**__<bondname>__[:__<bondslaves>__:[:__<options>__]]::
|
||||
Setup bonding device <bondname> on top of <bondslaves>.
|
||||
<bondslaves> is a comma-separated list of physical (ethernet) interfaces.
|
||||
<options> is a comma-separated list on bonding options (modinfo bonding for details)
|
||||
in format compatible with initscripts. If <options> includes multi-valued arp_ip_target option,
|
||||
then its values should be separated by semicolon.
|
||||
Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
||||
<options> is a comma-separated list on bonding options (modinfo bonding for
|
||||
details) in format compatible with initscripts. If <options> includes
|
||||
multi-valued arp_ip_target option, then its values should be separated by
|
||||
semicolon. Bond without parameters assumes
|
||||
bond=bond0:eth0,eth1:mode=balance-rr
|
||||
|
||||
**team =_<teammaster>_:_<teamslaves>_**::
|
||||
**team=**__<teammaster>__:__<teamslaves>__::
|
||||
Setup team device <teammaster> on top of <teamslaves>.
|
||||
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
|
||||
|
||||
**bridge=_<bridgename>_:_<ethnames>_**::
|
||||
**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
|
||||
|
||||
list of physical (ethernet) interfaces. Bridge without parameters assumes
|
||||
bridge=br0:eth0
|
||||
|
||||
NFS
|
||||
~~~
|
||||
**root=**[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_]::
|
||||
**root=**\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
|
||||
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. if server-ip is an IPv6 address it has to be put in
|
||||
dhcp next_server. If server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
|
||||
":" or "," and are seperated by ",".
|
||||
|
||||
**root=**nfs:[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_], **root=**nfs4:[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_], **root=**_{dhcp|dhcp6}_::
|
||||
**root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root-path=<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
----
|
||||
--
|
||||
|
||||
**root=**_/dev/nfs_ nfsroot=[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_]::
|
||||
**root=**_/dev/nfs_ nfsroot=\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
|
||||
_Deprecated!_ kernel Documentation_/filesystems/nfsroot.txt_ defines this
|
||||
method. This is supported by dracut, but not recommended.
|
||||
|
||||
**rd.nfs.domain=**_<NFSv4 domain name>_::
|
||||
**rd.nfs.domain=**__<NFSv4 domain name>__::
|
||||
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
**root=**cifs://[_<username>_[:_<password>_]@]_<server-ip>_:_<root-dir>_::
|
||||
**root=**cifs://[__<username>__[:__<password>__]@]__<server-ip>__:__<root-dir>__::
|
||||
mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use
|
||||
dhcp next_server. if server-ip is an IPv6 address it has to be put in
|
||||
brackets, e.g. [2001:DB8::1]. If a username or password are not specified
|
||||
as part of the root, then they must be passed on the command line through
|
||||
cifsuser/cifspass.
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
WARNING: Passwords specified on the kernel command line are visible for all
|
||||
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
|
||||
network, when using DHCP with DHCP root-path.
|
||||
|
||||
**cifsuser=_<username>_::
|
||||
**cifsuser**=__<username>__::
|
||||
Set the cifs username, if not specified as part of the root.
|
||||
|
||||
**cifspass=_<password>_::
|
||||
**cifspass**=__<password>__::
|
||||
Set the cifs password, if not specified as part of the root.
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
WARNING: Passwords specified on the kernel command line are visible for all
|
||||
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
|
||||
network, when using DHCP with DHCP root-path.
|
||||
|
||||
iSCSI
|
||||
~~~~~
|
||||
**root=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_::
|
||||
**root=**iscsi:[__<username>__:__<password>__[:__<reverse>__:__<password>__]@][__<servername>__]:[__<protocol>__]:[__<port>__][:[__<iscsi_iface_name>__]:[__<netdev_name>__]]:[__<LUN>__]:__<targetname>__::
|
||||
protocol defaults to "6", LUN defaults to "0". If the "servername" field is
|
||||
provided by BOOTP or DHCP, then that field is used in conjunction with other
|
||||
associated fields to contact the boot server in the Boot stage. However, if
|
||||
@@ -497,85 +605,95 @@ iSCSI
|
||||
used in the Discovery Service stage in conjunction with other associated
|
||||
fields. See
|
||||
link:$$http://tools.ietf.org/html/rfc4173#section-5$$[rfc4173].
|
||||
e.g.:
|
||||
+
|
||||
----
|
||||
WARNING: Passwords specified on the kernel command line are visible for all
|
||||
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
|
||||
network, when using DHCP with DHCP root-path.
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
--
|
||||
+
|
||||
If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
If servername is an IPv6 address, it has to be put in brackets:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
|
||||
====
|
||||
--
|
||||
|
||||
**root=**_???_ **netroot=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_ ...::
|
||||
multiple netroot options allow setting up multiple iscsi disks. e.g.:
|
||||
**root=**__???__ **netroot=**iscsi:[__<username>__:__<password>__[:__<reverse>__:__<password>__]@][__<servername>__]:[__<protocol>__]:[__<port>__][:[__<iscsi_iface_name>__]:[__<netdev_name>__]]:[__<LUN>__]:__<targetname>__ ...::
|
||||
multiple netroot options allow setting up multiple iscsi disks:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
root=UUID=12424547
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
|
||||
----
|
||||
--
|
||||
+
|
||||
If servername is an IPv6 address, it has to be put in brackets. e.g.:
|
||||
If servername is an IPv6 address, it has to be put in brackets:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
----
|
||||
--
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
|
||||
====
|
||||
WARNING: Passwords specified on the kernel command line are visible for all
|
||||
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
|
||||
network, when using DHCP with DHCP root-path.
|
||||
You may want to use rd.iscsi.firmware.
|
||||
|
||||
**root=**_???_ **rd.iscsi.initiator=**_<initiator>_ **rd.iscsi.target.name=**_<target name>_ **rd.iscsi.target.ip=**_<target ip>_ **rd.iscsi.target.port=**_<target port>_ **rd.iscsi.target.group=**_<target group>_ **rd.iscsi.username=**_<username>_ **rd.iscsi.password=**_<password>_ **rd.iscsi.in.username=**_<in username>_ **rd.iscsi.in.password=**_<in password>_::
|
||||
**root=**__???__ **rd.iscsi.initiator=**__<initiator>__ **rd.iscsi.target.name=**__<target name>__ **rd.iscsi.target.ip=**__<target ip>__ **rd.iscsi.target.port=**__<target port>__ **rd.iscsi.target.group=**__<target group>__ **rd.iscsi.username=**__<username>__ **rd.iscsi.password=**__<password>__ **rd.iscsi.in.username=**__<in username>__ **rd.iscsi.in.password=**__<in password>__::
|
||||
manually specify all iscsistart parameter (see **+iscsistart --help+**)
|
||||
+
|
||||
[WARNING]
|
||||
====
|
||||
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
|
||||
====
|
||||
WARNING: Passwords specified on the kernel command line are visible for all
|
||||
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
|
||||
network, when using DHCP with DHCP root-path.
|
||||
You may want to use rd.iscsi.firmware.
|
||||
|
||||
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
|
||||
**rd.iscsi.param=**_<param>_::
|
||||
**rd.iscsi.param=**__<param>__::
|
||||
<param> will be passed as "--param <param>" to iscsistart.
|
||||
This parameter can be specified multiple times.
|
||||
e.g.:
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"
|
||||
----
|
||||
--
|
||||
+
|
||||
will result in
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
--
|
||||
iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
----
|
||||
--
|
||||
|
||||
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
|
||||
Turn on iBFT autoconfiguration for the interfaces
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**fcoe=**_<edd|interface|MAC>_:_{dcb|nodcb}_::
|
||||
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::
|
||||
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
|
||||
_<MAC>_ or EDD settings. For the second argument, currently only nodcb is
|
||||
supported. This parameter can be specified multiple times.
|
||||
+
|
||||
[NOTE]
|
||||
letters in the MAC-address must be lowercase!
|
||||
NOTE: letters in the MAC-address must be lowercase!
|
||||
|
||||
NBD
|
||||
~~~
|
||||
**root=**??? **netroot=**nbd:_<server>_:_<port>_[:_<fstype>_[:_<mountopts>_[:_<nbdopts>_]]]::
|
||||
**root=**??? **netroot=**nbd:__<server>__:__<port>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
|
||||
mount nbd share from <server>
|
||||
|
||||
**root=dhcp** with **dhcp** **root-path=**nbd:_<server>_:_<port>_[:_<fstype>_[:_<mountopts>_[:_<nbdopts>_]]]::
|
||||
**root=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
|
||||
options can be specified. This syntax is only usable in cases where you are
|
||||
directly mounting the volume as the rootfs.
|
||||
@@ -587,25 +705,29 @@ DASD
|
||||
|
||||
ZFCP
|
||||
~~~~
|
||||
**rd.zfcp=**_<zfcp adaptor device bus ID>_,_<WWPN>_,_<FCPLUN>_::
|
||||
rd.zfcp can be specified multiple times on the kernel command line. e.g.:
|
||||
**rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
|
||||
rd.zfcp can be specified multiple times on the kernel command line.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
|
||||
----
|
||||
--
|
||||
|
||||
**rd.zfcp.conf=0**::
|
||||
ignore zfcp.conf included in the initramfs
|
||||
|
||||
ZNET
|
||||
~~~~
|
||||
**rd.znet=**_<nettype>_,_<subchannels>_,_<options>_::
|
||||
rd.znet can be specified multiple times on the kernel command line. e.g.:
|
||||
**rd.znet=**__<nettype>__,__<subchannels>__,__<options>__::
|
||||
rd.znet can be specified multiple times on the kernel command line.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
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,protocol=bar
|
||||
----
|
||||
--
|
||||
|
||||
Plymouth Boot Splash
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -617,37 +739,46 @@ Plymouth Boot Splash
|
||||
|
||||
Kernel keys
|
||||
~~~~~~~~~~~
|
||||
**masterkey=**_<kernel master key path name>_::
|
||||
Set the path name of the kernel master key. e.g.:
|
||||
**masterkey=**__<kernel master key path name>__::
|
||||
Set the path name of the kernel master key.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
masterkey=/etc/keys/kmk-trusted.blob
|
||||
----
|
||||
--
|
||||
|
||||
**masterkeytype=**_<kernel master key type>_::
|
||||
Set the type of the kernel master key. e.g.:
|
||||
**masterkeytype=**__<kernel master key type>__::
|
||||
Set the type of the kernel master key.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
masterkeytype=trusted
|
||||
----
|
||||
--
|
||||
|
||||
**evmkey=**_<EVM key path name>_::
|
||||
Set the path name of the EVM key. e.g.:
|
||||
**evmkey=**__<EVM key path name>__::
|
||||
Set the path name of the EVM key.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
evmkey=/etc/keys/evm-trusted.blob
|
||||
----
|
||||
--
|
||||
|
||||
**ecryptfskey=**_<eCryptfs key path name>_::
|
||||
Set the path name of the eCryptfs key. e.g.:
|
||||
**ecryptfskey=**__<eCryptfs key path name>__::
|
||||
Set the path name of the eCryptfs key.
|
||||
+
|
||||
----
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
ecryptfskey=/etc/keys/ecryptfs-trusted.blob
|
||||
----
|
||||
--
|
||||
|
||||
Deprecated, renamed Options
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Here is a list of options, which were used in dracut prior to version 008, and their new replacement.
|
||||
Here is a list of options, which were used in dracut prior to version 008, and
|
||||
their new replacement.
|
||||
|
||||
rdbreak:: rd.break
|
||||
|
||||
@@ -781,7 +912,8 @@ _/etc/conf.d/_::
|
||||
set in the configuration files.
|
||||
|
||||
_/etc/cmdline_::
|
||||
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
|
||||
Can contain additional command line options. Deprecated, better use
|
||||
/etc/cmdline.d/*.conf.
|
||||
|
||||
_/etc/cmdline.d/*.conf_::
|
||||
Can contain additional command line options.
|
||||
|
@@ -10,17 +10,19 @@ dracut.conf - configuration file(s) for dracut
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/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.
|
||||
|
||||
_*.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 '#'
|
||||
_*.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.
|
||||
|
||||
@@ -67,10 +69,16 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
*do_strip=*"__{yes|no}__"::
|
||||
Strip binaries in the initramfs (default=yes)
|
||||
|
||||
*do_prelink=*"__{yes|no}__"::
|
||||
Prelink binaries in the initramfs (default=yes)
|
||||
|
||||
*hostonly=*"__{yes|no}__"::
|
||||
Host-Only mode: Install only what is needed for booting the local host
|
||||
instead of a generic host and generate host-specific configuration.
|
||||
|
||||
*hostonly_cmdline*"__{yes|no}__"::
|
||||
If set, store the kernel command line arguments needed in the initramfs
|
||||
|
||||
*persistent_policy=*"__<policy>__"::
|
||||
Use _<policy>_ to address disks and partitions.
|
||||
_<policy>_ can be any directory name found in /dev/disk.
|
||||
@@ -81,7 +89,8 @@ Configuration files must have the extension .conf; other extensions are ignored.
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
If chrooted to another root other than the real root device, use --fstab and provide a valid _/etc/fstab_.
|
||||
If chrooted to another root other than the real root device, use --fstab and
|
||||
provide a valid _/etc/fstab_.
|
||||
====
|
||||
|
||||
*use_fstab=*"__{yes|no}__"::
|
||||
@@ -119,9 +128,24 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*kernel_only=*"__{yes|no}__"::
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
|
||||
*no_kernel=*"{yes|no}"::
|
||||
*no_kernel=*"__{yes|no}__"::
|
||||
Do not install kernel drivers and firmware files (default=no)
|
||||
|
||||
*acpi_override=*"__{yes|no}__"::
|
||||
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
|
||||
Override BIOS provided ACPI tables. For further documentation read
|
||||
Documentation/acpi/initrd_table_override.txt in the kernel sources.
|
||||
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
|
||||
directory (see below) and add them to a separate uncompressed cpio
|
||||
archive. This cpio archive gets glued (concatenated, uncompressed one
|
||||
must be the first one) to the compressed cpio archive. The first,
|
||||
uncompressed cpio archive is for data which the kernel must be able
|
||||
to access very early (and cannot make use of uncompress alogrithms yet)
|
||||
like microcode or ACPI tables (default=no).
|
||||
|
||||
*acpi_table_dir=*"__<dir>__"::
|
||||
Directory to search for ACPI tables if acpi_override= is set to yes.
|
||||
|
||||
*early_microcode=*"{yes|no}"::
|
||||
Combine early microcode with ramdisk (default=no)
|
||||
|
||||
@@ -140,6 +164,17 @@ If chrooted to another root other than the real root device, use --fstab and pro
|
||||
*show_modules=*"__{yes|no}__"::
|
||||
Print the name of the included modules to standard output during build.
|
||||
|
||||
*i18n_vars="__<variable mapping>__"::
|
||||
Distribution specific variable mapping.
|
||||
See dracut/modules.d/10i18n/README for a detailed description.
|
||||
|
||||
*i18n_default_font=*"__<fontname>__"::
|
||||
The font <fontname> to install, if not specified otherwise.
|
||||
Default is "LatArCyrHeb-16".
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
Install everything regardless of generic or hostonly mode.
|
||||
|
||||
Files
|
||||
-----
|
||||
_/etc/dracut.conf_::
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
i18n_default_font="latarcyrheb-sun16"
|
||||
i18n_install_all="yes"
|
||||
stdloglvl=3
|
||||
sysloglvl=5
|
||||
install_items+=" vi /etc/virc ps grep cat rm "
|
||||
@@ -12,3 +13,5 @@ systemdsystemunitdir=/usr/lib/systemd/system
|
||||
systemdsystemconfdir=/etc/systemd/system
|
||||
udevdir=/usr/lib/udev
|
||||
hostonly="yes"
|
||||
hostonly_cmdline="no"
|
||||
early_microcode="yes"
|
||||
|
1120
dracut.css
Normal file
1120
dracut.css
Normal file
File diff suppressed because it is too large
Load Diff
299
dracut.modules.7.asc
Normal file
299
dracut.modules.7.asc
Normal file
@@ -0,0 +1,299 @@
|
||||
DRACUT.MODULES(7)
|
||||
=================
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
|
||||
NAME
|
||||
----
|
||||
dracut.modules - dracut modules
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
dracut uses a modular system to build and extend the initramfs image. All
|
||||
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
|
||||
The most basic dracut module is _99base_. In _99base_ the initial shell script
|
||||
init is defined, which gets run by the kernel after initramfs loading. Although
|
||||
you can replace init with your own version of _99base_, this is not encouraged.
|
||||
Instead you should use, if possible, the hooks of dracut. All hooks, and the
|
||||
point of time in which they are executed, are described in <<stages>>.
|
||||
|
||||
The main script, which creates the initramfs is dracut itsself. It parses all
|
||||
arguments and sets up the directory, in which everything is installed. It then
|
||||
executes all check, install, installkernel scripts found in the modules, which
|
||||
are to be processed. After everything is installed, the install directory is
|
||||
archived and compressed to the final initramfs image. All helper functions used
|
||||
by check, install and installkernel are found in in the file _dracut-functions_.
|
||||
These shell functions are available to all module installer (install,
|
||||
installkernel) scripts, without the need to source _dracut-functions_.
|
||||
|
||||
A module can check the preconditions for install and installkernel with the
|
||||
check script. Also dependencies can be expressed with check. If a module passed
|
||||
check, install and installkernel will be called to install all of the necessary
|
||||
files for the module. To split between kernel and non-kernel parts of the
|
||||
installation, all kernel module related parts have to be in installkernel. All
|
||||
other files found in a module directory are module specific and mostly are hook
|
||||
scripts and udev rules.
|
||||
|
||||
|
||||
[[stages]]
|
||||
== Boot Process Stages
|
||||
|
||||
dracut modules can insert custom script at various points, to control the boot
|
||||
process.
|
||||
These hooks are plain directories containing shell scripts ending with ".sh",
|
||||
which are sourced by init.
|
||||
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
|
||||
|
||||
=== Hook: cmdline
|
||||
|
||||
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
|
||||
and prepare the later actions, like setting up udev rules and configuration
|
||||
files.
|
||||
|
||||
In this hook the most important environment variable is defined: root. The
|
||||
second one is rootok, which indicates, that a module claimed to be able to parse
|
||||
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
|
||||
iscsi dracut module, which then sets rootok.
|
||||
|
||||
=== Hook: pre-udev
|
||||
|
||||
This hook is executed right after the cmdline hook and a check if root and
|
||||
rootok were set. Here modules can take action with the final root, and before
|
||||
udev has been run.
|
||||
|
||||
=== Start Udev
|
||||
|
||||
Now udev is started and the logging for udev is setup.
|
||||
|
||||
=== Hook: pre-trigger
|
||||
|
||||
In this hook, you can set udev environment variables with **udevadm control
|
||||
--property=KEY=_value_** or control the further execution of udev with
|
||||
udevadm.
|
||||
|
||||
=== Trigger Udev
|
||||
|
||||
udev is triggered by calling udevadm trigger, which sends add events for all
|
||||
devices and subsystems.
|
||||
|
||||
=== Main Loop
|
||||
|
||||
In the main loop of dracut loops until udev has settled and
|
||||
all scripts in _initqueue/finished_ returned true.
|
||||
In this loop there are three hooks, where scripts can be inserted
|
||||
by calling /sbin/initqueue.
|
||||
|
||||
==== Initqueue
|
||||
|
||||
This hook gets executed every time a script is inserted here, regardless of the
|
||||
udev state.
|
||||
|
||||
==== Initqueue settled
|
||||
|
||||
This hooks (initqueue/settled) gets executed every time udev has settled.
|
||||
|
||||
==== Initqueue timeout
|
||||
|
||||
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes
|
||||
half of the rd.retry counter.
|
||||
|
||||
==== Initqueue finished
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
||||
Before the root device is mounted all scripts in the hook pre-mount are
|
||||
executed. In some cases (e.g. NFS) the real root device is already mounted,
|
||||
though.
|
||||
|
||||
=== Hook: mount
|
||||
|
||||
This hook is mainly to mount the real root device.
|
||||
|
||||
=== Hook: pre-pivot
|
||||
|
||||
This hook is called before cleanup hook, This is a good place for
|
||||
actions other than cleanups which need to be called before pivot.
|
||||
|
||||
=== Hook: cleanup
|
||||
|
||||
This hook is the last hook and is called before init finally switches root to
|
||||
the real root device. This is a good place to clean up and kill processes not
|
||||
needed anymore.
|
||||
|
||||
|
||||
=== Cleanup and switch_root
|
||||
|
||||
Init (or systemd) kills all udev processes, cleans up the environment,
|
||||
sets up the arguments for the real init process and finally calls switch_root.
|
||||
switch_root removes the whole filesystem hierarchy of the initramfs,
|
||||
chroot()s to the real root device and calls /sbin/init with the specified
|
||||
arguments.
|
||||
|
||||
To ensure all files in the initramfs hierarchy can be removed, all processes
|
||||
still running from the initramfs should not have any open file descriptors left.
|
||||
|
||||
== Network Infrastructure
|
||||
|
||||
FIXME
|
||||
|
||||
== Writing a Module
|
||||
|
||||
A simple example module is _96insmodpost_, which modprobes a kernel module after
|
||||
udev has settled and the basic device drivers have been loaded.
|
||||
|
||||
All module installation information is in the file module-setup.sh.
|
||||
|
||||
First we create a check() function, which just exits with 0 indicating that this
|
||||
module should be included by default.
|
||||
|
||||
check():
|
||||
----
|
||||
return 0
|
||||
----
|
||||
|
||||
The we create the install() function, which installs a cmdline hook with
|
||||
priority number 20 called _parse-insmodpost.sh_. It also installs the
|
||||
_insmodpost.sh_ script in _/sbin_.
|
||||
|
||||
install():
|
||||
----
|
||||
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
----
|
||||
|
||||
The _pase-instmodpost.sh_ parses the kernel command line for a argument
|
||||
rd.driver.post, blacklists the module from being autoloaded and installs the
|
||||
hook _insmodpost.sh_ in the _initqueue/settled_.
|
||||
|
||||
_parse-insmodpost.sh_:
|
||||
----
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
_do_insmodpost=1
|
||||
done
|
||||
|
||||
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
|
||||
----
|
||||
|
||||
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
|
||||
modprobe the kernel modules specified in all rd.driver.post kernel command line
|
||||
parameters. It runs after udev has settled and is only called once (--onetime).
|
||||
|
||||
_insmodpost.sh_:
|
||||
----
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs rd.driver.post=); do
|
||||
modprobe $p
|
||||
done
|
||||
|
||||
----
|
||||
|
||||
|
||||
=== module-setup.sh: check()
|
||||
|
||||
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
|
||||
the initramfs.
|
||||
|
||||
$hostonly:: If the $hostonly variable is set, then the module check() function
|
||||
should be in "hostonly" mode, which means, that the check() should only return
|
||||
0, if the module is really needed to boot this specific host.
|
||||
|
||||
check() should return with:
|
||||
|
||||
0:: Include the dracut module in the initramfs.
|
||||
|
||||
1:: Do not include the dracut module. The requirements are not fullfilled
|
||||
(missing tools, etc.)
|
||||
|
||||
255:: Only include the dracut module, if another module requires it or if
|
||||
explicitly specified in the config file or on the argument list.
|
||||
|
||||
|
||||
=== module-setup.sh: depends()
|
||||
|
||||
The function depends() should echo all other dracut module names the module
|
||||
depends on.
|
||||
|
||||
=== module-setup.sh: cmdline()
|
||||
|
||||
This function should print the kernel command line options needed to boot the
|
||||
current machine setup. It should start with a space and should not print a
|
||||
newline.
|
||||
|
||||
=== module-setup.sh: install()
|
||||
|
||||
The install() function is called to install everything non-kernel related.
|
||||
To install binaries, scripts, and other files, you can use the functions
|
||||
mentioned in <<creation>>.
|
||||
|
||||
To address a file in the current module directory, use the variable "$moddir".
|
||||
|
||||
=== module-setup.sh: installkernel()
|
||||
|
||||
In installkernel() all kernel related files should be installed. You can use all
|
||||
of the functions mentioned in <<creation>> to install files.
|
||||
|
||||
=== [[creation]]Creation Functions
|
||||
|
||||
==== inst_multiple [-o] <file> [ <file> ...]
|
||||
|
||||
installs multiple binaries and files. If executables are specified without a
|
||||
path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the
|
||||
binary. If the option "-o" is given as the first parameter, a missing file does
|
||||
not lead to an error.
|
||||
|
||||
==== inst <src> [<dst>]
|
||||
|
||||
installs _one_ file <src> either to the same place in the initramfs or to an
|
||||
optional <dst>.
|
||||
|
||||
==== inst_hook <hookdir> <prio> <src>
|
||||
|
||||
installs an executable/script <src> in the dracut hook <hookdir> with priority
|
||||
<prio>.
|
||||
|
||||
==== inst_rules <udevrule> [ <udevrule> ...]
|
||||
|
||||
installs one ore more udev rules. Non-existant udev rules are reported, but do
|
||||
not let dracut fail.
|
||||
|
||||
==== instmods <kernelmodule> [ <kernelmodule> ... ]
|
||||
|
||||
instmods should be used only in the installkernel() function.
|
||||
|
||||
instmods installs one or more kernel modules in the initramfs. <kernelmodule>
|
||||
can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".
|
||||
|
||||
instmods will not install the kernel module, if $hostonly is set and the kernel
|
||||
module is not currently needed by any /sys/*...*/uevent MODALIAS.
|
||||
To install a kernel module regardless of the hostonly mode use the form:
|
||||
----
|
||||
hostonly='' instmods <kernelmodule>
|
||||
----
|
||||
|
||||
=== Initramfs Functions
|
||||
|
||||
FIXME
|
||||
|
||||
|
||||
=== Network Modules
|
||||
|
||||
FIXME
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
Harald Hoyer
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
*dracut*(8)
|
533
dracut.sh
533
dracut.sh
@@ -70,6 +70,7 @@ Creates initial ramdisk images for preloading modules
|
||||
--kver [VERSION] Set kernel version to [VERSION].
|
||||
-f, --force Overwrite existing initramfs file.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
--rebuild Append arguments to those of existing image and rebuild
|
||||
-m, --modules [LIST] Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/lib/dracut/modules.d.
|
||||
@@ -97,6 +98,8 @@ Creates initial ramdisk images for preloading modules
|
||||
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--prelink Prelink binaries in the initramfs
|
||||
--noprelink Do not prelink binaries in the initramfs
|
||||
--hardlink Hardlink files in the initramfs
|
||||
--nohardlink Do not hardlink files in the initramfs
|
||||
--prefix [DIR] Prefix initramfs files with [DIR]
|
||||
@@ -134,6 +137,10 @@ Creates initial ramdisk images for preloading modules
|
||||
-H, --hostonly Host-Only mode: Install only what is needed for
|
||||
booting the local host instead of a generic host.
|
||||
-N, --no-hostonly Disables Host-Only mode
|
||||
--hostonly-cmdline Store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--no-hostonly-cmdline Do not store kernel command line arguments needed
|
||||
in the initramfs
|
||||
--persistent-policy [POLICY]
|
||||
Use [POLICY] to address disks and partitions.
|
||||
POLICY can be any directory name found in /dev/disk.
|
||||
@@ -163,6 +170,12 @@ Creates initial ramdisk images for preloading modules
|
||||
--xz Compress the generated initramfs using xz.
|
||||
Make sure that your kernel has xz support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--lzo Compress the generated initramfs using lzop.
|
||||
Make sure that your kernel has lzo support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--lz4 Compress the generated initramfs using lz4.
|
||||
Make sure that your kernel has lz4 support compiled
|
||||
in, otherwise you will not be able to boot.
|
||||
--compress [COMPRESSION] Compress the generated initramfs with the
|
||||
passed compression program. Make sure your kernel
|
||||
knows how to decompress the generated initramfs,
|
||||
@@ -175,6 +188,7 @@ Creates initial ramdisk images for preloading modules
|
||||
--keep Keep the temporary initramfs for debugging purposes
|
||||
--printsize Print out the module install size
|
||||
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
|
||||
--logfile [FILE] Logfile to use (overrides configuration setting)
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
@@ -270,130 +284,226 @@ dropindirs_sort()
|
||||
}
|
||||
}
|
||||
|
||||
rearrange_params()
|
||||
{
|
||||
# Workaround -i, --include taking 2 arguments
|
||||
set -- "${@/--include/++include}"
|
||||
|
||||
# This prevents any long argument ending with "-i"
|
||||
# -i, like --opt-i but I think we can just prevent that
|
||||
set -- "${@/%-i/++include}"
|
||||
|
||||
TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
|
||||
--long kver: \
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
--long add-drivers: \
|
||||
--long omit-drivers: \
|
||||
--long modules: \
|
||||
--long omit: \
|
||||
--long drivers: \
|
||||
--long filesystems: \
|
||||
--long install: \
|
||||
--long fwdir: \
|
||||
--long libdirs: \
|
||||
--long fscks: \
|
||||
--long add-fstab: \
|
||||
--long mount: \
|
||||
--long device: \
|
||||
--long add-device: \
|
||||
--long nofscks: \
|
||||
--long ro-mnt \
|
||||
--long kmoddir: \
|
||||
--long conf: \
|
||||
--long confdir: \
|
||||
--long tmpdir: \
|
||||
--long stdlog: \
|
||||
--long compress: \
|
||||
--long prefix: \
|
||||
--long rebuild: \
|
||||
--long force \
|
||||
--long kernel-only \
|
||||
--long no-kernel \
|
||||
--long print-cmdline \
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long prelink \
|
||||
--long noprelink \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
--long mdadmconf \
|
||||
--long nomdadmconf \
|
||||
--long lvmconf \
|
||||
--long nolvmconf \
|
||||
--long debug \
|
||||
--long profile \
|
||||
--long sshkey: \
|
||||
--long logfile: \
|
||||
--long verbose \
|
||||
--long quiet \
|
||||
--long local \
|
||||
--long hostonly \
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long hostonly-cmdline \
|
||||
--long no-hostonly-cmdline \
|
||||
--long persistent-policy: \
|
||||
--long fstab \
|
||||
--long help \
|
||||
--long bzip2 \
|
||||
--long lzma \
|
||||
--long xz \
|
||||
--long lzo \
|
||||
--long lz4 \
|
||||
--long no-compress \
|
||||
--long gzip \
|
||||
--long list-modules \
|
||||
--long show-modules \
|
||||
--long keep \
|
||||
--long printsize \
|
||||
--long regenerate-all \
|
||||
--long noimageifnotneeded \
|
||||
--long early-microcode \
|
||||
--long no-early-microcode \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
verbosity_mod_l=0
|
||||
unset kernel
|
||||
unset outfile
|
||||
|
||||
# Workaround -i, --include taking 2 arguments
|
||||
set -- "${@/--include/++include}"
|
||||
rearrange_params "$@"
|
||||
eval set -- "$TEMP"
|
||||
|
||||
# This prevents any long argument ending with "-i"
|
||||
# -i, like --opt-i but I think we can just prevent that
|
||||
set -- "${@/%-i/++include}"
|
||||
# parse command line args to check if '--rebuild' option is present
|
||||
unset append_args_l
|
||||
unset rebuild_file
|
||||
while :
|
||||
do
|
||||
if [ "$1" == "--" ]; then
|
||||
shift; break
|
||||
fi
|
||||
if [ "$1" == "--rebuild" ]; then
|
||||
append_args_l="yes"
|
||||
rebuild_file=$2
|
||||
if [ ! -e $rebuild_file ]; then
|
||||
echo "Image file '$rebuild_file', for rebuild, does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
abs_rebuild_file=$(readlink -f "$rebuild_file") && rebuild_file="$abs_rebuild_file"
|
||||
shift; continue
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
|
||||
--long kver: \
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
--long add-drivers: \
|
||||
--long omit-drivers: \
|
||||
--long modules: \
|
||||
--long omit: \
|
||||
--long drivers: \
|
||||
--long filesystems: \
|
||||
--long install: \
|
||||
--long fwdir: \
|
||||
--long libdirs: \
|
||||
--long fscks: \
|
||||
--long add-fstab: \
|
||||
--long mount: \
|
||||
--long device: \
|
||||
--long nofscks: \
|
||||
--long ro-mnt \
|
||||
--long kmoddir: \
|
||||
--long conf: \
|
||||
--long confdir: \
|
||||
--long tmpdir: \
|
||||
--long stdlog: \
|
||||
--long compress: \
|
||||
--long prefix: \
|
||||
--long force \
|
||||
--long kernel-only \
|
||||
--long no-kernel \
|
||||
--long print-cmdline \
|
||||
--long kernel-cmdline: \
|
||||
--long strip \
|
||||
--long nostrip \
|
||||
--long hardlink \
|
||||
--long nohardlink \
|
||||
--long noprefix \
|
||||
--long mdadmconf \
|
||||
--long nomdadmconf \
|
||||
--long lvmconf \
|
||||
--long nolvmconf \
|
||||
--long debug \
|
||||
--long profile \
|
||||
--long sshkey: \
|
||||
--long verbose \
|
||||
--long quiet \
|
||||
--long local \
|
||||
--long hostonly \
|
||||
--long host-only \
|
||||
--long no-hostonly \
|
||||
--long no-host-only \
|
||||
--long persistent-policy: \
|
||||
--long fstab \
|
||||
--long help \
|
||||
--long bzip2 \
|
||||
--long lzma \
|
||||
--long xz \
|
||||
--long no-compress \
|
||||
--long gzip \
|
||||
--long list-modules \
|
||||
--long show-modules \
|
||||
--long keep \
|
||||
--long printsize \
|
||||
--long regenerate-all \
|
||||
--long noimageifnotneeded \
|
||||
--long early-microcode \
|
||||
--long no-early-microcode \
|
||||
-- "$@")
|
||||
# get output file name and kernel version from command line arguments
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
++include)
|
||||
shift 2;;
|
||||
*)
|
||||
if ! [[ ${outfile+x} ]]; then
|
||||
outfile=$1
|
||||
elif ! [[ ${kernel+x} ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
printf "\nUnknown arguments: %s\n\n" "$*" >&2
|
||||
usage; exit 1;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
# extract input image file provided with rebuild option to get previous parameters, if any
|
||||
if [[ $append_args_l == "yes" ]]; then
|
||||
unset rebuild_param
|
||||
|
||||
# determine resultant file
|
||||
if ! [[ $outfile ]]; then
|
||||
outfile=$rebuild_file
|
||||
fi
|
||||
|
||||
if ! rebuild_param=$(lsinitrd $rebuild_file '*lib/dracut/build-parameter.txt'); then
|
||||
echo "Image '$rebuild_file' has no rebuild information stored"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# prepend previous parameters to current command line args
|
||||
if [[ $rebuild_param ]]; then
|
||||
TEMP="$rebuild_param $TEMP"
|
||||
eval set -- "$TEMP"
|
||||
rearrange_params "$@"
|
||||
fi
|
||||
|
||||
# clean the temporarily used scratch-pad directory
|
||||
rm -rf $scratch_dir
|
||||
fi
|
||||
|
||||
unset PARMS_TO_STORE
|
||||
PARMS_TO_STORE=""
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while :; do
|
||||
if [ $1 != "--" ] && [ $1 != "--rebuild" ]; then
|
||||
PARMS_TO_STORE+=" $1";
|
||||
fi
|
||||
case $1 in
|
||||
--kver) kernel="$2"; shift;;
|
||||
-a|--add) push add_dracutmodules_l "$2"; shift;;
|
||||
--force-add) push force_add_dracutmodules_l "$2"; shift;;
|
||||
--add-drivers) push add_drivers_l "$2"; shift;;
|
||||
--omit-drivers) push omit_drivers_l "$2"; shift;;
|
||||
-m|--modules) push dracutmodules_l "$2"; shift;;
|
||||
-o|--omit) push omit_dracutmodules_l "$2"; shift;;
|
||||
-d|--drivers) push drivers_l "$2"; shift;;
|
||||
--filesystems) push filesystems_l "$2"; shift;;
|
||||
-I|--install) push install_items_l "$2"; shift;;
|
||||
--fwdir) push fw_dir_l "$2"; shift;;
|
||||
--libdirs) push libdirs_l "$2"; shift;;
|
||||
--fscks) push fscks_l "$2"; shift;;
|
||||
--add-fstab) push add_fstab_l "$2"; shift;;
|
||||
--mount) push fstab_lines "$2"; shift;;
|
||||
--kver) kernel="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-a|--add) push add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--force-add) push force_add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--add-drivers) push add_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--omit-drivers) push omit_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-m|--modules) push dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-o|--omit) push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-d|--drivers) push drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--filesystems) push filesystems_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-I|--install) push install_items_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fwdir) push fw_dir_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--libdirs) push libdirs_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fscks) push fscks_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--add-fstab) push add_fstab_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--mount) push fstab_lines "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--add-device|--device)
|
||||
push add_device_l "$2"; shift;;
|
||||
--kernel-cmdline) push kernel_cmdline_l "$2"; shift;;
|
||||
push add_device_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--kernel-cmdline) push kernel_cmdline_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--nofscks) nofscks_l="yes";;
|
||||
--ro-mnt) ro_mnt_l="yes";;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
-c|--conf) conffile="$2"; shift;;
|
||||
--confdir) confdir="$2"; shift;;
|
||||
--tmpdir) tmpdir_l="$2"; shift;;
|
||||
-L|--stdlog) stdloglvl_l="$2"; shift;;
|
||||
--compress) compress_l="$2"; shift;;
|
||||
--prefix) prefix_l="$2"; shift;;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-c|--conf) conffile="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--confdir) confdir="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--tmpdir) tmpdir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-L|--stdlog) stdloglvl_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--compress) compress_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--prefix) prefix_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--rebuild) if [ $rebuild_file == $outfile ]; then
|
||||
force=yes
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-f|--force) force=yes;;
|
||||
--kernel-only) kernel_only="yes"; no_kernel="no";;
|
||||
--no-kernel) kernel_only="no"; no_kernel="yes";;
|
||||
--print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
||||
--early-microcode) early_microcode_l="yes";;
|
||||
--no-early-microcode) early_microcode_l="no";;
|
||||
--print-cmdline)
|
||||
print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
|
||||
--early-microcode)
|
||||
early_microcode_l="yes";;
|
||||
--no-early-microcode)
|
||||
early_microcode_l="no";;
|
||||
--strip) do_strip_l="yes";;
|
||||
--nostrip) do_strip_l="no";;
|
||||
--prelink) do_prelink_l="yes";;
|
||||
--noprelink) do_prelink_l="no";;
|
||||
--hardlink) do_hardlink_l="yes";;
|
||||
--nohardlink) do_hardlink_l="no";;
|
||||
--noprefix) prefix_l="/";;
|
||||
@@ -403,7 +513,8 @@ while :; do
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
--debug) debug="yes";;
|
||||
--profile) profile="yes";;
|
||||
--sshkey) sshkey="$2"; shift;;
|
||||
--sshkey) sshkey="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--logfile) logfile_l="$2"; shift;;
|
||||
-v|--verbose) ((verbosity_mod_l++));;
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local)
|
||||
@@ -415,15 +526,21 @@ while :; do
|
||||
hostonly_l="yes" ;;
|
||||
-N|--no-hostonly|--no-host-only)
|
||||
hostonly_l="no" ;;
|
||||
--hostonly-cmdline)
|
||||
hostonly_cmdline_l="yes" ;;
|
||||
--no-hostonly-cmdline)
|
||||
hostonly_cmdline_l="no" ;;
|
||||
--persistent-policy)
|
||||
persistent_policy_l="$2"; shift;;
|
||||
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--fstab) use_fstab_l="yes" ;;
|
||||
-h|--help) long_usage; exit 1 ;;
|
||||
-i|--include) push include_src "$2"
|
||||
-i|--include) push include_src "$2"; PARMS_TO_STORE+=" '$2'";
|
||||
shift;;
|
||||
--bzip2) compress_l="bzip2";;
|
||||
--lzma) compress_l="lzma";;
|
||||
--xz) compress_l="xz";;
|
||||
--lzo) compress_l="lzo";;
|
||||
--lz4) compress_l="lz4";;
|
||||
--no-compress) _no_compress_l="cat";;
|
||||
--gzip) compress_l="gzip";;
|
||||
--list-modules) do_list="yes";;
|
||||
@@ -447,21 +564,12 @@ done
|
||||
# the old fashioned way
|
||||
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
++include) push include_src "$2"
|
||||
push include_target "$3"
|
||||
shift 2;;
|
||||
*)
|
||||
if ! [[ ${outfile+x} ]]; then
|
||||
outfile=$1
|
||||
elif ! [[ ${kernel+x} ]]; then
|
||||
kernel=$1
|
||||
else
|
||||
printf "\nUnknown arguments: %s\n\n" "$*" >&2
|
||||
usage; exit 1;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ ${1%%=*} == "++include" ]; then
|
||||
push include_src "$2"
|
||||
push include_target "$3"
|
||||
PARMS_TO_STORE+=" --include '$2' '$3'"
|
||||
shift 2
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
@@ -485,22 +593,23 @@ if [[ $regenerate_all == "yes" ]]; then
|
||||
|
||||
cd /lib/modules
|
||||
for i in *; do
|
||||
[[ -f $i/modules.builtin ]] || continue
|
||||
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
|
||||
dracut --kver="$i" "${dracut_args[@]}"
|
||||
((ret+=$?))
|
||||
done
|
||||
exit $ret
|
||||
elif [[ $kernel ]]; then
|
||||
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
|
||||
printf -- "Kernel version $kernel has no modules in /lib/modules/$kernel\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ $kernel ]]; then
|
||||
kernel=$(uname -r)
|
||||
fi
|
||||
|
||||
if [[ $kernel ]]; then
|
||||
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
|
||||
printf -- "Kernel version $kernel has no module directory /lib/modules/$kernel\n" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! [[ $outfile ]]; then
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
|
||||
@@ -516,7 +625,7 @@ for i in /usr/sbin /sbin /usr/bin /bin; do
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
if [[ "$NPATH" != "*:$rl*" ]] ; then
|
||||
if [[ "$NPATH" != *:$rl* ]] ; then
|
||||
NPATH+=":$rl"
|
||||
fi
|
||||
done
|
||||
@@ -527,6 +636,7 @@ export LC_ALL=C
|
||||
export LANG=C
|
||||
unset NPATH
|
||||
unset LD_LIBRARY_PATH
|
||||
unset LD_PRELOAD
|
||||
unset GREP_OPTIONS
|
||||
|
||||
export DRACUT_LOG_LEVEL=warning
|
||||
@@ -651,11 +761,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
|
||||
[[ $do_strip_l ]] && do_strip=$do_strip_l
|
||||
[[ $do_strip ]] || do_strip=yes
|
||||
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
|
||||
[[ $do_prelink ]] || do_prelink=yes
|
||||
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
|
||||
[[ $do_hardlink ]] || do_hardlink=yes
|
||||
[[ $prefix_l ]] && prefix=$prefix_l
|
||||
[[ $prefix = "/" ]] && unset prefix
|
||||
[[ $hostonly_l ]] && hostonly=$hostonly_l
|
||||
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
|
||||
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
@@ -664,12 +777,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
|
||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
||||
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
[[ $nofscks_l ]] && nofscks="yes"
|
||||
[[ $ro_mnt_l ]] && ro_mnt="yes"
|
||||
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
|
||||
[[ $early_microcode ]] || early_microcode=no
|
||||
[[ $logfile_l ]] && logfile="$logfile_l"
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
@@ -677,9 +792,11 @@ fw_dir=${fw_dir//:/ }
|
||||
[[ $compress ]] || compress="gzip"
|
||||
case $compress in
|
||||
bzip2) compress="bzip2 -9";;
|
||||
lzma) compress="lzma -9";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
|
||||
lzma) compress="lzma -9 -T0";;
|
||||
xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
|
||||
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
|
||||
lzo) compress="lzop -9";;
|
||||
lz4) compress="lz4 -l -9";;
|
||||
esac
|
||||
if [[ $_no_compress_l = "cat" ]]; then
|
||||
compress="cat"
|
||||
@@ -695,19 +812,18 @@ readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)"
|
||||
[ -d "$microcode_dir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2
|
||||
if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
|
||||
readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
|
||||
[ -d "$early_cpio_dir" ] || {
|
||||
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_cpio.XXXXXX failed." >&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
# clean up after ourselves no matter how we die.
|
||||
trap '
|
||||
ret=$?;
|
||||
[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
|
||||
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
|
||||
[[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; };
|
||||
[[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
|
||||
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
|
||||
exit $ret;
|
||||
' EXIT
|
||||
@@ -718,6 +834,13 @@ trap 'exit 1;' SIGINT
|
||||
export DRACUT_KERNEL_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
if [[ $print_cmdline ]]; then
|
||||
stdloglvl=0
|
||||
sysloglvl=0
|
||||
fileloglvl=0
|
||||
kmsgloglvl=0
|
||||
fi
|
||||
|
||||
if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
else
|
||||
@@ -729,7 +852,7 @@ fi
|
||||
|
||||
if ! [[ $print_cmdline ]]; then
|
||||
inst /bin/sh
|
||||
if ! $DRACUT_INSTALL ${initdir+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
unset DRACUT_RESOLVE_LAZY
|
||||
export DRACUT_RESOLVE_DEPS=1
|
||||
fi
|
||||
@@ -791,6 +914,7 @@ for ((i=0; i < ${#dracut_args[@]}; i++)); do
|
||||
dracut_args[$i]="\"${dracut_args[$i]}\""
|
||||
#" keep vim happy
|
||||
done
|
||||
|
||||
dinfo "Executing: $0 ${dracut_args[@]}"
|
||||
|
||||
[[ $do_list = yes ]] && {
|
||||
@@ -816,23 +940,25 @@ if [[ -d $srcmods ]]; then
|
||||
}
|
||||
fi
|
||||
|
||||
if [[ -f $outfile && ! $force && ! $print_cmdline ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! $print_cmdline ]]; then
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
dfatal "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
outdir=${outfile%/*}
|
||||
[[ $outdir ]] || outdir="/"
|
||||
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
if [[ ! -d "$outdir" ]]; then
|
||||
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
|
||||
exit 1
|
||||
elif [[ ! -w "$outdir" ]]; then
|
||||
dfatal "No permission to write to $outdir."
|
||||
exit 1
|
||||
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
|
||||
dfatal "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Need to be able to have non-root users read stuff (rpcbind etc)
|
||||
@@ -890,7 +1016,9 @@ if [[ $hostonly ]]; then
|
||||
"/usr/sbin" \
|
||||
"/usr/lib" \
|
||||
"/usr/lib64" \
|
||||
"/boot";
|
||||
"/boot" \
|
||||
"/boot/efi" \
|
||||
;
|
||||
do
|
||||
mp=$(readlink -f "$mp")
|
||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||
@@ -898,7 +1026,7 @@ if [[ $hostonly ]]; then
|
||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
[[ -b $_bdev ]] && _dev=$_bdev
|
||||
push host_devs $_dev
|
||||
[[ "$_mp" == "/" ]] && root_dev="$_dev"
|
||||
[[ "$mp" == "/" ]] && root_dev="$_dev"
|
||||
push host_devs "$_dev"
|
||||
done
|
||||
|
||||
@@ -913,8 +1041,7 @@ if [[ $hostonly ]]; then
|
||||
[[ $_t != "swap" ]] && continue
|
||||
[[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
|
||||
[[ "$_o" == *noauto* ]] && continue
|
||||
[[ "$_d" == UUID\=* ]] && _d="/dev/disk/by-uuid/${_d#UUID=}"
|
||||
[[ "$_d" == LABEL\=* ]] && _d="/dev/disk/by-label/$_d#LABEL=}"
|
||||
_d=$(expand_persistent_dev "$_d")
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
|
||||
if [[ -f /etc/crypttab ]]; then
|
||||
@@ -922,6 +1049,8 @@ if [[ $hostonly ]]; then
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
[[ "$_o" ]] || _o="$_p"
|
||||
# skip entries with password files
|
||||
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
|
||||
# skip mkswap swap
|
||||
[[ $_o == *swap* ]] && continue 2
|
||||
done < /etc/crypttab
|
||||
@@ -932,16 +1061,42 @@ if [[ $hostonly ]]; then
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
# record all host modaliases
|
||||
declare -A host_modalias
|
||||
find /sys/devices/ -name uevent -print > "$initdir/.modalias"
|
||||
while read m; do
|
||||
while read line; do
|
||||
[[ "$line" != MODALIAS\=* ]] && continue
|
||||
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
|
||||
break
|
||||
done < "$m"
|
||||
done < "$initdir/.modalias"
|
||||
|
||||
rm -f -- "$initdir/.modalias"
|
||||
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
host_modalias["$_v"]=1
|
||||
done </proc/crypto
|
||||
|
||||
# check /proc/modules
|
||||
declare -A host_modules
|
||||
while read m rest; do
|
||||
host_modules["$m"]=1
|
||||
done </proc/modules
|
||||
fi
|
||||
|
||||
unset m
|
||||
unset rest
|
||||
|
||||
_get_fs_type() {
|
||||
[[ $1 ]] || return
|
||||
if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then
|
||||
host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
|
||||
if [[ -b /dev/block/$1 ]]; then
|
||||
ID_FS_TYPE=$(get_fs_env "/dev/block/$1") && host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if [[ -b $1 ]] && ID_FS_TYPE=$(get_fs_env "$1"); then
|
||||
host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
|
||||
if [[ -b $1 ]]; then
|
||||
ID_FS_TYPE=$(get_fs_env "$1") && host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
|
||||
return 1
|
||||
fi
|
||||
if fstype=$(find_dev_fstype "$1"); then
|
||||
@@ -997,14 +1152,17 @@ fi
|
||||
|
||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
|
||||
export initdir dracutbasedir dracutmodules \
|
||||
export initdir dracutbasedir \
|
||||
dracutmodules force_add_dracutmodules add_dracutmodules omit_dracutmodules \
|
||||
mods_to_load \
|
||||
fw_dir drivers_dir debug no_kernel kernel_only \
|
||||
omit_drivers mdadmconf lvmconf root_dev \
|
||||
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
|
||||
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
|
||||
debug host_fs_types host_devs sshkey add_fstab \
|
||||
DRACUT_VERSION udevdir prefix filesystems drivers \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir \
|
||||
host_modalias host_modules hostonly_cmdline
|
||||
|
||||
mods_to_load=""
|
||||
# check all our modules to see if they should be sourced.
|
||||
@@ -1049,7 +1207,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
fi
|
||||
done
|
||||
|
||||
for d in dev proc sys sysroot root run run/lock run/initramfs; do
|
||||
for d in dev proc sys sysroot root run; do
|
||||
if [ -L "/$d" ]; then
|
||||
inst_symlink "/$d"
|
||||
else
|
||||
@@ -1164,7 +1322,11 @@ if [[ $kernel_only != yes ]]; then
|
||||
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
|
||||
|
||||
while pop fstab_lines line; do
|
||||
printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab"
|
||||
line=($line)
|
||||
[ -z "${line[3]}" ] && line[3]="defaults"
|
||||
[ -z "${line[4]}" ] && line[4]="0"
|
||||
[ -z "${line[5]}" ] && line[5]="2"
|
||||
echo "${line[@]}" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
for f in $add_fstab; do
|
||||
@@ -1185,7 +1347,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
find "$initdir" -type f \
|
||||
'(' -perm -0100 -or -perm -0010 -or -perm -0001 ')' \
|
||||
-not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir+-D "$initdir"} -R ${DRACUT_FIPS_MODE+-H} --
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-H} --
|
||||
dinfo "*** Resolving executable dependencies done***"
|
||||
fi
|
||||
fi
|
||||
@@ -1235,7 +1397,7 @@ if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
|
||||
if [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Installing prelink files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
|
||||
else
|
||||
elif [[ $do_prelink == yes ]]; then
|
||||
dinfo "*** Pre-linking files ***"
|
||||
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
|
||||
chroot "$initdir" "$PRELINK_BIN" -a
|
||||
@@ -1280,7 +1442,7 @@ if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
|
||||
_dest_dir="$microcode_dir/d/kernel/x86/microcode"
|
||||
_dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
|
||||
_dest_idx="0 1"
|
||||
mkdir -p $_dest_dir
|
||||
if [[ $hostonly ]]; then
|
||||
@@ -1295,26 +1457,49 @@ if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Constructing ${ucode_dest[$idx]} ****"
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
if ! [[ -r $_fwdir/$_fw/$_src ]];then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
done
|
||||
done
|
||||
(cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio)
|
||||
fi
|
||||
|
||||
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
|
||||
dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
|
||||
_dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
|
||||
mkdir -p $_dest_dir
|
||||
for table in $acpi_table_dir/*.aml; do
|
||||
dinfo " Adding ACPI table: $table"
|
||||
cp $table $_dest_dir
|
||||
create_early_cpio="yes"
|
||||
done
|
||||
fi
|
||||
|
||||
dinfo "*** Store current command line parameters ***"
|
||||
if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
|
||||
dfatal "Could not store the current command line parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f -- "$outfile"
|
||||
dinfo "*** Creating image file ***"
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
|
||||
[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
|
||||
|
||||
if [[ $create_early_cpio = yes ]]; then
|
||||
echo 1 > "$early_cpio_dir/d/early_cpio"
|
||||
# The microcode blob is _before_ the initramfs blob, not after
|
||||
mv $microcode_dir/ucode.cpio $outfile.$$
|
||||
(cd "$early_cpio_dir/d"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > $outfile)
|
||||
fi
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \
|
||||
$compress >> "$outfile.$$"; ); then
|
||||
dfatal "dracut: creation of $outfile.$$ failed"
|
||||
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
|
||||
$compress >> "$outfile"; ); then
|
||||
dfatal "dracut: creation of $outfile failed"
|
||||
exit 1
|
||||
fi
|
||||
mv -- "$outfile.$$" "$outfile"
|
||||
dinfo "*** Creating image file done ***"
|
||||
|
||||
if (( maxloglvl >= 5 )); then
|
||||
|
15
dracut.spec
15
dracut.spec
@@ -271,9 +271,13 @@ echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-i
|
||||
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
%endif
|
||||
|
||||
# create compat symlink
|
||||
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
|
||||
ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
|
||||
|
||||
%clean
|
||||
rm -rf -- $RPM_BUILD_ROOT
|
||||
@@ -283,7 +287,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%{_bindir}/dracut
|
||||
# compat symlink
|
||||
/sbin/dracut
|
||||
%{_sbindir}/dracut
|
||||
%{_datadir}/bash-completion/completions/dracut
|
||||
%{_datadir}/bash-completion/completions/lsinitrd
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
|
||||
@@ -298,6 +302,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/dracut-logger.sh
|
||||
%{dracutlibdir}/dracut-initramfs-restore
|
||||
%{dracutlibdir}/dracut-install
|
||||
%{dracutlibdir}/skipcpio
|
||||
%config(noreplace) %{_sysconfdir}/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
|
||||
%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
@@ -312,6 +317,7 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
%{_mandir}/man7/dracut.bootup.7*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%if %{defined _unitdir}
|
||||
@@ -407,12 +413,15 @@ rm -rf -- $RPM_BUILD_ROOT
|
||||
%{dracutlibdir}/modules.d/95ssh-client
|
||||
%{dracutlibdir}/modules.d/45ifcfg
|
||||
%{dracutlibdir}/modules.d/95znet
|
||||
%{dracutlibdir}/modules.d/95fcoe-uefi
|
||||
%{dracutlibdir}/modules.d/99uefi-lib
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%{dracutlibdir}/modules.d/01fips
|
||||
%{dracutlibdir}/dracut.conf.d/40-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
%endif
|
||||
|
||||
%files fips-aesni
|
||||
|
537
dracut.usage.asc
Normal file
537
dracut.usage.asc
Normal file
@@ -0,0 +1,537 @@
|
||||
To create a initramfs image, the most simple command is:
|
||||
----
|
||||
# dracut
|
||||
----
|
||||
|
||||
This will generate a general purpose initramfs image, with all possible
|
||||
functionality resulting of the combination of the installed dracut modules and
|
||||
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
|
||||
contains the kernel modules of the currently active kernel with version
|
||||
_++<kernel version>++_.
|
||||
|
||||
If the initramfs image already exists, dracut will display an error message, and
|
||||
to overwrite the existing image, you have to use the --force option.
|
||||
----
|
||||
# dracut --force
|
||||
----
|
||||
|
||||
If you want to specify another filename for the resulting image you would issue
|
||||
a command like:
|
||||
----
|
||||
# dracut foobar.img
|
||||
----
|
||||
|
||||
To generate an image for a specific kernel version, the command would be:
|
||||
----
|
||||
# dracut foobar.img 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
A shortcut to generate the image at the default location for a specific kernel
|
||||
version is:
|
||||
----
|
||||
# dracut --kver 2.6.40-1.rc5.f20
|
||||
----
|
||||
|
||||
If you want to create lighter, smaller initramfs images, you may want to specify
|
||||
the --hostonly or -H option. Using this option, the resulting image will
|
||||
contain only those dracut modules, kernel modules and filesystems, which are
|
||||
needed to boot this specific machine. This has the drawback, that you can't put
|
||||
the disk on another controller or machine, and that you can't switch to another
|
||||
root filesystem, without recreating the initramfs image. The usage of the
|
||||
--hostonly option is only for experts and you will have to keep the broken
|
||||
pieces. At least keep a copy of a general purpose image (and corresponding
|
||||
kernel) as a fallback to rescue your system.
|
||||
|
||||
=== Inspecting the Contents
|
||||
To see the contents of the image created by dracut, you can use the lsinitrd
|
||||
tool.
|
||||
----
|
||||
# lsinitrd | less
|
||||
----
|
||||
|
||||
To display the contents of a file in the initramfs also use the lsinitrd tool:
|
||||
----
|
||||
# lsinitrd -f /etc/ld.so.conf
|
||||
include ld.so.conf.d/*.conf
|
||||
----
|
||||
|
||||
=== Adding dracut Modules
|
||||
Some dracut modules are turned off by default and have to be activated manually.
|
||||
You can do this by adding the dracut modules to the configuration file
|
||||
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
|
||||
You can also add dracut modules on the command line
|
||||
by using the -a or --add option:
|
||||
----
|
||||
# dracut --add bootchart initramfs-bootchart.img
|
||||
----
|
||||
|
||||
To see a list of available dracut modules, use the --list-modules option:
|
||||
----
|
||||
# dracut --list-modules
|
||||
----
|
||||
|
||||
=== Omitting dracut Modules
|
||||
Sometimes you don't want a dracut module to be included for reasons of speed,
|
||||
size or functionality. To do this, either specify the omit_dracutmodules
|
||||
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
|
||||
file (see *dracut.conf*(5)), or use the -o or --omit option
|
||||
on the command line:
|
||||
----
|
||||
# dracut -o "multipath lvm" no-multipath-lvm.img
|
||||
----
|
||||
|
||||
=== Adding Kernel Modules
|
||||
If you need a special kernel module in the initramfs, which is not
|
||||
automatically picked up by dracut, you have the use the --add-drivers option
|
||||
on the command line or the drivers vaiable in the _/etc/dracut.conf_
|
||||
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
|
||||
----
|
||||
# dracut --add-drivers mymod initramfs-with-mymod.img
|
||||
----
|
||||
|
||||
=== Boot parameters
|
||||
An initramfs generated without the "hostonly" mode, does not contain any system
|
||||
configuration files (except for some special exceptions), so the configuration
|
||||
has to be done on the kernel command line. With this flexibility, you can easily
|
||||
boot from a changed root partition, without the need to recompile the initramfs
|
||||
image. So, you could completly change your root partition (move it inside a md
|
||||
raid with encryption and LVM on top), as long as you specify the correct
|
||||
filesystem LABEL or UUID on the kernel command line for your root device, dracut
|
||||
will find it and boot from it.
|
||||
|
||||
The kernel command line usually can be configured in _/boot/grub/grub.conf_, if
|
||||
grub is your bootloader and it also can be edited in the real boot process in
|
||||
the grub menu.
|
||||
|
||||
The kernel command line can also be provided by the dhcp server with the
|
||||
root-path option. See <<NetworkBoot>>.
|
||||
|
||||
For a full reference of all kernel command line parameters,
|
||||
see *dracut.cmdline*(5).
|
||||
|
||||
To get a quick start for the suitable kernel command line on your system,
|
||||
use the __--print-cmdline__ option:
|
||||
----
|
||||
# dracut --print-cmdline
|
||||
root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
|
||||
----
|
||||
|
||||
==== Specifying the root Device
|
||||
This is the only option dracut really needs to boot from your root partition.
|
||||
Because your root partition can live in various environments, there are a lot of
|
||||
formats for the root= option. The most basic one is root=_++<path to device
|
||||
node>++_:
|
||||
----
|
||||
root=/dev/sda2
|
||||
----
|
||||
|
||||
Because device node names can change, dependent on the drive ordering, you are
|
||||
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
|
||||
to specify your root partition:
|
||||
----
|
||||
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
root=LABEL=myrootpartitionlabel
|
||||
----
|
||||
|
||||
To see all UUIDs or LABELs on your system, do:
|
||||
----
|
||||
# ls -l /dev/disk/by-uuid
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
----
|
||||
# ls -l /dev/disk/by-label
|
||||
----
|
||||
|
||||
If your root partition is on the network see <<NetworkBoot>>.
|
||||
|
||||
==== Keyboard Settings
|
||||
If you have to input passwords for encrypted disk volumes, you might want to set
|
||||
the keyboard layout and specify a display font.
|
||||
|
||||
A typical german kernel command would contain:
|
||||
----
|
||||
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
a modern init system, like systemd.
|
||||
|
||||
==== Blacklisting Kernel Modules
|
||||
Sometimes it is required to prevent the automatic kernel module loading of a
|
||||
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
|
||||
name>++_, with _++<kernel module name>++_ not containing the _.ko_
|
||||
suffix, to the kernel command line. For example:
|
||||
----
|
||||
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
|
||||
----
|
||||
|
||||
The option can be specified multiple times on the kernel command line.
|
||||
|
||||
==== Speeding up the Boot Process
|
||||
If you want to speed up the boot process, you can specify as much information
|
||||
for dracut on the kernel command as possible. For example, you can tell dracut,
|
||||
that you root partition is not on a LVM volume or not on a raid partition, or
|
||||
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
|
||||
searches everywhere. A typical dracut kernel command line for a plain primary or
|
||||
logical partition would contain:
|
||||
----
|
||||
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
|
||||
----
|
||||
|
||||
This turns off every automatic assembly of LVM, MD raids, DM raids and
|
||||
crypto LUKS.
|
||||
|
||||
Of course, you could also omit the dracut modules in the initramfs creation
|
||||
process, but then you would lose the posibility to turn it on on demand.
|
||||
|
||||
|
||||
[[Injecting]]
|
||||
=== Injecting custom Files
|
||||
To add your own files to the initramfs image, you have several possibilities.
|
||||
|
||||
The --include option let you specify a source path and a target path.
|
||||
For example
|
||||
----
|
||||
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
|
||||
----
|
||||
will create an initramfs image, where the file cmdline-preset will be copied
|
||||
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only
|
||||
be specified once.
|
||||
|
||||
|
||||
----
|
||||
# mkdir -p rd.live.overlay/etc/cmdline.d
|
||||
# mkdir -p rd.live.overlay/etc/conf.d
|
||||
# echo "ip=dhcp" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
|
||||
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
|
||||
# tree rd.live.overlay/
|
||||
rd.live.overlay/
|
||||
`-- etc
|
||||
|-- cmdline.d
|
||||
| `-- mycmdline.conf
|
||||
`-- conf.d
|
||||
`-- testvar.conf
|
||||
|
||||
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
|
||||
----
|
||||
|
||||
This will put the contents of the rd.live.overlay directory into the root of the
|
||||
initramfs image.
|
||||
|
||||
The --install option let you specify several files, which will get installed in
|
||||
the initramfs image at the same location, as they are present on initramfs
|
||||
creation time.
|
||||
|
||||
|
||||
----
|
||||
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
|
||||
----
|
||||
|
||||
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
|
||||
together with the libraries needed to start those. The --install option can be
|
||||
specified multiple times.
|
||||
|
||||
|
||||
[[NetworkBoot]]
|
||||
=== Network Boot
|
||||
|
||||
If your root partition is on a network drive, you have to have the network
|
||||
dracut modules installed to create a network aware initramfs image.
|
||||
|
||||
On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
|
||||
the _dracut-network_ rpm package:
|
||||
|
||||
|
||||
----
|
||||
# yum install dracut-network
|
||||
----
|
||||
|
||||
The resulting initramfs image can be served by a boot manager residing on your
|
||||
local hard drive or it can be served by a PXE/TFTP server.
|
||||
|
||||
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 ip=dhcp on the kernel command line, then dracut asks a dhcp
|
||||
server about the ip adress for the machine. The dhcp server can also serve an
|
||||
additional root-path, which will set the root device for dracut. With this
|
||||
mechanism, you have static configuration on your client machine and a
|
||||
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
|
||||
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a
|
||||
method described in <<Injecting>>.
|
||||
|
||||
==== Reducing the Image Size
|
||||
|
||||
To reduce the size of the initramfs, you should create it with by ommitting all
|
||||
dracut modules, which you know, you don't need to boot the machine.
|
||||
|
||||
You can also specify the exact dracut and kernel modules to produce a very tiny
|
||||
initramfs image.
|
||||
|
||||
For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
Then you would boot from this image with your target machine and reduce the size
|
||||
once more by creating it on the target machine with the --host-only option:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
|
||||
----
|
||||
|
||||
This will reduce the size of the initramfs image significantly.
|
||||
|
||||
|
||||
== Troubleshooting
|
||||
|
||||
If the boot process does not succeed, you have several options to debug the
|
||||
situation. Some of the basic operations are covered here. For more information
|
||||
you should also visit:
|
||||
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
|
||||
|
||||
|
||||
[[identifying-your-problem-area]]
|
||||
=== Identifying your problem area
|
||||
. Remove ''rhgb'' and ''quiet'' from the kernel command line
|
||||
. Add ''rd.shell'' to the kernel command line. This will present a shell should
|
||||
dracut be unable to locate your root device
|
||||
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
|
||||
dracut shell commands are printed as they are executed
|
||||
. The file /run/initramfs/rdsosreport.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.
|
||||
|
||||
[[information-to-include-in-your-report]]
|
||||
=== Information to include in your report
|
||||
|
||||
[[all-bug-reports]]
|
||||
==== All bug reports
|
||||
In all cases, the following should be mentioned and attached to your bug report:
|
||||
|
||||
* The exact kernel command-line used. Typically from the bootloader
|
||||
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
|
||||
* A copy of your disk partition information from _/etc/fstab_, which might be
|
||||
obtained booting an old working initramfs or a rescue medium.
|
||||
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
|
||||
the file /run/initramfs/rdsosreport.txt.
|
||||
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
|
||||
all files in _/etc/dracut.conf.d/*.conf_
|
||||
|
||||
[[network-root-device-related-problems]]
|
||||
==== Network root device related problems
|
||||
This section details information to include when experiencing problems on a
|
||||
system whose root device is located on a network attached volume (e.g. iSCSI,
|
||||
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
|
||||
following information:
|
||||
|
||||
|
||||
* Please include the output of
|
||||
+
|
||||
----
|
||||
# /sbin/ifup <interfacename>
|
||||
# ip addr show
|
||||
----
|
||||
|
||||
[[debugging-dracut]]
|
||||
=== Debugging dracut
|
||||
|
||||
|
||||
[[configure-a-serial-console]]
|
||||
==== Configure a serial console
|
||||
|
||||
Successfully debugging dracut will require some form of console
|
||||
logging during the system boot. This section documents configuring a
|
||||
serial console connection to record boot messages.
|
||||
|
||||
. First, enable serial console output for both the kernel and the bootloader.
|
||||
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
|
||||
the following:
|
||||
+
|
||||
----
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
console=tty0 console=ttyS0,9600
|
||||
----
|
||||
+
|
||||
. When finished, the _/etc/grub.conf_ file should look similar to the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. More detailed information on how to configure the kernel for console output
|
||||
can be found at
|
||||
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
|
||||
. Redirecting non-interactive output
|
||||
+
|
||||
--
|
||||
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
|
||||
will put it out on the console when it reaches the kernel buffer by doing
|
||||
|
||||
----
|
||||
# exec >/dev/kmsg 2>&1 </dev/console
|
||||
----
|
||||
--
|
||||
|
||||
[[using-the-dracut-shell]]
|
||||
==== Using the dracut shell
|
||||
|
||||
dracut offers a shell for interactive debugging in the event dracut fails to
|
||||
locate your root filesystem. To enable the shell:
|
||||
|
||||
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
|
||||
(e.g. _/etc/grub.conf_)
|
||||
. Remove the boot arguments ''rhgb'' and ''quiet''
|
||||
+
|
||||
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
|
||||
+
|
||||
----
|
||||
default=0
|
||||
timeout=5
|
||||
serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
title Fedora (2.6.29.5-191.fc11.x86_64)
|
||||
root (hd0,0)
|
||||
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
|
||||
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
|
||||
----
|
||||
+
|
||||
. If system boot fails, you will be dropped into a shell as seen in the example
|
||||
below.
|
||||
+
|
||||
----
|
||||
No root device found
|
||||
Dropping to debug shell.
|
||||
|
||||
#
|
||||
----
|
||||
+
|
||||
. Use this shell prompt to gather the information requested above
|
||||
(see <<all-bug-reports>>).
|
||||
|
||||
[[accessing-the-root-volume-from-the-dracut-shell]]
|
||||
==== Accessing the root volume from the dracut shell
|
||||
From the dracut debug shell, you can manually perform the task of locating and
|
||||
preparing your root volume for boot. The required steps will depend on how your
|
||||
root volume is configured. Common scenarios include:
|
||||
|
||||
* A block device (e.g. _/dev/sda7_)
|
||||
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
|
||||
* An encrypted device
|
||||
(e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
|
||||
* A network attached device
|
||||
(e.g. _netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all_)
|
||||
|
||||
The exact method for locating and preparing will vary. However, to continue with
|
||||
a successful boot, the objective is to locate your root volume and create a
|
||||
symlink _/dev/root_ which points to the file system. For example, the following
|
||||
example demonstrates accessing and booting a root volume that is an encrypted
|
||||
LVM Logical volume.
|
||||
|
||||
. Inspect your partitions using parted
|
||||
+
|
||||
----
|
||||
# parted /dev/sda -s p
|
||||
Model: ATA HTS541060G9AT00 (scsi)
|
||||
Disk /dev/sda: 60.0GB
|
||||
Sector size (logical/physical): 512B/512B
|
||||
Partition Table: msdos
|
||||
Number Start End Size Type File system Flags
|
||||
1 32.3kB 10.8GB 107MB primary ext4 boot
|
||||
2 10.8GB 55.6GB 44.7GB logical lvm
|
||||
----
|
||||
+
|
||||
. You recall that your root volume was a LVM logical volume. Scan and activate
|
||||
any logical volumes.
|
||||
+
|
||||
----
|
||||
# lvm vgscan
|
||||
# lvm vgchange -ay
|
||||
----
|
||||
+
|
||||
. You should see any logical volumes now using the command blkid:
|
||||
+
|
||||
----
|
||||
# blkid
|
||||
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
|
||||
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
|
||||
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
|
||||
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
|
||||
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
|
||||
----
|
||||
+
|
||||
. From the output above, you recall that your root volume exists on an encrypted
|
||||
block device. Following the guidance disk encryption guidance from the
|
||||
Installation Guide, you unlock your encrypted root volume.
|
||||
+
|
||||
----
|
||||
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
|
||||
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
|
||||
Enter passphrase for /dev/mapper/linux-root:
|
||||
Key slot 0 unlocked.
|
||||
----
|
||||
+
|
||||
. Next, make a symbolic link to the unlocked root volume
|
||||
+
|
||||
----
|
||||
# ln -s /dev/mapper/luks-$UUID /dev/root
|
||||
----
|
||||
+
|
||||
. With the root volume available, you may continue booting the system by exiting
|
||||
the dracut shell
|
||||
+
|
||||
----
|
||||
# exit
|
||||
----
|
||||
|
||||
[[additional-dracut-boot-parameters]]
|
||||
==== Additional dracut boot parameters
|
||||
For more debugging options, see *dracut.cmdline*(7).
|
||||
|
||||
|
||||
[[debugging-dracut-on-shutdown]]
|
||||
==== Debugging dracut on shutdown
|
||||
|
||||
To debug the shutdown sequence on systemd systems, you can _rd.break_
|
||||
on _pre-shutdown_ or _shutdown_.
|
||||
|
||||
To do this from an already booted system:
|
||||
----
|
||||
# mkdir -p /run/initramfs/etc/cmdline.d
|
||||
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
|
||||
# touch /run/initramfs/.need_shutdown
|
||||
----
|
||||
|
||||
This will give you a dracut shell after the system pivot'ed back in the
|
||||
initramfs.
|
||||
|
@@ -20,8 +20,7 @@ chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
my $release="$num";
|
||||
|
||||
while(<>) {
|
||||
if (/^Version:/) {
|
||||
|
1
install/.kateconfig
Normal file
1
install/.kateconfig
Normal file
@@ -0,0 +1 @@
|
||||
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
|
@@ -391,7 +391,11 @@ static int resolve_deps(const char *src)
|
||||
if (strstr(buf, destrootdir))
|
||||
break;
|
||||
|
||||
p = strchr(buf, '/');
|
||||
p = strstr(buf, "=>");
|
||||
if (!p)
|
||||
p = buf;
|
||||
|
||||
p = strchr(p, '/');
|
||||
if (p) {
|
||||
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
|
||||
*q = '\0';
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
|
147
lsinitrd.sh
147
lsinitrd.sh
@@ -27,20 +27,26 @@ usage()
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-m, --mod list modules."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
sorted=0
|
||||
modules=0
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
-o "shmf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long mod \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
@@ -58,6 +64,7 @@ while (($# > 0)); do
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
-m|--mod) modules=1;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
@@ -103,50 +110,130 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat";;
|
||||
BZh*)
|
||||
CAT="bzcat";;
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat";;
|
||||
*)
|
||||
CAT="xzcat";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files()
|
||||
{
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
$CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
else
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
version=$($CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "$version with dracut modules:"
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
|
||||
}
|
||||
|
||||
list_modules()
|
||||
{
|
||||
echo "dracut modules:"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
|
||||
((ret+=$?))
|
||||
}
|
||||
|
||||
list_files()
|
||||
{
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )); then
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
echo "Early CPIO image"
|
||||
list_files
|
||||
fi
|
||||
SKIP="$dracutbasedir/skipcpio"
|
||||
if ! [[ -x $SKIP ]]; then
|
||||
echo
|
||||
echo "'$SKIP' not found, cannot display remaining contents!" >&2
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
CAT=$({
|
||||
if [[ $SKIP ]]; then
|
||||
$SKIP "$image"
|
||||
else
|
||||
cat "$image"
|
||||
fi } | {
|
||||
read -N 6 bin
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
echo "zcat --"
|
||||
;;
|
||||
BZh*)
|
||||
echo "bzcat --"
|
||||
;;
|
||||
$'\x71\xc7'*|070701)
|
||||
echo "cat --"
|
||||
;;
|
||||
$'\x02\x21'*)
|
||||
echo "lz4 -d -c"
|
||||
;;
|
||||
$'\x89'LZO$'\0'*)
|
||||
echo "lzop -d -c"
|
||||
;;
|
||||
*)
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
echo "xzcat --single-stream --"
|
||||
else
|
||||
echo "xzcat --"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
})
|
||||
|
||||
skipcpio()
|
||||
{
|
||||
$SKIP "$@" | $ORIG_CAT
|
||||
}
|
||||
|
||||
if [[ $SKIP ]]; then
|
||||
ORIG_CAT="$CAT"
|
||||
CAT=skipcpio
|
||||
fi
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
extract_files
|
||||
else
|
||||
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
|
||||
((ret+=$?))
|
||||
echo "Version: $version"
|
||||
echo
|
||||
if [ "$modules" -eq 1 ]; then
|
||||
list_modules
|
||||
echo "========================================================================"
|
||||
else
|
||||
echo -n "Arguments: "
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
@@ -41,8 +41,8 @@ OPTIONS
|
||||
|
||||
**--preload=<module>**::
|
||||
preload the kernel module <module> in the initramfs before any other kernel
|
||||
modules are loaded. This can be used to ensure a certain device naming, which
|
||||
should in theory be avoided and the use of symbolic links in /dev is
|
||||
modules are loaded. This can be used to ensure a certain device naming,
|
||||
which should in theory be avoided and the use of symbolic links in /dev is
|
||||
encouraged.
|
||||
|
||||
**--nocompress**::
|
||||
|
@@ -60,8 +60,8 @@ do_rhevh_check()
|
||||
KERNEL=$(uname -r)
|
||||
kpath=${1}
|
||||
|
||||
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat /boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
# If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
|
||||
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
|
||||
warn "HMAC sum mismatch"
|
||||
@@ -96,7 +96,6 @@ do_fips()
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
@@ -112,10 +111,10 @@ do_fips()
|
||||
rmmod tcrypt
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1
|
||||
elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1
|
||||
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
|
||||
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
fi
|
||||
|
@@ -13,7 +13,7 @@ depends() {
|
||||
installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
|
||||
_fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
@@ -38,8 +38,10 @@ install() {
|
||||
|
||||
inst_libdir_file libsoftokn3.so libsoftokn3.so \
|
||||
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
|
||||
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 \
|
||||
libfreeblpriv3.so libfreeblpriv3.chk
|
||||
|
||||
inst_multiple -o prelink
|
||||
inst_simple /etc/system-fips
|
||||
}
|
||||
|
||||
|
0
modules.d/03modsign/load-modsign-keys.sh
Normal file → Executable file
0
modules.d/03modsign/load-modsign-keys.sh
Normal file → Executable file
0
modules.d/03modsign/module-setup.sh
Normal file → Executable file
0
modules.d/03modsign/module-setup.sh
Normal file → Executable file
@@ -4,6 +4,11 @@
|
||||
|
||||
check() {
|
||||
[[ "$mount_needs" ]] && return 1
|
||||
|
||||
for i in setfont loadkeys kbd_mode; do
|
||||
type -P "$i" >/dev/null || return 1
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -13,15 +18,11 @@ depends() {
|
||||
|
||||
install() {
|
||||
if dracut_module_included "systemd"; then
|
||||
[[ -f /etc/vconsole.conf ]] || return 0
|
||||
unset FONT
|
||||
unset KEYMAP
|
||||
. /etc/vconsole.conf
|
||||
# if vconsole.conf has no settings, do not include anything
|
||||
[[ $FONT ]] || [[ $KEYMAP ]] || return 0
|
||||
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
|
||||
fi
|
||||
|
||||
inst_multiple -o $systemdutildir/systemd-vconsole-setup
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
@@ -202,10 +203,20 @@ install() {
|
||||
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
fi
|
||||
|
||||
mksubdirs ${initdir}${I18N_CONF}
|
||||
mksubdirs ${initdir}${VCONFIG_CONF}
|
||||
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
||||
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
|
||||
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
|
||||
inst_simple ${I18N_CONF}
|
||||
else
|
||||
mksubdirs ${initdir}${I18N_CONF}
|
||||
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
||||
fi
|
||||
|
||||
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
|
||||
inst_simple ${VCONFIG_CONF}
|
||||
else
|
||||
mksubdirs ${initdir}${VCONFIG_CONF}
|
||||
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -229,16 +240,13 @@ install() {
|
||||
return 0
|
||||
}
|
||||
|
||||
if checks
|
||||
then
|
||||
if checks; then
|
||||
install_base
|
||||
|
||||
if [[ ${hostonly} ]]
|
||||
then
|
||||
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} ]]; then
|
||||
install_local_i18n || install_all_kbd
|
||||
else
|
||||
install_all_kbd
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,17 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
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
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
|
||||
setup_interface() {
|
||||
ip=$new_ip_address
|
||||
mtu=$new_interface_mtu
|
||||
@@ -12,6 +23,7 @@ setup_interface() {
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
lease_time=$new_dhcp_lease_time
|
||||
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
@@ -29,9 +41,11 @@ setup_interface() {
|
||||
fi
|
||||
fi
|
||||
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
|
||||
valid_lft ${lease_time} preferred_lft ${lease_time} \
|
||||
dev $netif
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
@@ -42,27 +56,49 @@ setup_interface() {
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
setup_interface6() {
|
||||
domain=$new_domain_name
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
preferred_lft=$lease_time
|
||||
[ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
|
||||
|
||||
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
|
||||
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
|
||||
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
|
||||
dev ${netif} scope global \
|
||||
${lease_time:+valid_lft $lease_time} \
|
||||
${preferred_lft:+preferred_lft ${preferred_lft}}
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# Note: hostname can be fqdn OR short hostname, so chop off any
|
||||
# trailing domain name and explicity add any domain if set.
|
||||
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
}
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
linkup $netif
|
||||
;;
|
||||
|
||||
PREINIT6)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
linkup $netif
|
||||
;;
|
||||
|
||||
BOUND)
|
||||
echo "dhcp: BOND setting $netif"
|
||||
unset layer2
|
||||
@@ -87,12 +123,31 @@ case $reason in
|
||||
echo "setup_net $netif"
|
||||
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
|
||||
|
||||
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
;;
|
||||
|
||||
BOUND6)
|
||||
echo "dhcp: BOND6 setting $netif"
|
||||
setup_interface6
|
||||
|
||||
set | while read line; do
|
||||
[ "${line#new_}" = "$line" ] && continue
|
||||
echo "$line"
|
||||
done >/tmp/dhclient.$netif.dhcpopts
|
||||
|
||||
{
|
||||
echo '. /lib/net-lib.sh'
|
||||
echo "setup_net $netif"
|
||||
echo "source_hook initqueue/online $netif"
|
||||
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
|
||||
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
|
||||
} > $hookdir/initqueue/setup_net_$netif.sh
|
||||
|
||||
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
|
||||
>/tmp/net.$netif.up
|
||||
;;
|
||||
*) echo "dhcp: $reason";;
|
||||
|
@@ -2,20 +2,24 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; then
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "$netroot" = "dhcp" ] && break
|
||||
[ "$netroot" = "dhcp6" ] && break
|
||||
done
|
||||
[ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
|
||||
fi
|
||||
|
||||
if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
|
||||
# Tell ip= checker that we need dhcp
|
||||
NEEDDHCP="1"
|
||||
|
||||
# Done, all good!
|
||||
rootok=1
|
||||
if [ "$netroot" != "dhcp" ] ; then
|
||||
if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
|
||||
netroot=$root
|
||||
fi
|
||||
|
||||
|
@@ -34,14 +34,17 @@ for i in /tmp/bond.*.info; do
|
||||
done
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teamslaves
|
||||
unset teammaster
|
||||
. "$i"
|
||||
for slave in $teamslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$teammaster
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
@@ -60,7 +63,7 @@ fi
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
for ethname in $ethnames ; do
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
@@ -80,19 +83,33 @@ fi
|
||||
# in netroot case we prefer netroot to bringup $netif automaticlly
|
||||
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
|
||||
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
|
||||
[ -n "$manualup" ] && >/tmp/net.$netif.manualup
|
||||
if [ -n "$manualup" ]; then
|
||||
>/tmp/net.$netif.manualup
|
||||
else
|
||||
[ -e /tmp/net.${netif}.did-setup ] && exit 0
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
|
||||
fi
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
# dhclient-script will mark the netif up and generate the online
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
|
||||
[ -e /tmp/dhclient.$netif.pid ] && return 0
|
||||
|
||||
if ! iface_has_link $netif; then
|
||||
echo "No carrier detected"
|
||||
return 1
|
||||
fi
|
||||
echo "Starting dhcp for interface $netif"
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|
||||
|| echo "dhcp failed"
|
||||
}
|
||||
|
||||
load_ipv6() {
|
||||
[ -d /proc/sys/net/ipv6 ] && return
|
||||
modprobe ipv6
|
||||
i=0
|
||||
while [ ! -d /proc/sys/net/ipv6 ]; do
|
||||
@@ -124,16 +141,16 @@ do_static() {
|
||||
[ -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 ${srv+peer $srv} dev $netif
|
||||
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
|
||||
wait_for_ipv6_dad $netif
|
||||
else
|
||||
ip addr flush dev $netif
|
||||
ip addr add $ip/$mask ${srv+peer $srv} 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 "$gw" ] && echo ip route replace 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
|
||||
}
|
||||
|
||||
@@ -175,6 +192,7 @@ if [ -e /tmp/bond.${netif}.info ]; then
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr
|
||||
echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
|
||||
linkup $slave
|
||||
done
|
||||
@@ -190,26 +208,44 @@ if [ -e /tmp/bond.${netif}.info ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
if [ -e /tmp/team.${netif}.info ]; then
|
||||
. /tmp/team.${netif}.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
|
||||
teamdctl ${teammaster} port present ${slave} 2>/dev/null \
|
||||
&& continue
|
||||
ip link set dev $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
|
||||
teamd -d -U -n -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
|
||||
ip link set dev $slave down
|
||||
(
|
||||
unset TEAM_PORT_CONFIG
|
||||
_hwaddr=$(cat /sys/class/net/$slave/address)
|
||||
_subchannels=$(iface_get_subchannels "$slave")
|
||||
if [ -n "$_hwaddr" ] && [ -e "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf" ]; then
|
||||
. "/etc/sysconfig/network-scripts/mac-${_hwaddr}.conf"
|
||||
elif [ -n "$_subchannels" ] && [ -e "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf" ]; then
|
||||
. "/etc/sysconfig/network-scripts/ccw-${_subchannels}.conf"
|
||||
elif [ -e "/etc/sysconfig/network-scripts/ifcfg-${slave}" ]; then
|
||||
. "/etc/sysconfig/network-scripts/ifcfg-${slave}"
|
||||
fi
|
||||
|
||||
if [ -n "${TEAM_PORT_CONFIG}" ]; then
|
||||
/usr/bin/teamdctl ${teammaster} port config update ${slave} "${TEAM_PORT_CONFIG}"
|
||||
fi
|
||||
)
|
||||
teamdctl $teammaster port add $slave
|
||||
done
|
||||
ip link set $teammaster up
|
||||
ip link set dev $teammaster up
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -221,7 +257,7 @@ if [ -e /tmp/bridge.info ]; then
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addbr $bridgename
|
||||
brctl setfd $bridgename 0
|
||||
for ethname in $ethnames ; do
|
||||
for ethname in $bridgeslaves ; do
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes ifup $bondname -m
|
||||
elif [ "$ethname" = "$teammaster" ] ; then
|
||||
@@ -260,18 +296,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
|
||||
ip link set "$vlanname" up
|
||||
fi
|
||||
|
||||
# setup nameserver
|
||||
namesrv=$(getargs nameserver)
|
||||
if [ -n "$namesrv" ] ; then
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s
|
||||
done
|
||||
fi >> /tmp/net.$netif.resolv.conf
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$ip" ]; then
|
||||
namesrv=$(getargs nameserver)
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
else
|
||||
@@ -303,21 +336,32 @@ for p in $(getargs ip=); do
|
||||
[ "$use_bridge" != 'true' ] && \
|
||||
[ "$use_vlan" != 'true' ] && continue
|
||||
|
||||
# setup nameserver
|
||||
namesrv="$dns1 $dns2 $(getargs nameserver)"
|
||||
for s in $namesrv; do
|
||||
echo nameserver $s >> /tmp/net.$netif.resolv.conf
|
||||
done
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr; do
|
||||
for i in ip srv gw mask hostname macaddr dns1 dns2; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
for autoopt in $(str_replace "$autoconf" "," " "); do
|
||||
case $autoopt in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
load_ipv6
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
done
|
||||
|
||||
> /tmp/net.${netif}.up
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
@@ -333,6 +377,24 @@ for p in $(getargs ip=); do
|
||||
;;
|
||||
esac
|
||||
|
||||
break
|
||||
exit 0
|
||||
done
|
||||
|
||||
# netif isn't the top stack? Then we should exit here.
|
||||
# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
|
||||
# bond0 doesn't make sense.
|
||||
if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# no ip option directed at our interface?
|
||||
if [ ! -e /tmp/net.${netif}.up ]; then
|
||||
if getargs 'ip=dhcp6'; then
|
||||
load_ipv6
|
||||
do_dhcp -6
|
||||
else
|
||||
do_dhcp -4
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
@@ -16,7 +16,6 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
[ -d /etc/sysconfig/network-scripts/ ] && echo ifcfg
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -24,8 +23,8 @@ installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
|
||||
net_module_filter() {
|
||||
local _net_drivers='eth_type_trans|register_virtio_device'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb)/'
|
||||
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
|
||||
local _ret
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
@@ -65,7 +64,11 @@ installkernel() {
|
||||
| net_module_filter | instmods
|
||||
|
||||
#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
|
||||
instmods \
|
||||
=drivers/net/phy \
|
||||
=drivers/net/team \
|
||||
=drivers/net/ethernet \
|
||||
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
|
||||
}
|
||||
|
||||
install() {
|
||||
@@ -83,6 +86,7 @@ install() {
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-team.sh"
|
||||
@@ -91,6 +95,43 @@ install() {
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook cleanup 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
# install all config files for teaming
|
||||
unset TEAM_MASTER
|
||||
unset TEAM_CONFIG
|
||||
unset TEAM_PORT_CONFIG
|
||||
unset HWADDR
|
||||
unset SUBCHANNELS
|
||||
for i in /etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -e "$i" ] || continue
|
||||
case "$i" in
|
||||
*~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
(
|
||||
. "$i"
|
||||
if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
|
||||
&& [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
|
||||
if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
|
||||
mkdir -p $initdir/etc/teamd
|
||||
printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
|
||||
elif [ -n "$TEAM_PORT_CONFIG" ]; then
|
||||
inst_simple "$i"
|
||||
|
||||
HWADDR="$(echo $HWADDR | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$HWADDR" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/mac-${HWADDR}.conf"
|
||||
fi
|
||||
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
if [ -n "$SUBCHANNELS" ]; then
|
||||
ln_r "$i" "/etc/sysconfig/network-scripts/ccw-${SUBCHANNELS}.conf"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
)
|
||||
done
|
||||
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
|
@@ -16,7 +16,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES ${ethnames%% *}"
|
||||
IFACES="$IFACES ${bridgeslaves%% *}"
|
||||
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
||||
fi
|
||||
|
||||
@@ -31,11 +31,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
MASTER_IFACES="$MASTER_IFACES ${bondname}"
|
||||
done
|
||||
|
||||
if [ -e /tmp/team.info ]; then
|
||||
. /tmp/team.info
|
||||
for i in /tmp/team.*.info; do
|
||||
[ -e "$i" ] || continue
|
||||
unset teamslaves
|
||||
unset teammaster
|
||||
. "$i"
|
||||
IFACES="$IFACES ${teamslaves}"
|
||||
MASTER_IFACES="$MASTER_IFACES ${teammaster}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /tmp/vlan.info ]; then
|
||||
. /tmp/vlan.info
|
||||
@@ -54,23 +57,30 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
[ -z "$netroot" ] && ifup="$ifup -m"
|
||||
|
||||
runcmd="RUN+=\"/sbin/initqueue --onetime $ifup\""
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "$IFACES" ]; then
|
||||
echo 'SUBSYSTEM!="net", GOTO="net_end"'
|
||||
echo 'ACTION=="remove", GOTO="net_end"'
|
||||
echo 'ACTION!="add|change|move", GOTO="net_end"'
|
||||
for iface in $IFACES; do
|
||||
case "$iface" in
|
||||
??:??:??:??:??:??) # MAC address
|
||||
cond="ATTR{address}==\"$iface\"" ;;
|
||||
cond="ATTR{address}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
??-??-??-??-??-??) # MAC address in BOOTIF form
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\"" ;;
|
||||
cond="ATTR{address}==\"$(fix_bootif $iface)\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
*) # an interface name
|
||||
cond="ENV{INTERFACE}==\"$iface\"" ;;
|
||||
cond="ENV{INTERFACE}==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
cond="NAME==\"$iface\""
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
;;
|
||||
esac
|
||||
# The GOTO prevents us from trying to ifup the same device twice
|
||||
echo "$cond, $runcmd, GOTO=\"net_end\""
|
||||
done
|
||||
echo 'LABEL="net_end"'
|
||||
|
||||
@@ -82,7 +92,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
for iface in $wait_ifaces; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
# Default: We don't know the interface to use, handle all
|
||||
|
394
modules.d/40network/net-lib.sh
Normal file → Executable file
394
modules.d/40network/net-lib.sh
Normal file → Executable file
@@ -28,30 +28,6 @@ iface_for_mac() {
|
||||
done
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
flags=$(cat $interface/flags)
|
||||
echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING
|
||||
[ "$(cat $interface/carrier)" = 1 ] || return 1
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
iface=${iface_path##*/}
|
||||
str_starts "$iface" "lo" && continue
|
||||
if iface_has_link $iface; then
|
||||
echo "$iface"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# get the iface name for the given identifier - either a MAC, IP, or iface name
|
||||
iface_name() {
|
||||
case $1 in
|
||||
@@ -106,12 +82,17 @@ ifdown() {
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
rm -f -- /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
# TODO: send "offline" uevent?
|
||||
}
|
||||
|
||||
setup_net() {
|
||||
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
|
||||
local _p
|
||||
[ -e /tmp/net.$netif.did-setup ] && return
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
[ -z "$IFACES" ] && IFACES="$netif"
|
||||
# run the scripts written by ifup
|
||||
@@ -123,6 +104,20 @@ setup_net() {
|
||||
[ -e /tmp/net.$netif.resolv.conf ] && \
|
||||
cp -f /tmp/net.$netif.resolv.conf /etc/resolv.conf
|
||||
|
||||
# add static route
|
||||
for _p in $(getargs rd.route); do
|
||||
route_to_var "$_p" || continue
|
||||
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
|
||||
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
|
||||
if strstr ":" "$route_mask"; then
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
else
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route."$netif"
|
||||
fi
|
||||
done
|
||||
|
||||
# Handle STP Timeout: arping the default gateway.
|
||||
# (or the root server, if a) it's local or b) there's no gateway.)
|
||||
# Note: This assumes that if no router is present the
|
||||
@@ -147,12 +142,14 @@ setup_net() {
|
||||
read layer2 < /sys/class/net/$netif/device/layer2
|
||||
fi
|
||||
|
||||
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
|
||||
info "Resolving $dest via ARP on $netif failed"
|
||||
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
|
||||
arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
|
||||
fi
|
||||
unset layer2
|
||||
|
||||
> /tmp/net.$netif.did-setup
|
||||
[ -e /sys/class/net/$netif/address ] && \
|
||||
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
|
||||
}
|
||||
|
||||
save_netinfo() {
|
||||
@@ -203,11 +200,14 @@ fix_bootif() {
|
||||
}
|
||||
|
||||
ibft_to_cmdline() {
|
||||
local iface="" mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local iface=""
|
||||
modprobe -q iscsi_ibft
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
local mac="" dev=""
|
||||
local dhcp="" ip="" gw="" mask="" hostname=""
|
||||
local dns1 dns2
|
||||
|
||||
[ -e ${iface}/mac ] || continue
|
||||
mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$mac" ] && continue
|
||||
@@ -216,10 +216,6 @@ ibft_to_cmdline() {
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
echo "vlan=$vlan:$dev"
|
||||
fi
|
||||
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
@@ -229,9 +225,11 @@ ibft_to_cmdline() {
|
||||
[ "$ip" = "0.0.0.0" ] && continue
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
|
||||
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
if [ -n "$ip" ] && [ -n "$mask" ]; then
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
|
||||
else
|
||||
warn "${iface} does not contain a valid iBFT configuration"
|
||||
warn "ip-addr=$ip"
|
||||
@@ -244,11 +242,28 @@ ibft_to_cmdline() {
|
||||
ls -l ${iface} | vinfo
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
echo $mac > /tmp/net.${dev}.${vlan}.has_ibft_config
|
||||
;;
|
||||
*)
|
||||
echo "vlan=$vlan:$dev"
|
||||
echo $mac > /tmp/net.${vlan}.has_ibft_config
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
fi
|
||||
else
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
fi
|
||||
|
||||
done
|
||||
) >> /etc/cmdline.d/40-ibft.conf
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
}
|
||||
|
||||
parse_iscsi_root()
|
||||
@@ -256,66 +271,63 @@ parse_iscsi_root()
|
||||
local v
|
||||
v=${1#iscsi:}
|
||||
|
||||
# extract authentication info
|
||||
# extract authentication info
|
||||
case "$v" in
|
||||
*@*:*:*:*:*)
|
||||
authinfo=${v%%@*}
|
||||
v=${v#*@}
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $authinfo
|
||||
IFS="$OLDIFS"
|
||||
if [ $# -gt 4 ]; then
|
||||
warn "Wrong authentication info in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*@*:*:*:*:*)
|
||||
authinfo=${v%%@*}
|
||||
v=${v#*@}
|
||||
# allow empty authinfo to allow having an @ in iscsi_target_name like this:
|
||||
# netroot=iscsi:@192.168.1.100::3260::iqn.2009-01.com.example:testdi@sk
|
||||
if [ -n "$authinfo" ]; then
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $authinfo
|
||||
IFS="$OLDIFS"
|
||||
if [ $# -gt 4 ]; then
|
||||
warn "Wrong authentication info in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
iscsi_username=$1
|
||||
iscsi_password=$2
|
||||
if [ $# -gt 2 ]; then
|
||||
iscsi_in_username=$3
|
||||
iscsi_in_password=$4
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# extract target ip
|
||||
# extract target ip
|
||||
case "$v" in
|
||||
[[]*[]]:*)
|
||||
iscsi_target_ip=${v#[[]}
|
||||
iscsi_target_ip=${iscsi_target_ip%%[]]*}
|
||||
v=${v#[[]$iscsi_target_ip[]]:}
|
||||
;;
|
||||
*)
|
||||
iscsi_target_ip=${v%%[:]*}
|
||||
v=${v#$iscsi_target_ip:}
|
||||
;;
|
||||
[[]*[]]:*)
|
||||
iscsi_target_ip=${v#[[]}
|
||||
iscsi_target_ip=${iscsi_target_ip%%[]]*}
|
||||
v=${v#[[]$iscsi_target_ip[]]:}
|
||||
;;
|
||||
*)
|
||||
iscsi_target_ip=${v%%[:]*}
|
||||
v=${v#$iscsi_target_ip:}
|
||||
;;
|
||||
esac
|
||||
|
||||
# extract target name
|
||||
unset iscsi_target_name
|
||||
# extract target name
|
||||
case "$v" in
|
||||
*:iqn.*)
|
||||
iscsi_target_name=iqn.${v##*:iqn.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:eui.*)
|
||||
iscsi_target_name=iqn.${v##*:eui.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:naa.*)
|
||||
iscsi_target_name=iqn.${v##*:naa.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*)
|
||||
warn "Invalid iscii target name, should begin with 'iqn.' or 'eui.' or 'naa.'"
|
||||
return 1
|
||||
;;
|
||||
*:iqn.*)
|
||||
iscsi_target_name=iqn.${v##*:iqn.}
|
||||
v=${v%:iqn.*}:
|
||||
;;
|
||||
*:eui.*)
|
||||
iscsi_target_name=eui.${v##*:eui.}
|
||||
v=${v%:eui.*}:
|
||||
;;
|
||||
*:naa.*)
|
||||
iscsi_target_name=naa.${v##*:naa.}
|
||||
v=${v%:naa.*}:
|
||||
;;
|
||||
esac
|
||||
|
||||
# parse the rest
|
||||
# parse the rest
|
||||
OLDIFS="$IFS"
|
||||
IFS=:
|
||||
set $v
|
||||
@@ -323,17 +335,34 @@ parse_iscsi_root()
|
||||
|
||||
iscsi_protocol=$1; shift # ignored
|
||||
iscsi_target_port=$1; shift
|
||||
if [ $# -eq 3 ]; then
|
||||
iscsi_iface_name=$1; shift
|
||||
|
||||
if [ -n "$iscsi_target_name" ]; then
|
||||
if [ $# -eq 3 ]; then
|
||||
iscsi_iface_name=$1; shift
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
iscsi_netdev_name=$1; shift
|
||||
fi
|
||||
iscsi_lun=$1; shift
|
||||
if [ $# -ne 0 ]; then
|
||||
warn "Invalid parameter in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
iscsi_netdev_name=$1; shift
|
||||
|
||||
|
||||
if [ $# -gt 3 ] && [ -n "$1$2" ]; then
|
||||
if [ -z "$3" ] || [ "$3" -ge 0 ] 2>/dev/null ; then
|
||||
iscsi_iface_name=$1; shift
|
||||
iscsi_netdev_name=$1; shift
|
||||
fi
|
||||
fi
|
||||
|
||||
iscsi_lun=$1; shift
|
||||
if [ $# -ne 0 ]; then
|
||||
warn "Invalid parameter in iscsi: parameter!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
iscsi_target_name=$(printf "%s:" "$@")
|
||||
iscsi_target_name=${iscsi_target_name%:}
|
||||
}
|
||||
|
||||
ip_to_var() {
|
||||
@@ -353,7 +382,7 @@ ip_to_var() {
|
||||
fi
|
||||
done
|
||||
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu
|
||||
unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
|
||||
case $# in
|
||||
0) autoconf="error" ;;
|
||||
1) autoconf=$1 ;;
|
||||
@@ -361,11 +390,22 @@ ip_to_var() {
|
||||
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
|
||||
;;
|
||||
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7;
|
||||
case "$8" in
|
||||
[0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
|
||||
dns1="$8"
|
||||
[ -n "$9" ] && dns2="$9"
|
||||
;;
|
||||
[0-9]*)
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
@@ -389,6 +429,33 @@ ip_to_var() {
|
||||
fi
|
||||
}
|
||||
|
||||
route_to_var() {
|
||||
local v=${1}:
|
||||
local i
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
if [ "${v#\[*:*:*\]:}" != "$v" ]; then
|
||||
# handle IPv6 address
|
||||
i="${v%%\]:*}"
|
||||
i="${i##\[}"
|
||||
set -- "$@" "$i"
|
||||
v=${v#\[$i\]:}
|
||||
else
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
fi
|
||||
done
|
||||
|
||||
unset route_mask route_gw route_dev
|
||||
case $# in
|
||||
2) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"
|
||||
return 0;;
|
||||
3) [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"; [ -n "$3" ] && route_dev="$3"
|
||||
return 0;;
|
||||
*) return 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
@@ -433,7 +500,7 @@ wait_for_if_up() {
|
||||
local li
|
||||
while [ $cnt -lt 200 ]; do
|
||||
li=$(ip -o link show up dev $1)
|
||||
[ -n "$li" ] && return 0
|
||||
[ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -451,12 +518,26 @@ wait_for_route_ok() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_dad() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 500 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "tentative" || return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_ipv6_auto() {
|
||||
local cnt=0
|
||||
local li
|
||||
while [ $cnt -lt 400 ]; do
|
||||
li=$(ip -6 addr show dev $1)
|
||||
strstr "$li" "dynamic" && return 0
|
||||
if ! strstr "$li" "tentative"; then
|
||||
strstr "$li" "dynamic" && return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
done
|
||||
@@ -473,3 +554,110 @@ type hostname >/dev/null 2>&1 || \
|
||||
hostname() {
|
||||
cat /proc/sys/kernel/hostname
|
||||
}
|
||||
|
||||
iface_has_link() {
|
||||
local interface="$1" flags=""
|
||||
[ -n "$interface" ] || return 2
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
linkup "$1"
|
||||
[ "$(cat $interface/carrier)" = 1 ] || return 1
|
||||
# XXX Do we need to reset the flags here? anaconda never bothered..
|
||||
}
|
||||
|
||||
find_iface_with_link() {
|
||||
local iface_path="" iface=""
|
||||
for iface_path in /sys/class/net/*; do
|
||||
iface=${iface_path##*/}
|
||||
str_starts "$iface" "lo" && continue
|
||||
if iface_has_link $iface; then
|
||||
echo "$iface"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
is_persistent_ethernet_name() {
|
||||
local _netif="$1"
|
||||
local _name_assign_type="0"
|
||||
|
||||
[ -f "/sys/class/net/$_netif/name_assign_type" ] \
|
||||
&& _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
|
||||
|
||||
# NET_NAME_ENUM 1
|
||||
[ "$_name_assign_type" = "1" ] && return 1
|
||||
|
||||
# NET_NAME_PREDICTABLE 2
|
||||
[ "$_name_assign_type" = "2" ] && return 0
|
||||
|
||||
case "$_netif" in
|
||||
# udev persistent interface names
|
||||
eno[0-9]|eno[0-9][0-9]|eno[0-9][0-9][0-9]*)
|
||||
;;
|
||||
ens[0-9]|ens[0-9][0-9]|ens[0-9][0-9][0-9]*)
|
||||
;;
|
||||
enp[0-9]s[0-9]*|enp[0-9][0-9]s[0-9]*|enp[0-9][0-9][0-9]*s[0-9]*)
|
||||
;;
|
||||
enP*p[0-9]s[0-9]*|enP*p[0-9][0-9]s[0-9]*|enP*p[0-9][0-9][0-9]*s[0-9]*)
|
||||
;;
|
||||
# biosdevname
|
||||
em[0-9]|em[0-9][0-9]|em[0-9][0-9][0-9]*)
|
||||
;;
|
||||
p[0-9]p[0-9]*|p[0-9][0-9]p[0-9]*|p[0-9][0-9][0-9]*p[0-9]*)
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
is_kernel_ethernet_name() {
|
||||
local _netif="$1"
|
||||
local _name_assign_type="1"
|
||||
|
||||
if [ -e "/sys/class/net/$_netif/name_assign_type" ]; then
|
||||
_name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
|
||||
|
||||
case "$_name_assign_type" in
|
||||
2|3|4)
|
||||
# NET_NAME_PREDICTABLE 2
|
||||
# NET_NAME_USER 3
|
||||
# NET_NAME_RENAMED 4
|
||||
return 1
|
||||
;;
|
||||
1|*)
|
||||
# NET_NAME_ENUM 1
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# fallback to error prone manual name check
|
||||
case "$_netif" in
|
||||
eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
iface_get_subchannels() {
|
||||
local _netif
|
||||
local _subchannels
|
||||
|
||||
_netif="$1"
|
||||
|
||||
_subchannels=$({
|
||||
for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
|
||||
[ -e $i ] || continue
|
||||
channel=$(readlink -f $i)
|
||||
printf -- "%s" "${channel##*/},"
|
||||
done
|
||||
})
|
||||
[ -n "$_subchannels" ] || return 1
|
||||
|
||||
printf -- "%s" ${_subchannels%,}
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ if [ -z "$2" ]; then
|
||||
netroot=$new_root_path
|
||||
|
||||
# FIXME!
|
||||
unset rootok
|
||||
for f in $hookdir/cmdline/90*.sh; do
|
||||
[ -f "$f" ] && . "$f";
|
||||
done
|
||||
|
@@ -3,9 +3,9 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# bridge=<bridgename>:<ethnames>
|
||||
# bridge=<bridgename>:<bridgeslaves>
|
||||
#
|
||||
# <ethnames> is a comma-separated list of physical (ethernet) interfaces
|
||||
# <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
|
||||
# bridge without parameters assumes bridge=br0:eth0
|
||||
#
|
||||
|
||||
@@ -25,20 +25,20 @@ parsebridge() {
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bridgename ethnames
|
||||
unset bridgename bridgeslaves
|
||||
case $# in
|
||||
0) bridgename=br0; ethnames=$iface ;;
|
||||
0) bridgename=br0; bridgeslaves=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;;
|
||||
2) bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename ethnames
|
||||
unset bridgename bridgeslaves
|
||||
|
||||
iface=eth0
|
||||
|
||||
# Parse bridge for bridgename and ethnames
|
||||
# Parse bridge for bridgename and bridgeslaves
|
||||
if bridge="$(getarg bridge)"; then
|
||||
# Read bridge= parameters if they exist
|
||||
if [ -n "$bridge" ]; then
|
||||
@@ -47,9 +47,9 @@ if bridge="$(getarg bridge)"; then
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
bridgename=br0
|
||||
ethnames=$iface
|
||||
bridgeslaves=$iface
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "ethnames=\"$ethnames\"" >> /tmp/bridge.info
|
||||
echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
||||
return
|
||||
fi
|
||||
|
10
modules.d/40network/parse-ibft.sh
Executable file
10
modules.d/40network/parse-ibft.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
|
||||
ibft_to_cmdline
|
||||
fi
|
@@ -15,7 +15,6 @@
|
||||
#
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
|
||||
# No ip= argument(s) for netroot provided, defaulting to DHCP
|
||||
@@ -26,6 +25,10 @@ fi
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
count=0
|
||||
for p in $(getargs ip=); do
|
||||
case "$p" in
|
||||
ibft)
|
||||
continue;;
|
||||
esac
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
@@ -39,9 +42,6 @@ if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
fi
|
||||
|
||||
# If ibft is requested, read ibft vals and write ip=XXX cmdline args
|
||||
[ "ibft" = "$(getarg ip=)" ] && ibft_to_cmdline
|
||||
|
||||
# Check ip= lines
|
||||
# XXX Would be nice if we could errorcheck ip addresses here as well
|
||||
for p in $(getargs ip=); do
|
||||
@@ -66,24 +66,26 @@ for p in $(getargs ip=); do
|
||||
fi
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off)
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
for autoopt in $(str_replace "$autoconf" "," " "); do
|
||||
case $autoopt in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
|
||||
none|off)
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$dev" ] ; then
|
||||
# We don't like duplicate device configs
|
||||
@@ -112,7 +114,7 @@ for p in $(getargs ip=); do
|
||||
done
|
||||
|
||||
# put BOOTIF in IFACES to make sure it comes up
|
||||
if BOOTIF="$(getarg BOOTIF=)"; then
|
||||
if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
|
||||
BOOTDEV=$(fix_bootif $BOOTIF)
|
||||
IFACES="$BOOTDEV $IFACES"
|
||||
fi
|
||||
|
@@ -24,21 +24,31 @@ parseteam() {
|
||||
|
||||
unset teammaster teamslaves
|
||||
case $# in
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) die "team= requires two parameters" ;;
|
||||
2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
|
||||
*) warn "team= requires two parameters"; return 1;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
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
|
||||
for team in $(getargs team); do
|
||||
[ "$team" = "team" ] && continue
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info
|
||||
return
|
||||
unset teammaster
|
||||
unset teamslaves
|
||||
|
||||
parseteam "$team" || continue
|
||||
|
||||
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
|
||||
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
|
||||
|
||||
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
|
||||
warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
|
||||
mkdir -p /etc/teamd
|
||||
printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
0
modules.d/40network/parse-vlan.sh
Normal file → Executable file
0
modules.d/40network/parse-vlan.sh
Normal file → Executable file
@@ -3,10 +3,12 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo "network"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,8 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
|
||||
|
||||
udevadm settle --timeout=30
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
@@ -55,9 +57,9 @@ print_s390() {
|
||||
|
||||
SUBCHANNELS=${SUBCHANNELS%,}
|
||||
echo "SUBCHANNELS=\"${SUBCHANNELS}\""
|
||||
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
|
||||
|
||||
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return
|
||||
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
|
||||
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
|
||||
|
||||
OLD_IFS=$IFS
|
||||
IFS=","
|
||||
@@ -77,6 +79,44 @@ print_s390() {
|
||||
OPTIONS=${OPTIONS## }
|
||||
echo "NETTYPE=\"${NETTYPE}\""
|
||||
echo "OPTIONS=\"${OPTIONS}\""
|
||||
return 0
|
||||
}
|
||||
|
||||
hw_bind() {
|
||||
local _netif="$1"
|
||||
local _macaddr="$2"
|
||||
|
||||
[ -n "$_macaddr" ] \
|
||||
&& echo "MACADDR=\"$_macaddr\""
|
||||
|
||||
print_s390 "$_netif" \
|
||||
&& return 0
|
||||
|
||||
[ -n "$_macaddr" ] && return 0
|
||||
|
||||
is_persistent_ethernet_name "$_netif" && return 0
|
||||
|
||||
[ -f "/sys/class/net/$_netif/addr_assign_type" ] \
|
||||
&& [ "$(cat "/sys/class/net/$_netif/addr_assign_type")" != "0" ] \
|
||||
&& return 1
|
||||
|
||||
[ -f "/sys/class/net/$_netif/address" ] \
|
||||
|| return 1
|
||||
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$_netif/address)\""
|
||||
}
|
||||
|
||||
interface_bind() {
|
||||
local _netif="$1"
|
||||
local _macaddr="$2"
|
||||
|
||||
# see, if we can bind it to some hw parms
|
||||
if hw_bind "$_netif" "$_macaddr"; then
|
||||
# only print out DEVICE, if it's user assigned
|
||||
is_kernel_ethernet_name "$_netif" && return 0
|
||||
fi
|
||||
|
||||
echo "DEVICE=\"$_netif\""
|
||||
}
|
||||
|
||||
for netup in /tmp/net.*.did-setup ; do
|
||||
@@ -84,9 +124,11 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
netif=${netup%%.did-setup}
|
||||
netif=${netif##*/net.}
|
||||
strstr "$netif" ":*:*:*:*:" && continue
|
||||
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
|
||||
unset bridge
|
||||
unset bond
|
||||
unset team
|
||||
unset bondslaves
|
||||
unset bondname
|
||||
unset bondoptions
|
||||
@@ -99,10 +141,13 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
unset slave
|
||||
unset ethname
|
||||
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
|
||||
[ -e /tmp/team.${netif}.info ] && . /tmp/team.${netif}.info
|
||||
|
||||
uuid=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
elif [ "$netif" = "$teammaster" ]; then
|
||||
team=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
@@ -110,16 +155,20 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
if [ "$netif" = "$vlanname" ]; then
|
||||
vlan=yes
|
||||
fi
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
|
||||
# skip team interfaces for now, the host config must be in sync
|
||||
[ "$netif" = "$teammaster" ] && continue
|
||||
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$netif\""
|
||||
echo "NAME=\"$netif\""
|
||||
interface_bind "$netif" "$macaddr"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "UUID=\"$uuid\""
|
||||
strstr "$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/dhclient.$netif.lease ]; then
|
||||
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
|
||||
strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
|
||||
if [ -f /tmp/net.$netif.has_ibft_config ]; then
|
||||
echo "BOOTPROTO=ibft"
|
||||
else
|
||||
@@ -156,17 +205,10 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ] && [ -z "$team" ]; then
|
||||
# standard interface
|
||||
{
|
||||
if [ -n "$macaddr" ]; then
|
||||
echo "MACADDR=\"$macaddr\""
|
||||
else
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
|
||||
fi
|
||||
print_s390 $netif
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"$netif\""
|
||||
[ -n "$mtu" ] && echo "MTU=\"$mtu\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
@@ -191,17 +233,19 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
(
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "NAME=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=\"$netif\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -211,50 +255,31 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"$netif\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$bondname\""
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=\"$bondname\""
|
||||
echo "NAME=\"$slave\""
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
for slave in $bridgeslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
(
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=\"$ethname\""
|
||||
echo "NAME=\"$slave\""
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
|
||||
echo "BRIDGE=\"$netif\""
|
||||
echo "NAME=\"$ethname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
echo "BRIDGE=\"$bridgename\""
|
||||
echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
||||
unset macaddr
|
||||
[ -e /tmp/net.$slave.override ] && . /tmp/net.$slave.override
|
||||
interface_bind "$slave" "$macaddr"
|
||||
) >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
i=1
|
||||
for ns in $(getargs nameserver); do
|
||||
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
[ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
|
||||
[ -f /tmp/net.route."$netif" ] && cp /tmp/net.route."$netif" /tmp/ifcfg/route-"$netif"
|
||||
done
|
||||
|
||||
# Pass network opts
|
||||
|
@@ -64,7 +64,7 @@ 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 $curl_args --output - -- "$url" > "$outloc" || return $?
|
||||
else
|
||||
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
|
||||
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
|
||||
|
0
modules.d/50drm/module-setup.sh
Normal file → Executable file
0
modules.d/50drm/module-setup.sh
Normal file → Executable file
@@ -9,6 +9,7 @@ mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
function cms_write_config()
|
||||
{
|
||||
. /tmp/cms.conf
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
|
@@ -32,7 +32,6 @@ fi
|
||||
echo "nameserver=$i"
|
||||
done
|
||||
} > /etc/cmdline.d/80-cms.conf
|
||||
unset CMDLINE
|
||||
|
||||
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
|
||||
IFACES="$IFACES $DEVICE"
|
||||
|
@@ -44,146 +44,147 @@ function dasd_settle() {
|
||||
}
|
||||
|
||||
function dasd_settle_all() {
|
||||
for dasdccw in $(while read line; do echo ${line%%(*}; done < /proc/dasd/devices) ; do
|
||||
for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
|
||||
if ! dasd_settle $dasdccw ; then
|
||||
echo $"Could not access DASD $dasdccw in time"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# prints a canonocalized device bus ID for a given devno of any format
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
function canonicalize_devno()
|
||||
{
|
||||
case ${#1} in
|
||||
3) echo "0.0.0${1}" ;;
|
||||
4) echo "0.0.${1}" ;;
|
||||
*) echo "${1}" ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
# read file from CMS and write it to /tmp
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
function readcmsfile() # $1=dasdport $2=filename
|
||||
{
|
||||
local dev
|
||||
local numcpus
|
||||
local devname
|
||||
local ret=0
|
||||
if [ $# -ne 2 ]; then return; fi
|
||||
# precondition: udevd created dasda block device node
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
if ! dasd_cio_free -d $1 ; then
|
||||
echo $"DASD $1 could not be cleared from device blacklist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe dasd_mod dasd=$CMSDASD
|
||||
modprobe dasd_eckd_mod
|
||||
udevadm settle
|
||||
|
||||
# precondition: dasd_eckd_mod driver incl. dependencies loaded,
|
||||
# dasd_mod must be loaded without setting any DASD online
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
dev=$(canonicalize_devno $1)
|
||||
numcpus=$(
|
||||
while read line; do
|
||||
if strstr "$line" "# processors"; then
|
||||
echo ${line##*:};
|
||||
break;
|
||||
fi;
|
||||
done < /proc/cpuinfo
|
||||
)
|
||||
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
udevadm settle
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
if [ ${numcpus} -eq 1 ]; then
|
||||
echo 1 > /sys/bus/ccw/devices/$dev/online
|
||||
else
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
||||
echo $"DASD $dev could not be set online"
|
||||
return 1
|
||||
fi
|
||||
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
if ! dasd_settle $dev ; then
|
||||
echo $"Could not access DASD $dev in time"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
udevadm settle
|
||||
|
||||
devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
||||
devname=${devname:-dasda}
|
||||
|
||||
[[ -d /mnt ]] || mkdir /mnt
|
||||
if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
||||
cat /mnt/$2 > /run/initramfs/$2
|
||||
umount /mnt || umount -l /mnt
|
||||
udevadm settle
|
||||
else
|
||||
echo $"Could not read conf file $2 on CMS DASD $1."
|
||||
ret=1
|
||||
fi
|
||||
|
||||
if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
||||
echo $"DASD $dev could not be set offline again"
|
||||
#return 1
|
||||
fi
|
||||
udevadm settle
|
||||
fi
|
||||
udevadm settle
|
||||
|
||||
# unbind all dasds to unload the dasd modules for a clean start
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
||||
udevadm settle
|
||||
modprobe -r dasd_eckd_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_diag_mod
|
||||
udevadm settle
|
||||
modprobe -r dasd_mod
|
||||
udevadm settle
|
||||
return $ret
|
||||
}
|
||||
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
processcmsfile()
|
||||
{
|
||||
source /tmp/cms.conf
|
||||
SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
||||
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
if [[ $NETTYPE ]]; then
|
||||
(
|
||||
echo -n $NETTYPE,$SUBCHANNELS
|
||||
[[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
||||
[[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
||||
[[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
||||
echo
|
||||
) >> /etc/ccw.conf
|
||||
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
OLDIFS=$IFS
|
||||
IFS=,
|
||||
read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
||||
IFS=$OLDIFS
|
||||
devbusid=${subch_array[1]}
|
||||
if [ "$NETTYPE" = "ctc" ]; then
|
||||
driver="ctcm"
|
||||
else
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
|
||||
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
|
||||
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/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
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
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
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
|
||||
if [[ $DASD ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
if [[ $DASD ]] && [[ $DASD != "none" ]]; then
|
||||
echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
||||
echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
||||
dasd_cio_free
|
||||
fi
|
||||
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
unset _do_zfcp
|
||||
for i in ${!FCP_*}; do
|
||||
echo "${!i}" | while read port rest; do
|
||||
case $port in
|
||||
*.*.*)
|
||||
;;
|
||||
*.*)
|
||||
@@ -192,23 +193,23 @@ function dasd_settle_all() {
|
||||
*)
|
||||
port="0.0.$port"
|
||||
;;
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
_do_zfcp=1
|
||||
esac
|
||||
echo $port $rest >> /etc/zfcp.conf
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
_do_zfcp=1
|
||||
done
|
||||
[[ $_do_zfcp ]] && zfcp_cio_free
|
||||
unset _do_zfcp
|
||||
}
|
||||
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
||||
[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
||||
|
||||
# Parse configuration
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
||||
if readcmsfile $CMSDASD $CMSCONFFILE; then
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
||||
ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
||||
processcmsfile
|
||||
fi
|
||||
fi
|
||||
|
@@ -3,7 +3,10 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
type -P probe-bcache >/dev/null || return 1
|
||||
if ! blkid -k | { while read line; do [[ $line == bcache ]] && exit 0; done; exit 1; } \
|
||||
&& ! type -P probe-bcache >/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
@@ -24,7 +27,7 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple probe-bcache ${udevdir}/bcache-register
|
||||
inst_rules 61-bcache.rules
|
||||
blkid -k | { while read line; do [[ $line == bcache ]] && exit 0; done; exit 1; } || inst_multiple -o probe-bcache
|
||||
inst_multiple -o ${udevdir}/bcache-register
|
||||
inst_rules 61-bcache.rules 69-bcache.rules
|
||||
}
|
||||
|
||||
|
@@ -39,8 +39,7 @@ install() {
|
||||
fi
|
||||
|
||||
if ! dracut_module_included "systemd"; then
|
||||
inst_script "$moddir/btrfs_timeout.sh" \
|
||||
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
|
||||
inst_hook initqueue/timeout 10 "$moddir/btrfs_timeout.sh"
|
||||
fi
|
||||
|
||||
inst_multiple -o btrfsck btrfs-zero-log
|
||||
|
@@ -46,8 +46,10 @@ cmdline() {
|
||||
|
||||
install() {
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
|
||||
fi
|
||||
|
||||
inst_multiple cryptsetup rmdir readlink umount
|
||||
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
|
@@ -13,7 +13,7 @@ depends() {
|
||||
|
||||
installkernel() {
|
||||
instmods =drivers/md
|
||||
instmods dm_mod
|
||||
instmods dm_mod dm-cache dm-cache-mq dm-cache-cleaner
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -27,7 +27,8 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
for s in $SETS; do
|
||||
if [ "${s##$r}" != "$s" ]; then
|
||||
info "Activating $s"
|
||||
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
|
||||
udevsettle
|
||||
fi
|
||||
done
|
||||
@@ -36,7 +37,8 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
|
||||
# scan and activate all DM RAIDS
|
||||
for s in $SETS; do
|
||||
info "Activating $s"
|
||||
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo
|
||||
dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
|
||||
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -9,8 +9,17 @@ check() {
|
||||
type -P dmraid >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = *_raid_member ]] && return 0
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e "$holder/dm" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -31,16 +40,7 @@ cmdline() {
|
||||
local holder DEVPATH DM_NAME majmin
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
majmin=$(get_maj_min $dev)
|
||||
DEVPATH=$(
|
||||
for i in /sys/block/*; do
|
||||
[[ -e "$i/dev" ]] || continue
|
||||
if [[ $a == $(<"$i/dev") ]]; then
|
||||
printf "%s" "$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
)
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
@@ -61,8 +61,10 @@ cmdline() {
|
||||
install() {
|
||||
local _i
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
|
||||
fi
|
||||
|
||||
inst_multiple dmraid
|
||||
inst_multiple -o kpartx
|
||||
|
@@ -7,12 +7,16 @@ if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd; then
|
||||
if ! command -v mdadm >/dev/null \
|
||||
|| ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd \
|
||||
|| ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
if ! command -v mdadm >/dev/null || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd; then
|
||||
if ! command -v mdadm >/dev/null \
|
||||
|| ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd \
|
||||
|| ! getargbool 1 rd.md -d -n rd_NO_MD; then
|
||||
info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
|
||||
udevproperty rd_NO_MDDDF=1
|
||||
fi
|
||||
|
@@ -9,7 +9,7 @@ case "$root" in
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> /etc/udev/rules.d/99-live-squash.rules
|
||||
wait_for_dev "${root#live:}"
|
||||
wait_for_dev -n "${root#live:}"
|
||||
;;
|
||||
live:*)
|
||||
if [ -f "${root#live:}" ]; then
|
||||
|
@@ -57,7 +57,7 @@ det_img_fs() {
|
||||
}
|
||||
|
||||
modprobe squashfs
|
||||
|
||||
CMDLINE=$(getcmdline)
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
@@ -144,6 +144,9 @@ do_live_overlay() {
|
||||
over=$OVERLAY_LOOPDEV
|
||||
fi
|
||||
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
|
||||
|
||||
# Create a device that always points to a ro base image
|
||||
echo 0 $sz linear $base 0 | dmsetup create --readonly live-base
|
||||
}
|
||||
|
||||
# live cd helper function
|
||||
@@ -225,9 +228,6 @@ if [ -n "$ROOTFLAGS" ]; then
|
||||
ROOTFLAGS="-o $ROOTFLAGS"
|
||||
fi
|
||||
|
||||
if [ -b "$BASE_LOOPDEV" ]; then
|
||||
ln -s $BASE_LOOPDEV /run/initramfs/live-baseloop
|
||||
fi
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
if [ "${root%%:*}" = "liveiso" ]; then
|
||||
{
|
||||
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
|
||||
printf 'KERNEL=="loop-control", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
|
||||
${root#liveiso:}
|
||||
} >> /etc/udev/rules.d/99-liveiso-mount.rules
|
||||
fi
|
||||
|
@@ -10,7 +10,7 @@ isofile=$1
|
||||
|
||||
[ -z "$isofile" ] && exit 1
|
||||
|
||||
ismounted "/run/initramfs/isoscan" && exit 1
|
||||
ismounted "/run/initramfs/isoscan" && exit 0
|
||||
|
||||
mkdir -p "/run/initramfs/isoscan"
|
||||
|
||||
|
@@ -56,4 +56,4 @@ info "root was $liveroot, is now $root"
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
||||
|
||||
wait_for_dev /dev/mapper/live-rw
|
||||
wait_for_dev -n /dev/mapper/live-rw
|
||||
|
@@ -7,8 +7,5 @@
|
||||
isofile=$(getarg iso-scan/filename)
|
||||
|
||||
if [ -n "$isofile" ]; then
|
||||
{
|
||||
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --unique /sbin/iso-scan %s"\n' \
|
||||
"'${isofile}'"
|
||||
} >> /etc/udev/rules.d/99-isofile-mount.rules
|
||||
/sbin/initqueue --settled --unique /sbin/iso-scan "$isofile"
|
||||
fi
|
||||
|
@@ -5,7 +5,7 @@
|
||||
installkernel() {
|
||||
if [[ -z $drivers ]]; then
|
||||
block_module_filter() {
|
||||
local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect'
|
||||
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_pltfm_init'
|
||||
# subfunctions inherit following FDs
|
||||
local _merge=8 _side2=9
|
||||
function bmf1() {
|
||||
@@ -35,20 +35,25 @@ installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \
|
||||
ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \
|
||||
unix
|
||||
hostonly='' instmods \
|
||||
sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
|
||||
ehci-hcd ehci-pci ehci-platform \
|
||||
ohci-hcd ohci-pci \
|
||||
uhci-hcd \
|
||||
xhci-hcd
|
||||
|
||||
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 \
|
||||
pcmcia usb_storage nvme hid-hyperv hv-vmbus
|
||||
pcmcia usb_storage nvme hid-hyperv hv-vmbus \
|
||||
sdhci_acpi
|
||||
|
||||
if [[ "$(uname -p)" == arm* ]]; then
|
||||
# arm specific modules
|
||||
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
|
||||
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \
|
||||
ehci-tegra
|
||||
hostonly='' instmods \
|
||||
connector-hdmi connector-dvi encoder-tfp410 \
|
||||
encoder-tpd12s015 i2c-tegra gpio-regulator \
|
||||
as3722-regulator orion-ehci ehci-tegra
|
||||
fi
|
||||
|
||||
# install virtual machine support
|
||||
|
@@ -11,7 +11,6 @@ if [ -n "$updates" ]; then
|
||||
# make sure network comes up even if we're doing a local live device
|
||||
if [ -z "$netroot" ]; then
|
||||
echo > /tmp/net.ifaces
|
||||
unset CMDLINE
|
||||
fi
|
||||
echo "$updates" > /tmp/liveupdates.info
|
||||
echo '[ -e /tmp/liveupdates.done ]' > \
|
||||
@@ -28,7 +27,7 @@ if get_url_handler "$liveurl" >/dev/null; then
|
||||
netroot="livenet:$liveurl"
|
||||
root="livenet" # quiet complaints from init
|
||||
rootok=1
|
||||
wait_for_dev /dev/root
|
||||
wait_for_dev -n /dev/root
|
||||
else
|
||||
info "livenet: no url handler for $liveurl"
|
||||
fi
|
||||
|
@@ -107,11 +107,13 @@ fi
|
||||
if [ -n "$LVS" ] ; then
|
||||
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
|
||||
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange --yes -ay $sysinit $LVS 2>&1 | vinfo
|
||||
fi
|
||||
for LV in $LVS; do
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$LVS" -o -n "$VGS" ]; then
|
||||
|
@@ -22,7 +22,8 @@ depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
get_host_lvs() {
|
||||
# called by dracut
|
||||
cmdline() {
|
||||
local _activated
|
||||
declare -A _activated
|
||||
|
||||
@@ -35,30 +36,22 @@ get_host_lvs() {
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
||||
if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
|
||||
printf "%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
|
||||
printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
|
||||
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
get_host_lvs | while read line; do
|
||||
printf " rd.lvm.lv=$line"
|
||||
done
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
local _i _needthin
|
||||
local _i
|
||||
|
||||
inst lvm
|
||||
|
||||
get_host_lvs | while read line; do
|
||||
printf "%s" " rd.lvm.lv=$line"
|
||||
if ! [[ $_needthin ]]; then
|
||||
[[ "$(lvs --noheadings -o segtype ${line%%/*} 2>/dev/null)" == *thin* ]] && _needthin=1
|
||||
fi
|
||||
done >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
||||
fi
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
@@ -82,7 +75,21 @@ install() {
|
||||
} > "${initdir}/etc/lvm/lvm.conf"
|
||||
fi
|
||||
|
||||
inst_rules 11-dm-lvm.rules
|
||||
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
|
||||
|
||||
# Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut!
|
||||
if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then
|
||||
if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
|
||||
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \
|
||||
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
else
|
||||
sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \
|
||||
${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
|
||||
fi
|
||||
fi
|
||||
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
@@ -94,9 +101,18 @@ install() {
|
||||
|
||||
inst_libdir_file "libdevmapper-event-lvm*.so"
|
||||
|
||||
if [[ $_needthin ]]; then
|
||||
if [[ $hostonly ]] && type -P lvs &>/dev/null; then
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
|
||||
dev=$(</sys/block/${dev#/dev/}/dm/name)
|
||||
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
|
||||
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
|
||||
if [[ "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" == *thin* ]] ; then
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
inst_multiple -o thin_dump thin_restore thin_check thin_repair
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
|
||||
rm -f -- /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $LV_DEVS; do
|
||||
wait_for_dev "/dev/$dev"
|
||||
wait_for_dev -n "/dev/$dev"
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -20,4 +20,5 @@ IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
|
||||
IMPORT BLKID
|
||||
OPTIONS+="link_priority=100"
|
||||
OPTIONS+="watch"
|
||||
OPTIONS+="db_persist"
|
||||
LABEL="md_end"
|
||||
|
@@ -8,8 +8,17 @@ check() {
|
||||
type -P mdadm >/dev/null || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ "$fs" == *_raid_member ]] && return 0
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
|
||||
|
||||
DEVPATH=$(get_devpath_block "$dev")
|
||||
|
||||
for holder in "$DEVPATH"/holders/*; do
|
||||
[[ -e "$holder" ]] || continue
|
||||
[[ -e "$holder/md" ]] && return 0
|
||||
break
|
||||
done
|
||||
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -41,6 +50,8 @@ cmdline() {
|
||||
done
|
||||
)
|
||||
|
||||
[[ -z "$UUID" ]] && continue
|
||||
|
||||
if ! [[ ${_activated[${UUID}]} ]]; then
|
||||
printf "%s" " rd.md.uuid=${UUID}"
|
||||
_activated["${UUID}"]=1
|
||||
@@ -50,20 +61,31 @@ cmdline() {
|
||||
}
|
||||
|
||||
install() {
|
||||
local rule rule_path
|
||||
inst_multiple cat
|
||||
inst_multiple -o mdmon
|
||||
inst $(command -v partx) /sbin/partx
|
||||
inst $(command -v mdadm) /sbin/mdadm
|
||||
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
||||
fi
|
||||
|
||||
# <mdadm-3.3 udev rule
|
||||
inst_rules 64-md-raid.rules
|
||||
# >=mdadm-3.3 udev rules
|
||||
inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.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"
|
||||
for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
|
||||
rule_path="${initdir}${udevdir}/rules.d/${rule}"
|
||||
[ -f "${rule_path}" ] && sed -i -r \
|
||||
-e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
|
||||
"${rule_path}"
|
||||
done
|
||||
|
||||
inst_rules "$moddir/65-md-incremental-imsm.rules"
|
||||
|
||||
@@ -84,6 +106,14 @@ install() {
|
||||
else
|
||||
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
fi
|
||||
if [ -d /etc/mdadm.conf.d ]; then
|
||||
local f
|
||||
inst_dir /etc/mdadm.conf.d
|
||||
for f in /etc/mdadm.conf.d/*.conf; do
|
||||
[ -f "$f" ] || continue
|
||||
inst "$f"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"
|
||||
|
@@ -22,5 +22,8 @@ check() {
|
||||
|
||||
installkernel() {
|
||||
# qemu specific modules
|
||||
hostonly='' instmods virtio_blk virtio virtio_ring virtio_pci ata_piix ata_generic pata_acpi cdrom sr_mod ahci virtio_scsi
|
||||
hostonly='' instmods \
|
||||
ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
|
||||
virtio_blk virtio virtio_ring virtio_pci \
|
||||
virtio_scsi virtio_console
|
||||
}
|
||||
|
0
modules.d/91crypt-loop/crypt-loop-lib.sh
Normal file → Executable file
0
modules.d/91crypt-loop/crypt-loop-lib.sh
Normal file → Executable file
@@ -14,22 +14,20 @@
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
. /lib/cifs-lib.sh
|
||||
|
||||
#Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "cifs" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "cifs" ] || unset netroot
|
||||
fi
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "cifs" ] ; then
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
if [ -n "$netroot" ] ; then
|
||||
warn "root takes precedence over netroot. Ignoring netroot"
|
||||
|
||||
fi
|
||||
netroot=$root
|
||||
unset root
|
||||
|
22
modules.d/95fcoe-uefi/module-setup.sh
Executable file
22
modules.d/95fcoe-uefi/module-setup.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
for i in dcbtool fipvlan lldpad ip readlink; do
|
||||
type -P $i >/dev/null || return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo fcoe uefi-lib
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_hook cmdline 20 "$moddir/parse-uefifcoe.sh"
|
||||
}
|
36
modules.d/95fcoe-uefi/parse-uefifcoe.sh
Executable file
36
modules.d/95fcoe-uefi/parse-uefifcoe.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
command -v get_fcoe_boot_mac >/dev/null || . /lib/uefi-lib.sh
|
||||
command -v set_ifname >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
print_fcoe_uefi_conf()
|
||||
{
|
||||
local mac dev vlan
|
||||
mac=$(get_fcoe_boot_mac "$1")
|
||||
[ -z "$mac" ] && return 1
|
||||
dev=$(set_ifname fcoe $mac)
|
||||
vlan=$(get_fcoe_boot_vlan "$1")
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
printf "%s\n" "vlan=$dev.$vlan:$dev"
|
||||
dev="$dev.$vlan"
|
||||
;;
|
||||
*)
|
||||
printf "%s\n" "vlan=$vlan:$dev"
|
||||
dev="$vlan"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# fcoe=eth0:nodcb
|
||||
printf "fcoe=%s\n" "$dev:nodcb"
|
||||
return 0
|
||||
}
|
||||
|
||||
for i in /sys/firmware/efi/vars/FcoeBootDevice-*/data; do
|
||||
[ -e "$i" ] || continue
|
||||
print_fcoe_uefi_conf $i > /etc/cmdline.d/40-fcoe-uefi.conf && break
|
||||
done
|
@@ -13,4 +13,4 @@
|
||||
else
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb"
|
||||
fi
|
||||
} > /etc/udev/rules.d/92-fcoe.rules
|
||||
} >> /etc/udev/rules.d/92-fcoe.rules
|
||||
|
@@ -31,12 +31,35 @@ if [ "$dcb" = "dcb" ]; then
|
||||
# are to kill it and start a new lldpad to take over. Data is transfered
|
||||
# between the 2 using a shm segment
|
||||
lldpad -d
|
||||
# stupid tools, need sleep
|
||||
sleep 1
|
||||
dcbtool sc "$netif" dcb on
|
||||
sleep 1
|
||||
dcbtool sc "$netif" app:fcoe e:1 a:1 w:1
|
||||
# wait for lldpad to be ready
|
||||
i=0
|
||||
while [ $i -lt 60 ]; do
|
||||
lldptool -p && break
|
||||
info "Waiting for lldpad to be ready"
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
# on some systems lldpad needs some time
|
||||
# sleep until we find a better solution
|
||||
sleep 30
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" dcb on && break
|
||||
info "Retrying to turn dcb on"
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
while [ $i -lt 60 ]; do
|
||||
dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
|
||||
info "Retrying to turn fcoe on"
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
||||
sleep 1
|
||||
|
||||
fipvlan "$netif" -c -s
|
||||
elif [ "$netdriver" = "bnx2x" ]; then
|
||||
# If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
|
||||
|
@@ -3,11 +3,6 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
# FIXME
|
||||
# If hostonly was requested, fail the check until we have some way of
|
||||
# knowing we are booting from FCoE
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && return 1
|
||||
|
||||
for i in dcbtool fipvlan lldpad ip readlink; do
|
||||
type -P $i >/dev/null || return 1
|
||||
done
|
||||
@@ -25,7 +20,7 @@ installkernel() {
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_multiple ip dcbtool fipvlan lldpad readlink
|
||||
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
|
||||
|
||||
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
|
||||
|
||||
|
@@ -27,7 +27,11 @@ fstab_mount() {
|
||||
return 0
|
||||
}
|
||||
|
||||
[ -f /etc/fstab ] && fstab_mount /etc/fstab
|
||||
# systemd will mount and run fsck from /etc/fstab and we don't want to
|
||||
# run into a race condition.
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
[ -f /etc/fstab ] && fstab_mount /etc/fstab
|
||||
fi
|
||||
|
||||
# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
|
||||
if [ -f $NEWROOT/etc/fstab.sys ]; then
|
||||
|
@@ -31,33 +31,47 @@ iroot="$2"
|
||||
# If it's not iscsi we don't continue
|
||||
[ "${iroot%%:*}" = "iscsi" ] || exit 1
|
||||
|
||||
iroot=${iroot#iscsi:}
|
||||
iroot=${iroot#iscsi}
|
||||
iroot=${iroot#:}
|
||||
|
||||
# XXX modprobe crc32c should go in the cmdline parser, but I haven't yet
|
||||
# figured out a way how to check whether this is built-in or not
|
||||
modprobe crc32c 2>/dev/null
|
||||
|
||||
[ -e /sys/module/bnx2i ] && iscsiuio
|
||||
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
if [ -z "$root" -o -n "${root%%block:*}" ]; 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
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
iscsistart -b $iscsi_param
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
exit 0
|
||||
if [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
|
||||
iscsiuio
|
||||
> /tmp/iscsiuio-started
|
||||
fi
|
||||
|
||||
handle_firmware()
|
||||
{
|
||||
if ! [ -e /tmp/iscsistarted-firmware ]; then
|
||||
if ! iscsistart -f; then
|
||||
warn "iscistart: Could not get list of targets from firmware."
|
||||
return 1
|
||||
fi
|
||||
|
||||
for p in $(getargs rd.iscsi.param -d iscsi_param); do
|
||||
iscsi_param="$iscsi_param --param $p"
|
||||
done
|
||||
|
||||
if ! iscsistart -b $iscsi_param; then
|
||||
warn "'iscsistart -b $iscsi_param' failed"
|
||||
fi
|
||||
|
||||
if [ -d /sys/class/iscsi_session ]; then
|
||||
echo 'started' > "/tmp/iscsistarted-iscsi:"
|
||||
echo 'started' > "/tmp/iscsistarted-firmware"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
handle_netroot()
|
||||
{
|
||||
local iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port
|
||||
@@ -96,7 +110,7 @@ handle_netroot()
|
||||
# XXX is this needed?
|
||||
getarg ro && iscsirw=ro
|
||||
getarg rw && iscsirw=rw
|
||||
fsopts=${fsopts+$fsopts,}${iscsirw}
|
||||
fsopts=${fsopts:+$fsopts,}${iscsirw}
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
# XXX Where are these from?
|
||||
@@ -111,7 +125,7 @@ handle_netroot()
|
||||
|
||||
if [ -z $iscsi_initiator ]; then
|
||||
if [ -f /sys/firmware/ibft/initiator/initiator-name ]; then
|
||||
iscsi_initiator=$(while read line; do echo $line;done < /sys/firmware/ibft/initiator-name)
|
||||
iscsi_initiator=$(while read line; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -137,12 +151,12 @@ handle_netroot()
|
||||
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
if [ -z "$root" -o -n "${root%%block:*}" ]; then
|
||||
if [ "$root" = "dhcp" ]; 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
|
||||
wait_for_dev -n /dev/root
|
||||
|
||||
# install mount script
|
||||
[ -z "$DRACUT_SYSTEMD" ] && \
|
||||
@@ -155,32 +169,49 @@ handle_netroot()
|
||||
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
|
||||
-g $iscsi_target_group -a $iscsi_target_ip \
|
||||
-p $iscsi_target_port \
|
||||
${iscsi_username+-u $iscsi_username} \
|
||||
${iscsi_password+-w $iscsi_password} \
|
||||
${iscsi_in_username+-U $iscsi_in_username} \
|
||||
${iscsi_in_password+-W $iscsi_in_password} \
|
||||
${iscsi_iface_name+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
||||
${iscsi_netdev_name+--param iface.net_ifacename=$iscsi_netdev_name} \
|
||||
${iscsi_username:+-u $iscsi_username} \
|
||||
${iscsi_password:+-w $iscsi_password} \
|
||||
${iscsi_in_username:+-U $iscsi_in_username} \
|
||||
${iscsi_in_password:+-W $iscsi_in_password} \
|
||||
${iscsi_iface_name:+--param iface.iscsi_ifacename=$iscsi_iface_name} \
|
||||
${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}"
|
||||
|
||||
}
|
||||
|
||||
ret=0
|
||||
|
||||
# loop over all netroot parameter
|
||||
if getarg netroot; then
|
||||
for nroot in $(getargs netroot); do
|
||||
[ "${netroot%%:*}" = "iscsi" ] || continue
|
||||
handle_netroot ${nroot##iscsi:}
|
||||
[ "${nroot%%:*}" = "iscsi" ] || continue
|
||||
nroot="${nroot##iscsi:}"
|
||||
if [ -n "$nroot" ]; then
|
||||
handle_netroot "$nroot"
|
||||
ret=$(($ret + $?))
|
||||
fi
|
||||
done
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
handle_firmware
|
||||
ret=$(($ret + $?))
|
||||
fi
|
||||
else
|
||||
handle_netroot $iroot
|
||||
if [ -n "$iroot" ]; then
|
||||
handle_netroot "$iroot"
|
||||
ret=$?
|
||||
else
|
||||
if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
|
||||
handle_firmware
|
||||
ret=$?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
|
||||
# now we have a root filesystem somewhere in /dev/sda*
|
||||
# let the normal block handler handle root=
|
||||
exit 0
|
||||
exit $ret
|
||||
|
@@ -23,7 +23,7 @@ check() {
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
pushd . >/dev/null
|
||||
for_each_host_dev_and_slaves is_iscsi || return 1
|
||||
for_each_host_dev_and_slaves is_iscsi || return 255
|
||||
popd >/dev/null
|
||||
}
|
||||
return 0
|
||||
|
@@ -13,12 +13,14 @@
|
||||
# root= takes precedence over netroot= if root=iscsi[...]
|
||||
#
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "iscsi" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "iscsi" ] || unset netroot
|
||||
fi
|
||||
[ -z "$iscsiroot" ] && iscsiroot=$(getarg iscsiroot=)
|
||||
[ -z "$iscsi_firmware" ] && getargbool 0 rd.iscsi.firmware -y iscsi_firmware && iscsi_firmware="1"
|
||||
|
||||
@@ -59,10 +61,10 @@ fi
|
||||
|
||||
# iscsi_firmware does not need argument checking
|
||||
if [ -n "$iscsi_firmware" ] ; then
|
||||
netroot=${netroot:-iscsi}
|
||||
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
|
||||
initqueue --onetime --timeout /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
fi
|
||||
|
||||
# If it's not iscsi we don't continue
|
||||
@@ -86,7 +88,7 @@ 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"
|
||||
initqueue --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -14,7 +14,7 @@ check() {
|
||||
|
||||
_rootdev=$(find_root_block_device)
|
||||
[[ -b /dev/block/$_rootdev ]] || return 1
|
||||
check_block_and_slaves is_nbd "$_rootdev" || return 1
|
||||
check_block_and_slaves is_nbd "$_rootdev" || return 255
|
||||
}
|
||||
|
||||
return 0
|
||||
|
@@ -76,12 +76,12 @@ while [ -n "$nbdflags" ]; do
|
||||
nbdrw=$f
|
||||
continue
|
||||
fi
|
||||
fsopts=${fsopts+$fsopts,}$f
|
||||
fsopts=${fsopts:+$fsopts,}$f
|
||||
done
|
||||
|
||||
getarg ro && nbdrw=ro
|
||||
getarg rw && nbdrw=rw
|
||||
fsopts=${fsopts+$fsopts,}${nbdrw}
|
||||
fsopts=${fsopts:+$fsopts,}${nbdrw}
|
||||
|
||||
# XXX better way to wait for the device to be made?
|
||||
i=0
|
||||
@@ -97,12 +97,12 @@ done
|
||||
|
||||
# If we didn't get a root= on the command line, then we need to
|
||||
# add the udev rules for mounting the nbd0 device
|
||||
if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then
|
||||
if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
|
||||
printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules
|
||||
udevadm control --reload
|
||||
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
write_fs_tab /dev/root "$nbdfstype" "$fsopts"
|
||||
wait_for_dev /dev/root
|
||||
wait_for_dev -n /dev/root
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
printf '/bin/mount %s\n' \
|
||||
@@ -111,6 +111,10 @@ if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then
|
||||
preopts="--systemd-mark $preopts"
|
||||
fi
|
||||
|
||||
nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
|
||||
|
||||
# NBD doesn't emit uevents when it gets connected, so kick it
|
||||
|
@@ -26,14 +26,16 @@ netroot_to_var() {
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
|
||||
if [ -z "$netroot" ]; then
|
||||
for netroot in $(getargs netroot=); do
|
||||
[ "${netroot%%:*}" = "nbd" ] && break
|
||||
done
|
||||
[ "${netroot%%:*}" = "nbd" ] || unset netroot
|
||||
fi
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "nbd" ] ; then
|
||||
|
||||
# Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
if [ -n "$netroot" ] ; then
|
||||
warn "root takes precedence over netroot. Ignoring netroot"
|
||||
|
||||
@@ -59,6 +61,6 @@ rootok=1
|
||||
# Shut up init error check
|
||||
if [ -z "$root" ]; then
|
||||
root=block:/dev/root
|
||||
wait_for_dev /dev/root
|
||||
wait_for_dev -n /dev/root
|
||||
fi
|
||||
|
||||
|
@@ -97,7 +97,7 @@ nfsroot_from_dhcp() {
|
||||
[ -z "$path" ] && [ "$(getarg root=)" == "/dev/nfs" ] && path=/tftpboot/%s
|
||||
[ -z "$server" ] && server=$srv
|
||||
[ -z "$server" ] && server=$new_dhcp_server_identifier
|
||||
[ -z "$server" ] && server=$new_dhcp_next_server
|
||||
[ -z "$server" ] && server=$new_next_server
|
||||
[ -z "$server" ] && server=${new_root_path%%:*}
|
||||
}
|
||||
|
||||
@@ -125,10 +125,10 @@ munge_nfs_options() {
|
||||
mount_nfs() {
|
||||
local nfsroot="$1" mntdir="$2" netif="$3"
|
||||
local nfs="" server="" path="" options=""
|
||||
nfs_to_var $nfsroot $netif
|
||||
nfs_to_var "$nfsroot" $netif
|
||||
munge_nfs_options
|
||||
if [ "$nfs" = "nfs4" ]; then
|
||||
options=$options${nfslock+,$nfslock}
|
||||
options=$options${nfslock:+,$nfslock}
|
||||
else
|
||||
# NFSv{2,3} doesn't support using locks as it requires a helper to
|
||||
# transfer the rpcbind state to the new root
|
||||
@@ -136,5 +136,5 @@ mount_nfs() {
|
||||
&& warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
|
||||
options=$options,nolock
|
||||
fi
|
||||
mount -t $nfs -o$options $server:$path $mntdir
|
||||
mount -t $nfs -o$options "$server:$path" "$mntdir"
|
||||
}
|
||||
|
@@ -24,9 +24,9 @@ if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
|
||||
if [ -d $NEWROOT/$rpcpipefspath ]; then
|
||||
# mount --move does not seem to work???
|
||||
mount --bind /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
umount /var/lib/nfs/rpc_pipefs 2>/dev/null
|
||||
else
|
||||
umount /var/lib/nfs/rpc_pipefs
|
||||
umount /var/lib/nfs/rpc_pipefs 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -16,7 +16,7 @@ NEWROOT="$3"
|
||||
nfs_to_var $root $netif
|
||||
[ -z "$server" ] && die "Required parameter 'server' is missing"
|
||||
|
||||
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; }
|
||||
mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; [ -e /dev/nfs ] || ln -s null /dev/nfs; }
|
||||
|
||||
[ -f $NEWROOT/etc/fstab ] && cat $NEWROOT/etc/fstab > /dev/null
|
||||
|
||||
|
@@ -27,18 +27,19 @@
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
#Don't continue if root is ok
|
||||
[ -n "$rootok" ] && return
|
||||
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
[ -z "$nfsroot" ] && nfsroot=$(getarg nfsroot=)
|
||||
|
||||
[ -n "$netroot" ] && oldnetroot="$netroot"
|
||||
|
||||
# netroot= cmdline argument must be ignored, but must be used if
|
||||
# we're inside netroot to parse dhcp root-path
|
||||
if [ -n "$netroot" ] ; then
|
||||
if [ "$netroot" = "$(getarg netroot=)" ] ; then
|
||||
for n in $(getargs netroot=); do
|
||||
[ "$n" = "$netroot" ] && break
|
||||
done
|
||||
if [ "$n" = "$netroot" ]; then
|
||||
warn "Ignoring netroot argument for NFS"
|
||||
netroot=$root
|
||||
fi
|
||||
@@ -67,7 +68,14 @@ esac
|
||||
# Continue if nfs
|
||||
case "${netroot%%:*}" in
|
||||
nfs|nfs4|/dev/nfs);;
|
||||
*) unset netroot; return;;
|
||||
*)
|
||||
if [ -n "$oldnetroot" ]; then
|
||||
netroot="$oldnetroot"
|
||||
else
|
||||
unset netroot
|
||||
fi
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check required arguments
|
||||
|
@@ -6,7 +6,7 @@ check() {
|
||||
# No point trying to support resume, if no swap partition exist
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for fs in "${host_fs_types[@]}"; do
|
||||
[[ $fs = swap ]] && return 0
|
||||
[[ $fs =~ ^(swap|swsuspend|swsupend)$ ]] && return 0
|
||||
done
|
||||
return 255
|
||||
}
|
||||
@@ -17,7 +17,7 @@ check() {
|
||||
install() {
|
||||
local _bin
|
||||
# Optional uswsusp support
|
||||
for _bin in /usr/sbin/resume /usr/lib/suspend/resume
|
||||
for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
|
||||
do
|
||||
[[ -x "${_bin}" ]] && {
|
||||
inst "${_bin}" /usr/sbin/resume
|
||||
@@ -30,7 +30,6 @@ install() {
|
||||
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
|
||||
|
@@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
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"
|
||||
|
||||
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
|
@@ -10,17 +10,8 @@ depends() {
|
||||
echo fs-lib
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
local dev=/dev/block/$(find_root_block_device)
|
||||
if [ -e $dev ]; then
|
||||
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
|
||||
printf " rootflags=%s" "$(find_mp_fsopts /)"
|
||||
printf " rootfstype=%s" "$(find_mp_fstype /)"
|
||||
fi
|
||||
}
|
||||
|
||||
install() {
|
||||
|
||||
cmdline_journal() {
|
||||
if [[ $hostonly ]]; then
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
|
||||
@@ -32,10 +23,28 @@ install() {
|
||||
fi
|
||||
|
||||
if [ -n "$journaldev" ]; then
|
||||
printf "%s\n" "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
|
||||
printf " root.journaldev=%s" "$journaldev"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
cmdline() {
|
||||
local dev=/dev/block/$(find_root_block_device)
|
||||
if [ -e $dev ]; then
|
||||
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
|
||||
printf " rootflags=%s" "$(find_mp_fsopts /)"
|
||||
printf " rootfstype=%s" "$(find_mp_fstype /)"
|
||||
fi
|
||||
cmdline_journal
|
||||
}
|
||||
|
||||
install() {
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
journaldev=$(cmdline_journal)
|
||||
[[ $journaldev ]] && printf "%s\n" "$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
|
||||
fi
|
||||
|
||||
inst_multiple umount
|
||||
inst_multiple tr
|
||||
@@ -44,5 +53,6 @@ install() {
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
inst_hook initqueue/timeout 99 "$moddir/rootfallback.sh"
|
||||
}
|
||||
|
46
modules.d/95rootfs-block/rootfallback.sh
Executable file
46
modules.d/95rootfs-block/rootfallback.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/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
|
||||
|
||||
for root in $(getargs rootfallback=); do
|
||||
case "$root" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
root="${root#block:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="/dev/disk/by-label/${root#LABEL=}"
|
||||
;;
|
||||
block:UUID=*|UUID=*)
|
||||
root="${root#block:}"
|
||||
root="${root#UUID=}"
|
||||
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
|
||||
root="/dev/disk/by-uuid/${root#UUID=}"
|
||||
;;
|
||||
block:PARTUUID=*|PARTUUID=*)
|
||||
root="${root#block:}"
|
||||
root="${root#PARTUUID=}"
|
||||
root="$(echo $root | tr "[:upper:]" "[:lower:]")"
|
||||
root="/dev/disk/by-partuuid/${root}"
|
||||
;;
|
||||
block:PARTLABEL=*|PARTLABEL=*)
|
||||
root="${root#block:}"
|
||||
root="/dev/disk/by-partlabel/${root#PARTLABEL=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [ -b "$root" ]; then
|
||||
warn "Could not find rootfallback $root"
|
||||
continue
|
||||
fi
|
||||
|
||||
if mount "$root" /sysroot; then
|
||||
info "Mounted rootfallback $root"
|
||||
exit 0
|
||||
else
|
||||
warn "Failed to mount rootfallback $root"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
[ -e "$job" ] && rm -f "$job"
|
@@ -41,7 +41,15 @@ inst_sshenv()
|
||||
|
||||
# Copy over root and system-wide ssh configs.
|
||||
[[ -f /root/.ssh/config ]] && inst_simple /root/.ssh/config
|
||||
[[ -f /etc/ssh/ssh_config ]] && inst_simple /etc/ssh/ssh_config
|
||||
if [[ -f /etc/ssh/ssh_config ]]; then
|
||||
inst_simple /etc/ssh/ssh_config
|
||||
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
|
||||
while read key val; do
|
||||
[[ $key != "GlobalKnownHostsFile" ]] && continue
|
||||
inst_simple "$val"
|
||||
break
|
||||
done < /etc/ssh/ssh_config
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ install() {
|
||||
60-pcmcia.rules \
|
||||
50-udev.rules 95-late.rules \
|
||||
50-firmware.rules \
|
||||
70-uaccess.rules 71-seat.rules 73-seat-late.rules \
|
||||
75-net-description.rules 80-net-name-slot.rules \
|
||||
"$moddir/59-persistent-storage.rules" \
|
||||
"$moddir/61-persistent-storage.rules"
|
||||
|
0
modules.d/98pollcdrom/pollcdrom.sh
Normal file → Executable file
0
modules.d/98pollcdrom/pollcdrom.sh
Normal file → Executable file
33
modules.d/98systemd/dracut-cmdline-ask.service
Normal file
33
modules.d/98systemd/dracut-cmdline-ask.service
Normal file
@@ -0,0 +1,33 @@
|
||||
# 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 ask for additional cmdline parameters
|
||||
DefaultDependencies=no
|
||||
Before=dracut-cmdline.service
|
||||
After=systemd-journald.socket
|
||||
Wants=systemd-journald.socket
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
ConditionKernelCommandLine=rd.cmdline=ask
|
||||
|
||||
[Service]
|
||||
Environment=DRACUT_SYSTEMD=1
|
||||
Environment=NEWROOT=/sysroot
|
||||
Type=oneshot
|
||||
ExecStart=-/bin/dracut-cmdline-ask
|
||||
StandardInput=tty
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
RemainAfterExit=yes
|
||||
KillMode=process
|
||||
IgnoreSIGPIPE=no
|
||||
|
||||
# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
|
||||
# terminates cleanly.
|
||||
KillSignal=SIGHUP
|
20
modules.d/98systemd/dracut-cmdline-ask.sh
Executable file
20
modules.d/98systemd/dracut-cmdline-ask.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
sleep 0.5
|
||||
echo
|
||||
sleep 0.5
|
||||
echo
|
||||
sleep 0.5
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
|
||||
while read -e -p "> " line; do
|
||||
[[ "$line" == "." ]] && break
|
||||
[[ "$line" ]] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
|
||||
done
|
||||
|
||||
exit 0
|
@@ -15,6 +15,9 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -f /etc/initrd-release ] && . /etc/initrd-release
|
||||
[ -n "$VERSION" ] && info "dracut-$VERSION"
|
||||
|
||||
info "Using kernel command line parameters:"
|
||||
getcmdline | vinfo
|
||||
|
||||
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
|
||||
|
||||
@@ -66,8 +69,6 @@ case "$root" in
|
||||
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'"
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user