Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Genkernel doesn't mount ZFS root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Orionos
n00b
n00b


Joined: 27 Apr 2014
Posts: 29

PostPosted: Wed Feb 18, 2015 9:59 pm    Post subject: Genkernel doesn't mount ZFS root Reply with quote

I have a system that uses ZFS on top of GPG-LUKS. Using the ~AMD64 version of Genkernel I can get past the LUKS unlock (the stable version panics and stops). However, it won't import the ZFS pool.

I get these messages on the console:
>> ZFS pool system already imported.
>> LUKS detected. Reimporting system
cannot import 'system': no such pool available
>> Working on device /dev/sdb1...
>> Using key device /dev/sda2.
Removable device /dev/sda2 mounted.
luks-key.gpg on device /dev/sda2 found
Enter passphrase:
>> LUKS device /dev/sdb1 opened
>> Initializing root device...
cannot open 'system/root': dataset does not exist

Then it drops me into a shell asking for the root block device. The zpool was not imported.

In the shell, I can easily do 'zpool import -f -N system' and log out of the shell and the initram will boot successfully.

It would appear the script doesn't run another zpool import after the unlock. Anything I can do to troubleshoot this?

For the record, I'm using this cmdline:
real_root=ZFS=system/root ro crypt_root=UUID=80b6426b-92b2-481e-9b25-ef29ed32c82d root_keydev=UUID=faef29f8-01a3-42db-9fd7-7d82b4e27b20 root_key=luks-key.gpg dozfs=force
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Wed Feb 18, 2015 11:39 pm    Post subject: Reply with quote

you can tweak genkernel so you can check which options are enabled for the kernel.

you may check the usual for file system support, encryption and such.

i assume you lack the support for your file system in the generated kernel.

you may also consider using the genkernel initramfs and a kernel build by yourself to get your box booting and running
Back to top
View user's profile Send private message
Orionos
n00b
n00b


Joined: 27 Apr 2014
Posts: 29

PostPosted: Thu Feb 19, 2015 12:55 am    Post subject: Reply with quote

Thanks for the reply.

Like I said, if I use the rescue shell from that exact same initramfs, I can import the system and complete the boot without any further intervention. So obviously both the initramfs as well as the kernel support everything they need. I created my own kernel customized for this test-system.

I placed
>app-crypt/gnupg-1.4.18 in /usr/portage/profiles/package.mask
because genkernel still cannot handle GnuPG 2.x

I placed
sys-kernel/genkernel-next cryptsetup gpg in /etc/portage/package.use
to have emerge pull in those packages as dependencies

I then emerged genkernel-next

I created the initramfs with
genkernel --install --luks --gpg --busybox --zfs initramfs

All that seems to be wrong is the order by which the initramfs executes its scripts. It attempts to import ZFS before LUKS. It should try again after the LUKS unlock, which it doesn't do.
Back to top
View user's profile Send private message
Orionos
n00b
n00b


Joined: 27 Apr 2014
Posts: 29

PostPosted: Thu Feb 19, 2015 8:55 pm    Post subject: Reply with quote

Looks like I was right. I unpacked the initramfs:
Code:

mkdir /opt/genkernel-initramfs
cd /opt/genkernel-initramfs/
unxz < /boot/initramfs-genkernel-x86_64-3.17.8-gentoo-r1 | cpio -i -d -H newc --no-absolute-filenames


then I looked into the init-script (nano -w /opt/genkernel-initramfs/init) and found this part:
Code:

start_volumes
zfs_start_volumes

setup_keymap

# Initialize LUKS root device except for livecd's
is_livecd || start_luks


So I altered it to do another ZFS import after the luks unlock:
Code:

start_volumes
zfs_start_volumes

setup_keymap

# Initialize LUKS root device except for livecd's
is_livecd || start_luks

zfs_start_volumes


Repacked (find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/initramfs-genkernel2-x86_64-3.17.8-gentoo-r1)

And it worked like a charm.

So what do I do? Can I open a bug report somewhere? Or is there a way to tell genkernel to edit the order in which to execute the scripts?
Back to top
View user's profile Send private message
cs0rbagomba
n00b
n00b


Joined: 23 Feb 2015
Posts: 2

PostPosted: Mon Feb 23, 2015 3:56 pm    Post subject: genkernel patch Reply with quote

Orionos, if you don't mind, I've created a bugreport at genkrenel:
https://github.com/Sabayon/genkernel-next/issues/25
with a patch proposal:
https://github.com/Sabayon/genkernel-next/pull/26

and I've left a link to this thread at the issue description.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Mon Feb 23, 2015 6:23 pm    Post subject: Re: genkernel patch Reply with quote

cs0rbagomba wrote:
Orionos, if you don't mind, I've created a bugreport at genkrenel: https://github.com/Sabayon/genkernel-next/issues/25

cs0rbagomba ... genkernel-next is a gentoo project, not a sabayon project, sabayon is downstream, not upstream, any report (by gentoo users) should be made to b.g.o.

best ... khay
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


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

PostPosted: Sun May 17, 2015 5:08 pm    Post subject: Re: Genkernel doesn't mount ZFS root Reply with quote

Orionos wrote:

For the record, I'm using this cmdline:
real_root=ZFS=system/root ro crypt_root=UUID=80b6426b-92b2-481e-9b25-ef29ed32c82d root_keydev=UUID=faef29f8-01a3-42db-9fd7-7d82b4e27b20 root_key=luks-key.gpg dozfs=force


Thanks for that "sample" line

and the suggested fix,


I'll see how well genkernel(-next) works and/or in conjunction with ZFS

since dracut doesn't appear to want to do anything besides mounting the root partition (still btrfs right now)
_________________
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
nouboh
n00b
n00b


Joined: 04 Apr 2003
Posts: 14

PostPosted: Fri Oct 02, 2015 3:58 pm    Post subject: Reply with quote

This is still not solved. Is genkernel recommended over genkernel-next? Seems to be updated more frequently.
Back to top
View user's profile Send private message
nouboh
n00b
n00b


Joined: 04 Apr 2003
Posts: 14

PostPosted: Fri Oct 02, 2015 5:29 pm    Post subject: Reply with quote

Well, it is solved in genkernel package so yes, it seems to be a better option than genkernel-next.
Back to top
View user's profile Send private message
likewhoa
l33t
l33t


Joined: 04 Oct 2006
Posts: 777
Location: Brooklyn, New York

PostPosted: Fri Oct 02, 2015 7:11 pm    Post subject: Reply with quote

Orionos wrote:
Looks like I was right. I unpacked the initramfs:
Code:

mkdir /opt/genkernel-initramfs
cd /opt/genkernel-initramfs/
unxz < /boot/initramfs-genkernel-x86_64-3.17.8-gentoo-r1 | cpio -i -d -H newc --no-absolute-filenames


then I looked into the init-script (nano -w /opt/genkernel-initramfs/init) and found this part:
Code:

start_volumes
zfs_start_volumes

setup_keymap

# Initialize LUKS root device except for livecd's
is_livecd || start_luks



So I altered it to do another ZFS import after the luks unlock:
Code:

start_volumes
zfs_start_volumes

setup_keymap

# Initialize LUKS root device except for livecd's
is_livecd || start_luks

zfs_start_volumes


Repacked (find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/initramfs-genkernel2-x86_64-3.17.8-gentoo-r1)

And it worked like a charm.

So what do I do? Can I open a bug report somewhere? Or is there a way to tell genkernel to edit the order in which to execute the scripts?


Can you try with this change?

Code:

start_volumes

setup_keymap

# Initialize LUKS root device except for livecd's
is_livecd || start_luks

zfs_start_volumes


To me it looks like a design bug because with your setup assuming you're using full / encryption there is no need to import any pools in this case since nothing is available at this stage.
Back to top
View user's profile Send private message
Orionos
n00b
n00b


Joined: 27 Apr 2014
Posts: 29

PostPosted: Sun Jan 31, 2016 6:52 pm    Post subject: Reply with quote

Well, this is still an issue, been over 6 months since a bug was created at Gentoo BugZilla. They really don't seem to give a hoot.

Anyway, the above change works of course. I didn't bother to remove the first zfs_start_volumes because it wasn't in the way. But it works fine if I do, as long as it comes after the LUKS-test.

@nouboh, I believe I had no choice but to go for -Next since the original didn't support my specific configuration. Plus, I thought -Next was the latest and greatest.

Anyway, I just spent half a day doing overdue maintenance. Piece of advice: don't compress your modules, Genkernel-Next refused to copy the modules into the initrd. Also, I keep getting kernel panics when repacking with LZ4, but I'm too worn out to figure out why.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing 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