-
Hi everyone, I am attempting to setup ZFSBootMenu to boot between two environments, each with its own
My goal is to use the
Current Setup
Here’s the script I’ve written to test if hooks are being executed: #!/bin/bash
# Determine the directory of the current script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LOG_FILE="${SCRIPT_DIR}/zfsbootmenu_boot_state.log"
# Create or clear the log file
echo "Running mount-home.sh" > /dev/tty
echo "Log file: ${LOG_FILE}" > /dev/tty
echo "=== ZFSBootMenu Boot-Selection Hook Log ===" > "${LOG_FILE}"
echo "Timestamp: $(date)" >> "${LOG_FILE}"
# Log ZFSBootMenu environment variables
echo -e "\n--- ZFSBootMenu Environment Variables ---" >> "${LOG_FILE}"
echo "ZBM_SELECTED_BE: ${ZBM_SELECTED_BE}" >> "${LOG_FILE}"
echo "ZBM_SELECTED_KERNEL: ${ZBM_SELECTED_KERNEL}" >> "${LOG_FILE}"
echo "ZBM_SELECTED_INITRAMFS: ${ZBM_SELECTED_INITRAMFS}" >> "${LOG_FILE}"
echo "ZBM_SELECTED_MOUNTPOINT: ${ZBM_SELECTED_MOUNTPOINT}" >> "${LOG_FILE}"
# Log all shell environment variables
echo -e "\n--- Shell Environment Variables ---" >> "${LOG_FILE}"
env >> "${LOG_FILE}"
# Check mounted filesystems
echo -e "\n--- Mounted Filesystems ---" >> "${LOG_FILE}"
mount >> "${LOG_FILE}"
# Check if pools are available and list them
echo -e "\n--- ZFS Pool Status ---" >> "${LOG_FILE}"
if command -v zfs >/dev/null 2>&1; then
echo "ZFS command is available" >> "${LOG_FILE}"
zpool status >> "${LOG_FILE}"
zfs list >> "${LOG_FILE}"
else
echo "ZFS command is NOT available" >> "${LOG_FILE}"
fi
# Log script completion
echo -e "\n--- Script Completed ---" >> "${LOG_FILE}"
echo "Log file written to ${LOG_FILE}" Problems
What I’ve Checked
Questions
Any guidance or suggestions would be greatly appreciated. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
User hooks stored at If you want to use the pre-built image, you'll need to put the hooks on your ESP, and pass in a parameter to the ZFSBootMenu KCL - specifically the Alternatively, you can just add an entry to |
Beta Was this translation helpful? Give feedback.
-
You should absolutely use |
Beta Was this translation helpful? Give feedback.
User hooks stored at
/etc/zfsbootmenu/hooks/...
only work if you're building your own copy of ZFSBootMenu withgenerate-zbm
. They're then copied to a specific location inside of ZFSBootMenu where they're executed during different loader stages. Your script isn't being executed by ZFSBootMenu because it's not available to it.If you want to use the pre-built image, you'll need to put the hooks on your ESP, and pass in a parameter to the ZFSBootMenu KCL - specifically the
zbm.hookroot
option, detailed at https://docs.zfsbootmenu.org/en/v2.3.x/man/zfsbootmenu.7.html#command-line-parameters .Alternatively, you can just add an entry to
/etc/fstab
on each BE to mount the appropriate home direc…