On Tue, Nov 28, 2023 at 01:02:40PM +0100, Martin Kletzander wrote: > Before this patch users might be confused with the error when no daemon > nor systemd socket unit is running due to the error message being a bit > vague when running as root with no URI: > > # virsh list > error: failed to connect to the hypervisor > error: Operation not supported: Cannot use direct socket mode if no > URI is set > > Instead of merely suggesting to start any daemon, also give a hint as to > what socket we have tried looking up: > > # virsh list > error: failed to connect to the hypervisor > error: Operation not supported: Cannot connect to > '/var/run/libvirt/virtqemud-sock' and no URI is set, is any virt > daemon or systemd socket unit started? This is definitely much better, but can we suggest the actual command here? An alternative might be to refer to a libvirt wiki page which describes how to start the libvirt daemon(s) after installing libvirt. This seems to be a common problem, but I can't find any libvirt.org page about it. There is https://libvirt.org/daemons.html but my eyes glaze over reading it. https://wiki.libvirt.org/The_daemon_cannot_be_started.html is close, but not quite the same problem. Rich. > Resolves: https://issues.redhat.com/browse/RHEL-700 > Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> > --- > src/remote/remote_sockets.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c > index c21970cd31e7..0c0e31e4eb78 100644 > --- a/src/remote/remote_sockets.c > +++ b/src/remote/remote_sockets.c > @@ -311,6 +311,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, > g_autofree char *daemon_name = NULL; > g_autofree char *direct_sock_name = NULL; > g_autofree char *legacy_sock_name = NULL; > + g_autofree char *default_socket = NULL; > #ifdef REMOTE_DRIVER_AUTOSTART_DIRECT > g_autofree char *guessdriver = NULL; > #endif > @@ -345,7 +346,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, > } else { > if (remoteProbeSystemDriverFromSocket(flags & REMOTE_DRIVER_OPEN_RO, > &guessdriver, > - NULL) < 0) > + &default_socket) < 0) > return NULL; > } > driver = guessdriver; > @@ -404,8 +405,14 @@ remoteGetUNIXSocket(remoteDriverTransport transport, > } > > if (!direct_sock_name) { > - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", > - _("Cannot use direct socket mode if no URI is set")); > + if (default_socket) { > + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, > + _("Cannot connect to '%1$s' and no URI is set, is any virt daemon or systemd socket unit started?"), > + default_socket); > + } else { > + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", > + _("Cannot use direct socket mode if no URI is set")); > + } > return NULL; > } > > -- > 2.43.0 > _______________________________________________ > Devel mailing list -- devel@xxxxxxxxxxxxxxxxx > To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx