Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install Ubuntu with a native ZFS root filesystem on top of an encrypted partition. The device setup is as follows:

  • The physical disk is partitioned into a small boot partition and the rest.
  • The rest of the disk is entirely encrypted and carved up into a /swap and a /root partition for the actual system.
  • The ZFS pool created on that root partition with a couple of ZFS filesystems for things like /home.

These are the two principal guides I've been following:

It's all working fine except for the final step -- the installation of grub. update-grub says (inside the chroot)

error: cannot find a device for / (is /dev mounted?)

/dev is mounted and I followed the additional advice in the second guide for setting up /etc/default/grub and so on.

I can't seem to get grub to recognise the device and grub.cfg/menu.lst are not being created. Are there any steps I might have missed? All of this is running inside VirtualBox if that's relevant.

In particular I'm wondering what the correct grub command-line would be to boot this system.

share|improve this question

You may need to bind the LVM root. Exit the chroot, and type:

sudo mount --bind /dev /mnt/root/dev

Then chroot back in, and see if the ZFS-grub update works.

share|improve this answer
I did this. It's in the first guide I linked to. – Lars Kotthoff Aug 10 '12 at 8:06
But did you bind your physical root and not the ZFS root? – izx Aug 11 '12 at 1:01
Yes. Exactly as you said, before entering the chroot. – Lars Kotthoff Aug 11 '12 at 11:13
This step what does it give you: 6.1 Verify that the ZFS root filesystem is recognized by GRUB: # grub-probe / zfs – LnxSlck Aug 13 '12 at 15:51
It gives me the same error about not being able to find a device. – Lars Kotthoff Aug 15 '12 at 13:08

Grub 1.99 (shipped with Ubuntu) doesn't support encrypted zfs, which is why update-grub is failing.

So your options are:

  1. Install grub 2.00 (which does support encrypted zfs).
  2. Write your grub.cfg manually rather than using update-grub.

Both of these options deviate significantly from Ubuntu defaults, but still much less so than using encrypted ZFS for your root FS in the first place :)

For #1 you'll need to compile grub 2.00 from source, as I'm not aware of any grub 2.00 packages for Ubuntu.

For #2 you'll need to dpkg-divert update-grub and replace it with a symlink to /bin/true then write your grub.cfg by hand (updating it whenever you get a kernel upgrade).

If you need to more specifics on how to do either option I'd be glad to expand on that.

share|improve this answer
The zfs-supporting grub is provided by a ppa (mentioned in the first guide). I've tried ZFS without encryption (i.e. following just the first guide) and that works fine. The problem is really just that I don't know the combination of grub commandline options and initrd configuration to make the combination of encryption + zfs succeed. – Lars Kotthoff Aug 14 '12 at 8:02
That PPA includes grub with ZFS support, not with encrypted ZFS support. For encrypted ZFS you need grub 2.00. – Jordan Uggla Aug 20 '12 at 4:28
Ahh, I see. I'll give that a try. – Lars Kotthoff Aug 20 '12 at 8:15
I've tried compiling grub 2.00 from source but the machine froze up while I did that. I might give it another go later, but this definitely doesn't inspire me with confidence. I'll probably just wait until ZFS on linux is more stable. – Lars Kotthoff Aug 21 '12 at 8:01
I've tried with Ubuntu 12.10 which comes with grub 2.00, but that didn't work either -- same error as before. Apparently there are some changes about to be made to the zfs-related packages though, so it might work in a while. – Lars Kotthoff Oct 29 '12 at 11:03

The most reasonable approch seems to use zfs for your home folder and leave / as ext4 in a luks container!topic/zfs-discuss/tqZybs5SAGA

There is also a tutorial on howto use luks and zfs on / in gentoo: which i haven't tried yet. If there is someone out there who could write a nice tutorial i am sure there are hundrets of thankfull people who would appreciate it.

share|improve this answer
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Oyibo Jun 17 '13 at 9:46
up vote 0 down vote accepted

I've written up a step-by-step guide on how to get this working here:

share|improve this answer
Very nice guide. Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – gertvdijk Jun 29 '13 at 11:45
I do appreciate your point, but you will see that this is a rather long article. Writing it took quite some time and I don't really want to spend even more time condensing it solely for the purpose of having a "nice" answer. – Lars Kotthoff Jun 29 '13 at 11:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.