while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
} | vinfo
-systemctl switch-root
export -p > /dracut-state.sh
+
+systemctl isolate switch-root.target
# By the time we get here, the root filesystem should be mounted.
# Try to find init.
-for i in "$(getarg real_init=)" "$(getarg init=)" $(getargs rd.distroinit=) /sbin/init; do
+
+for i in "$(getarg real_init=)" "$(getarg init=)"; do
[ -n "$i" ] || continue
__p=$(readlink -f "${NEWROOT}/${i}")
if [ -x "$__p" ]; then
INIT="$i"
+ echo "NEWINIT=\"$INIT\"" > /etc/switch-root.conf
break
fi
done
-if [ -n "$INIT" ]; then
- {
- echo "NEWROOT=\"$NEWROOT\""
- echo "NEWINIT=\"$INIT\""
- } > /etc/switch-root.conf
-else
- echo "Cannot find init!"
- echo "Please check to make sure you passed a valid root filesystem!"
- emergency_shell
-fi
+echo "NEWROOT=\"$NEWROOT\"" >> /etc/switch-root.conf
udevadm control --stop-exec-queue
systemctl stop udevd.service
Environment=HOME=/
WorkingDirectory=/
ExecStart=-/bin/sh -i -l
-ExecStopPost=-/usr/bin/systemctl --fail --no-block switch-root
+ExecStopPost=-/usr/bin/systemctl --fail --no-block default
Type=idle
StandardInput=tty-force
StandardOutput=inherit
ln -fs /lib/systemd/systemd "$initdir/init"
- {
- echo "LogLevel=debug"
- echo "LogTarget=console"
- } >> "$initdir/etc/systemd/system.conf"
+# {
+# echo "LogLevel=debug"
+# echo "LogTarget=console"
+# } >> "$initdir/etc/systemd/system.conf"
rm -f "$initdir/lib/systemd/system/emergency.service"
inst "$moddir/emergency.service" /lib/systemd/system/emergency.service
inst "$moddir/dracut-pre-pivot.service" /lib/systemd/system/dracut-pre-pivot.service
mkdir -p "$initdir/lib/systemd/system/switch-root.target.wants"
ln -s ../dracut-pre-pivot.service "$initdir/lib/systemd/system/switch-root.target.wants/dracut-pre-pivot.service"
-
+ > "$initdir/etc/machine-id"
}
WorkingDirectory=/
ExecStart=-/bin/sh -i -l
#ExecStopPost=-/usr/bin/systemctl --fail --no-block switch-root /sysroot /sbin/init
-ExecStopPost=-/usr/bin/systemctl --fail --no-block switch-root
+ExecStopPost=-/usr/bin/systemctl --fail --no-block default
Type=idle
StandardInput=tty-force
StandardOutput=inherit
-hda $TESTDIR/root.ext3 \
-m 256M -nographic \
-net none -kernel /boot/vmlinuz-$KVERSION \
- -append "root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
+ -append "root=LABEL=dracut rw loglevel=77 systemd.log_level=debug systemd.log_target=console rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug init=/sbin/init $DEBUGFAIL" \
-initrd $TESTDIR/initramfs.testing
grep -m 1 -q dracut-root-block-success $TESTDIR/root.ext3 || return 1
}