qemu Xorg and Wayland fail to work on a QEMU virtual machine.

I've been trying to get a gui running for FreeBSD with QEMU, to no avail. I've asked in the WM forums and the solutions I've been offered from the helpful people there sadly did not work for me, so I'm wondering if it's an issue with QEMU. answers for either X or wayland would be helpful, i've been trying to get *something* running! i am using the latest versions of all softwares, and use intel graphics.
whenever i boot into my virt machine, i type

sudo qemu-system-x86_64 -m 3096 -smp 2 -bios /usr/share/ovmf/OVMF.fd -serial mon:stdio -drive file=FreeBSD-14.2-RELEASE-amd64.qcow2 -enable-kvm
into my terminal. i tried again with the gui and the same things happened.

XORG
i've been following the freebsd documentation and also a youtube tutorial (here
View: https://youtu.be/59w2UMZistg?si=uHiirohjM8Jzamt3
) to install xorg, everything goes fine until I type startx, and i get this error
Code:
X.Org X Server 1.21.1.14
X Protocol Version 11, Revision 0
[2673.183] Current Operating System: FreeBSD daemonik 14.2-RELEASE FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c7412 GENERIC amd64 [2673.183] [2673.183] Current version of pixman: 0.42.2
[2673.183] Before reporting problems, check http://wiki.x.org
[
to make sure that you have the latest version.
[2673. 1831 Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[2673.183] (==) Log file: "/var/log/Xorg.0.log", Time: Fri Jan 24 22:16:58 2025 2673.183] (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
[ 2673.183] (==) Using system config directory "/usr/local/share/X11/xorg.conf.d" 2673.183] (==) ServerLayout "XSPICE Example'
2673.183] (**) -->Screen "XSPICE Screen" (0)
-->Monitor "Configured Monitor"
[
[
[
2673.183] (**) |
[
2673.183] (**) | -->Device "XSPICE"
[ 2673.183] (**)
[
2673.1831 (**)
-->Input Device "XSPICE POINTER"
[
-->Input Device "XSPICE KEYBOARD"
2673.183] (**) Option "AutoAddDevices" "False"
[ 2673.183] (**) Allowing byte-swapped clients 2673.183] (**) Not automatically adding devices
[
[
[
2673.183] (==) Automatically enabling devices
2673.183] (==) Automatically adding GPU devices
[ 2673.183] (==) Automatically binding GPU devices
[
2673.183] (==) Max clients allowed: 256, resource mask: 0x1fffff [2673.183] (==) FontPath set to:
/usr/local/share/fonts/misc/,
/usr/local/share/fonts/TTF/,
/usr/local/share/fonts/OTF/,
/usr/local/share/fonts/Type1/,
/usr/local/share/fonts/100dpi/,
/usr/local/share/fonts/75dpi/,
catalogue:/usr/local/etc/X11/fontpath.d
[2673.183] (==) ModulePath set to "/usr/local/lib/xorg/modules"
[2673.183] (==) |-->Input Device "<default pointer>"
[
2673.183] (==) |-->Input Device "<default keyboard>"
[2673.183] (==) The core pointer device wasn't specified explicitly in the layout. Using the default mouse configuration.
[2673. 183] (==) The core keyboard device wasn't specified explicitly in the layout. Using the default keyboard configuration.
[2673.183] (II) Module ABI versions:
file "/var/log/Xorg.0.log", 110 lines
you can read more about my struggle with xorg on this thread here https://forums.freebsd.org/threads/...ound-trouble-starting-xorg.96512/#post-687315 , where I just get a "serverauth x not found error" every time i try to start xorg, no matter how many things i tweak and edit, or things i download.

WAYLAND
for wayland, this is my first time coming to the forums. i have been trying to install wayland with the wayfire compositior tonight, and ive been following the official freebsd documentation for this word for word here https://docs.freebsd.org/en/books/handbook/wayland/#wayland-wayfire

however, whenever i do % wayfire -c ~/.config/wayfire/wayfire.ini im met with this error:
Code:
II 27-01-25 23:59:34.012
[src/main.cpp:364] Starting wayfire version v0.9.0 II 27-01-25 23:59:34.013 [libseat] [libseat/libseat.c:77] Seat opened with backend 'seatd' nabling seat
II 27-01-25 23:59:34.013 [libseat] [libseat/backend/seatd.c:212] E
II 27-01-25 23:59:34.013 - [backend/session/session.c:109] Successfully loaded libseat session 467] Waiting for a DRM card device
EE 27-01-25 23:59:44.055
-
end.c:376] Failed to open any DRM device
-
II 27-01-25 23:59:34.030 - [backend/session/session.c:
[backend/backend.c:2101 Found 0 GPUs, cannot create backend
EE 27-01-25 23:59:44.055
EE 27-01-25 23:59:44.056 - [src/main.cpp:141] Fatal error: Segmentation fault 0x338f20 <main+0x1900> at /usr/local/bin/wayfire
#1
#2
#3
0x82c68e410 <pthread_sigmask+0x540> at /lib/libthr.so.3 0x82c68d9cb <pthread_setschedparam+0x84b> at /lib/libthr.so.3 0x8215b12d3 <???> at ???
EE 27-01-25 23:59:44.057 EE 27-01-25 23:59:44.060 EE 27-01-25 23:59:44.060 EE 27-01-25 23:59:44.061 EE 27-01-25 23:59:44.061 EE 27-01-25 23:59:44.061 EE 27-01-25 23:59:44.061 #7 root@daemonikin #
#4 #5
#6
0x821854294 <wlr_backend_get_drm_fd+0x4> at /usr/local/lib/libulroots.so.12 0x337af5 <main+0x4d5> at /usr/local/bin/wayfire
0x829ccec3a <___libc_start1+0x12a> at /lib/libc.so.7
[backend/back

I'm not sure what this means, or what to do about these issues , im very new to freebsd. the first workarounds i tried to do were reconfiguring the wayfire.ini file, and also switching my graphics display server to see if it had something to do with the "0 gpus found" error, but that didnt do anything. i really appreciate any help i can get, thank you!
 
For Xorg, could you post /var/log/Xorg.0.log ? Note that FreeBSD does not currently support 3D acceleration in a guest with the virtio drivers, so you will most likely be using software rendering with the package: x11-drivers/xf86-video-scfb.
This means that you will not be able to use wayland, since we lack an equivalent to SimpleDRM.
I would suggest to try with virt-manager, each graphics options until you found one that work with the scfb drivers.
Here a sample of what you should put inside /usr/local/etc/X11/xorg.conf.d/scfb.conf
Code:
Section "Device"
	Identifier	"Card0"
	Driver	"scfb"
EndSection
The output of pciconf -lv | grep -B3 display could be interesting.
Finally, what Operating System is used on the host ?
 
Hi. I saw that there have been no replies for a while. I've been trying FreeBSD in a QEMU virtual machine for a couple days and I encountered similar errors. I use virt-manager on a Debian Testing host. I tried different "video models" (as virt-manager calls them), specifically QXL, Ramfb, Virtio, and VGA, but none of them worked. I also compiled all VirtIO modules, including virtio_gpu into a new kernel.

As for X11, I got the following error. All models gave more or less the same output, except for memory addresses. I correctly installed and set up Ly as display manager and running startx gives almost the same output: the first line is xauth: file /home/user/.serverauth.953 does not exist which is then followed by the same output.

Code:
X.Org X Server 1.21.1.16
X Protocol Version 11, Revision 0
Current Operating System: FreeBSD freebsd-vm 14.2-RELEASE FreeBSD 14.2-RELEASE GENERIC amd64

Current version of pixman: 0.44.2
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Tue May 6 17:53:41 2025
(==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/local/share/X11/xorg.conf.d" resizing surface to 0
memory space from 0x3806074081d0 to 0x3806074051d0
memory space from 0x3806074081d8 to 0x3806074081d8
(EE) Segmentation fault at address 0x3807074061d0
(EE)
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE)
(EE)
Please consult the The X.Org Foundation support
    at http://wiki.x.org
for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.

Although I don't think this is related to the cause of the issue (but it's rather a consequence of it), the DE I'm trying to run is LXQt and just running lxqt-session gives the following output:

Code:
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: From 6.5.0, xcb-cursor or libxcb-cursor is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: minimal, vnc, xcb, wayland, offscreen, wayland-egl, vkkhrdisplay.

Abort trap (core dumped)

The Xorg log file at /var/log/Xorg.0.log tells the following:

Code:
[ 184.503]
X.Org X Server 1.21.1.16
X Protocol Version 11, Revision 0
[ 184.503] Current Operating System: FreeBSD freebsd-vm 14.2-RELEASE FreeBSD 14.2-RELEASE GENERIC amd64
[ 184.503]
[ 184.503] Current version of pixman: 0.44.2
[ 184.503]     Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[ 184.503] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 184.503] (==) Log file: "/var/log/Xorg.0.log", Time: Tue May 6 19:09:21 2025
[ 184.503] (==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
[ 184.503] (==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
[ 184.503] (==) ServerLayout "XSPICE Example"
[ 184.503] (**) |-->Screen "XSPICE Screen" (0)
[ 184.503] (**) |   I-->Monitor "Configured Monitor"
[ 184.503] (**) |   I-->Device "XSPICE"
[ 184.503] (**) |   |-->GPUDevice "Card0"
[ 184.503] (**) |-->Input Device "XSPICE KEYBOARD"
[ 184.503] (**) |-->Input Device "XSPICE POINTER"
[ 184.503] (**) Option "AutoAddDevices" "False"
[ 184.503] (**) Allowing byte-swapped clients
[ 184.503] (**) Not automatically adding devices
[ 184.503] (==) Automatically enabling devices
[ 184.503] (==) Automatically adding GPU devices
[ 184.503] (==) Automatically binding GPU devices
[ 184.503] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 184.513] (==) FontPath set to:
    /usr/local/share/fonts/misc/,
    /usr/local/share/fonts/TTF/,
    /usr/local/share/fonts/OTF/,
    /usr/local/share/fonts/Type1/,
    /usr/local/share/fonts/100dpi/,
    /usr/local/share/fonts/75dpi/,
    catalogue:/usr/local/etc/X11/fontpath.d
[ 184.513] (==) ModulePath set to "/usr/local/lib/xorg/modules"
[ 184.513] (==) |-->Input Device "<default pointer>"
[ 184.513] (==) |-->Input Device "<default keyboard>"
[ 184.513] (==) The core pointer device wasn't specified explicitly in the layout.
    Using the default mouse configuration.
[ 184.513] (==) The core keyboard device wasn't specified explicitly in the layout.
    Using the default keyboard configuration.
[ 184.513] (II) Module ABI versions:
[ 184.513]    X.Org ANSI C Emulation: 0.4
[ 184.513]    X.Org Video Driver: 25.2
[ 184.513]    X.Org XInput driver : 24.4
[ 184.513]    X.Org Server Extension : 10.0
[ 184.513] (--) PCI:*(0@0:2:0) 1234:1111:1af4:1100 rev 2, Mem @ 0xc0000000/16777216, 0xc1049000/4096, BIOS @ 0x????????/65536
[ 184.513] (II) LoadModule: "glx"
[ 184.593] (II) Loading /usr/local/lib/xorg/modules/extensions/libglx.so
[ 184.533] (II) Module glx: vendor="X.Org Foundation"
[ 184.533]    compiled for 1.21.1.16, module version = 1.0.0
[ 184.533]    ABI class: X.Org Server Extension, version 10.0
[ 184.533] (II) LoadModule: "spiceqxl"
[ 184.533] (II) Loading /usr/local/lib/xorg/modules/drivers/spiceqxl_drv.so
[ 184.593] (II) Module spiceqxl: vendor="X.Org Foundation"
[ 184.593]    compiled for 1.21.1.16, module version = 0.1.6
[ 184.593]    Module class: X.Org Video Driver
[ 184.593]    ABI class: X.Org Video Driver, version 25.2
[ 184.593] (II) LoadModule: "scfb"
[ 184.593] (II) Loading /usr/local/lib/xorg/modules/drivers/scfb_drv.so
[ 184.605] (II) Module scfb: vendor="X.Org Foundation"
[ 184.605]    compiled for 1.21.1.16, module version 0.0.5
[ 184.605]    ABI class: X.Org Video Driver, version 25.2
[ 184.605] (II) LoadModule: "xspicekeyboard"
[ 184.605] (WW) Warning, couldn't open module xspicekeyboard
[ 184.605] (EE) Failed to load module "xspicekeyboard" (module does not exist, 0)
[ 184.605] (II) LoadModule: "xspicepointer"
[ 184.605] (WW) Warning, couldn't open module xspicepointer
[ 184.605) (EE) Failed to load module "xspicepointer" (module does not exist, 0)
[ 184.605] (II) LoadModule: "mouse"
[ 184.605] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[ 184.605] (II) Module mouse: vendor="X.Org Foundation"
[ 184.605]    compiled for 1.21.1.16, module version = 1.9.3
[ 184.605]    Module class: X.Org XInput Driver
[ 184.605]    ABI class: X.Org XInput driver, version 24.4
[ 184.605] (II) LoadModule: "kbd"
[ 184.605] (II) Loading /usr/local/lib/xorg/modules/input/kbd_drv.so
[ 184.605] (II) Module kbd: vendor="X.Org Foundation"
[ 184.605]    compiled for 1.21.1.16, module version 1.9.0
[ 184.605]    Module class: X.Org XInput Driver
[ 184.6051   ABI class: X.Org XInput driver, version 24.4
[ 184.605] (II) scfb: driver for wsdisplay framebuffer: scfb
[ 184.605] (--) Using syscons driver with X support (version 2.0)
[ 184.6051 (--) using VT number 9

[ 184.605] (WW) Falling back to old probe method for spiceqxl
[ 184.605] (WW) Falling back to old probe method for scfb
[ 184.6051 scfb trace: probe start
[ 184.605] (II) scfb(1) using default device
[ 184.605] scfb trace: probe done
[ 184.605] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[ 184.605] (EE) Screen 1 deleted because of no matching config section.
[ 184.605] (II) UnloadModule: "scfb"
[ 184.605] (II) spiceqxl(0): Creating default Display subsection in Screen section
    "XSPICE Screen" for depth/fbbpp 24/32
[ 184.605] (**) spiceqxl(0): Depth 24, (--) framebuffer bpp 32
[ 184.605] (==) spiceqxl(0): RGB weight 888
[ 184.605] (==) spiceqxl(0): Default visual is TrueColor
[ 184.605] (==) spiceqxl(0): Using gamma correction (1.0, 1.0, 1.0)
[ 184.6051 (DB) xf86MergeOutputClassOptions unsupported bus type 0
[ 184.605] (II) spiceqxl(0): QXL_NUM_HEADS not configured, defaulting to 1
[ 184.605] (II) spiceqxl(0): Deferred Frames: Disabled
[ 184.605] (II) spiceqxl(0): Offscreen Surfaces: Disabled
[ 184.605) (II) spiceqxl(0): Image Cache: Disabled
[ 184.605] (II) spiceqxl(0): Fallback Cache: Disabled
[ 184.605] (II) spiceqxl(0): framebuffer at 0x1cde0a0081d8 (0 KB)
[ 184.605] (II) spiceqxl(0): command ram at 0x1cde0a0081d8 (4194296 KB)
[ 184.605] (II) spiceqxl(0): vram at 0x1cde0a008108 (0 KB)
[ 184.605] (II) spiceqxl(8): rom at 0x1cde0a8005c0
[ 184.605] resizing surface to 0
[ 184.605] memory space from 8x1cde0a0081d8 to 0x1cde0a0051d8
[ 184.605] memory space from 0x1cde0a008108 to 0x1cde0a008108
[ 184.605] (EE) Segmentation fault at address 0x1cdf0a0061d8
[ 184.605] (EE)
Fatal server error:
[ 184.685] (EE) Caught signal 11 (Segmentation fault). Server aborting
[ 184.605] (EE)
[ 184.605] (EE)
Please consult the The X.Org Foundation support
    at http://wiki.x.org
for help.
[ 184.605] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[ 184.605] (EE)
[ 184.605] (EE) Server terminated with error (1). Closing log file.

As for Wayland, I tried starting Sway. The error below hints at wlroots, a library to build Wayland compositors. In this case, I think the issue is really just trying to use the DRM without an AMD/Intel/Nvidia GPU, which logically cannot happen.

Code:
00:00:10.026 [wlr] [backend/backend.c:253] Found 0 GPUs, cannot create backend
00:00:10.026 [wlr] [backend/backend.c:428] Failed to open any DRM device
00:00:10.030 [sway/server.c:228] Unable to create backend

As a last attempt, I tried setting up SCFB as the wiki says with a VGA model, but to no avail.

For command output and file content, I used a website that allows to turn screenshots into text since I couldn't think of a faster way. It looks right but there might be some minor spelling issues in words or wrong digits in numbers.
 
For Xorg, I think it is defaulting to SPICE which is maybe not working well. I don't have too much familiarity with scfb on FreeBSD.

One thing to try is to boot it as a regular BIOS (not UEFI) and startx. It should autodetect vesa. I know this was fairly straight forward a couple of years ago unless there have been regressions.

Perhaps a good workaround (and also the fastest solution) is DISPLAY=10.0.2.2:2 and running Xephyr on the host? You could even use SSH/X11 forwarding, again to the host. (ssh -X).
 
For some strange reason, when I boot the installer using BIOS, then choose to use MBR (BIOS) during the installation, it does all the things and finishes installation. Then, after rebooting, the virtual machine's firmware says it can't find the operating system when booting from disk. I tried both VirtIO and SATA as disk bus. The virtual machine's default configuration uses IDE as bus for the ISO image.
 
Back
Top