[PATCH 2/2] vbox: Fix starting domains

Michal Privoznik mprivozn at redhat.com
Mon Jan 23 09:31:53 UTC 2023


When starting a VirtualBox domain, we try to guess which frontend
to use. While the whole algorithm looks a bit outdated, it may
happen that we tell VirtualBox to use "gui" frontend, but not
which DISPLAY= to use.

I haven't found any documentation on the algorithm we use, but if
I make us fallback onto DISPLAY=:0 when no other configuration is
found then I'm able to start my guests just fine.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/vbox/vbox_common.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index bd77641d39..5269f9b23f 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2121,13 +2121,12 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine, vboxIID *iid
     VBOX_UTF8_FREE(valueDisplayUtf8);
 
     if (guiPresent) {
-        if (guiDisplay) {
-            char *displayutf8;
-            displayutf8 = g_strdup_printf("DISPLAY=%s", guiDisplay);
-            VBOX_UTF8_TO_UTF16(displayutf8, &env);
-            VIR_FREE(displayutf8);
-            VIR_FREE(guiDisplay);
-        }
+        char *displayutf8;
+
+        displayutf8 = g_strdup_printf("DISPLAY=%s", guiDisplay ? guiDisplay : ":0");
+        VBOX_UTF8_TO_UTF16(displayutf8, &env);
+        VIR_FREE(displayutf8);
+        VIR_FREE(guiDisplay);
 
         VBOX_UTF8_TO_UTF16("gui", &sessionType);
     }
-- 
2.39.1



More information about the libvir-list mailing list