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

LXD should have more tools in its path #31117

Closed
3 of 6 tasks
CosmicToast opened this issue Nov 2, 2017 · 15 comments · Fixed by #253292
Closed
3 of 6 tasks

LXD should have more tools in its path #31117

CosmicToast opened this issue Nov 2, 2017 · 15 comments · Fixed by #253292
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@CosmicToast
Copy link

CosmicToast commented Nov 2, 2017

Issue description

lxd supports multiple storage backends, but most of them are unusable.

Steps to reproduce

  1. Set virtualisation.lxd.enable = true;
  2. Add your user to the lxd group (or perform the rest of the steps as root).
  3. Try to initialize a storage backend (e.g using lxd init) that isn't marked on the list below.

Technical details

Nix's lxd storage backend support matrix:

  • Directory (see note 1)
  • Btrfs (see note 1)
  • Zfs (missing path)
  • LVM Thin Volumes (missing path)
  • Raw LVM (untested, but seems to not be present in lxd.nix)
  • Ceph (untested, but seems to not be present in lxd.nix)

Note 1: LXD does somewhat work with the directory and btrfs backends, but any and all created containers insist that /var/lib/lxc/rootfs must exist.
It doesn't actually get used. This is almost certainly a bug, and is mentioned in #25280.

Potential solutions

  • LVM2 and thin-provisioning tools should almost definitely be enabled unconditionally, as per the TODO.
  • Zfs and Btrfs support may potentially be autodetected based on boot.supportedFilesystems.
  • Ceph is sufficiently uncommon that it may be an explicitly-enabled option.

Alternatively, we can have something ala boot.supportedFilesystems under, say, virtualisation.lxd.storageBackends.

I'm going to be busy working for a bit, and am still somewhat unfamiliar with the nix expression language, but I'll take a look at making a (basic, to be expanded upon) patch once I have time.

@Shados
Copy link
Member

Shados commented Nov 13, 2017

FWIW, the version of Ceph in nixpkgs is 1) ancient, and 2) marked as broken (due to a DOS vulnerability), so I wouldn't worry about it too much right now. I've been working on packaging a recent (12.2.x) release, but they changed to building using cmake and some outputs are silently not being built by my current expression...

@CosmicToast
Copy link
Author

Ceph is the one I'm worried least about (since it's quite uncommon, as far as I can tell).
LVM and Zfs, on the other hand, are very common, and currently nonfunctional.

@1pakch
Copy link
Contributor

1pakch commented Nov 14, 2017

I like supported backends option more than unconditional enabling. This option is not necessarily LXD specific. For instance, current docker module also does not include thin provisioning tools automatically AFAIK.

@MrSorcus
Copy link

When it will be completed?

@CosmicToast
Copy link
Author

Probably never, I stopped using nix since it ended up not fitting into my workflow very well, with relatively common annoying (to me) side effects (of the immutability bit).
If there was work being done it would be availabe in a linked PR ;)

@Mic92
Copy link
Member

Mic92 commented Jul 21, 2018

zfsSupport was added as a flag in 7663de1

@Mic92
Copy link
Member

Mic92 commented Jul 21, 2018

Ceph module was also revisted in the last release. It also has a test now.

@jkryl
Copy link

jkryl commented Apr 27, 2020

I had this problem with lvm storage backend and was able to work around it by putting the following line to /etc/nixos/configuration.nix:

  systemd.services.lxd.path = with pkgs; [ lvm2 thin-provisioning-tools ];

The line above includes lvm tools in the PATH of lxd daemon. Until I did that I was getting the following error from lxd init or lxc when trying to create a storage pool:

$ lxc storage create lxd lvm source=/dev/sdb1
Error: Error getting LVM version: Failed to run: lvm version:
output:''

@mt-caret
Copy link
Contributor

On the topic of tools which should be included in the lxd module, I think libnvidia-container should be included as well (related issue: #27999). I really should take a stab at it someday...

@stale
Copy link

stale bot commented Dec 15, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 15, 2020
@Mic92
Copy link
Member

Mic92 commented Dec 16, 2020

still not addressed.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 16, 2020
@gebner
Copy link
Member

gebner commented Dec 26, 2020

I believe qemu-img is missing as well:

$ lxc launch --vm images:archlinux/current
Error: Failed instance creation: Create instance from image: Failed reading image info "/var/lib/lxd/storage-pools/default/virtual-machines/sincere-eagle/root.img": Failed to run: qemu-img info --output=json /var/lib/lxd/images/ed08824e15dd8efc89afb9eba288f8417d2309c0bce7c7684ac160ece786034f.rootfs:i

But that still fails with "/usr/share not found" even if I add qemu to the path..

@stale
Copy link

stale bot commented Jun 26, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 26, 2021
@Mic92
Copy link
Member

Mic92 commented Jun 26, 2021

For some backends I would add additional options rather than just adding all of them. Qemu for example can be quite big (i.e. pulling in x11 and opengl dependencies).

@anpin
Copy link
Contributor

anpin commented Aug 19, 2022

following the advice of @jkryl and hitting Error: Failed instance creation: Failed creating instance from image: Error creating LVM logical volume: Error making filesystem on LVM logical volume: Failed to run: mkfs.ext4 -E nodiscard,lazy_itable_init=0,lazy_journal_init=0 /dev/vg/images_* I found here that one should also add e2fsprogs to lxd path as such

systemd.services.lxd.path = with pkgs; [ lvm2 thin-provisioning-tools e2fsprogs ];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants