* [PATCH 00/10] *** SUBJECT HERE ***
@ 2009-07-03 16:45 Harald Hoyer
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
Some important things I changed today.
Harald Hoyer (10):
add binutiles requirement to specfile (because of nm)
output everything to /dev/kmesg and add dmesg for the emergency_shell
Defer mount to the real mount loop
remove 50plymouth-pre0.7 module
add firmware packages to be required by the dracut-generic package
add rm to be installed for initqueue
fail iscsiroot, if iscsistart fails
put back the nfs mount in the udev event
initqueue now loops until /dev/root exists or root is mounted
add "rdshell" command line argument
dracut.8 | 3 +
dracut.spec | 8 ++-
modules.d/40network/net-genrules.sh | 8 +-
modules.d/50plymouth-pre0.7/63-luks.rules | 11 --
modules.d/50plymouth-pre0.7/check | 3 -
modules.d/50plymouth-pre0.7/cryptroot-ask.sh | 4 -
modules.d/50plymouth-pre0.7/install | 8 --
modules.d/50plymouth-pre0.7/plymouth-newroot.sh | 4 -
.../50plymouth-pre0.7/plymouth-populate-initrd | 25 -----
modules.d/50plymouth-pre0.7/plymouth-start.sh | 31 ------
modules.d/50plymouth/63-luks.rules | 2 +-
modules.d/90crypt/70-luks.rules | 2 +-
modules.d/90dmraid/61-dmraid.rules | 12 ++
modules.d/90dmraid/dmraid.sh | 3 -
modules.d/90dmraid/dmraid_scan | 8 ++
modules.d/90dmraid/install | 3 +-
modules.d/95debug/install | 2 +-
modules.d/95iscsi/iscsiroot | 4 +-
modules.d/95nbd/nbdroot | 7 +-
modules.d/95nfs/nfsroot | 22 ++--
modules.d/95rootfs-block/block-genrules.sh | 12 ++-
modules.d/95rootfs-block/install | 1 +
modules.d/99base/init | 111 ++++++++++++--------
modules.d/99base/initqueue | 11 ++-
modules.d/99base/install | 3 +-
test/TEST-10-RAID/test.sh | 4 +-
test/TEST-20-NFS/test.sh | 2 +-
test/TEST-30-ISCSI/test.sh | 4 +-
test/TEST-40-NBD/test.sh | 4 +-
29 files changed, 153 insertions(+), 169 deletions(-)
delete mode 100644 modules.d/50plymouth-pre0.7/63-luks.rules
delete mode 100755 modules.d/50plymouth-pre0.7/check
delete mode 100755 modules.d/50plymouth-pre0.7/cryptroot-ask.sh
delete mode 100755 modules.d/50plymouth-pre0.7/install
delete mode 100755 modules.d/50plymouth-pre0.7/plymouth-newroot.sh
delete mode 100755 modules.d/50plymouth-pre0.7/plymouth-populate-initrd
delete mode 100755 modules.d/50plymouth-pre0.7/plymouth-start.sh
create mode 100644 modules.d/90dmraid/61-dmraid.rules
delete mode 100644 modules.d/90dmraid/dmraid.sh
create mode 100755 modules.d/90dmraid/dmraid_scan
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/10] add binutiles requirement to specfile (because of nm)
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-03 16:45 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 02/10] output everything to /dev/kmesg and add dmesg for the emergency_shell Harald Hoyer
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
---
dracut.spec | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index 7b7a224..3e33819 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -27,6 +27,7 @@ Requires: module-init-tools
Requires: cpio
Requires: coreutils
Requires: findutils
+Requires: binutils
Requires: grep
Requires: mktemp
Requires: mount
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/10] output everything to /dev/kmesg and add dmesg for the emergency_shell
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 01/10] add binutiles requirement to specfile (because of nm) Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
[not found] ` <1246639520-3094-3-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 03/10] Defer mount to the real mount loop Harald Hoyer
` (7 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
---
modules.d/99base/init | 9 ++++++++-
modules.d/99base/install | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 701706d..b49ba21 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -7,6 +7,8 @@
emergency_shell()
{
+ exec >/dev/console 2>&1 </dev/console
+ getarg rdinitdebug || dmesg
source_all emergency
echo ; echo
echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
@@ -64,7 +66,12 @@ if [ ! -c /dev/ptmx ]; then
fi
fi
-getarg rdinitdebug && set -x
+if getarg rdinitdebug; then
+ set -x
+else
+ exec >/dev/kmsg 2>&1
+fi
+
mkdir /dev/shm
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
diff --git a/modules.d/99base/install b/modules.d/99base/install
index ff15200..4ecba9c 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -1,5 +1,5 @@
#!/bin/bash
-dracut_install mount mknod mkdir modprobe pidof sleep chroot sed ls flock cp mv
+dracut_install mount mknod mkdir modprobe pidof sleep chroot sed ls flock cp mv dmesg
if [ ! -e "${initdir}/bin/sh" ]; then
dracut_install bash
(ln -s bash "${initdir}/bin/sh" || :)
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/10] Defer mount to the real mount loop
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 01/10] add binutiles requirement to specfile (because of nm) Harald Hoyer
2009-07-03 16:45 ` [PATCH 02/10] output everything to /dev/kmesg and add dmesg for the emergency_shell Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
[not found] ` <1246639520-3094-4-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 04/10] remove 50plymouth-pre0.7 module Harald Hoyer
` (6 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
Udev rules set a /dev/root symlink to the real root and add
a mount script to /mount/. This enables the proper use of pre-mount
scripts and prevents mount being killed by a udev timeout.
---
modules.d/40network/net-genrules.sh | 8 ++++----
modules.d/95debug/install | 2 +-
modules.d/95iscsi/iscsiroot | 2 +-
modules.d/95nbd/nbdroot | 7 ++++---
modules.d/95nfs/nfsroot | 23 +++++++++++++----------
modules.d/95rootfs-block/block-genrules.sh | 8 ++++----
modules.d/99base/init | 9 ++++++++-
7 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
index f843c53..dbd0474 100755
--- a/modules.d/40network/net-genrules.sh
+++ b/modules.d/40network/net-genrules.sh
@@ -19,20 +19,20 @@ fix_bootif() {
BOOTIF=$(getarg 'BOOTIF=')
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(fix_bootif "$BOOTIF")
- printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue /sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
+ printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
- printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/initqueue /sbin/ifup $env{INTERFACE}"\n' "$iface"
+ printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
done
# Default: We don't know the interface to use, handle all
else
- printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/initqueue /sbin/ifup $env{INTERFACE}"\n'
+ printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
fi
# Udev event 'online' only gets fired from ifup/dhclient-script.
# No special rules required
- printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/initqueue /sbin/netroot $env{INTERFACE}"\n'
+ printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/netroot $env{INTERFACE}"\n'
} > /etc/udev/rules.d/60-net.rules
diff --git a/modules.d/95debug/install b/modules.d/95debug/install
index 33a724d..6d4f089 100755
--- a/modules.d/95debug/install
+++ b/modules.d/95debug/install
@@ -1,3 +1,3 @@
#!/bin/bash
-dracut_install ln ps grep more dmesg cat rm strace free showmount
+dracut_install ln ps grep more cat rm strace free showmount
dracut_install ping netstat rpcinfo
diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
index 8ee7cbc..316d8f4 100755
--- a/modules.d/95iscsi/iscsiroot
+++ b/modules.d/95iscsi/iscsiroot
@@ -122,7 +122,7 @@ echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
# FIXME $iscsi_protocol??
-echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/iscsi.sh
+echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/01-$$-iscsi.sh
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
-g $iscsi_target_group -a $iscsi_target_ip \
diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
index ad2e906..ecac211 100755
--- a/modules.d/95nbd/nbdroot
+++ b/modules.d/95nbd/nbdroot
@@ -93,9 +93,10 @@ 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 [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
- printf 'KERNEL=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s %s %s"\n' \
- nbd0 "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
- > /etc/udev/rules.d/99-mount.rules
+ printf 'KERNEL=="nbd0", SYMLINK+="root"\n'> /etc/udev/rules.d/99-mount.rules
+ printf '/bin/mount -t %s -o %s %s %s\n' \
+ "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
+ > /mount/01-$$-nbd.sh
fi
nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index 0da8ee3..5f5b08f 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -142,14 +142,17 @@ if [ "$nfs" = "nfs4" ]; then
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
# XXX Should we loop here?
- exec mount -t nfs4 -o$options${nfslock+,$nfslock} \
- $server:$path $NEWROOT
-fi
-
-# NFSv{2,3} doesn't support using locks as it requires a helper to transfer
-# the rpcbind state to the new root
-[ "$nfslock" = "lock" ] && \
- warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
+ echo mount -t nfs4 -o$options${nfslock+,$nfslock} \
+ $server:$path $NEWROOT > /mount/01-$$-nfs4.sh
+ [ -e /dev/root ] || >/dev/root
+else
+ # NFSv{2,3} doesn't support using locks as it requires a helper to transfer
+ # the rpcbind state to the new root
+ [ "$nfslock" = "lock" ] && \
+ warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
-# XXX Should we loop here?
-exec mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT
+ # XXX Should we loop here?
+ echo mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
+ > /mount/01-$$-nfs.sh
+ [ -e /dev/root ] || >/dev/root
+fi
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 2706dbb..5d1a669 100644
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -1,8 +1,8 @@
if [ "${root%%:*}" = "block" ]; then
(
- printf 'KERNEL=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s %s %s"\n' \
- ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
- printf 'SYMLINK=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s %s %s"\n' \
- ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
+ printf 'KERNEL=="%s", SYMLINK+="root"\n' \
+ ${root#block:/dev/}
+ printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
+ ${root#block:/dev/}
) >> /etc/udev/rules.d/99-mount.rules
fi
diff --git a/modules.d/99base/init b/modules.d/99base/init
index b49ba21..bb20220 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -22,8 +22,11 @@ do_initqueue()
# bail out, if we have mounted the root filesystem
[ -d "$NEWROOT/proc" ] && break;
+ # check if root can be mounted
+ [ -e /dev/root ] && break;
+
if [ $UDEVVERSION -ge 143 ]; then
- udevadm settle --exit-if-exists=/initqueue/work
+ udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
else
udevadm settle --timeout=30
fi
@@ -33,8 +36,12 @@ do_initqueue()
for job in /initqueue/*.job; do
. $job
rm -f $job
+
# bail out, if we have mounted the root filesystem
[ -d "$NEWROOT/proc" ] && break;
+
+ # check if root can be mounted
+ [ -e /dev/root ] && break;
done
done
}
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/10] remove 50plymouth-pre0.7 module
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (2 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 03/10] Defer mount to the real mount loop Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 05/10] add firmware packages to be required by the dracut-generic package Harald Hoyer
` (5 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
---
modules.d/50plymouth-pre0.7/63-luks.rules | 11 -------
modules.d/50plymouth-pre0.7/check | 3 --
modules.d/50plymouth-pre0.7/cryptroot-ask.sh | 4 --
modules.d/50plymouth-pre0.7/install | 8 -----
modules.d/50plymouth-pre0.7/plymouth-newroot.sh | 4 --
.../50plymouth-pre0.7/plymouth-populate-initrd | 25 ----------------
modules.d/50plymouth-pre0.7/plymouth-start.sh | 31 --------------------
7 files changed, 0 insertions(+), 86 deletions(-)
delete mode 100644 modules.d/50plymouth-pre0.7/63-luks.rules
delete mode 100755 modules.d/50plymouth-pre0.7/check
delete mode 100755 modules.d/50plymouth-pre0.7/cryptroot-ask.sh
delete mode 100755 modules.d/50plymouth-pre0.7/install
delete mode 100755 modules.d/50plymouth-pre0.7/plymouth-newroot.sh
delete mode 100755 modules.d/50plymouth-pre0.7/plymouth-populate-initrd
delete mode 100755 modules.d/50plymouth-pre0.7/plymouth-start.sh
diff --git a/modules.d/50plymouth-pre0.7/63-luks.rules b/modules.d/50plymouth-pre0.7/63-luks.rules
deleted file mode 100644
index 711e865..0000000
--- a/modules.d/50plymouth-pre0.7/63-luks.rules
+++ /dev/null
@@ -1,11 +0,0 @@
-# hacky rules to try to try unlocking dm-crypt devs
-#
-# Copyright 2008, Red Hat, Inc.
-# Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
-
-
-SUBSYSTEM!="block", GOTO="luks_end"
-ACTION!="add|change", GOTO="luks_end"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
-
-LABEL="luks_end"
diff --git a/modules.d/50plymouth-pre0.7/check b/modules.d/50plymouth-pre0.7/check
deleted file mode 100755
index 018c0e9..0000000
--- a/modules.d/50plymouth-pre0.7/check
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-[[ $1 = -d ]] && echo crypt
-[[ -x /sbin/plymouthd && -x /bin/plymouth && ! /usr/sbin/plymouth-set-default-theme ]]
diff --git a/modules.d/50plymouth-pre0.7/cryptroot-ask.sh b/modules.d/50plymouth-pre0.7/cryptroot-ask.sh
deleted file mode 100755
index fadb502..0000000
--- a/modules.d/50plymouth-pre0.7/cryptroot-ask.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-[ -b /dev/mapper/$2 ] || exec /bin/plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
-
diff --git a/modules.d/50plymouth-pre0.7/install b/modules.d/50plymouth-pre0.7/install
deleted file mode 100755
index 4d3f7dc..0000000
--- a/modules.d/50plymouth-pre0.7/install
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-. "$moddir"/plymouth-populate-initrd
-inst_hook pre-udev 10 "$moddir"/plymouth-start.sh
-inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
-inst_rules "$moddir/63-luks.rules"
-inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask
-inst cryptsetup
-
diff --git a/modules.d/50plymouth-pre0.7/plymouth-newroot.sh b/modules.d/50plymouth-pre0.7/plymouth-newroot.sh
deleted file mode 100755
index c6f8c6d..0000000
--- a/modules.d/50plymouth-pre0.7/plymouth-newroot.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-[ -x /bin/plymouth ] && /bin/plymouth --newroot=$NEWROOT
-
diff --git a/modules.d/50plymouth-pre0.7/plymouth-populate-initrd b/modules.d/50plymouth-pre0.7/plymouth-populate-initrd
deleted file mode 100755
index 1802b25..0000000
--- a/modules.d/50plymouth-pre0.7/plymouth-populate-initrd
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-if ldd /sbin/plymouthd |grep -q lib64; then
- LIBDIR="/usr/lib64"
-else
- LIBDIR="/usr/lib"
-fi
-PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
-PLYMOUTH_PLUGIN_NAME=$(plymouth-set-default-plugin)
-
-inst /sbin/plymouthd /bin/plymouthd
-dracut_install /bin/plymouth "${LIBDIR}/plymouth/text.so" \
- "${LIBDIR}/plymouth/details.so" "${PLYMOUTH_LOGO_FILE}" \
- /etc/system-release "${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN_NAME:=text}.so"
-mkdir -p "${initdir}/usr/share/plymouth"
-
-[[ -f ${LIBDIR}/plymouth/default.so ]] && inst ${LIBDIR}/plymouth/default.so
-
-if [[ -d /usr/share/plymouth/${PLYMOUTH_PLUGIN_NAME} ]]; then
- for x in "/usr/share/plymouth/${PLYMOUTH_PLUGIN_NAME}"/* ; do
- [[ -f "$x" ]] || break
- inst $x
- done
-fi
-
-# vim:ts=8:sw=4:sts=4:et
diff --git a/modules.d/50plymouth-pre0.7/plymouth-start.sh b/modules.d/50plymouth-pre0.7/plymouth-start.sh
deleted file mode 100755
index 310042d..0000000
--- a/modules.d/50plymouth-pre0.7/plymouth-start.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-[ -c /dev/null ] || mknod /dev/null c 1 3
-mknod /dev/zero c 1 5
-mknod /dev/systty c 4 0
-mknod /dev/tty c 5 0
-[ -c /dev/console ] || mknod /dev/console c 5 1
-[ -c /dev/ptmx ] || mknod /dev/ptmx c 5 2
-mknod /dev/fb c 29 0
-mknod /dev/tty0 c 4 0
-mknod /dev/tty1 c 4 1
-mknod /dev/tty2 c 4 2
-mknod /dev/tty3 c 4 3
-mknod /dev/tty4 c 4 4
-mknod /dev/tty5 c 4 5
-mknod /dev/tty6 c 4 6
-mknod /dev/tty7 c 4 7
-mknod /dev/tty8 c 4 8
-mknod /dev/tty9 c 4 9
-mknod /dev/tty10 c 4 10
-mknod /dev/tty11 c 4 11
-mknod /dev/tty12 c 4 12
-mknod /dev/ttyS0 c 4 64
-mknod /dev/ttyS1 c 4 65
-mknod /dev/ttyS2 c 4 66
-mknod /dev/ttyS3 c 4 67
-/lib/udev/console_init tty0
-
-[ -x /bin/plymouthd ] && /bin/plymouthd
-[ -x /bin/plymouth ] && /bin/plymouth --show-splash
-
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/10] add firmware packages to be required by the dracut-generic package
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (3 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 04/10] remove 50plymouth-pre0.7 module Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 06/10] add rm to be installed for initqueue Harald Hoyer
` (4 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
---
dracut.spec | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index 3e33819..4fae92b 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -60,12 +60,17 @@ Requires: rpcbind nfs-utils
Requires: iscsi-initiator-utils
Requires: nbd
Requires: net-tools iproute
+Requires: kernel-firmware
+Requires: ql2100-firmware
+Requires: ql2200-firmware
+Requires: ql23xx-firmware
+Requires: ql2400-firmware
+Requires: ql2500-firmware
%description generic
This package requires everything which is needed to build a generic
all purpose initramfs.
-
%prep
%setup -q -n %{name}-%{version}%{?dashgittag}
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/10] add rm to be installed for initqueue
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (4 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 05/10] add firmware packages to be required by the dracut-generic package Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 07/10] fail iscsiroot, if iscsistart fails Harald Hoyer
` (3 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
---
modules.d/99base/install | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/install b/modules.d/99base/install
index 4ecba9c..3f5b29a 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -1,5 +1,6 @@
#!/bin/bash
-dracut_install mount mknod mkdir modprobe pidof sleep chroot sed ls flock cp mv dmesg
+dracut_install mount mknod mkdir modprobe pidof sleep chroot \
+ sed ls flock cp mv dmesg rm
if [ ! -e "${initdir}/bin/sh" ]; then
dracut_install bash
(ln -s bash "${initdir}/bin/sh" || :)
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/10] fail iscsiroot, if iscsistart fails
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (5 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 06/10] add rm to be installed for initqueue Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 08/10] put back the nfs mount in the udev event Harald Hoyer
` (2 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
---
modules.d/95iscsi/iscsiroot | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
index 316d8f4..b7e3cf8 100755
--- a/modules.d/95iscsi/iscsiroot
+++ b/modules.d/95iscsi/iscsiroot
@@ -130,7 +130,7 @@ iscsistart -i $iscsi_initiator -t $iscsi_target_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_in_password+-W $iscsi_in_password} || exit 1
# now we have a root filesystem somewhere in /dev/sda*
# let the normal block handler handle root=
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/10] put back the nfs mount in the udev event
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (6 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 07/10] fail iscsiroot, if iscsistart fails Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
[not found] ` <1246639520-3094-9-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 09/10] initqueue now loops until /dev/root exists or root is mounted Harald Hoyer
2009-07-03 16:45 ` [PATCH 10/10] add "rdshell" command line argument Harald Hoyer
9 siblings, 1 reply; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
it solves the following case:
root=/dev/nfs nfsroot=server:/path
- the server could be reachable on any interface
- any interface can get an IP by dhcp
- only one IP is allowed to mount the root
---
modules.d/95nfs/nfsroot | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index 5f5b08f..0add977 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -142,9 +142,9 @@ if [ "$nfs" = "nfs4" ]; then
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
# XXX Should we loop here?
- echo mount -t nfs4 -o$options${nfslock+,$nfslock} \
- $server:$path $NEWROOT > /mount/01-$$-nfs4.sh
- [ -e /dev/root ] || >/dev/root
+ mount -t nfs4 -o$options${nfslock+,$nfslock} \
+ $server:$path $NEWROOT \
+ && { [ -e /dev/root ] || >/dev/root ; }
else
# NFSv{2,3} doesn't support using locks as it requires a helper to transfer
# the rpcbind state to the new root
@@ -152,7 +152,6 @@ else
warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
# XXX Should we loop here?
- echo mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
- > /mount/01-$$-nfs.sh
- [ -e /dev/root ] || >/dev/root
+ mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
+ && { [ -e /dev/root ] || >/dev/root ; }
fi
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/10] initqueue now loops until /dev/root exists or root is mounted
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (7 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 08/10] put back the nfs mount in the udev event Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
[not found] ` <1246639520-3094-10-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 10/10] add "rdshell" command line argument Harald Hoyer
9 siblings, 1 reply; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
init now has the following points to inject scripts:
/cmdline/*.sh
scripts for command line parsing
/pre-udev/*.sh
scripts to run before udev is started
/pre-trigger/*.sh
scripts to run before the main udev trigger is pulled
/initqueue/*.sh
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
If /initqueue/work is created and udev >= 143 then this loop can
process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
/pre-mount/*.sh
scripts to run before the root filesystem is mounted
NFS is an exception, because it has no device node to be created
and mounts in the udev events
/mount/*.sh
scripts to mount the root filesystem
NFS is an exception, because it has no device node to be created
and mounts in the udev events
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
/pre-pivot/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
The behaviour of the dmraid module demonstrates how to use the new
mechanism. If it detects a device which is part of a raidmember from a
udev rule, it installs a job to scan for dmraid devices, if the udev
queue is empty. After a scan, it removes itsself from the queue.
---
modules.d/50plymouth/63-luks.rules | 2 +-
modules.d/90crypt/70-luks.rules | 2 +-
modules.d/90dmraid/61-dmraid.rules | 12 ++++
modules.d/90dmraid/dmraid.sh | 3 -
modules.d/90dmraid/dmraid_scan | 8 +++
modules.d/90dmraid/install | 3 +-
modules.d/95rootfs-block/block-genrules.sh | 4 ++
modules.d/95rootfs-block/install | 1 +
modules.d/99base/init | 82 +++++++++++++++-------------
modules.d/99base/initqueue | 11 +++-
test/TEST-10-RAID/test.sh | 2 +-
test/TEST-30-ISCSI/test.sh | 2 +-
test/TEST-40-NBD/test.sh | 2 +-
13 files changed, 85 insertions(+), 49 deletions(-)
create mode 100644 modules.d/90dmraid/61-dmraid.rules
delete mode 100644 modules.d/90dmraid/dmraid.sh
create mode 100755 modules.d/90dmraid/dmraid_scan
diff --git a/modules.d/50plymouth/63-luks.rules b/modules.d/50plymouth/63-luks.rules
index c3c6627..f55bf39 100644
--- a/modules.d/50plymouth/63-luks.rules
+++ b/modules.d/50plymouth/63-luks.rules
@@ -7,6 +7,6 @@
SUBSYSTEM!="block", GOTO="luks_end"
ACTION!="add|change", GOTO="luks_end"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --onetime /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
LABEL="luks_end"
diff --git a/modules.d/90crypt/70-luks.rules b/modules.d/90crypt/70-luks.rules
index c3c6627..f55bf39 100644
--- a/modules.d/90crypt/70-luks.rules
+++ b/modules.d/90crypt/70-luks.rules
@@ -7,6 +7,6 @@
SUBSYSTEM!="block", GOTO="luks_end"
ACTION!="add|change", GOTO="luks_end"
-ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
+ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --onetime /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
LABEL="luks_end"
diff --git a/modules.d/90dmraid/61-dmraid.rules b/modules.d/90dmraid/61-dmraid.rules
new file mode 100644
index 0000000..a8034db
--- /dev/null
+++ b/modules.d/90dmraid/61-dmraid.rules
@@ -0,0 +1,12 @@
+# This file causes block devices with Linux RAID (mdadm) signatures to
+# automatically cause mdadm to be run.
+# See udev(8) for syntax
+
+SUBSYSTEM!="block", GOTO="dm_end"
+ACTION!="add|change", GOTO="dm_end"
+
+ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
+
+ENV{ID_FS_TYPE}=="*_raid_member", RUN+="/sbin/initqueue /sbin/dmraid_scan"
+
+LABEL="dm_end"
diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh
deleted file mode 100644
index 4e2d5bf..0000000
--- a/modules.d/90dmraid/dmraid.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-dmraid -ay -Z
-udevadm settle --timeout=30 >/dev/null 2>&1
-
diff --git a/modules.d/90dmraid/dmraid_scan b/modules.d/90dmraid/dmraid_scan
new file mode 100755
index 0000000..433e5d3
--- /dev/null
+++ b/modules.d/90dmraid/dmraid_scan
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if udevadm settle --timeout=0 >/dev/null 2>&1; then
+ # run dmraid if udev has settled
+ dmraid -ay -Z
+ [ -e "$job" ] && rm -f "$job"
+fi
+
diff --git a/modules.d/90dmraid/install b/modules.d/90dmraid/install
index 636f1d2..9314c00 100755
--- a/modules.d/90dmraid/install
+++ b/modules.d/90dmraid/install
@@ -1,4 +1,5 @@
#!/bin/bash
dracut_install dmraid
-inst_hook pre-mount 10 "$moddir/dmraid.sh"
+inst "$moddir/dmraid_scan" /sbin/dmraid_scan
inst_rules 64-md-raid.rules
+inst_rules "$moddir/61-dmraid.rules"
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 5d1a669..10471ea 100644
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -5,4 +5,8 @@ if [ "${root%%:*}" = "block" ]; then
printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
${root#block:/dev/}
) >> /etc/udev/rules.d/99-mount.rules
+ (
+ printf '[ -e "%s" ] && { ln -s "%s" /dev/root; rm "$job"; }\n' \
+ "${root#block:}" "${root#block:}"
+ ) >> /initqueue/blocksymlink.sh
fi
diff --git a/modules.d/95rootfs-block/install b/modules.d/95rootfs-block/install
index 618d357..d6c161a 100755
--- a/modules.d/95rootfs-block/install
+++ b/modules.d/95rootfs-block/install
@@ -1,4 +1,5 @@
#!/bin/sh
+dracut_install ln
inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
diff --git a/modules.d/99base/init b/modules.d/99base/init
index bb20220..f082765 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -16,36 +16,6 @@ emergency_shell()
sh -i
}
-do_initqueue()
-{
- while :; do
- # bail out, if we have mounted the root filesystem
- [ -d "$NEWROOT/proc" ] && break;
-
- # check if root can be mounted
- [ -e /dev/root ] && break;
-
- if [ $UDEVVERSION -ge 143 ]; then
- udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
- else
- udevadm settle --timeout=30
- fi
- [ -f /initqueue/work ] || break
- rm /initqueue/work
-
- for job in /initqueue/*.job; do
- . $job
- rm -f $job
-
- # bail out, if we have mounted the root filesystem
- [ -d "$NEWROOT/proc" ] && break;
-
- # check if root can be mounted
- [ -e /dev/root ] && break;
- done
- done
-}
-
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
NEWROOT="/sysroot"
@@ -116,7 +86,47 @@ source_all pre-trigger
# then the rest
udevadm trigger $udevtriggeropts >/dev/null 2>&1
-do_initqueue
+i=0
+while :; do
+ # bail out, if we have mounted the root filesystem
+ [ -d "$NEWROOT/proc" ] && break;
+
+ # check if root can be mounted
+ [ -e /dev/root ] && break;
+
+ if [ $UDEVVERSION -ge 143 ]; then
+ udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
+ else
+ udevadm settle --timeout=30
+ fi
+ unset queuetriggered
+ if [ -f /initqueue/work ]; then
+ rm /initqueue/work
+ queuetriggered="1"
+ fi
+
+ for job in /initqueue/*.sh; do
+ [ -e "$job" ] || break
+ job=$job . $job
+
+ # bail out, if we have mounted the root filesystem
+ [ -d "$NEWROOT/proc" ] && break;
+ # check if root can be mounted
+ [ -e /dev/root ] && break;
+ done
+
+ [ -n "$queuetriggered" ] && continue
+
+ if udevadm settle --timeout=0 >/dev/null 2>&1; then
+ # no more udev jobs
+ sleep 0.5
+ i=$(($i+1))
+ [ $i -gt 20 ] && getarg rdshell \
+ && { flock -s 9 ; emergency_shell; } 9>/.console_lock
+ fi
+done
+unset job
+unset queuetriggered
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
@@ -124,23 +134,19 @@ getarg 'rdbreak=pre-mount' && emergency_shell
source_all pre-mount
getarg 'rdbreak=mount' && emergency_shell
-do_initqueue
-
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
while :; do
[ -d "$NEWROOT/proc" ] && break;
-
for f in /mount/*.sh; do
[ -f "$f" ] && . "$f"
- do_initqueue
- [ "$ROOTFS_MOUNTED" ] && break;
+ [ -d "$NEWROOT/proc" ] && break;
done
- sleep 0.5
i=$(($i+1))
- { flock -s 9 ; [ $i -gt 20 ] && emergency_shell; } 9>/.console_lock
+ [ $i -gt 20 ] && getarg rdshell \
+ && { flock -s 9 ; emergency_shell; } 9>/.console_lock
done
# pre pivot scripts are sourced just before we switch over to the new root.
diff --git a/modules.d/99base/initqueue b/modules.d/99base/initqueue
index 0a760b7..a5c6ef6 100755
--- a/modules.d/99base/initqueue
+++ b/modules.d/99base/initqueue
@@ -1,5 +1,12 @@
#!/bin/sh
-echo "$@" > /tmp/$$.job
-mv /tmp/$$.job /initqueue/
+if [ "$1" = "--onetime" ]; then
+ onetime="yes"
+ shift
+fi
+echo "$@" > /tmp/$$.sh
+if [ -n "$onetime" ]; then
+ echo '[ -e "$job" ] && rm "$job"' >> /tmp/$$.sh
+fi
+mv /tmp/$$.sh /initqueue/
>> /initqueue/work
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index 23f9aff..700c377 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -38,7 +38,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
- inst_simple ./create-root.sh /pre-mount/01create-root.sh
+ inst_simple ./create-root.sh /initqueue/01create-root.sh
)
# create an initramfs that will create the target root filesystem.
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 6469950..d9da529 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -81,7 +81,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
- inst_simple ./create-root.sh /pre-mount/01create-root.sh
+ inst_simple ./create-root.sh /initqueue/01create-root.sh
)
# create an initramfs that will create the target root filesystem.
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index 2f54511..07de7fe 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -184,7 +184,7 @@ make_encrypted_root() {
initdir=overlay
. $basedir/dracut-functions
dracut_install mke2fs poweroff cp umount
- inst_simple ./create-root.sh /pre-mount/01create-root.sh
+ inst_simple ./create-root.sh /initqueue/01create-root.sh
)
# create an initramfs that will create the target root filesystem.
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/10] add "rdshell" command line argument
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
` (8 preceding siblings ...)
2009-07-03 16:45 ` [PATCH 09/10] initqueue now loops until /dev/root exists or root is mounted Harald Hoyer
@ 2009-07-03 16:45 ` Harald Hoyer
[not found] ` <1246639520-3094-11-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
9 siblings, 1 reply; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 16:45 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Harald Hoyer
Only drop to an interactive shell if "rdshell" is specified on the
command line. This prevents malicious users from gaining easy shell
access to the host system (grub might be secured with a password).
---
dracut.8 | 3 +++
modules.d/99base/init | 37 ++++++++++++++++++++++---------------
test/TEST-10-RAID/test.sh | 2 +-
test/TEST-20-NFS/test.sh | 2 +-
test/TEST-30-ISCSI/test.sh | 2 +-
test/TEST-40-NBD/test.sh | 2 +-
6 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/dracut.8 b/dracut.8
index 4bf29a7..4d6ac29 100644
--- a/dracut.8
+++ b/dracut.8
@@ -167,6 +167,9 @@ do not load kernel module <drivername>
.SH Debug
.TP
+.B rdshell
+drop to a shell, if the imitramfs fails
+.TP
.B rdinitdebug
set -x for the dracut shell
.TP
diff --git a/modules.d/99base/init b/modules.d/99base/init
index f082765..cc42527 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -8,19 +8,25 @@
emergency_shell()
{
exec >/dev/console 2>&1 </dev/console
+ echo ; echo
+ echo $@
getarg rdinitdebug || dmesg
source_all emergency
- echo ; echo
- echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
- echo
- sh -i
+ if getarg rdshell; then
+ echo ; echo
+ echo "Dropping to a shell. Good luck!"
+ echo
+ sh -i
+ else
+ while :; do sleep 1;done
+ fi
}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
NEWROOT="/sysroot"
-trap "emergency_shell" 0
+trap "emergency_shell Unkown signal caught!" 0
. /lib/dracut-lib.sh
@@ -56,7 +62,7 @@ mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
UDEVVERSION=$(udevadm --version)
# run scriptlets to parse the command line
-getarg 'rdbreak=cmdline' && emergency_shell
+getarg 'rdbreak=cmdline' && emergency_shell "Break before cmdline"
source_all cmdline
[ -z "$root" ] && die "No or empty root= argument"
@@ -73,7 +79,7 @@ source_all cmdline
} > /tmp/root.info
# pre-udev scripts run before udev starts, and are run only once.
-getarg 'rdbreak=pre-udev' && emergency_shell
+getarg 'rdbreak=pre-udev' && emergency_shell "Break before pre-udev"
source_all pre-udev
# start up udev and trigger cold plugs
@@ -121,8 +127,8 @@ while :; do
# no more udev jobs
sleep 0.5
i=$(($i+1))
- [ $i -gt 20 ] && getarg rdshell \
- && { flock -s 9 ; emergency_shell; } 9>/.console_lock
+ [ $i -gt 20 ] \
+ && { flock -s 9 ; emergency_shell "No root device found"; } 9>/.console_lock
fi
done
unset job
@@ -130,10 +136,11 @@ unset queuetriggered
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
-getarg 'rdbreak=pre-mount' && emergency_shell
+getarg 'rdbreak=pre-mount' && emergency_shell "Break pre-mount"
source_all pre-mount
-getarg 'rdbreak=mount' && emergency_shell
+
+getarg 'rdbreak=mount' && emergency_shell "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
@@ -145,8 +152,8 @@ while :; do
done
i=$(($i+1))
- [ $i -gt 20 ] && getarg rdshell \
- && { flock -s 9 ; emergency_shell; } 9>/.console_lock
+ [ $i -gt 20 ] \
+ && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
done
# pre pivot scripts are sourced just before we switch over to the new root.
@@ -159,8 +166,8 @@ for i in "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
[ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
done
[ "$INIT" ] || {
- echo "Cannot find init! Please check to make sure you passed"
- echo "a valid root filesystem! Dropping to a shell."
+ echo "Cannot find init!"
+ echo "Please check to make sure you passed a valid root filesystem!"
emergency_shell
}
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index 700c377..fbad51a 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -9,7 +9,7 @@ KVERSION=${KVERSION-$(uname -r)}
test_run() {
$testdir/run-qemu -hda root.ext2 -m 256M -nographic \
-net none -kernel /boot/vmlinuz-$KVERSION \
- -append "root=/dev/dracut/root rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
+ -append "root=/dev/dracut/root rw quiet console=ttyS0,115200n81 rdshell $DEBUGFAIL" \
-initrd initramfs.testing
grep -m 1 -q dracut-root-block-success root.ext2 || return 1
}
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 4410751..1811eca 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -46,7 +46,7 @@ client_test() {
-net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
+ -append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
if [[ $? -ne 0 ]] || ! grep -m 1 -q nfs-OK client.img; then
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index d9da529..440cd16 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -37,7 +37,7 @@ run_client() {
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net socket,mcast=230.0.0.1:1235 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "root=dhcp rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
+ -append "root=dhcp rw quiet console=ttyS0,115200n81 rdshell $DEBUGFAIL" \
-initrd initramfs.testing
grep -m 1 -q iscsi-OK client.img || return 1
}
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index 07de7fe..c3d8bfc 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -50,7 +50,7 @@ client_test() {
-net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1236 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
+ -append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
if [[ $? -ne 0 ]] || ! grep -m 1 -q nbd-OK flag.img; then
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 02/10] output everything to /dev/kmesg and add dmesg for the emergency_shell
[not found] ` <1246639520-3094-3-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-03 18:11 ` David Dillow
[not found] ` <1246644686.13823.5.camel-1q1vX8mYZiGLUyTwlgNVppKKF0rrzTr+@public.gmane.org>
0 siblings, 1 reply; 21+ messages in thread
From: David Dillow @ 2009-07-03 18:11 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On Fri, 2009-07-03 at 18:45 +0200, Harald Hoyer wrote:
> diff --git a/modules.d/99base/init b/modules.d/99base/init
> index 701706d..b49ba21 100755
> --- a/modules.d/99base/init
> +++ b/modules.d/99base/init
> @@ -7,6 +7,8 @@
>
> emergency_shell()
> {
> + exec >/dev/console 2>&1 </dev/console
> + getarg rdinitdebug || dmesg
Ugh, please no. If I want dmesg output in my emergency shell, I can type
'dmesg'. Doing it for me means I may push valuable information from
rdinitdebug out of my scrollback buffer before I've had a chance to
review it and write it down.
Also, this adds a dependency on dmesg to a stripped down install, which
is counter to (my) goal of a smaller initramfs over time.
> -getarg rdinitdebug && set -x
> +if getarg rdinitdebug; then
> + set -x
> +else
> + exec >/dev/kmsg 2>&1
> +fi
I'm really not happy about polluting the kernel message source with
dracut messages. I know it is convenient, but in my opinion, dmesg
should only show me kernel messages, not a mixture of kernel and
userspace.
At the very least, we need to add an indication that the message is from
dracut, not the kernel.
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 02/10] output everything to /dev/kmesg and add dmesg for the emergency_shell
[not found] ` <1246644686.13823.5.camel-1q1vX8mYZiGLUyTwlgNVppKKF0rrzTr+@public.gmane.org>
@ 2009-07-03 18:14 ` Harald Hoyer
0 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-03 18:14 UTC (permalink / raw)
To: David Dillow; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]
Am 03.07.2009 20:11, schrieb David Dillow:
> On Fri, 2009-07-03 at 18:45 +0200, Harald Hoyer wrote:
>
>> diff --git a/modules.d/99base/init b/modules.d/99base/init
>> index 701706d..b49ba21 100755
>> --- a/modules.d/99base/init
>> +++ b/modules.d/99base/init
>> @@ -7,6 +7,8 @@
>>
>> emergency_shell()
>> {
>> + exec>/dev/console 2>&1</dev/console
>> + getarg rdinitdebug || dmesg
>
> Ugh, please no. If I want dmesg output in my emergency shell, I can type
> 'dmesg'. Doing it for me means I may push valuable information from
> rdinitdebug out of my scrollback buffer before I've had a chance to
> review it and write it down.
ok
>
> Also, this adds a dependency on dmesg to a stripped down install, which
> is counter to (my) goal of a smaller initramfs over time.
>
>> -getarg rdinitdebug&& set -x
>> +if getarg rdinitdebug; then
>> + set -x
>> +else
>> + exec>/dev/kmsg 2>&1
>> +fi
>
> I'm really not happy about polluting the kernel message source with
> dracut messages. I know it is convenient, but in my opinion, dmesg
> should only show me kernel messages, not a mixture of kernel and
> userspace.
>
> At the very least, we need to add an indication that the message is from
> dracut, not the kernel.
hmm, ok
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3636 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 03/10] Defer mount to the real mount loop
[not found] ` <1246639520-3094-4-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-04 12:29 ` Seewer Philippe
[not found] ` <4A4F4B41.2060205-omB+W0Dpw2o@public.gmane.org>
0 siblings, 1 reply; 21+ messages in thread
From: Seewer Philippe @ 2009-07-04 12:29 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
Harald Hoyer wrote:
> Udev rules set a /dev/root symlink to the real root and add
> a mount script to /mount/. This enables the proper use of pre-mount
> scripts and prevents mount being killed by a udev timeout.
This looks look good. Network initialization now done asynchronously and
in parallel again. Thank you!
Some comments below.
> ---
> modules.d/40network/net-genrules.sh | 8 ++++----
> modules.d/95debug/install | 2 +-
> modules.d/95iscsi/iscsiroot | 2 +-
> modules.d/95nbd/nbdroot | 7 ++++---
> modules.d/95nfs/nfsroot | 23 +++++++++++++----------
> modules.d/95rootfs-block/block-genrules.sh | 8 ++++----
> modules.d/99base/init | 9 ++++++++-
> 7 files changed, 35 insertions(+), 24 deletions(-)
>
> diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
> index f843c53..dbd0474 100755
> --- a/modules.d/40network/net-genrules.sh
> +++ b/modules.d/40network/net-genrules.sh
> @@ -19,20 +19,20 @@ fix_bootif() {
> BOOTIF=$(getarg 'BOOTIF=')
> if [ -n "$BOOTIF" ] ; then
> BOOTIF=$(fix_bootif "$BOOTIF")
> - printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue /sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
> + printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
>
> # If we have to handle multiple interfaces, handle only them.
> elif [ -n "$IFACES" ] ; then
> for iface in $IFACES ; do
> - printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/initqueue /sbin/ifup $env{INTERFACE}"\n' "$iface"
> + printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
> done
>
> # Default: We don't know the interface to use, handle all
> else
> - printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/initqueue /sbin/ifup $env{INTERFACE}"\n'
> + printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
> fi
>
> # Udev event 'online' only gets fired from ifup/dhclient-script.
> # No special rules required
> - printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/initqueue /sbin/netroot $env{INTERFACE}"\n'
> + printf 'ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/netroot $env{INTERFACE}"\n'
> } > /etc/udev/rules.d/60-net.rules
> diff --git a/modules.d/95debug/install b/modules.d/95debug/install
> index 33a724d..6d4f089 100755
> --- a/modules.d/95debug/install
> +++ b/modules.d/95debug/install
> @@ -1,3 +1,3 @@
> #!/bin/bash
> -dracut_install ln ps grep more dmesg cat rm strace free showmount
> +dracut_install ln ps grep more cat rm strace free showmount
> dracut_install ping netstat rpcinfo
> diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
> index 8ee7cbc..316d8f4 100755
> --- a/modules.d/95iscsi/iscsiroot
> +++ b/modules.d/95iscsi/iscsiroot
> @@ -122,7 +122,7 @@ echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
>
> # FIXME $iscsi_protocol??
>
> -echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/iscsi.sh
> +echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/01-$$-iscsi.sh
I'd do that after iscsistart. That way the file is only written if
iscsistart succeeded.
>
> iscsistart -i $iscsi_initiator -t $iscsi_target_name \
> -g $iscsi_target_group -a $iscsi_target_ip \
> diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
> index ad2e906..ecac211 100755
> --- a/modules.d/95nbd/nbdroot
> +++ b/modules.d/95nbd/nbdroot
> @@ -93,9 +93,10 @@ 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 [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
> - printf 'KERNEL=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s %s %s"\n' \
> - nbd0 "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
> - > /etc/udev/rules.d/99-mount.rules
> + printf 'KERNEL=="nbd0", SYMLINK+="root"\n'> /etc/udev/rules.d/99-mount.rules
> + printf '/bin/mount -t %s -o %s %s %s\n' \
> + "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
> + > /mount/01-$$-nbd.sh
> fi
Same here, I'd only write a mount-script if nbdclient succeeds.
>
> nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
> diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
> index 0da8ee3..5f5b08f 100755
> --- a/modules.d/95nfs/nfsroot
> +++ b/modules.d/95nfs/nfsroot
> @@ -142,14 +142,17 @@ if [ "$nfs" = "nfs4" ]; then
> [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
>
> # XXX Should we loop here?
> - exec mount -t nfs4 -o$options${nfslock+,$nfslock} \
> - $server:$path $NEWROOT
> -fi
> -
> -# NFSv{2,3} doesn't support using locks as it requires a helper to transfer
> -# the rpcbind state to the new root
> -[ "$nfslock" = "lock" ] && \
> - warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
> + echo mount -t nfs4 -o$options${nfslock+,$nfslock} \
> + $server:$path $NEWROOT > /mount/01-$$-nfs4.sh
> + [ -e /dev/root ] || >/dev/root
> +else
> + # NFSv{2,3} doesn't support using locks as it requires a helper to transfer
> + # the rpcbind state to the new root
> + [ "$nfslock" = "lock" ] && \
> + warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
>
> -# XXX Should we loop here?
> -exec mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT
> + # XXX Should we loop here?
> + echo mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
> + > /mount/01-$$-nfs.sh
> + [ -e /dev/root ] || >/dev/root
> +fi
> diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
> index 2706dbb..5d1a669 100644
> --- a/modules.d/95rootfs-block/block-genrules.sh
> +++ b/modules.d/95rootfs-block/block-genrules.sh
> @@ -1,8 +1,8 @@
> if [ "${root%%:*}" = "block" ]; then
> (
> - printf 'KERNEL=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s %s %s"\n' \
> - ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
> - printf 'SYMLINK=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s %s %s"\n' \
> - ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
> + printf 'KERNEL=="%s", SYMLINK+="root"\n' \
> + ${root#block:/dev/}
> + printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
> + ${root#block:/dev/}
> ) >> /etc/udev/rules.d/99-mount.rules
> fi
> diff --git a/modules.d/99base/init b/modules.d/99base/init
> index b49ba21..bb20220 100755
> --- a/modules.d/99base/init
> +++ b/modules.d/99base/init
> @@ -22,8 +22,11 @@ do_initqueue()
> # bail out, if we have mounted the root filesystem
> [ -d "$NEWROOT/proc" ] && break;
>
> + # check if root can be mounted
> + [ -e /dev/root ] && break;
> +
> if [ $UDEVVERSION -ge 143 ]; then
> - udevadm settle --exit-if-exists=/initqueue/work
> + udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
> else
> udevadm settle --timeout=30
> fi
> @@ -33,8 +36,12 @@ do_initqueue()
> for job in /initqueue/*.job; do
> . $job
> rm -f $job
> +
> # bail out, if we have mounted the root filesystem
> [ -d "$NEWROOT/proc" ] && break;
> +
> + # check if root can be mounted
> + [ -e /dev/root ] && break;
> done
> done
> }
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 10/10] add "rdshell" command line argument
[not found] ` <1246639520-3094-11-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-06 1:53 ` Jeremy Katz
[not found] ` <20090706015313.GA70037-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 21+ messages in thread
From: Jeremy Katz @ 2009-07-06 1:53 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On Friday, July 03 2009, Harald Hoyer said:
> Only drop to an interactive shell if "rdshell" is specified on the
> command line. This prevents malicious users from gaining easy shell
> access to the host system (grub might be secured with a password).
I don't have a strong opinion about doing this vs not, but how could
they end up getting easy shell access? If grub is secured with a
password, they can't change kernel arguments. If they can change kernel
arguments, they can just add rdshell rather than change the root=
specifier.
Jeremy
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 08/10] put back the nfs mount in the udev event
[not found] ` <1246639520-3094-9-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-06 8:39 ` Seewer Philippe
0 siblings, 0 replies; 21+ messages in thread
From: Seewer Philippe @ 2009-07-06 8:39 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
Harald Hoyer wrote:
> it solves the following case:
>
> root=/dev/nfs nfsroot=server:/path
>
> - the server could be reachable on any interface
> - any interface can get an IP by dhcp
> - only one IP is allowed to mount the root
Thanks.
For the record, some further explanations:
If netroot is in "guess-the-interface-mode", netroot calls the
root-handler for each interface that has a useable IP configuration. If
the root-handler fails, the interface is deconfigured so that the next
interface netroot tries does not suffer from side-effects.
This is accomplished by depending on mount-handlers having an exit-code
telling us whether mounting (would) succeed or not. For devicefile based
network mounts, this isn't a problem since we need to call some sort of
client-utility that makes the device nodes available (or not if
contacting the server fails). For network-filesystems like NFS that do
not use devicefiles, the actual mount call is needed.
> ---
> modules.d/95nfs/nfsroot | 11 +++++------
> 1 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
> index 5f5b08f..0add977 100755
> --- a/modules.d/95nfs/nfsroot
> +++ b/modules.d/95nfs/nfsroot
> @@ -142,9 +142,9 @@ if [ "$nfs" = "nfs4" ]; then
> [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
>
> # XXX Should we loop here?
> - echo mount -t nfs4 -o$options${nfslock+,$nfslock} \
> - $server:$path $NEWROOT > /mount/01-$$-nfs4.sh
> - [ -e /dev/root ] || >/dev/root
> + mount -t nfs4 -o$options${nfslock+,$nfslock} \
> + $server:$path $NEWROOT \
> + && { [ -e /dev/root ] || >/dev/root ; }
> else
> # NFSv{2,3} doesn't support using locks as it requires a helper to transfer
> # the rpcbind state to the new root
> @@ -152,7 +152,6 @@ else
> warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
>
> # XXX Should we loop here?
> - echo mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
> - > /mount/01-$$-nfs.sh
> - [ -e /dev/root ] || >/dev/root
> + mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
> + && { [ -e /dev/root ] || >/dev/root ; }
> fi
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/10] initqueue now loops until /dev/root exists or root is mounted
[not found] ` <1246639520-3094-10-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-06 8:54 ` Seewer Philippe
[not found] ` <4A51BBE0.6030603-omB+W0Dpw2o@public.gmane.org>
0 siblings, 1 reply; 21+ messages in thread
From: Seewer Philippe @ 2009-07-06 8:54 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
Harald Hoyer wrote:
> init now has the following points to inject scripts:
>
> /cmdline/*.sh
> scripts for command line parsing
>
> /pre-udev/*.sh
> scripts to run before udev is started
>
> /pre-trigger/*.sh
> scripts to run before the main udev trigger is pulled
>
> /initqueue/*.sh
> runs in parallel to the udev trigger
> Udev events can add scripts here with /sbin/initqueue.
> If /sbin/initqueue is called with the "--onetime" option, the script
> will be removed after it was run.
> If /initqueue/work is created and udev >= 143 then this loop can
> process the jobs in parallel to the udevtrigger.
> If the udev queue is empty and no root device is found or no root
> filesystem was mounted, the user will be dropped to a shell after
> a timeout.
> Scripts can remove themselves from the initqueue by "rm $job".
I like this. It introduces a bit more complexity than I'd like, but
allows us to solves a lot of timeing issues between asynchronous and
parallel tasks in udev.
> /pre-mount/*.sh
> scripts to run before the root filesystem is mounted
> NFS is an exception, because it has no device node to be created
> and mounts in the udev events
Suggestion: If this description goes into a README or something similar,
I'd rewrite this as "...network filesystems like NFS that do not use
devicefiles are an exception,..."
> /mount/*.sh
> scripts to mount the root filesystem
> NFS is an exception, because it has no device node to be created
> and mounts in the udev events
Same here, although I'd just drop it since its already mentioned or
change it to say "network filesystems like NFS that do not use
devicefiles should mount directly inside their netroot root-handlers."
> If the udev queue is empty and no root device is found or no root
> filesystem was mounted, the user will be dropped to a shell after
> a timeout.
>
> /pre-pivot/*.sh
> scripts to run before the real init is executed and the initramfs
> disappears
> All processes started before should be killed here.
>
> The behaviour of the dmraid module demonstrates how to use the new
> mechanism. If it detects a device which is part of a raidmember from a
> udev rule, it installs a job to scan for dmraid devices, if the udev
> queue is empty. After a scan, it removes itsself from the queue.
[snip]
> diff --git a/modules.d/90dmraid/dmraid_scan b/modules.d/90dmraid/dmraid_scan
> new file mode 100755
> index 0000000..433e5d3
> --- /dev/null
> +++ b/modules.d/90dmraid/dmraid_scan
> @@ -0,0 +1,8 @@
> +#!/bin/sh
> +
> +if udevadm settle --timeout=0 >/dev/null 2>&1; then
> + # run dmraid if udev has settled
> + dmraid -ay -Z
> + [ -e "$job" ] && rm -f "$job"
> +fi
Please do not use 'udevadm settle timeout=0'. Older version of udev,
especially the one on debian lenny does not support a value of 0.
I suggest to increase that timeout to 1.
[snip]
> diff --git a/modules.d/99base/init b/modules.d/99base/init
> index bb20220..f082765 100755
> --- a/modules.d/99base/init
> +++ b/modules.d/99base/init
> @@ -16,36 +16,6 @@ emergency_shell()
> sh -i
> }
>
> -do_initqueue()
> -{
> - while :; do
> - # bail out, if we have mounted the root filesystem
> - [ -d "$NEWROOT/proc" ] && break;
> -
> - # check if root can be mounted
> - [ -e /dev/root ] && break;
> -
> - if [ $UDEVVERSION -ge 143 ]; then
> - udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
> - else
> - udevadm settle --timeout=30
> - fi
> - [ -f /initqueue/work ] || break
> - rm /initqueue/work
> -
> - for job in /initqueue/*.job; do
> - . $job
> - rm -f $job
> -
> - # bail out, if we have mounted the root filesystem
> - [ -d "$NEWROOT/proc" ] && break;
> -
> - # check if root can be mounted
> - [ -e /dev/root ] && break;
> - done
> - done
> -}
> -
> export PATH=/sbin:/bin:/usr/sbin:/usr/bin
> export TERM=linux
> NEWROOT="/sysroot"
> @@ -116,7 +86,47 @@ source_all pre-trigger
> # then the rest
> udevadm trigger $udevtriggeropts >/dev/null 2>&1
>
> -do_initqueue
> +i=0
> +while :; do
> + # bail out, if we have mounted the root filesystem
> + [ -d "$NEWROOT/proc" ] && break;
> +
> + # check if root can be mounted
> + [ -e /dev/root ] && break;
> +
> + if [ $UDEVVERSION -ge 143 ]; then
> + udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
> + else
> + udevadm settle --timeout=30
> + fi
> + unset queuetriggered
> + if [ -f /initqueue/work ]; then
> + rm /initqueue/work
> + queuetriggered="1"
> + fi
> +
> + for job in /initqueue/*.sh; do
> + [ -e "$job" ] || break
> + job=$job . $job
> +
> + # bail out, if we have mounted the root filesystem
> + [ -d "$NEWROOT/proc" ] && break;
> + # check if root can be mounted
> + [ -e /dev/root ] && break;
> + done
> +
> + [ -n "$queuetriggered" ] && continue
> +
> + if udevadm settle --timeout=0 >/dev/null 2>&1; then
Same here. Please increase the timeout to 1.
> + # no more udev jobs
> + sleep 0.5
> + i=$(($i+1))
> + [ $i -gt 20 ] && getarg rdshell \
> + && { flock -s 9 ; emergency_shell; } 9>/.console_lock
Question: Would it make sense to reset i to 0 after we've opened a
shell? Or is it the intention that if a shell is opened and closed that
we drop in again as soon as possible?
Regards,
Philippe
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 09/10] initqueue now loops until /dev/root exists or root is mounted
[not found] ` <4A51BBE0.6030603-omB+W0Dpw2o@public.gmane.org>
@ 2009-07-13 9:53 ` Harald Hoyer
0 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-13 9:53 UTC (permalink / raw)
To: Seewer Philippe; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 07/06/2009 10:54 AM, Seewer Philippe wrote:
> Suggestion: If this description goes into a README or something similar,
> I'd rewrite this as "...network filesystems like NFS that do not use
> devicefiles are an exception,..."
ok, will do
>
> Please do not use 'udevadm settle timeout=0'. Older version of udev,
> especially the one on debian lenny does not support a value of 0.
>
> I suggest to increase that timeout to 1.
>
ok, will do
> Question: Would it make sense to reset i to 0 after we've opened a
> shell? Or is it the intention that if a shell is opened and closed that
> we drop in again as soon as possible?
Well, if the user had a shell, he had the chance to find the real root, so I
don't think 20 more loops will solve the problem.
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 03/10] Defer mount to the real mount loop
[not found] ` <4A4F4B41.2060205-omB+W0Dpw2o@public.gmane.org>
@ 2009-07-13 10:21 ` Harald Hoyer
0 siblings, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-13 10:21 UTC (permalink / raw)
To: Seewer Philippe; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 07/04/2009 02:29 PM, Seewer Philippe wrote:
>> -echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/iscsi.sh
>> +echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/01-$$-iscsi.sh
>
> I'd do that after iscsistart. That way the file is only written if
> iscsistart succeeded.
right
>
>>
>> iscsistart -i $iscsi_initiator -t $iscsi_target_name \
>> -g $iscsi_target_group -a $iscsi_target_ip \
>> diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
>> index ad2e906..ecac211 100755
>> --- a/modules.d/95nbd/nbdroot
>> +++ b/modules.d/95nbd/nbdroot
>> @@ -93,9 +93,10 @@ 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 [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
>> - printf 'KERNEL=="%s", RUN+="/sbin/initqueue /bin/mount -t %s -o %s
>> %s %s"\n' \
>> - nbd0 "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
>> - > /etc/udev/rules.d/99-mount.rules
>> + printf 'KERNEL=="nbd0", SYMLINK+="root"\n'>
>> /etc/udev/rules.d/99-mount.rules
>> + printf '/bin/mount -t %s -o %s %s %s\n' \
>> + "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
>> + > /mount/01-$$-nbd.sh
>> fi
>
> Same here, I'd only write a mount-script if nbdclient succeeds.
yep
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 10/10] add "rdshell" command line argument
[not found] ` <20090706015313.GA70037-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-07-13 10:29 ` Harald Hoyer
2009-07-13 10:30 ` Harald Hoyer
1 sibling, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-13 10:29 UTC (permalink / raw)
To: Jeremy Katz; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 07/06/2009 03:53 AM, Jeremy Katz wrote:
> On Friday, July 03 2009, Harald Hoyer said:
>> Only drop to an interactive shell if "rdshell" is specified on the
>> command line. This prevents malicious users from gaining easy shell
>> access to the host system (grub might be secured with a password).
>
> I don't have a strong opinion about doing this vs not, but how could
> they end up getting easy shell access? If grub is secured with a
> password, they can't change kernel arguments. If they can change kernel
> arguments, they can just add rdshell rather than change the root=
> specifier.
>
> Jeremy
If root is on a network device, they can just unplug the network cable and end
up with a shell, then they can replug the cable and do whatever they want in the
shell.
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 10/10] add "rdshell" command line argument
[not found] ` <20090706015313.GA70037-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-13 10:29 ` Harald Hoyer
@ 2009-07-13 10:30 ` Harald Hoyer
1 sibling, 0 replies; 21+ messages in thread
From: Harald Hoyer @ 2009-07-13 10:30 UTC (permalink / raw)
To: Jeremy Katz; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 07/06/2009 03:53 AM, Jeremy Katz wrote:
> On Friday, July 03 2009, Harald Hoyer said:
>> Only drop to an interactive shell if "rdshell" is specified on the
>> command line. This prevents malicious users from gaining easy shell
>> access to the host system (grub might be secured with a password).
>
> I don't have a strong opinion about doing this vs not, but how could
> they end up getting easy shell access? If grub is secured with a
> password, they can't change kernel arguments. If they can change kernel
> arguments, they can just add rdshell rather than change the root=
> specifier.
>
> Jeremy
If root is on a network device, they can just unplug the network cable and end
up with a shell, then they can replug the cable and do whatever they want in the
shell.
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2009-07-13 10:30 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-03 16:45 [PATCH 00/10] *** SUBJECT HERE *** Harald Hoyer
[not found] ` <1246639520-3094-1-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 16:45 ` [PATCH 01/10] add binutiles requirement to specfile (because of nm) Harald Hoyer
2009-07-03 16:45 ` [PATCH 02/10] output everything to /dev/kmesg and add dmesg for the emergency_shell Harald Hoyer
[not found] ` <1246639520-3094-3-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-03 18:11 ` David Dillow
[not found] ` <1246644686.13823.5.camel-1q1vX8mYZiGLUyTwlgNVppKKF0rrzTr+@public.gmane.org>
2009-07-03 18:14 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 03/10] Defer mount to the real mount loop Harald Hoyer
[not found] ` <1246639520-3094-4-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-04 12:29 ` Seewer Philippe
[not found] ` <4A4F4B41.2060205-omB+W0Dpw2o@public.gmane.org>
2009-07-13 10:21 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 04/10] remove 50plymouth-pre0.7 module Harald Hoyer
2009-07-03 16:45 ` [PATCH 05/10] add firmware packages to be required by the dracut-generic package Harald Hoyer
2009-07-03 16:45 ` [PATCH 06/10] add rm to be installed for initqueue Harald Hoyer
2009-07-03 16:45 ` [PATCH 07/10] fail iscsiroot, if iscsistart fails Harald Hoyer
2009-07-03 16:45 ` [PATCH 08/10] put back the nfs mount in the udev event Harald Hoyer
[not found] ` <1246639520-3094-9-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-06 8:39 ` Seewer Philippe
2009-07-03 16:45 ` [PATCH 09/10] initqueue now loops until /dev/root exists or root is mounted Harald Hoyer
[not found] ` <1246639520-3094-10-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-06 8:54 ` Seewer Philippe
[not found] ` <4A51BBE0.6030603-omB+W0Dpw2o@public.gmane.org>
2009-07-13 9:53 ` Harald Hoyer
2009-07-03 16:45 ` [PATCH 10/10] add "rdshell" command line argument Harald Hoyer
[not found] ` <1246639520-3094-11-git-send-email-harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-06 1:53 ` Jeremy Katz
[not found] ` <20090706015313.GA70037-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-07-13 10:29 ` Harald Hoyer
2009-07-13 10:30 ` Harald Hoyer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.