Created attachment 1451784 [details] debug output Bionic beaver 18.04 libguetfs-tools 1:1.36.13-1ubuntu3: sudo apt-get install libguestfs-tools mkdir sysroot # Just a test file. dd if=/dev/urandom of=sysroot/myfile bs=1024 count=1024 sudo virt-make-fs --format=qcow2 --type=ext2 sysroot sysroot.ext2.qcow2 fails with: libguestfs: error: tar_in: write error on directory: /: Without sudo: virt-make-fs --format=qcow2 --type=ext2 sysroot sysroot.ext2.qcow2 fails with: libguestfs: error: /usr/bin/supermin 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. but I think it is an unrelated problem. Original command with debug vars: sudo LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 virt-make-fs --format=qcow2 --size=+200M sysroot/ output.img attached as a file. Launchpad report: https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1777058
The without sudo thing is probably because of the usual Ubuntu kernel bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725 See also the libguestfs FAQ. The error reported here seems to be a bug in the tar command. We're running: tar -C /sysroot/ -xf - 2> /tmp/tarLvFy1o and tar prints: write error on directory: /: but doesn't say what the actual error is.
https://github.com/libguestfs/libguestfs/blob/afd1c70601c51043684a0245ce2f63d71a9cc07a/daemon/tar.c#L186
In fact the message: write error on directory: /: comes from libguestfs, but what's after the second colon is supposed to be the output from the failed tar command. Unfortunately tar prints nothing at all so I'm still no closer to understanding what the actual error message is. Suggest varying the type of the filesystem, contents you want to upload, etc until you can get it to work to see what the confounding factor is.
This is because the appliance does not contain dash. This was fixed upstream with - https://github.com/libguestfs/libguestfs/commit/0cca7f9061455d29a7f893e715028cd3e75c19fd (in libguestfs >= 1.39.1) - https://github.com/libguestfs/libguestfs/commit/e2e3248377e52314ce9ac60a9cb1fed9ec209ad4 (in libguestfs >= 1.38.1) The workaround is to manually include dash: # echo dash > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zz-dash-packages then remove the cache: $ rm -rf /var/cache/.guestfs-$UID The commit above must be backported in Ubuntu (good luck, since it has no maintainer there).
Thanks Pino and Richard, As a good member of the Ubuntu community, I will immediately... revert back to dd with random image size and losetup :-) @Richard: the sudo thing was exactly what you mentioned, thanks. If you want to become even more famous through your awesome library, I would recommend that you maintain the Ubuntu package :-) I wonder if you can legally do that as a Red Hat employee, but I suppose yes? Also, get a more modern website design. Current one scared me when I first saw it :-) Partly due to the 2009-2014 Fish thing :-) libguestfs is just awesome, shame it has so many system dependencies that Debian can't get it to work :-( Ubuntu and Fedora should just merge into a single distro :-(
(In reply to Ciro Santilli from comment #5) > Thanks Pino and Richard, > > As a good member of the Ubuntu community, I will immediately... revert back > to dd with random image size and losetup :-) Why? I even wrote down a working workaround, which has no drawbacks. Did you test it? > libguestfs is just awesome, shame it has so many system dependencies that > Debian can't get it to work :-( The Debian maintainer of libguestfs, Hilko Bengen, does a good job in maintaining it, and as Debian user I can assure that it works fine there.
> Why? I even wrote down a working workaround, which has no drawbacks. > Did you test it? Thanks, for the workarounds, I didn't have the time to test them yet (changed to work computer :-)), but I'm writing what I hope will be highly stable and automated image generation scripts for other people to use, so I'd rather not rely on workarounds.
The workaround works on Ubuntu 18.04: The workaround is to manually include dash: # echo dash > /usr/lib/x86_64-linux-gnu/guestfs/supermin.d/zz-dash-packages then remove the cache: $ rm -rf /var/cache/.guestfs-$UID