Nixpkgs: NixOps libvirtd fails since username can't be detected

Created on 15 Oct 2019  路  20Comments  路  Source: NixOS/nixpkgs

Describe the bug
Specifically through nixops creating libvirtd-image, it fails with error: cannot figure out user name around chroot /mnt ${config.nix.package.out}/bin/nix-store --load-db [2]. whoami outputs whoami: cannot find name for user ID 0: No such file or directory.

To Reproduce
Steps to reproduce the behavior:
Any nixops machine deployed through libvirtd.

  1. nixops create -d a ./.
  2. nixops deploy -d a

Expected behavior
Create a QEMU image successfully.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata
Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.3.6-hardened, NixOS, 20.03.git.c6d74dc (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3pre6895_84de821`
 - channels(root): `"nixos-20.03pre194293.2436c27541b"`
 - nixpkgs: `$HOME/Projects/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:

https://github.com/nix-community/nixops-libvirtd/issues/5

[2] https://github.com/nix-community/nixops-libvirtd/blob/master/nix/libvirtd-image.nix#L67

bug

Most helpful comment

Or at least finally mark the package broken, as it is broken (!) for months now. Probably this would lead to a little bit of attention to the issue.

All 20 comments

This seems to also be the case with 19.09.

I seem to be also affected by this issue. I am currently in process of bisecting Nixpkgs to see which commit introduced this behavior.

It seems like the bug is caused by Nix update from 2.3 to 2.3.1 (Nixpkgs commit 3ab3614e2be95da22716cdc54b846b38a774efbb by @edolstra). ~I am currently testing master to see if the bug is fixed.~ master also exhibits this issue. I think that temporarily reverting the commit in question can fix this issue.

If only one could bisect Nix versions, applying each version to Nixpkgs. I think cloning Nix separately and running git bisect with bad as 2.3.1 and 2.3 good and pointing Nix derivation to cloned source would work, but this could be slow. I think I might need a faster PC to do that.

The error probably comes from https://github.com/NixOS/nix/blob/804910fb0eeb6a14ec8d6f98c7fd219da8d04581/src/libstore/local-store.cc#L80. You could try to set USER=root in the environment when calling nix-store --load-db.

@edolstra Right now I'm building Nix 2.3 with update commit in Nixpkgs reverted. I will try adding USER=root next (stashed it for now)

Reverting the commit fixes the issue. Building with USER=root added to nixos/lib/make-disk-image.nix in the nix-store --load-db... doesn't seem to work.

Experiencing this issue as well. Any updates on this?

The issue in nixops was resolved through https://github.com/nix-community/nixops-libvirtd/pull/4. However the issue in runInLinuxVM probably isn't?

When is the time to mark a package broken?
Amazon support is gone, libvirtd does not work. There wasn't even a small bugfix release to fix the libvirtd issue.
I wanted to look into nixops and I like the idea, but this seems more broken then unstable at the moment.

Within coming channel bumps of 19.09, 20.03, and unstable, this should be fixed. See #80680.

@samueldr, I'm on nixos-20.03 channel and still have "error: cannot figure out user name" while deploying on libvirtd.

Eek, right,

I noted there that it wasn't the fix for the Nixops-side issue, but didn't re-open that issue. Sorry.

Though, the issue, in Nixops, has been solved. I don't know why there has not been an update to it to use the now fixed plugin. I am not involved with the Nixops project though.


@eadwu I updated the title to better reflect the situation, since runInLinuxVM now doesn't fail under the same situation. Tell me if the title is wrong.

At the time the issue was created, the bug was in runInLinuxVM [1]. But the new title probably makes more sense, since that was how I found it.

[1] https://github.com/nix-community/nixops-libvirtd/commit/1c29f6c716dad9ad58aa863ebc9575422459bf95#diff-379b2f3643afdd2d648411d50c054080L9

Is there any fix or workaround for this issue?

I cannot use nixops with libvirtd (this issue) and virtualbox (NixOS/nixops#1207).

Is there any update on this issue? I thought nixops would be a fundamental part of nixos?

Is this not fixed already on nixops side?

(not a nixops user) AFAIUI not from a released version.

Almost begs the question if it might be worth considering some kind of funding, similar to what we did for the nix re-write, for NixOps. I feel it's a very fundamental part of NixOS and would benefit from some dedicated work.

Or at least finally mark the package broken, as it is broken (!) for months now. Probably this would lead to a little bit of attention to the issue.

I'm getting this on NixOS 20.09:

prima> these derivations will be built: prima> /nix/store/62r4jjjqvfl146kp0ham952hldwlbdsf-libvirtd-image.drv prima> /nix/store/ig6ii01sxdj48xg7s2rhghsjg918j0qf-libvirtd-ssh-image.drv prima> building '/nix/store/62r4jjjqvfl146kp0ham952hldwlbdsf-libvirtd-image.drv'... prima> Formatting '/nix/store/ixdkdcqlhmkybw1f990f3j91iwl4ba2r-libvirtd-image/image', fmt=qcow2 cluster_size=65536 compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16 prima> cSeaBIOS (version rel-1.13.0-48-gd9c812dda519-prebuilt.qemu.org) prima> prima> prima> iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+2FF8EFC0+2FEEEFC0 CA00 prima> prima> prima> prima> Booting from ROM... prima> Probing EDD (edd=off to disable)... ocloading kernel modules... prima> mounting Nix store... prima> mounting host's temporary directory... prima> starting stage 2 (/nix/store/csbmi2wc2pm1y6hwq10x2i4p7apx1v63-vm-run-stage2) prima> Information: You may need to update /etc/fstab. prima> prima> Information: You may need to update /etc/fstab. prima> prima> mke2fs 1.45.5 (07-Jan-2020) prima> Discarding device blocks: done prima> Creating filesystem with 2621184 4k blocks and 655360 inodes prima> Filesystem UUID: 1851004c-d2f2-4dca-ba31-4b34d68983bd prima> Superblock backups stored on blocks: prima> 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 prima> prima> Allocating group tables: done prima> Writing inode tables: done prima> Creating journal (16384 blocks): done prima> Writing superblocks and filesystem accounting information: done prima> prima> tune2fs 1.45.5 (07-Jan-2020) prima> Setting maximal mount count to -1 prima> Setting interval between checks to 0 seconds prima> filling Nix store... prima> error: cannot figure out user name prima> [ 34.804621] reboot: Power down prima> builder for '/nix/store/62r4jjjqvfl146kp0ham952hldwlbdsf-libvirtd-image.drv' failed with exit code 1 prima> cannot build derivation '/nix/store/ig6ii01sxdj48xg7s2rhghsjg918j0qf-libvirtd-ssh-image.drv': 1 dependencies couldn't be built prima> error: build of '/nix/store/ig6ii01sxdj48xg7s2rhghsjg918j0qf-libvirtd-ssh-image.drv' failed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

retrry picture retrry  路  3Comments

copumpkin picture copumpkin  路  3Comments

spacekitteh picture spacekitteh  路  3Comments

yawnt picture yawnt  路  3Comments

teto picture teto  路  3Comments