diff options
author | Richard Yao <ryao@gentoo.org> | 2015-09-20 21:44:36 -0400 |
---|---|---|
committer | Richard Yao <ryao@gentoo.org> | 2015-09-21 09:13:30 -0400 |
commit | 6b3e3dfbc265ef47c2c2e008ad31ae79041225b6 (patch) | |
tree | 7ad5e06a6af250748ed4298f3d383adf5a97a455 /defaults | |
parent | Reimplement dozfs=force support (diff) | |
download | genkernel-6b3e3dfbc265ef47c2c2e008ad31ae79041225b6.tar.gz genkernel-6b3e3dfbc265ef47c2c2e008ad31ae79041225b6.tar.bz2 genkernel-6b3e3dfbc265ef47c2c2e008ad31ae79041225b6.zip |
Cleanup logic to find rootfs on ZFS
We no longer support root=ZFS. Only root=ZFS=$dataset is supported.
GRUB2 never used that syntax and users never liked it, so that should be
okay.
We also handle the case where the root pool is missing from the
cachefile or the cachefile itself is missing by informing users of how
to repair the system. We inform them rather than do it ourselves because
a step is required after the pool is imported and while we can do it for
them, the heuristics are unlikely to be right 100% of the time and we
really should not be making changes to the rootfs from the initramfs.
Signed-off-by: Richard Yao <ryao@gentoo.org>
Diffstat (limited to 'defaults')
-rw-r--r-- | defaults/linuxrc | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/defaults/linuxrc b/defaults/linuxrc index 877d845..dc129ce 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -523,11 +523,27 @@ do fi ;; ZFS*) - if [ "${USE_ZFS}" = '0' ]; then + zpool list -H -o name | grep -q "${ZFS_POOL}" + if [ $? -ne 0 ] + then + if [ ! -e /etc/zfs/zpool.cache ] + then + bad_msg "${ZFS_POOL} not imported due to missing zpool.cache file." + + else + bad_msg "${ZFS_POOL} absent from zpool.cache file." + fi + bad_msg "Provided that ${ZFS_POOL} exists, you can correct this by:" + bad_msg + bad_msg "1. Dropping to a shell." + bad_msg "2. Running \`zpool import -d /dev/disk/by-id -N ${ZFS_POOL}\`" + bad_msg "3. Pressing Cntl+D to exit." + bad_msg "4. Running \`zpool set cachefile= ${ZFS_POOL}\` (space after equal sign)" + bad_msg " as root after system has booted." prompt_user "REAL_ROOT" "root block device" + got_good_root=0 continue fi - ROOT_DEV="${REAL_ROOT#*=}" if [ "${ROOT_DEV}" != 'ZFS' ] then @@ -543,29 +559,11 @@ do continue fi else - BOOTFS=$(/sbin/zpool list -H -o bootfs) - if [ "${BOOTFS}" != '-' ] - then - - for i in ${BOOTFS} - do - - zfs get type ${i} > /dev/null - retval=$? - - if [ ${retval} -eq 0 ]; then - got_good_root=1 - REAL_ROOT=${i} - ROOTFSTYPE=zfs - break - fi - - done; - - else - got_good_root=0 - fi - + bad_msg "root=ZFS is no longer supported." + bad_msg "Please specify root=ZFS=\$DATASET:" + prompt_user "REAL_ROOT" "root block device" + got_good_root=0 + continue fi if [ ${got_good_root} -ne 1 ]; then |