[nbdkit PATCH] curl: use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T when available
by Pino Toscano
Use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T for curl_easy_getinfo() (added in
curl 7.55.0) to get the length of a remote file, instead of the old
CURLINFO_CONTENT_LENGTH_DOWNLOAD. This way the size is already a 64-bit
integer value, as opposed to a double (the old information).
---
plugins/curl/curl.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c
index 1b0d2b9..e0449b7 100644
--- a/plugins/curl/curl.c
+++ b/plugins/curl/curl.c
@@ -70,6 +70,10 @@ static long protocols = CURLPROTO_ALL;
/* Use '-D curl.verbose=1' to set. */
int curl_debug_verbose = 0;
+#if CURL_AT_LEAST_VERSION(7, 55, 0)
+#define HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
+#endif
+
static void
curl_load (void)
{
@@ -290,6 +294,9 @@ curl_open (int readonly)
struct curl_handle *h;
CURLcode r;
double d;
+#ifdef HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
+ curl_off_t o;
+#endif
h = calloc (1, sizeof *h);
if (h == NULL) {
@@ -377,6 +384,21 @@ curl_open (int readonly)
goto err;
}
+#ifdef HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
+ r = curl_easy_getinfo (h->c, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &o);
+ if (r != CURLE_OK) {
+ display_curl_error (h, r, "could not get length of remote file [%s]", url);
+ goto err;
+ }
+
+ if (o == -1) {
+ nbdkit_error ("could not get length of remote file [%s], "
+ "is the URL correct?", url);
+ goto err;
+ }
+
+ h->exportsize = o;
+#else
r = curl_easy_getinfo (h->c, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d);
if (r != CURLE_OK) {
display_curl_error (h, r, "could not get length of remote file [%s]", url);
@@ -390,6 +412,7 @@ curl_open (int readonly)
}
h->exportsize = (size_t) d;
+#endif
nbdkit_debug ("content length: %" PRIi64, h->exportsize);
if (strncasecmp (url, "http://", strlen ("http://")) == 0 ||
--
2.24.1
4 years, 10 months
virt-sparsify error message.
by gilles2.lebris@laposte.net
Hello,
I'm using virt-sparsify on a new server and I get an error message:
# virt-sparsify img img2
[ 0.0] Create overlay file in /tmp to protect source disk
[ 0.1] Examine source disk
virt-sparsify: error: libguestfs error: guestfs_launch failed.
This usually means the libguestfs appliance failed to start or crashed.
Here is libguestfs-test-tool output:
http://pastebin.com/3EZNxAeR
I would really appreciate any help or hint
Thanks in advance.
4 years, 10 months
(no subject)
by TEP
Installing debian-9, for using with hassio in docker. Followed steps in
this tutorial:
https://www.home-assistant.io/blog/2017/11/29/hassio-virtual-machine/
This is linux mint on a lenovo computer, unsure what you would need to
troubleshoot the following error.
Please advise how to go forward.
Sincerely
Tor
Info hardware:
lenovo yoga 2 pro, model: yb05031832
lshw
WARNING: you should run this program as super-user.
teev-ha
description: Computer
width: 64 bits
capabilities: smp vsyscall32
*-core
description: Motherboard
physical id: 0
*-memory
description: System memory
physical id: 0
size: 3868MiB
*-cpu
product: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
vendor: Intel Corp.
physical id: 1
bus info: cpu@0
size: 2384MHz
capacity: 2700MHz
width: 64 bits
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8
apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss
ht tm pbe syscall nx pdpe1gb rdtscp x86-64 constant_tsc arch_perfmon pebs
bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq
dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1
sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm
abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi
flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
xsaveopt dtherm ida arat pln pts md_clear flush_l1d cpufreq
*-pci
description: Host bridge
product: Haswell-ULT DRAM Controller
vendor: Intel Corporation
physical id: 100
bus info: pci@0000:00:00.0
version: 0b
width: 32 bits
clock: 33MHz
configuration: driver=hsw_uncore
resources: irq:0
*-display
description: VGA compatible controller
product: Haswell-ULT Integrated Graphics Controller
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 0b
width: 64 bits
clock: 33MHz
capabilities: vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:43 memory:b0000000-b03fffff
memory:a0000000-afffffff ioport:3000(size=64) memory:c0000-dffff
*-multimedia:0
description: Audio device
product: Haswell-ULT HD Audio Controller
vendor: Intel Corporation
physical id: 3
bus info: pci@0000:00:03.0
version: 0b
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=snd_hda_intel latency=0
resources: irq:58 memory:b0518000-b051bfff
*-generic:0
description: Signal processing controller
product: Haswell-ULT Thermal Subsystem
vendor: Intel Corporation
physical id: 4
bus info: pci@0000:00:04.0
version: 0b
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=proc_thermal latency=0
resources: irq:16 memory:b0510000-b0517fff
*-usb:0
description: USB controller
product: 8 Series USB xHCI HC
vendor: Intel Corporation
physical id: 14
bus info: pci@0000:00:14.0
version: 04
width: 64 bits
clock: 33MHz
capabilities: xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:41 memory:b0500000-b050ffff
*-communication UNCLAIMED
description: Communication controller
product: 8 Series HECI #0
vendor: Intel Corporation
physical id: 16
bus info: pci@0000:00:16.0
version: 04
width: 64 bits
clock: 33MHz
capabilities: cap_list
configuration: latency=0
resources: memory:b0520000-b052001f
*-multimedia:1
description: Audio device
product: 8 Series HD Audio Controller
vendor: Intel Corporation
physical id: 1b
bus info: pci@0000:00:1b.0
version: 04
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=snd_hda_intel latency=0
resources: irq:44 memory:b051c000-b051ffff
*-pci
description: PCI bridge
product: 8 Series PCI Express Root Port 1
vendor: Intel Corporation
physical id: 1c
bus info: pci@0000:00:1c.0
version: e4
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:40 memory:b0400000-b04fffff
*-network
description: Wireless interface
product: Wireless 7260
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:01:00.0
logical name: wlp1s0
version: 6b
serial: 5c:c5:d4:6a:74:80
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi
driverversion=4.15.0-72-generic firmware=17.948900127.0 ip=192.168.86.101
latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:45 memory:b0400000-b0401fff
*-usb:1
description: USB controller
product: 8 Series USB EHCI #1
vendor: Intel Corporation
physical id: 1d
bus info: pci@0000:00:1d.0
version: 04
width: 32 bits
clock: 33MHz
capabilities: ehci bus_master cap_list
configuration: driver=ehci-pci latency=0
resources: irq:23 memory:b0524000-b05243ff
*-isa
description: ISA bridge
product: 8 Series LPC Controller
vendor: Intel Corporation
physical id: 1f
bus info: pci@0000:00:1f.0
version: 04
width: 32 bits
clock: 33MHz
capabilities: isa bus_master cap_list
configuration: driver=lpc_ich latency=0
resources: irq:0
*-storage
description: SATA controller
product: 8 Series SATA Controller 1 [AHCI mode]
vendor: Intel Corporation
physical id: 1f.2
bus info: pci@0000:00:1f.2
version: 04
width: 32 bits
clock: 66MHz
capabilities: storage ahci_1.0 bus_master cap_list
configuration: driver=ahci latency=0
resources: irq:42 ioport:3088(size=8) ioport:3094(size=4)
ioport:3080(size=8) ioport:3090(size=4) ioport:3060(size=32)
memory:b0523000-b05237ff
*-serial UNCLAIMED
description: SMBus
product: 8 Series SMBus Controller
vendor: Intel Corporation
physical id: 1f.3
bus info: pci@0000:00:1f.3
version: 04
width: 64 bits
clock: 33MHz
configuration: latency=0
resources: memory:b0521000-b05210ff ioport:3040(size=32)
*-generic:1
description: Signal processing controller
product: 8 Series Thermal
vendor: Intel Corporation
physical id: 1f.6
bus info: pci@0000:00:1f.6
version: 04
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=intel_pch_thermal latency=0
resources: irq:18 memory:b0522000-b0522fff
WARNING: output may be incomplete or inaccurate, you should run this
program as super-user.
teev@teev-HA:~$
Error:
teev@teev-HA:~$ sudo virt-builder debian-9 \
> --output /var/lib/libvirt/images/hassio.img \
> --format qcow2 \
> --size 10G \
> --root-password password:test123 \
> --hostname hassio \
> --firstboot-command "dpkg-reconfigure openssh-server"
[sudo] passord for teev:
[ 1,7] Downloading: http://libguestfs.org/download/builder/debian-9.xz
[ 2,5] Planning how to build this image
[ 2,5] Uncompressing
[ 16,6] Resizing (using virt-resize) to expand the disk to 10,0G
virt-builder: error: libguestfs error: qemu-img:
/var/lib/libvirt/images/hassio.img: qemu-img exited with error status 1.
To see full error messages you may need to enable debugging.
Do:
export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again. For further information, read:
http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.
If reporting bugs, run virt-builder with debugging enabled and include the
complete output:
virt-builder -v -x [...]
teev@teev-HA:~$ libguestfs-test-tool
************************************************************
* IMPORTANT NOTICE
*
* When reporting bugs, include the COMPLETE, UNEDITED
* output below in your bug report.
*
************************************************************
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
XDG_RUNTIME_DIR=/run/user/1000
SELinux: sh: 1: getenforce: not found
guestfs_get_append: (null)
guestfs_get_autosync: 1
guestfs_get_backend: direct
guestfs_get_backend_settings: []
guestfs_get_cachedir: /var/tmp
guestfs_get_direct: 0
guestfs_get_hv: /usr/bin/qemu-system-x86_64
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /usr/lib/x86_64-linux-gnu/guestfs
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_smp: 1
guestfs_get_sockdir: /run/user/1000
guestfs_get_tmpdir: /tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: program=libguestfs-test-tool
libguestfs: launch: version=1.36.13
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=/tmp/libguestfsVov1Hm
libguestfs: launch: umask=0022
libguestfs: launch: euid=1000
libguestfs: is_openable: /dev/kvm: Ikke tilgang
libguestfs: warning: current user is not a member of the KVM group (group
ID 130). This user cannot access /dev/kvm, so libguestfs may run very
slowly. It is recommended that you 'chmod 0666 /dev/kvm' or add the current
user to the KVM group (you might need to log out and log in again).
libguestfs: begin building supermin appliance
libguestfs: run supermin
libguestfs: command: run: /usr/bin/supermin
libguestfs: command: run: \ --build
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --if-newer
libguestfs: command: run: \ --lock /var/tmp/.guestfs-1000/lock
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/x86_64-linux-gnu/guestfs/supermin.d
libguestfs: command: run: \ -o /var/tmp/.guestfs-1000/appliance.d
supermin: version: 5.1.19
supermin: package handler: debian/dpkg
supermin: acquiring lock on /var/tmp/.guestfs-1000/lock
supermin: build: /usr/lib/x86_64-linux-gnu/guestfs/supermin.d
supermin: reading the supermin appliance
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/base.tar.gz type gzip base
image (tar)
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/daemon.tar.gz type gzip base
image (tar)
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/excludefiles type uncompressed
excludefiles
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/hostfiles type uncompressed
hostfiles
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/init.tar.gz type gzip base
image (tar)
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/packages type uncompressed
packages
supermin: build: visiting
/usr/lib/x86_64-linux-gnu/guestfs/supermin.d/udev-rules.tar.gz type gzip
base image (tar)
supermin: mapping package names to installed packages
supermin: resolving full list of package dependencies
supermin: build: 210 packages, including dependencies
supermin: build: 9832 files
supermin: build: 6680 files, after matching excludefiles
supermin: build: 6691 files, after adding hostfiles
supermin: build: 6688 files, after removing unreadable files
supermin: build: 6691 files, after munging
supermin: kernel: looking for kernel using environment variables ...
supermin: kernel: looking for kernels in /lib/modules/*/vmlinuz ...
supermin: kernel: looking for kernels in /boot ...
supermin: kernel: kernel version of /boot/vmlinuz-4.15.0-72-generic =
4.15.0-72-generic (from filename)
supermin: kernel: picked modules path /lib/modules/4.15.0-72-generic
supermin: kernel: kernel version of /boot/vmlinuz-4.15.0-54-generic =
4.15.0-54-generic (from content)
supermin: kernel: picked modules path /lib/modules/4.15.0-54-generic
supermin: kernel: picked vmlinuz /boot/vmlinuz-4.15.0-72-generic
supermin: kernel: kernel_version 4.15.0-72-generic
supermin: kernel: modpath /lib/modules/4.15.0-72-generic
cp: cannot open '/boot/vmlinuz-4.15.0-72-generic' for reading: Permission
denied
supermin: cp -p '/boot/vmlinuz-4.15.0-72-generic'
'/var/tmp/.guestfs-1000/appliance.d.sxjic2b4/kernel': command failed, see
earlier errors
libguestfs: error: /usr/bin/supermin exited with error status 1, see debug
messages above
libguestfs: closing guestfs handle 0x55a8c25890d0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsVov1Hm
teev@teev-HA:~$ ^C
teev@teev-HA:~$ export libguestfs_debug=1
teev@teev-HA:~$ export libguestfs_trace=1
teev@teev-HA:~$ sudo virt-builder debian-9 --output
/var/lib/libvirt/images/hassio.img --format qcow2 --size 10G
--root-password password:test123 --hostname hassio
--firstboot-command "dpkg-reconfigure openssh-server"
[sudo] passord for teev:
[ 1,6] Downloading: http://libguestfs.org/download/builder/debian-9.xz
[ 2,4] Planning how to build this image
[ 2,4] Uncompressing
[ 16,4] Resizing (using virt-resize) to expand the disk to 10,0G
virt-builder: error: libguestfs error: qemu-img:
/var/lib/libvirt/images/hassio.img: qemu-img exited with error status 1.
To see full error messages you may need to enable debugging.
Do:
export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1
and run the command again. For further information, read:
http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
You can also run 'libguestfs-test-tool' and post the *complete* output
into a bug report or message to the libguestfs mailing list.
If reporting bugs, run virt-builder with debugging enabled and include the
complete output:
virt-builder -v -x [...]
teev@teev-HA:~$
4 years, 10 months