Conversation
There was a problem hiding this comment.
Shouldn't this only be needed if /boot itself is zfs?
There was a problem hiding this comment.
Yes, but when using zfs we cannot tell from the nix expression if /boot is a part of the / dataset or it's own dataset. It was just easier to assume that if they were intending to boot from a root zpool, grub would likely need zfs support. Using grub2 with compiled in zfs support adds no extra dependencies if you already have zfs installed on your machine.
There was a problem hiding this comment.
What's the overhead of zfs support in grub? Can we enable it unconditionally?
There was a problem hiding this comment.
It's pretty small as it just needs libzfs. I wouldn't mind enabling this by default but I'll leave it as a configurable option. The biggest issue I suppose is that any breakage to the zfs package (incompatible kernel api) and then you break the ability to build grub. This probably isn't a big deal but something to keep in mind.
If /boot is a btrfs subvolume, it will be on a different device than / but not be at the root from grub's perspective. This should be fixed in a nicer way by #2449, but that won't make it into 14.04
|
I have some zfs tests started in NixOS/nixos#246 . Perhaps that could be leveraged. |
|
@jcumming Yes, it would be great if we could test full zfs root without separate datasets, /boot and /nix in separate datasets, and then the usual ext2 /boot with a zfs root. Even a zfs dataset /boot with root in a non-top level dataset. |
|
As far as btrfs tests are concerned we should have a plain old root with no subvolumes, a root which is set as the default and placed in a subvolume, a separate subvolume for /boot and /nix, and then a combination of default subvolume + /boot on it's own. Again, a separate /boot on ext2 + btrfs root would also be good. |
If /boot is a btrfs subvolume, it will be on a different device than / but not be at the root from grub's perspective. This should be fixed in a nicer way by #2449, but that can't go into 14.04.
|
I believe this is pretty much in working order. I've added tests for nixos/release.nix within the installer test group. The tests verify that it works in a variety of configurations, using labels, uuids, multiple partition layouts, btrfs plainly, btrfs with subvolumes. I'm only missing zfs tests at this point(maybe related to NixOS/nixos#246). I haven't added these to nixos/release-combined.nix as required dependencies, but this could be added trivially in the future. @shlevy Could you test if this works for your btrfs setup which relied upon #2456? |
pkgs/tools/misc/grub/2.0x.nix
Outdated
|
@shlevy so, do you have any opinion on this? If the tests still pass, I guess this should be merged after the typo fix… |
This reverts commit e4630c1.
…m layouts including full zfs / and /boot
There was a problem hiding this comment.
Why not just use the backtick operator to run btrfs?
There was a problem hiding this comment.
Because btrfs doesn't actually return an error string in the cases I need to know it failed, therefore relying on the exit code of the application. In hindsight, I could have used ${^CHILD_ERROR_NATIVE} to grab the return code, I just don't really like the fact that I am retrieving a global variable for the return status.
There was a problem hiding this comment.
It was most likely because I didn't want to deal with parsing errors from text vs the real subvolume strings.
|
Is this "beta" version considered stable enough to have it as the default grub? I would think it's marked as "beta" for some reason... EDIT-added: I tend to be careful about GRUB, as it may be difficult to roll back its breakage. |
|
Hm. I used repository-head GRUB for too long, maybe… (without problems) |
|
@vcunat Ubuntu 14.04 LTS, Archlinux, and Gentoo all use Grub 2.02-beta2 without issue. I would imagine this is common among almost all distros. |
|
Hmm, 14.04 has 54 patches on top of that beta [1], which isn't too reassuring, but Arch and Gentoo use it (almost) without patches, so I guess it's probably OK. Latest upstream release is more that two years old. [1] http://anonscm.debian.org/cgit/pkg-grub/grub.git/tree/debian/patches/series?h=ubuntu/trusty |
|
Sorry, I'm nixnoob, but how to build this?
|
|
I reproduce that error in a chrooted build. |
|
Yeah, the build is also failing on hydra, let me check it out. |
|
Also I just found that it's impossible to build grub2 with zfsSupport = false: -> Now with it's the same. But if I modify grub/2.0x.nix like this: Then it builds without ZFS support. I mean... Wat? :) Gotta say, it's a very magical package. Been messing with it and even asserts do not work as expected. Or I'm just stupid. Anyhow, placing forced |
|
You clearly didn't think of encrypted volumes when writing this. Sorry if I'm a bit angry, but I'm locked out of my machine because of this. |
There was a problem hiding this comment.
Nope, that is not necessarily true. Searching may fail if it's encrypted, for example!
|
Pushed revert |
|
I would recommend simply stripping out the logic that disables the kernel copying if there is a search command. Simply always copy kernels if /boot and / are on a different partition, end of story. The rest of the grub update is probably fine. |
You mean /boot, / and /nix/store? |
|
The idea of /nix/store not being on / seems crazy to me:)
|
Why? My / has /etc/ and /root/, I'd like /nix/ overfull not to affect |
|
Isn't the store needed to boot?
|
Not if initrd is copied to /boot. |
So is /tmp and /var/log I have them all separate and just set neededForBoot=true; in |
|
Ah, I didn't know about that feature. Nice. Anyways, the kernel should be copied if it doesn't reside on the same 2014-08-31 14:55 GMT+02:00 Michael Raskin notifications@github.com:
|
This reverts commit 469f22d, reversing changes made to 0078bc5. Conflicts: nixos/modules/installer/tools/nixos-generate-config.pl nixos/modules/system/boot/loader/grub/install-grub.pl nixos/release.nix nixos/tests/installer.nix I tried to keep apparently-safe code in conflicts. Conflicts: nixos/modules/installer/tools/nixos-generate-config.pl nixos/modules/system/boot/loader/grub/install-grub.pl
….grub"" This reverts commit 94205f5. Conflicts: nixos/modules/system/boot/loader/grub/install-grub.pl
If /boot is a btrfs subvolume, it will be on a different device than / but not be at the root from grub's perspective. This should be fixed in a nicer way by NixOS#2449, but that can't go into 14.04. (cherry picked from commit e4630c1)
This patchset brings grub up to the 2.02 beta release. This version of grub now supports most of the features in the zfsonlinux project allowing it to boot directly from root zpools. I also refactored install-grub.pl so that it understands how to search for zpools and btrfs volumes. Additionally a feature was added to allow users to force grub into locating disks by uuid or label.
This still needs extensive testing. I plan to add nixos tests for a variety of different edge case configurations. For now I just wanted to get this out for feedback.