Merge pull request #1401 from anderbubble/init-rootfs-fixes
Init rootfs fixes
This commit is contained in:
@@ -51,6 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
|
|
||||||
- Return an error during `wwctl container import` if archive filename includes a colon. #1371
|
- Return an error during `wwctl container import` if archive filename includes a colon. #1371
|
||||||
- Correctly extract smbios asset key during Grub boot. #1291
|
- Correctly extract smbios asset key during Grub boot. #1291
|
||||||
|
- Refactor of `wwinit/init` to more properly address rootfs options. #1098
|
||||||
|
|
||||||
## v4.5.7, 2024-09-11
|
## v4.5.7, 2024-09-11
|
||||||
|
|
||||||
|
|||||||
@@ -38,3 +38,4 @@
|
|||||||
* Tobias Poschwatta <poschwatta@zib.de>
|
* Tobias Poschwatta <poschwatta@zib.de>
|
||||||
* Josh Burks <jeburks2@asu.edu>
|
* Josh Burks <jeburks2@asu.edu>
|
||||||
* Elmar Pruesse <pruessee@njhealth.org> @epruesse
|
* Elmar Pruesse <pruessee@njhealth.org> @epruesse
|
||||||
|
* Adam Michel <elfurbe@furbism.com> [@elfurbe](https://github.com/elfurbe)
|
||||||
|
|||||||
@@ -5,52 +5,49 @@
|
|||||||
#
|
#
|
||||||
# Edit at your own risk! DANGER DANGER.
|
# Edit at your own risk! DANGER DANGER.
|
||||||
|
|
||||||
|
echo -n "Mounting kernel file systems:"
|
||||||
if test -f "/warewulf/config"; then
|
mkdir /proc /dev /sys /run 2>/dev/null
|
||||||
. /warewulf/config
|
mount -t proc proc /proc && echo -n " /proc"
|
||||||
else
|
mount -t devtmpfs devtmpfs /dev && echo -n " /dev"
|
||||||
echo "ERROR: Warewulf configuration file not found... rebooting in 1 minute"
|
mount -t sysfs sysfs /sys && echo -n " /sys"
|
||||||
sleep 60
|
mount -t tmpfs tmpfs /run && echo -n " /run"
|
||||||
echo b > /proc/sysrq-trigger || /sbin/reboot
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Warewulf v4 is now booting: $WWHOSTNAME"
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo "Mounting up kernel file systems"
|
if [ -f "/warewulf/config" ]; then
|
||||||
mkdir /proc /dev /sys /run 2>/dev/null
|
. /warewulf/config
|
||||||
mount -t proc proc /proc
|
else
|
||||||
mount -t devtmpfs devtmpfs /dev
|
echo "ERROR: Warewulf configuration file not found."
|
||||||
mount -t sysfs sysfs /sys
|
echo "Rebooting in 1 minute..."
|
||||||
mount -t tmpfs tmpfs /run
|
sleep 60
|
||||||
|
echo b > /proc/sysrq-trigger || /sbin/reboot -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Warewulf v4 is now booting: ${WWHOSTNAME}"
|
||||||
|
echo
|
||||||
|
|
||||||
chmod 755 /warewulf/wwinit
|
chmod 755 /warewulf/wwinit
|
||||||
|
|
||||||
echo "Checking Rootfs type"
|
if [ -z "${WWROOT}" -o "${WWROOT}" == "initramfs" ]; then
|
||||||
ROOTFSTYPE=`stat -f -c "%T" /`
|
echo "Retaining initramfs and invoking /warewulf/wwinit..."
|
||||||
|
|
||||||
if test "$WWROOT" = "initramfs"; then
|
|
||||||
echo "Provisioned to default initramfs file system: $ROOTFSTYPE"
|
|
||||||
echo "Calling WW Init"
|
|
||||||
exec /warewulf/wwinit
|
exec /warewulf/wwinit
|
||||||
elif test "$WWROOT" = "tmpfs"; then
|
elif [ "${WWROOT}" == "ramfs" -o "${WWROOT}" == "tmpfs" ]; then
|
||||||
if test "$ROOTFSTYPE" = "tmpfs"; then
|
echo "Setting up new ${WWROOT} rootfs..."
|
||||||
echo "ERROR: Switching the root file system requires the kernel argument: 'rootfstype=ramfs'"
|
mkdir /newroot
|
||||||
else
|
mount wwroot /newroot -t ${WWROOT} -o mpol=interleave # mpol ignored for ramfs
|
||||||
echo "Setting up tmpfs root file system"
|
tar -cf - --exclude ./proc --exclude ./sys --exclude ./dev --exclude ./run --exclude ./newroot . | tar -xf - -C /newroot
|
||||||
mkdir /newroot
|
mkdir /newroot/proc /newroot/dev /newroot/sys /newroot/run 2>/dev/null
|
||||||
mount wwroot /newroot -t tmpfs -o mpol=interleave
|
echo "Switching to new rootfs and invoking /warewulf/wwinit..."
|
||||||
echo "Moving RAMFS to TMPFS"
|
exec /sbin/switch_root /newroot /warewulf/wwinit
|
||||||
tar -cf - --exclude ./proc --exclude ./sys --exclude ./dev --exclude ./newroot . | tar -xf - -C /newroot
|
|
||||||
mkdir /newroot/proc /newroot/dev /newroot/sys /newroot/run 2>/dev/null
|
|
||||||
echo "Calling switch_root and invoking WW Init"
|
|
||||||
exec /sbin/switch_root /newroot /warewulf/wwinit
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "ERROR: Unknown Warewulf Root file system: $WWROOT"
|
echo "ERROR: Unrecognized rootfs type requested: ${WWROOT}"
|
||||||
|
echo "Rebooting in 1 minute..."
|
||||||
|
sleep 60
|
||||||
|
echo b > /proc/sysrq-trigger || /sbin/reboot -f
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "There was a problem with the provisioning process, rebooting in 1 minute..."
|
echo "ERROR: There was a problem with the initial provisioning process.
|
||||||
|
echo "Rebooting in 1 minute..."
|
||||||
sleep 60
|
sleep 60
|
||||||
echo b > /proc/sysrq-trigger || /sbin/reboot
|
echo b > /proc/sysrq-trigger || /sbin/reboot -f
|
||||||
|
|||||||
Reference in New Issue
Block a user