]> git.proxmox.com Git - mirror_zfs-debian.git/commitdiff
Print initramfs errors in a sensible order.
authorDarik Horn <dajhorn@vanadac.com>
Wed, 30 Mar 2011 04:35:14 +0000 (23:35 -0500)
committerDarik Horn <dajhorn@vanadac.com>
Wed, 30 Mar 2011 04:35:14 +0000 (23:35 -0500)
If the zfs script must drop into a recovery shell, then print the error message
and error number after the command invocation that failed.

debian/tree/zfs-initramfs/usr/share/initramfs-tools/scripts/zfs

index c00360843051b961a2c278b700672ce10528df31..f9cb473729169b51cf54e96196dcbb604101b349 100644 (file)
@@ -57,14 +57,14 @@ mountroot()
        # Import the root pool, but don't mount it.  Doing `-R /` instead of
        # `-R $rootmnt` keeps the namespace sensible after the pivot.
        [ "$quiet" != "y" ] && log_begin_msg "Importing ZFS root pool $ZFS_RPOOL"
-       zpool import -R / -N "$ZFS_RPOOL"
+       ZFS_STDERR=$(zpool import -R / -N "$ZFS_RPOOL" 2>&1)
        ZFS_ERROR=$?
        [ "$quiet" != "y" ] && log_end_msg
 
        if [ "$ZFS_ERROR" -ne 0 ]
        then
-               echo ""
                echo "Command: zpool import -R / -N $ZFS_RPOOL"
+               echo "Message: $ZFS_STDERR"
                echo "Error: $ZFS_ERROR"
                echo ""
                echo "Manually import the root pool at the command prompt and then exit."
@@ -82,17 +82,17 @@ mountroot()
 
        if [ -z "$ZFS_BOOTFS" ]
        then
-               echo ""
                echo "Command: zpool list -H -o bootfs $ZFS_RPOOL"
                echo "Error: $ZFS_ERROR, unable to get the bootfs property."
                echo ""
                echo "Manually mount the root filesystem on $rootmnt and then exit."
+               echo "Hint: Try:  mount -t zfs -o zfsutil $ZFS_RPOOL/ROOT/system $rootmnt"
                /bin/sh 
        fi
 
        # Force the mountpoint to the only correct value for a root filesystem.
        [ "$quiet" != "y" ] && log_begin_msg "Setting mountpoint=/ on ZFS filesystem $ZFS_BOOTFS"
-       zfs set -o mountpoint=/ "$ZFS_BOOTFS"
+       ZFS_STDERR=$(zfs set -o mountpoint=/ "$ZFS_BOOTFS" 2>&1)
        [ "$quiet" != "y" ] && log_end_msg
 
        # Ideally, the root filesystem would be mounted like this:
@@ -105,7 +105,7 @@ mountroot()
        # `zfs mount -a` and the /etc/mtab refresh.
 
        [ "$quiet" != "y" ] && log_begin_msg "Mounting ZFS filesystem $ZFS_BOOTFS"
-       mount -t zfs -o zfsutil "$ZFS_BOOTFS" "$rootmnt"
+       ZFS_STDERR=$(mount -t zfs -o zfsutil "$ZFS_BOOTFS" "$rootmnt" 2>&1)
        ZFS_ERROR=$?
        [ "$quiet" != "y" ] && log_end_msg
 
@@ -113,6 +113,7 @@ mountroot()
        then
                echo ""
                echo "Command: mount -t zfs -o zfsutil $ZFS_BOOTFS $rootmnt"
+               echo "Message: $ZFS_STDERR"
                echo "Error: $ZFS_ERROR"
                echo ""
                echo "Manually mount the root filesystem on $rootmnt and then exit."