[Libguestfs] guestfs_launch() fails when C application is started as a systemd service

Richard W.M. Jones rjones at redhat.com
Fri Nov 2 19:47:56 UTC 2018


On Fri, Nov 02, 2018 at 06:04:08PM +0200, Peter Dimitrov wrote:
> Hello,
> 
> I have a simple C program that uses libguestfs to extract info about disk
> usage from a libvirt domain. It works when ran manually as root, but fails
> when started as a systemd service.
> 
> I'm attaching the service file, source code and verbose logs from both the
> successful manual run and from the service journal.
> 
> SELinix is disabled.
> 
> Error messages:
> libguestfs: set_socket_create_context: getcon failed: (none): Invalid
> argument [you can ignore this message if you are not using SELinux + sVirt]
> libguestfs: clear_socket_create_context: setsockcreatecon failed: NULL:
> Invalid argument [you can ignore this message if you are not using SELinux
> + sVirt]
> libguestfs: error: chown: /tmp/libguestfsvMMaec/guestfsd.sock: Operation
> not permitted
> libguestfs: clear_socket_create_context: setsockcreatecon failed: NULL:
> Invalid argument [you can ignore this message if you are not using SELinux
> + sVirt]
> libguestfs: trace: launch = -1 (error)
> failed to launch domain: Invalid argument

I cannot see what the problem is immediately, but I guess that systemd
is confining the service in such a way that libvirt has problems.

Firstly I would try using the direct backend:

  export LIBGUESTFS_BACKEND=direct

If it's still not fixed, then it's something to do with systemd
confining affecting qemu.

If that fixes it, then it's a problem with libvirt, and you will need
to find the libvirt log file.  Usually that's in
/var/log/libvirt/qemu/guestfs-*.log or in
$HOME/.cache/libvirt/qemu/log/guestfs-*.log  But I've no idea where it
will end up when you're running everything under systemd.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list