Store switch-root.conf in /run/initramfs/switch-root.conf, so that the
service does not fail in ExecPost after switching to the real root.
__p=$(readlink -f "${NEWROOT}/${i}")
if [ -x "$__p" ]; then
INIT="$i"
- echo "NEWINIT=\"$INIT\"" > /etc/switch-root.conf
+ echo "NEWINIT=\"$INIT\"" > /run/initramfs/switch-root.conf
break
fi
done
-echo "NEWROOT=\"$NEWROOT\"" >> /etc/switch-root.conf
+echo "NEWROOT=\"$NEWROOT\"" >> /run/initramfs/switch-root.conf
udevadm control --stop-exec-queue
systemctl stop systemd-udev.service
[Service]
Type=oneshot
-EnvironmentFile=/etc/switch-root.conf
+EnvironmentFile=/run/initramfs/switch-root.conf
ExecStart=/usr/bin/systemctl --force switch-root ${NEWROOT} ${NEWINIT}
ExecStopPost=-/usr/bin/systemctl isolate default.target