Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
(ZFS root) genkernel initramfs: no /dev/disk? [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 84
Location: Japan

PostPosted: Fri Sep 12, 2014 3:29 am    Post subject: (ZFS root) genkernel initramfs: no /dev/disk? [solved] Reply with quote

Quick solution: genkernel uses busybox's mdev, which doesn't provide udev /dev/disk/by-id labels. emerge genkernel-next instead, which uses udev, and populates /dev/disk.

Hello,

I'm new to ZFS, and have just done a fresh install of Gentoo on a new drive to give ZFS on root a try. I created my pool using disk IDs as I knew I would be rearranging the SATA disks later, and so avoided using /dev/sd*:
Code:
  pool: tank
 state: ONLINE
  scan: none requested
config:

        NAME                                          STATE     READ WRITE CKSUM
        tank                                          ONLINE       0     0     0
          ata-WDC_WD30EZRX-00DC0B0_WD-WMC1T4136617    ONLINE       0     0     0

errors: No known data errors


Unfortunately, I'm unable to boot with this:
Code:
>> Importing ZFS pools
!! Imported ZFS pools failed
>> Determining root device...
>> Mounting /dev/sdb1 as root...
>> Using mount -t auto -o ro
mount: mounting /dev/sdb1 on /newroot failed: Invalid argument
!! Could not mount specified ROOT, try again
!! Could not find the root block device in .
!! Please specify another value or:
!! - press Enter for the same
!! - type "shell" for a shell
!! - type "q" to skip...
root block device() :: ZFS=tank
cannot open 'tank': dataset does not exist
!! tank is not a filesystem
!! Could not find the root block device in ZFS=tank.


After dropping to a shell and checking out zpool status, I noticed that udev in the initramfs doesn't seem to populate /dev/disk at all:
Code:

root block device() :: shell
** To leave and try again just press <Ctrl>+D

...

# zpool status
  pool: tank
 state: UNAVAIL
status: One or more devices could not be used because the label is missing
        or invalid.  There are insufficient replicas for the pool to continue
        functioning.
action: Destroy and re-create the pool from
        a backup source.
   see: http://zfsonlinux.org/msg/ZFS-8000-5E
  scan: none requested
config:

        NAME                                          STATE     READ WRITE CKSUM
        tank                                          UNAVAIL      0     0     0  insufficient replicas
          ata-WDC_WD30EZRX-00DC0B0_WD-WMC1T4136617    UNAVAIL      0     0     0

# ls -l /dev/disk
ls: /dev/disk: No such file or directory


I can work around this by recreating the /dev/disk/by-id/ link manually, and the system boots fine after it:
Code:
# mkdir -p /dev/disk/by-id/
# cd /dev/disk/by-id/
# ln -s ../../sdb1 ata-WDC_WD30EZRX-00DC0B0_WD-WMC1T4136617-part1
# ^D
!! Could not find the root block device in .
!! Please specify another value or:
!! - press Enter for the same
!! - type "shell" for a shell
!! - type "q" to skip...
root block device() :: ZFS=tank
>> Mounting tank as root
>> Using mount -t zfs -o rw,zfsutil
>> Booting (initramfs)
INIT: version 2.88 booting


FWIW, I built the initramfs with:
Code:
genkernel all --no-clean --makeopts=-j3 --zfs --callback="emerge @module-rebuild" --bootloader=lilo


And the relevant lines from my /etc/lilo.conf:
Code:
image = /boot/kernel-genkernel-x86_64-3.16.2-gentoo
        root = /dev/ram0
        label = GentooZFS
        read-only # read-only for checking
        initrd = /boot/initramfs-genkernel-x86_64-3.16.2-gentoo
        append = "dozfs root=/dev/sdb1"


Does anyone have any suggestions on what I can do here? Is there something I missed with genkernel to get udev to create the proper labels in /dev/disk?


Last edited by bpoint on Thu Sep 25, 2014 2:35 am; edited 2 times in total
Back to top
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 771
Location: over here

PostPosted: Fri Sep 12, 2014 8:11 am    Post subject: Reply with quote

in my experience genkernel all, doesn't work with zfs. I use
Code:
genkernel --zfs initramfs
after building the kernel.

EDIT: I use grub2, your problem may be with lilo but after reconfiguring and rebuilding kernels,
Code:
genkernel --zfs all
has lead me to an unbootable system and I've had to rebuild the initramfs within a chroot.
I've also more than once forgotten to re-emerge zfs-kmod with
Code:
emerge -av @module-rebuild
with the same result (and maybe re-emergeing zfs and spl is necessary I forget, anyway now I just do both).

Last edited by mrbassie on Fri Sep 12, 2014 5:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 771
Location: over here

PostPosted: Fri Sep 12, 2014 5:26 pm    Post subject: Reply with quote

While I'm at it; a question for the sadly under-celebrated Mr. Yao:

Does upgrading zfs, zfs-kmod ans spl to the latest version, and doing a zpool upgrade work yet with zfs-on-linux? I have done it and made my zpool fail to import, specifically going from 0.6.2-r5 to 0.6.3) luckily I had a fairly recent stage4 tarball on a usb drive so I just started from scratch. I suspect PEBKAC.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri Sep 12, 2014 6:18 pm    Post subject: Reply with quote

mrbassie wrote:
..the sadly under-celebrated Mr. Yao

Not in all quarters: /msg friendlyToaster ryao on IRC: chat.freenode.net, home of #gentoo and #gentoo-chat as well as so many other great channels like #friendly-coders where ryao has been known to offer the odd bit of sage advice.. ;-)
Back to top
View user's profile Send private message
Gentoo64
n00b
n00b


Joined: 21 Oct 2011
Posts: 52
Location: ::

PostPosted: Sun Sep 14, 2014 8:28 pm    Post subject: Reply with quote

Get rid of genkernel and use this https://github.com/fearedbliss/bliss-initramfs

It's a lot cleaner and easier
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Sun Sep 14, 2014 9:23 pm    Post subject: Reply with quote

Gentoo64 wrote:
Get rid of genkernel and use this https://github.com/fearedbliss/bliss-initramfs

It's a lot cleaner and easier


does it support LVM ?
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
ryao
Retired Dev
Retired Dev


Joined: 27 Feb 2012
Posts: 132

PostPosted: Mon Sep 15, 2014 4:00 am    Post subject: Reply with quote

bpoint, my apologies for the late response. I was overwhelmed by the response to a blog post that I recently did, so it has been hard to respond to everyone asking questions.

That said, genkernel does not yet support udev-style device symlinks. You can use Sabayon's genkernel-next to deal with this until genkernel adds support. MOre specifically, until I find time to add support to genkernel.
Back to top
View user's profile Send private message
Gentoo64
n00b
n00b


Joined: 21 Oct 2011
Posts: 52
Location: ::

PostPosted: Mon Sep 15, 2014 8:34 pm    Post subject: Reply with quote

kernelOfTruth wrote:
Gentoo64 wrote:
Get rid of genkernel and use this https://github.com/fearedbliss/bliss-initramfs

It's a lot cleaner and easier


does it support LVM ?


Yes
Back to top
View user's profile Send private message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 84
Location: Japan

PostPosted: Tue Sep 16, 2014 8:09 am    Post subject: Reply with quote

ryao wrote:
bpoint, my apologies for the late response. I was overwhelmed by the response to a blog post that I recently did, so it has been hard to respond to everyone asking questions.

Not a problem at all, thanks for noticing and taking the time to reply! I had a rather busy weekend myself and didn't get a chance to poke at this much.

ryao wrote:
That said, genkernel does not yet support udev-style device symlinks. You can use Sabayon's genkernel-next to deal with this until genkernel adds support. MOre specifically, until I find time to add support to genkernel.

Ah, that would explain it then. I'll give genkernel-next a shot and see how it goes.

I might also give bliss-initramfs a quick go as well too, thanks for the suggestion Gentoo64.
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Tue Sep 16, 2014 11:24 am    Post subject: Reply with quote

ryao wrote:
That said, genkernel does not yet support udev-style device symlinks.


To clarify:

Far as I'm aware genkernel doesn't even use udev. Instead it's using busybox's mdev.
Back to top
View user's profile Send private message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 84
Location: Japan

PostPosted: Tue Sep 16, 2014 12:28 pm    Post subject: Reply with quote

I tried genkernel-next, but it doesn't seem to like me. Unfortunately I can't drop to a shell and poke around, so I'm not sure what it is I might be missing.

Code:
>> Loading modules
...
   :: Loading from fs: [    2.543971] SPL: Loaded module v0.6.3-r0-gentoo
[    2.544078] znvpair: module license 'CDDL' taints kernel.
[    2.544079] Disabling lock debugging due to kernel taint
...
>> Initializing root device...
>> Mounting /dev/sdb1 as root...
Failed to load ZFS module stack.
Load the module manually by running 'insmod <location>/zfs.ko' as root.
>> Detected fstype: zfs_member
>> Using mount fstype: zfs
>> Using mount opts: -o rw,zfsutil
mount: mounting /dev/sdb1 on /newroot failed: No such device
!! Cannot mount /dev/sdb1, trying with -t auto
[    2.601061] UDF-fs: bad mount option "zfsutil" or missing value
mount: mounting /dev/sdb1 on /newroot failed: Invalid argument
!! Cannot mount /dev/sdb1 with -t auto, giving up
!! Could not mount specified ROOT, try again
!! Please file a bug report with this message
[    2.607455] Kernel panic -- not syncing: Attempted to kill init! exitcode=0x00000100


I'm using the same genkernel command line (and /etc/genkernel.conf) as I did for genkernel-next.

Any thoughts/suggestions on things to try?
Back to top
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 771
Location: over here

PostPosted: Tue Sep 16, 2014 12:46 pm    Post subject: Reply with quote

have a look at this guide. http://www.funtoo.org/ZFS_Install_Guide
Back to top
View user's profile Send private message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 84
Location: Japan

PostPosted: Tue Sep 16, 2014 1:52 pm    Post subject: Reply with quote

Unfortunately the problems I'm having with genkernel aren't covered in that guide.

I suppose it's worth giving bliss-initramfs a try.
Back to top
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 771
Location: over here

PostPosted: Tue Sep 16, 2014 4:58 pm    Post subject: Reply with quote

bpoint wrote:
Unfortunately the problems I'm having with genkernel aren't covered in that guide.

I suppose it's worth giving bliss-initramfs a try.


I set up my zpool with disk-by-id as well and used genkernel to build the kernel and initramfs. it boots fine...well there's one little niggle where swapon fails on a zvol but it still boots.

try rebuilding your modules and the zfs userland tool and then
Code:
genkernel --zfs initramfs
seperately. If that doesn't work then I wonder if it's your bootloader.
Back to top
View user's profile Send private message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 84
Location: Japan

PostPosted: Wed Sep 17, 2014 9:46 am    Post subject: Reply with quote

mrbassie wrote:
I set up my zpool with disk-by-id as well and used genkernel to build the kernel and initramfs. it boots fine...well there's one little niggle where swapon fails on a zvol but it still boots.

If ryao is correct in saying that genkernel doesn't support udev-style device symlinks for /dev/disk/by-id, then there's something else in your initramfs that's creating it.

I'm curious to know what that is though, because I went ahead and tried your suggestion of genkernel --zfs initramfs and get the same issue with a non-existent /dev/disk directory.

mrbassie wrote:
If that doesn't work then I wonder if it's your bootloader.

Possible, but unlikely. I can mount and boot the pool manually from the initramfs shell, so I don't think it's bootloader related.
Back to top
View user's profile Send private message
mrbassie
l33t
l33t


Joined: 31 May 2013
Posts: 771
Location: over here

PostPosted: Wed Sep 17, 2014 2:14 pm    Post subject: Reply with quote

bpoint wrote:
mrbassie wrote:
I set up my zpool with disk-by-id as well and used genkernel to build the kernel and initramfs. it boots fine...well there's one little niggle where swapon fails on a zvol but it still boots.

If ryao is correct in saying that genkernel doesn't support udev-style device symlinks for /dev/disk/by-id, then there's something else in your initramfs that's creating it.

I'm curious to know what that is though, because I went ahead and tried your suggestion of genkernel --zfs initramfs and get the same issue with a non-existent /dev/disk directory.



I use eudev, that's the only think I can think of. That guide I posted was my installation method. I didn't do anything special with the initramfs, just let genkernel do it's thing.
Back to top
View user's profile Send private message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 84
Location: Japan

PostPosted: Wed Sep 24, 2014 11:04 am    Post subject: Reply with quote

I finally had a chance to investigate into why genkernel-next wasn't working. It looks like all that was wrong was I was specifying an incorrect root in the append line in my /etc/lilo.conf.

This worked with genkernel:
Quote:
append = "dozfs root=/dev/sdb1"

But I needed to specify the ZFS pool with genkernel-next:
Quote:
append = "dozfs root=ZFS=tank"


And that's it. I enabled udev in genkernel-next, and confirmed with an initramfs shell that /dev/disk/by-id is now populated, and the pool mounts and boots with no errors.

Thanks for all the help and suggestions, everyone!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum