6

The project page http://libguestfs.org/ claims that we can do operations without sudo, which is awesome.

However, if I try it out:

sudo apt-get install libguestfs-tools
mkdir sysroot
# Just a test file.
dd if=/dev/urandom of=sysroot/myfile bs=1024 count=1024
virt-make-fs --format=ext2 --type=qcow2 sysroot sysroot.qcow2 

I get the error:

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.

How to solve that?

Tested in Ubuntu 16.04.4, libguestfs-tools 1:1.32.2-4ubuntu2.

1
  • The format and type are swapped in the question.
    – bearrito
    Mar 3, 2022 at 19:58

4 Answers 4

10
sudo chmod +r /boot/vmlinuz-*

The underlying problem is that the kernel cannot be read and is reported at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725 and was wontfixed for some reason.

A more direct bug report is present at: https://bugs.launchpad.net/fuel/+bug/1467579

I could not find a method that will work automatically when new kernels are installed.

I think it needs the kernel because it works by booting the kernel with QEMU to do the file operations using the kernel filesystem operations.

They should just ship their own prebuilt kernel + QEMU, you just can't rely on other people's dependencies basically.

1
1

If you have faced to this problem for the first time, near to 100 percent the problem is related to a bug which linux kernel is not readable!

You can overcome to this problem by running following command in your host operating system:

sudo chmod 0644 /boot/vmlinuz*

If the problem persists, you must check the error more deeper! run following command:

export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1

and then run your expected command again!:

virt-make-fs --format=ext2 --type=qcow2 sysroot sysroot.qcow2 

straight after that run following command :

libguests-test-tool

It shows the log of error which helps to find the raise point much better.

If you couldn't find exactly the point of error and problem or couldn't find the solution, you must provide us the output which libguests-test-tool provides, to let us know about the cause of error and help us to help you much better.

1

As others say the main reason is that the kernel cannot be read on newer Ubuntu versions. I searched a lot an it's very weird that NO ONE found a solution different than using root privileges. You can specify which kernel libguestfs should use by setting these environment variables.

So fast a solution which doesn't require root priviliges is the following one:

apt-get download linux-image-$(uname -r)
dpkg-deb -x linux-image-$(uname -r)*.deb ./
SUPERMIN_KERNEL=./boot/vmlinuz-image-$(uname -r) YOURCOMMAND
0

Even if this question is today a bit old, I fell into this problem today, and found that the reason was disk saturation. Once freed, the problem didn't show up anymore. So check also this, and do not ignore the other suggestions in this thread.

1
  • How did you fix the "disk saturation"? Oct 19, 2021 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .