[PATCH 0/3] remote: improve missing socket diagnostics

Daniel P. Berrangé (3): remote: improve error message when no URI is set kbase: update docs to account for changed error message remote: expand some debug messages for socket detection docs/kbase/failed_connection_after_install.rst | 10 ++++++++++ src/remote/remote_sockets.c | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) -- 2.48.1

From: Daniel P. Berrangé <berrange@redhat.com> When no URI is set we try to guess what daemon to connect to by looking for any listening sockets. If there are no listening sockets, however, we don't even know what daemon the user expected to connect to. The error message in this case is not especially clear This tweaks the error message to try to make the problem easier to understand. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_sockets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 8d403b6f01..4e6d19098c 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -398,7 +398,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, if (!direct_sock_name) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("Cannot use direct socket mode if no URI is set. For more information see https://libvirt.org/kbase/failed_connection_after_install.html")); + _("No URI is provided and cannot identify any listening daemon socket path to attempt to connect to. Please ensure the expected daemon sockets are active and/or provide an explicit URI. For more information see https://libvirt.org/kbase/failed_connection_after_install.html")); return NULL; } -- 2.48.1

On Thu, Apr 17, 2025 at 06:11:56PM +0100, Daniel P. Berrangé wrote:
From: Daniel P. Berrangé <berrange@redhat.com>
When no URI is set we try to guess what daemon to connect to by looking for any listening sockets. If there are no listening sockets, however, we don't even know what daemon the user expected to connect to. The error message in this case is not especially clear
This tweaks the error message to try to make the problem easier to understand.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Sorry, one thing: Do you need to add a link to Ming's bug report? eg: Fixes: https://issues.redhat.com/browse/RHEL-87177 Rich.
--- src/remote/remote_sockets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 8d403b6f01..4e6d19098c 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -398,7 +398,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport,
if (!direct_sock_name) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("Cannot use direct socket mode if no URI is set. For more information see https://libvirt.org/kbase/failed_connection_after_install.html")); + _("No URI is provided and cannot identify any listening daemon socket path to attempt to connect to. Please ensure the expected daemon sockets are active and/or provide an explicit URI. For more information see https://libvirt.org/kbase/failed_connection_after_install.html")); return NULL; }
-- 2.48.1
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top

From: Daniel P. Berrangé <berrange@redhat.com> The updated doc refers to both the old and new error message, as users with old deployed versions will still be pointed to the current online docs URL. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/kbase/failed_connection_after_install.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/kbase/failed_connection_after_install.rst b/docs/kbase/failed_connection_after_install.rst index cea57c460e..f2c6fee72d 100644 --- a/docs/kbase/failed_connection_after_install.rst +++ b/docs/kbase/failed_connection_after_install.rst @@ -28,6 +28,16 @@ not work when run as root: error: Operation not supported: Cannot use direct socket mode if no URI is set. For more information see https://libvirt.org/kbase/failed_connection_after_install.html +Or + +:: + + # virsh list + error: failed to connect to the hypervisor + error: Operation not supported: No URI is provided and cannot identify any listening + daemon socket path to attempt to connect to. For more information see + https://libvirt.org/kbase/failed_connection_after_install.html + Root cause ========== -- 2.48.1

From: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_sockets.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 4e6d19098c..b3f6cd6a42 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -317,7 +317,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, VIR_DEBUG("Choosing remote socket for transport=%s mode=%s driver=%s flags=0x%x", remoteDriverTransportTypeToString(transport), remoteDriverModeTypeToString(mode), - driver, flags); + NULLSTR(driver), flags); #ifdef REMOTE_DRIVER_AUTOSTART_DIRECT if (!driver && mode != REMOTE_DRIVER_MODE_LEGACY) { @@ -342,6 +342,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, return NULL; } driver = guessdriver; + VIR_DEBUG("Guessed driver %s", NULLSTR(driver)); } #endif @@ -354,6 +355,9 @@ remoteGetUNIXSocket(remoteDriverTransport transport, legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", flags); if (mode == REMOTE_DRIVER_MODE_AUTO) { + VIR_DEBUG("Resolving mode=auto direct_daemon=%s direct_sock=%s legacy_daemon=%s legacy_sock=%s", + NULLSTR(direct_daemon), NULLSTR(direct_sock_name), + NULLSTR(legacy_daemon), NULLSTR(legacy_sock_name)); if (transport == REMOTE_DRIVER_TRANSPORT_UNIX) { /* * When locally accessing libvirtd, we pick legacy or @@ -380,6 +384,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, */ mode = REMOTE_DRIVER_MODE_LEGACY; } + VIR_DEBUG("Resolved mode=%s", remoteDriverModeTypeToString(mode)); } switch ((remoteDriverMode)mode) { -- 2.48.1

For the series: Reviewed-by: Richard W.M. Jones <rjones@redhat.com> -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com nbdkit - Flexible, fast NBD server with plugins https://gitlab.com/nbdkit/nbdkit
participants (2)
-
Daniel P. Berrangé
-
Richard W.M. Jones