Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 597154 - sys-kernel/genkernel-9999 block device mypool/ds is not a valid block device
Summary: sys-kernel/genkernel-9999 block device mypool/ds is not a valid block device
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-15 06:37 UTC by Mark Wright
Modified: 2016-11-08 04:55 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
genkernel-9999-zfs-rootfs-is-not-a-block-device.patch (genkernel-9999-zfs-rootfs-is-not-a-block-device.patch,424 bytes, patch)
2016-10-15 06:40 UTC, Mark Wright
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wright gentoo-dev 2016-10-15 06:37:44 UTC
Originally reported here:
https://github.com/zfsonlinux/zfs/issues/5197

bunder2015 commented 15 days ago • edited
could not boot latest head (as of 09/27) with newer genkernel (which should have the fix for the libgcc_s bug). pool gets imported but doesn't get mounted anywhere.

Reproducible: Always

Steps to Reproduce:
1. emerge -av -1 sys-kernel/genkernel-9999 to obtain genkernel --version 3.5.0.5-1-gc985584-git
2. Using genkernel build a initramfs to boot a Gentoo system with its root filesystem on ZFS.
3. Booting from the initramfs fails:
Actual Results:  
Importing ZFS pool mypool
Import of mypool succeeded
Determining block device

Block device mypool/ds is not a valid block device
Could not find the root block device in . 
Please specify a new value (blah blah blah)

Expected Results:  
It should not test if mypool/ds is a block device, it is just a string specifying the ZFS root filesystem.

My theory is that some continue statements in the ZFS logic do not exit out of the loop around the timing loop introduced here:

commit 67893b749b83fd716e55fa7c865f4c924454ee24
Author: Robin H. Johnson <robbat2@gentoo.org>
Date:   Sun May 15 23:40:43 2016 -0700

    defaults/linuxrc: bug #232733: implement rootwait.
    
    Based on patch from John Klug <ski.brimson@gmail.com>.
    
    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

diff --git a/defaults/linuxrc b/defaults/linuxrc
index ac8f215..72e1543 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -133,6 +133,12 @@ do
                scandelay)
                        SDELAY=3
                ;;
+               rootdelay=*|rootwait=*)
+                       ROOTDELAY=${x#*=}
+               ;;
+               rootdelay|rootwait)
+                       ROOTDELAY=5
+               ;;
                # Module no-loads
                doload=*)
                        MDOLIST=${x#*=}
@@ -485,10 +491,14 @@ fi
 
 # Determine root device
 good_msg 'Determining root device ...'
+ROOTDELAY_100MSEC=1
+[ -n "${ROOTDELAY}" ] && ROOTDELAY_100MSEC=$(($ROOTDELAY * 10))
 while true
 do
        while [ "${got_good_root}" != '1' ]
        do
+               # Start of sleep loop waiting on root
+               while [ ${ROOTDELAY_100MSEC} -ge 0 -a "${got_good_root}" != '1' ] ; do
                case "${REAL_ROOT}" in
                        LABEL=*|UUID=*)
 
@@ -574,6 +584,11 @@ do
                                ;;
                esac
 
+               if [ "${got_good_root}" != '1' ] ; then
+                 let ROOTDELAY_100MSEC=${ROOTDELAY_100MSEC}-1
+                 usleep 100
+               fi
+               done  # End of sleep loop waiting on root
                if [ "${REAL_ROOT}" = '' ]
                then
                        # No REAL_ROOT determined/specified. Prompt user for root block device.

Which then results in this now bogus for zfs if statement being executed:

 		# Check for a block device or /dev/nfs
		elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "/dev/nfs" ]

Where for ZFS "${REAL_ROOT}" is not a block device, it is just a string indicating where the ZFS root file system is.
Comment 1 Mark Wright gentoo-dev 2016-10-15 06:40:36 UTC
Created attachment 450244 [details, diff]
genkernel-9999-zfs-rootfs-is-not-a-block-device.patch

A workaround is to save my proposed patch file here:

/etc/portage/patches/sys-kernel/genkernel-9999/genkernel-9999-zfs-rootfs-is-not-a-block-device.patch
Comment 2 Chris Henhawke 2016-10-15 10:17:22 UTC
Thanks for looking into this, I will try to test it on Monday.
Comment 3 Chris Henhawke 2016-10-17 22:58:27 UTC
Patch tested and working.  Thanks again.
Comment 4 Richard Yao (RETIRED) gentoo-dev 2016-10-18 02:13:54 UTC
(In reply to Mark Wright from comment #1)
> Created attachment 450244 [details, diff] [details, diff]
> genkernel-9999-zfs-rootfs-is-not-a-block-device.patch
> 
> A workaround is to save my proposed patch file here:
> 
> /etc/portage/patches/sys-kernel/genkernel-9999/genkernel-9999-zfs-rootfs-is-
> not-a-block-device.patch

This patch looks good to me. I'll put it through my standard test and then commit it after my plane lands in Shanghai. I'll be hacking from there for a month.

If anyone wants to do this sooner, feel free.
Comment 5 Rick Farina (Zero_Chaos) gentoo-dev 2016-11-08 04:55:13 UTC
fixed in genkernel-9999, thanks for the patch (tested, etc)