NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.51k stars 13k forks source link

virt-sparsify -- libguestfs: error: cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH #112920

Closed mkgvt closed 6 months ago

mkgvt commented 3 years ago

Describe the bug

virt-sparsify fails with an obscure libguestfs error.

To Reproduce Steps to reproduce the behavior:

$ virt-sparsify myimage.qcow2 sparse.myimage.qcow2 [ 0.0] Create overlay file in /run/user/1001 to protect source disk [ 0.0] Examine source disk .virt-sparsify-wrapped: error: libguestfs error: cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH (search path: /nix/store/4g49x151301xk52rmh3rdic6p2p5g1ga-libguestfs-1.40.2/lib64/guestfs)

If reporting bugs, run .virt-sparsify-wrapped with debugging enabled and include the complete output:

.virt-sparsify-wrapped -v -x [...]

$ .virt-sparsify-wrapped -v -x myimage.qcow2 sparse.myimage.qcow2 libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: disk_format "/home/user/myimage.20180907.qcow2" libguestfs: command: run: qemu-img --help | grep -sqE -- '\binfo\b.-U\b' libguestfs: command: run: qemu-img libguestfs: command: run: \ info libguestfs: command: run: \ -U libguestfs: command: run: \ --output json libguestfs: command: run: \ /home/user/myimage.20180907.qcow2 libguestfs: parse_json: qemu-img info JSON output:\n{\n "virtual-size": 1073741824,\n "filename": "/home/user/myimage.20180907.qcow2",\n "cluster-size": 65536,\n "format": "qcow2",\n "actual-size": 26477568,\n "format-specific": {\n "type": "qcow2",\n "data": {\n "compat": "1.1",\n "compression-type": "zlib",\n "lazy-refcounts": true,\n "refcount-bits": 16,\n "corrupt": false\n }\n },\n "dirty-flag": false\n}\n\n libguestfs: trace: disk_format = "qcow2" libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: disk_virtual_size "/home/user/myimage.20180907.qcow2" libguestfs: command: run: qemu-img --help | grep -sqE -- '\binfo\b.-U\b' libguestfs: command: run: qemu-img libguestfs: command: run: \ info libguestfs: command: run: \ -U libguestfs: command: run: \ --output json libguestfs: command: run: \ /home/user/myimage.20180907.qcow2 libguestfs: parse_json: qemu-img info JSON output:\n{\n "virtual-size": 1073741824,\n "filename": "/home/user/myimage.20180907.qcow2",\n "cluster-size": 65536,\n "format": "qcow2",\n "actual-size": 26477568,\n "format-specific": {\n "type": "qcow2",\n "data": {\n "compat": "1.1",\n "compression-type": "zlib",\n "lazy-refcounts": true,\n "refcount-bits": 16,\n "corrupt": false\n }\n },\n "dirty-flag": false\n}\n\n libguestfs: trace: disk_virtual_size = 1073741824 input disk virtual size is 1073741824 bytes (1.0G) [ 0.0] Create overlay file in /run/user/1001 to protect source disk libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: disk_create "/run/user/1001/sparsifycec54d.qcow2" "qcow2" -1 "backingfile:/home/user/myimage.20180907.qcow2" "compat:1.1" libguestfs: command: run: qemu-img libguestfs: command: run: \ create libguestfs: command: run: \ -f qcow2 libguestfs: command: run: \ -o backing_file=/home/user/myimage.20180907.qcow2,compat=1.1 libguestfs: command: run: \ /run/user/1001/sparsifycec54d.qcow2 qemu-img: warning: Deprecated use of backing file without explicit backing format (detected format of qcow2) Formatting '/run/user/1001/sparsifycec54d.qcow2', fmt=qcow2 cluster_size=65536 compression_type=zlib size=1073741824 compat=1.1 backing_file=/home/user/myimage.20180907.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 libguestfs: trace: disk_create = 0 [ 0.1] Examine source disk libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: add_drive "/run/user/1001/sparsifycec54d.qcow2" "readonly:false" "format:qcow2" "cachemode:unsafe" libguestfs: trace: add_drive = 0 libguestfs: trace: launch libguestfs: trace: max_disks libguestfs: trace: max_disks = 255 libguestfs: trace: get_tmpdir libguestfs: trace: get_tmpdir = "/run/user/1001" libguestfs: trace: version libguestfs: trace: version = <struct guestfs_version = major: 1, minor: 40, release: 2, extra: , > libguestfs: trace: get_backend libguestfs: trace: get_backend = "direct" libguestfs: launch: program=.virt-sparsify-wrapped libguestfs: launch: version=1.40.2 libguestfs: launch: backend registered: unix libguestfs: launch: backend registered: uml libguestfs: launch: backend registered: libvirt libguestfs: launch: backend registered: direct libguestfs: launch: backend=direct libguestfs: launch: tmpdir=/run/user/1001/libguestfsJOsdjZ libguestfs: launch: umask=0022 libguestfs: launch: euid=1001 libguestfs: trace: launch = -1 (error) .virt-sparsify-wrapped: error: libguestfs error: cannot find any suitable libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH (search path: /nix/store/4g49x151301xk52rmh3rdic6p2p5g1ga-libguestfs-1.40.2/lib64/guestfs) libguestfs: trace: close libguestfs: closing guestfs handle 0x10d2c60 (state 0) libguestfs: command: run: rm libguestfs: command: run: \ -rf /run/user/1001/libguestfsJOsdjZ libguestfs: trace: close

Expected behavior The image to be sparsified rather than to give an error.

Additional context NixOS 20.09.3106.ae47c79479a libguestfs 1.40.2 (loaded via nix-shell)

Notify maintainers

Metadata Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
Xe commented 3 years ago

I just ran into this today too:

[nix-shell:~]$ virt-sparsify --compress tadar.qcow2 tadar.qcow2c
[   0.3] Create overlay file in /home/cadey/tmp to protect source disk
[   0.4] Examine source disk
.virt-sparsify-wrapped: error: libguestfs error: cannot find any suitable
libguestfs supermin, fixed or old-style appliance on LIBGUESTFS_PATH
(search path:
/nix/store/r0a5l4q7gbz80k8z9lqxr6g1ac7i3b6r-libguestfs-1.40.2/lib64/guestfs)

If reporting bugs, run .virt-sparsify-wrapped with debugging enabled and
include the complete output:

  .virt-sparsify-wrapped -v -x [...]
minijackson commented 2 years ago

I ran into this problem just now while using virt-builder, and while trying to package supermin to see if it would solve things, I just noticed that there is two libguestfs packages in nixpkgs: libguestfs and libguestfs-with-appliance. Switching to libguestfs-with-appliance fixed my issue. Be careful since the appliance is explicitly opted-out from Hydra, so there is some compilation to be done to install it.

I'm not sure if supermin can still be useful.

stale[bot] commented 2 years ago

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

minijackson commented 6 months ago

This should be fixed with https://github.com/NixOS/nixpkgs/pull/195417