rdshell
parent
58dbb43eac
commit
a3a3448d8c
3
dracut.8
3
dracut.8
|
|
@ -167,6 +167,9 @@ do not load kernel module <drivername>
|
||||||
|
|
||||||
.SH Debug
|
.SH Debug
|
||||||
.TP
|
.TP
|
||||||
|
.B rdshell
|
||||||
|
drop to a shell, if the imitramfs fails
|
||||||
|
.TP
|
||||||
.B rdinitdebug
|
.B rdinitdebug
|
||||||
set -x for the dracut shell
|
set -x for the dracut shell
|
||||||
.TP
|
.TP
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,25 @@
|
||||||
emergency_shell()
|
emergency_shell()
|
||||||
{
|
{
|
||||||
exec >/dev/console 2>&1 </dev/console
|
exec >/dev/console 2>&1 </dev/console
|
||||||
|
echo ; echo
|
||||||
|
echo $@
|
||||||
getarg rdinitdebug || dmesg
|
getarg rdinitdebug || dmesg
|
||||||
source_all emergency
|
source_all emergency
|
||||||
|
if getarg rdshell; then
|
||||||
echo ; echo
|
echo ; echo
|
||||||
echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
|
echo "Dropping to a shell. Good luck!"
|
||||||
echo
|
echo
|
||||||
sh -i
|
sh -i
|
||||||
|
else
|
||||||
|
while :; do sleep 1;done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
export TERM=linux
|
export TERM=linux
|
||||||
NEWROOT="/sysroot"
|
NEWROOT="/sysroot"
|
||||||
|
|
||||||
trap "emergency_shell" 0
|
trap "emergency_shell Unkown signal caught!" 0
|
||||||
|
|
||||||
. /lib/dracut-lib.sh
|
. /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)
|
UDEVVERSION=$(udevadm --version)
|
||||||
|
|
||||||
# run scriptlets to parse the command line
|
# run scriptlets to parse the command line
|
||||||
getarg 'rdbreak=cmdline' && emergency_shell
|
getarg 'rdbreak=cmdline' && emergency_shell "Break before cmdline"
|
||||||
source_all cmdline
|
source_all cmdline
|
||||||
|
|
||||||
[ -z "$root" ] && die "No or empty root= argument"
|
[ -z "$root" ] && die "No or empty root= argument"
|
||||||
|
|
@ -73,7 +79,7 @@ source_all cmdline
|
||||||
} > /tmp/root.info
|
} > /tmp/root.info
|
||||||
|
|
||||||
# pre-udev scripts run before udev starts, and are run only once.
|
# 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
|
source_all pre-udev
|
||||||
|
|
||||||
# start up udev and trigger cold plugs
|
# start up udev and trigger cold plugs
|
||||||
|
|
@ -121,8 +127,8 @@ while :; do
|
||||||
# no more udev jobs
|
# no more udev jobs
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
i=$(($i+1))
|
i=$(($i+1))
|
||||||
[ $i -gt 20 ] && getarg rdshell \
|
[ $i -gt 20 ] \
|
||||||
&& { flock -s 9 ; emergency_shell; } 9>/.console_lock
|
&& { flock -s 9 ; emergency_shell "No root device found"; } 9>/.console_lock
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
unset job
|
unset job
|
||||||
|
|
@ -130,10 +136,11 @@ unset queuetriggered
|
||||||
|
|
||||||
# pre-mount happens before we try to mount the root filesystem,
|
# pre-mount happens before we try to mount the root filesystem,
|
||||||
# and happens once.
|
# and happens once.
|
||||||
getarg 'rdbreak=pre-mount' && emergency_shell
|
getarg 'rdbreak=pre-mount' && emergency_shell "Break pre-mount"
|
||||||
source_all 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
|
# 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.
|
# be sourced any number of times. As soon as one suceeds, no more are sourced.
|
||||||
i=0
|
i=0
|
||||||
|
|
@ -145,8 +152,8 @@ while :; do
|
||||||
done
|
done
|
||||||
|
|
||||||
i=$(($i+1))
|
i=$(($i+1))
|
||||||
[ $i -gt 20 ] && getarg rdshell \
|
[ $i -gt 20 ] \
|
||||||
&& { flock -s 9 ; emergency_shell; } 9>/.console_lock
|
&& { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
|
||||||
done
|
done
|
||||||
|
|
||||||
# pre pivot scripts are sourced just before we switch over to the new root.
|
# 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; }
|
[ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
|
||||||
done
|
done
|
||||||
[ "$INIT" ] || {
|
[ "$INIT" ] || {
|
||||||
echo "Cannot find init! Please check to make sure you passed"
|
echo "Cannot find init!"
|
||||||
echo "a valid root filesystem! Dropping to a shell."
|
echo "Please check to make sure you passed a valid root filesystem!"
|
||||||
emergency_shell
|
emergency_shell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||||
test_run() {
|
test_run() {
|
||||||
$testdir/run-qemu -hda root.ext2 -m 256M -nographic \
|
$testdir/run-qemu -hda root.ext2 -m 256M -nographic \
|
||||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
-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
|
-initrd initramfs.testing
|
||||||
grep -m 1 -q dracut-root-block-success root.ext2 || return 1
|
grep -m 1 -q dracut-root-block-success root.ext2 || return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ client_test() {
|
||||||
-net nic,macaddr=$mac,model=e1000 \
|
-net nic,macaddr=$mac,model=e1000 \
|
||||||
-net socket,mcast=230.0.0.1:1234 \
|
-net socket,mcast=230.0.0.1:1234 \
|
||||||
-kernel /boot/vmlinuz-$KVERSION \
|
-kernel /boot/vmlinuz-$KVERSION \
|
||||||
-append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
|
-append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
|
||||||
-initrd initramfs.testing
|
-initrd initramfs.testing
|
||||||
|
|
||||||
if [[ $? -ne 0 ]] || ! grep -m 1 -q nfs-OK client.img; then
|
if [[ $? -ne 0 ]] || ! grep -m 1 -q nfs-OK client.img; then
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ run_client() {
|
||||||
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
|
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
|
||||||
-net socket,mcast=230.0.0.1:1235 \
|
-net socket,mcast=230.0.0.1:1235 \
|
||||||
-kernel /boot/vmlinuz-$KVERSION \
|
-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
|
-initrd initramfs.testing
|
||||||
grep -m 1 -q iscsi-OK client.img || return 1
|
grep -m 1 -q iscsi-OK client.img || return 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ client_test() {
|
||||||
-net nic,macaddr=$mac,model=e1000 \
|
-net nic,macaddr=$mac,model=e1000 \
|
||||||
-net socket,mcast=230.0.0.1:1236 \
|
-net socket,mcast=230.0.0.1:1236 \
|
||||||
-kernel /boot/vmlinuz-$KVERSION \
|
-kernel /boot/vmlinuz-$KVERSION \
|
||||||
-append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
|
-append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
|
||||||
-initrd initramfs.testing
|
-initrd initramfs.testing
|
||||||
|
|
||||||
if [[ $? -ne 0 ]] || ! grep -m 1 -q nbd-OK flag.img; then
|
if [[ $? -ne 0 ]] || ! grep -m 1 -q nbd-OK flag.img; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue