Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image with btrfs rootfs doesn't boot in qemu vm #588

Open
kurnevsky opened this issue Mar 7, 2023 · 6 comments
Open

Image with btrfs rootfs doesn't boot in qemu vm #588

kurnevsky opened this issue Mar 7, 2023 · 6 comments

Comments

@kurnevsky
Copy link
Member

kurnevsky commented Mar 7, 2023

My earlier comment: #356 (comment)

I'm trying to boot into qemu vm using an image with btrfs rootfs. Here is what I tried: kurnevsky/nixfiles@6f84f88 - before this change it worked, and it works if I just change fs type to ext4.

Here are my full configs I used, just for the reference:
https://github.com/kurnevsky/nixfiles/blob/phone-btrfs/modules/phone.nix
https://github.com/kurnevsky/nixfiles/blob/phone-btrfs/machines/phone/configuration.nix
https://github.com/kurnevsky/nixfiles/blob/phone-btrfs/flake.nix#L152

In the qemu vm logs I see (after running ./result):

modprobe: module btrfs not found in modules.dep
W, [2023-03-07T12:58:01.179669//1.6682 #1]  WARN -- : Kernel filesystem module “btrfs” failed to load.
mount: mounting /dev/disk/by-uuid/e3b552a3-be28-4d1d-9016-e1b9a8699464 on /mnt/ failed: No such device
@kurnevsky
Copy link
Member Author

Specifying mobile.boot.stage-1.kernel.additionalModules = [ "btrfs" ]; fixed the problem.

@kurnevsky
Copy link
Member Author

kurnevsky commented Jul 15, 2023

Though now home-manager complains: error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted

@kurnevsky
Copy link
Member Author

kurnevsky commented Jul 15, 2023

It executes nix-build --expr '{}' --no-out-link which fails on btrfs. And this happens because nix daemon didn't start: Nix Daemon was skipped because of an unmet condition check (ConditionPathIsReadWrite=/nix/var/nix/daemon-socket). This is quite strange, because this path is writable.

@kurnevsky
Copy link
Member Author

Looks like this

copies owner as well, which is wrong...

@kurnevsky
Copy link
Member Author

Yep, that's the reason - if I change owner to root it works.

@kurnevsky
Copy link
Member Author

kurnevsky commented Jul 15, 2023

It seems the only way to fix this is to patch these lines: https://github.com/kdave/btrfs-progs/blob/d1d8fb4b599e76a3d6bc355df9e5787955104a72/mkfs/rootdir.c#L128-L129

Or, maybe some hack with linux vm...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant