FreeBSD GNOME Desktop on QEMU / KVM
Status #1: Jan 2020 - a commit was made to add udev based X11 input device discovery which greatly simplifies getting FreeBSD desktop running. This has now (May 2020) flowed into ports and pkg and I have updated tip to reflect this.
Status #2: May 2021 - This is broken again with FreeBSD 12.2 as the qxl video driver ports has been removed from distribution (see notes below on building from source).
Status #3: Sep 2021 - Update again for FreeBSD 12.2 has there have been quite a few ports changes...
Status #4: Sept 2022 - Try with FreeBSD 13.1 and document (enable dbus & source change to xf86-video-qxl required)
Status #5: Apr 2023 - Retested with FreeBSD 13.1 with restored xf86-video-qxl via 100% pkg binary install, now working again
Back in the late 1980's the announcement that AT&T and SUN would work together on the next unified System V release, triggered the "Unix Wars". Pretty much all UNIX systems vendors (IBM, HP, SGI, DEC and others) reacted to this with some forming the Open Software Foundation (which subsequently became Open Group). As Open Software Foundation they developed OSF/1 OS (now another dead Unix flavour) and Motif X11 desktop.
At around the same time University of California Berkeley was stripping out the legacy AT&T code from its BSD distribution so it could provide an unencumbered release. The first unencumbered release was BSD Net/2, followed by 4.4 BSD Lite. This all took time and there was a considerable amount of legal activity going on. Additional serious tickering by Linus Torvalds resulted in Linux, which was grafted into the stalled GNU free Unix OS initiative.
Now the UNIX business has Linux at its heart and 4.4 BSD has soldiered on through FreeBSD, NetBSD, OpenBSD and even MacOS via Darwin. Interestingly MacOS (via NextStep) was built on top of (Carnegie Mellon sourced) Mach mirco-kernel and BSD with X11 replaced with Apple Macintosh UI. So the result is aligned with what GNU Hurd was aiming for, but it losts its Stallman / GNU "freeness" along the way.
So why use FreeBSD ? For me, the answer was that in 1995 FreeBSD 2.0.5 was available via Walnut Creek CDROM and as SUN user at work, BSD was a known proposition. Linux on the other hand was provided as a very diverse set of distributions and simply deciding which of these to use was hard to determine.
FreeBSD - VM on QEMU / KVM
NOTE #1: To get a FreeBSD release 11.3 or 12.1 running in QEMU / KVM requires that you build a machine with a custom kernel, due to current and known bug.
NOTE: #2 Using FreeBSD 12.4 & 13.1 does not require custom kernel as the bugs with netmap is resolved in both and virtio issues fixed in 13.1.
If you are using VNC / X11 to access the VM UI, then you will need to have EvTouch USB Tablet for mouse.
Here is summary of QEMU / KVM configuration I have used:
- QEMU / KVM / libvirt on Ubuntu (19.10, 20.04, 20.10 & 22.04)
- QEMU Q35 with OVMF VM (I have found that UEFI requires 4.2 machine and most current 6.2 machine will not boot UEFI successfully)
- SATA HD & CD (or Virtio HD for FreeBSD 13.1)
- vmxnet3 network (rather than e1000) or Virtio with FreeBSD 13.1
- qxl - vga driver or scfb with FreeBSD 13.1
- QEMU Generic USB keyboard & EvTouch USB Tablet
- NOTE: Custom kernel build with "dev netmap" disabled (the netmap bug is fixed with 12.2, so you should be to able to avoid this for 12.3 & 13.1)
With FreeBSD 11.3 / 12.X you can only get QEMU Q35 VM running by using SATA HD and [optionally: build a custom network kernel, to get networking up and running].
NOTE #3: netmap bug is fixed with 12.2/ 13.1 so there is no need to build custom kernel.
Once you have built your Q35 / OVMF machine, you should do a boot and while in UEFI / TianoCore bootup press ESC to get into the UEFI configuration parameters (or boot from put a more recent Ubuntu cdrom which allows you to select going into UEFI setup).
NOTE #4: This might take a few trys as you need to ensure the VM window has focus and press ESC early in the boot sequence.
Once you are in UEFI configuration screen you should set the default screen resolution of your machine (I set my to a relatively low 1024 x 768). This is required for X11 to discover the framebuffer and use the scfb (screen framebuffer) driver (see below: "FreeBSD - Kernel & X11 Configuration").
NOTE #5: On Ubuntu 19.10 apt packages required for QEMU/KVM hosting are: qemu-system-x86 libvirt-clients libvirt-daemon-system ovmf virt-manager
NOTE #6: See my tip on "MacOS on Ubuntu with KVM/QEMU and OVMF/Clover EFI" for more information on setup of KVM / QEMU.
FreeBSD Desktop (GNOME) with QEMU EvTouch USD Tablet Pointer
This is the "tricky" and very poorly documented part. There are two options to getting "Desktop" environment running:
- Build via Ports
- Binary Package Install
While in general I have always used Ports (us FreeBSD'ers love source code ;-) ). In the case of GNOME / X11 , I would strongly recommend using option 2 - "Binary Package Install".
On a simple 2 CPU VM with 4096 GB RAM doing source build will take a whole day. If you don't to a "config-recursive" the process will keep halting and go into additional config steps, as each of the large number of dependency modules are built. The result is a multi-day build.
For binary install packages are: xorg, gnome3 or gnome-lite and binary install of extra xorg drivers: evdev
---
--- Was ..
---
# pkg install xorg gnome3 xf86-input-evdev
---
--- Most recently - Sept 2021
--
# pkg install xorg gnome3-lite xf86-input-evdev utouch-kmod help2man texinfo libspice-server spice-protocol python37 bison openssl
---
--- With FreeBSD 13.1 (Sept 2022)
---
# pkg install xorg gnome-lite xf86-input-evdev utouch-kmod help2man texinfo libspice-server spice-protocol python38 bison openssl
---
--- Apr 2023 - newly re-instated xf86-video-qxl port
---
# pkg install xf86-video-qxl
The latest set of packages installs 497 (3GB) packages (500 packages on 13.1), so best to do this by logging into VM console to avoid potential timeout with dropping ssh session.
The pkgs: help2man texinfo libspice-server spice-protocol bison openssl are needed to satisfy the dependencies for the missing xf86-video-qxl driver.
In late 2022 / early 2023 the xf86-video-qxl port was re-instated, so this can can now be installed via pkg. Prior to this a manual build (from source or via old ports tree) was required.
If you do not use binary pkg: utouch-kmod then you will need to use:
- Ports build of: misc/utouch
The misc/utouch driver is the helper for support of QEMU Q35 EvTouch USB Tablet. Using this is essential to get "absolute coordinates" mouse, required to use mouse via QEMU / VNC driver virtual console.
NOTE #5: Thanks to Vladimir Kondratyev for tip on using misc/utouch
You can now do your initial testing. Assuming you have not yet added anything to /etc/rc.conf, simply log in to root and try and start X11 from the console:
# startx
This may:
- do nothing,
- result in x11 starting with multiple xterm windows with non working mouse or
- if you are really lucky have X11 starting with multiple xterm windows and a working mouse.
Depending on result you can look in "/var/log/Xorg.0.log" for startup results.
In my case I got nothing until I set the UEFI resolution as per notes above in: "FreeBSD - VM on QEMU / KVM".
Once I had set UEFI resolution, I got XTerm windows but a non-working mouse.
So next step was to validate the evdev / utouch mouse was working and which /dev/input/eventN the QEMU EvTouch tablet is on.
To do this you can use the evdev.evtest python tool, which is installed as part of xf86-input-evdev package. Here is example:
# python3.7 -m evdev.evtest
ID Device Name Phys Uniq
------------------------------------------------------------------------------------------------------------------------------------------
0 /dev/input/event0 System keyboard multiplexer kbdmux0
1 /dev/input/event1 System mouse sysmouse
2 /dev/input/event2 AT keyboard atkbd0
3 /dev/input/event3 IntelliMouse Explorer psm0
4 /dev/input/event4 QEMU QEMU USB Keyboard, class 0/0, rev 2.00/0.00, addr 2 ukbd0 68284-0000:00:1d.7-1
5 /dev/input/event5 QEMU QEMU USB Tablet, class 0/0, rev 2.00/0.00, addr 4 utouch0 28754-0000:00:1d.7-5
6 /dev/input/event6 QEMU QEMU USB Mouse, class 0/0, rev 2.00/0.00, addr 3 ums0 89126-0000:00:1d.7-4
Select devices [0-6]: 5
Listening for events (press ctrl-c to exit) ...
time 1582007519.619301 --------- SYN_DROPPED --------
time 1582007519.619301 --------- SYN_REPORT --------
time 1582007519.638179 type 3 (EV_ABS), code 0 (ABS_X), value 22015
time 1582007519.638179 type 3 (EV_ABS), code 1 (ABS_Y), value 26495
time 1582007519.638179 --------- SYN_REPORT --------
time 1582007519.642895 type 3 (EV_ABS), code 0 (ABS_X), value 21663
time 1582007519.642895 type 3 (EV_ABS), code 1 (ABS_Y), value 27348
time 1582007519.642895 --------- SYN_REPORT --------
time 1582007519.65342 type 3 (EV_ABS), code 0 (ABS_X), value 21215
time 1582007519.65342 type 3 (EV_ABS), code 1 (ABS_Y), value 28585
time 1582007519.65342 --------- SYN_REPORT --------
time 1582007519.66421 type 3 (EV_ABS), code 0 (ABS_X), value 20863
time 1582007519.66421 type 3 (EV_ABS), code 1 (ABS_Y), value 29823
time 1582007519.66421 --------- SYN_REPORT --------
time 1582007519.677026 type 3 (EV_ABS), code 0 (ABS_X), value 20607
time 1582007519.677026 type 3 (EV_ABS), code 1 (ABS_Y), value 31060
time 1582007519.677026 --------- SYN_REPORT --------
time 1582007519.686741 type 3 (EV_ABS), code 0 (ABS_X), value 20415
time 1582007519.686741 type 3 (EV_ABS), code 1 (ABS_Y), value 32297
time 1582007519.686741 --------- SYN_REPORT --------
time 1582007536.383169 type 3 (EV_ABS), code 0 (ABS_X), value 12031
time 1582007536.383169 type 3 (EV_ABS), code 1 (ABS_Y), value 17108
time 1582007536.383169 --------- SYN_REPORT --------
time 1582007536.449228 type 3 (EV_ABS), code 0 (ABS_X), value 12063
time 1582007536.449228 --------- SYN_REPORT --------
time 1582007536.744538 type 3 (EV_ABS), code 1 (ABS_Y), value 17066
time 1582007536.744538 --------- SYN_REPORT --------
time 1582007536.754257 type 3 (EV_ABS), code 0 (ABS_X), value 12095
time 1582007536.754257 type 3 (EV_ABS), code 1 (ABS_Y), value 17023
time 1582007536.754257 --------- SYN_REPORT --------
time 1582007536.765432 type 3 (EV_ABS), code 0 (ABS_X), value 12127
time 1582007536.765432 type 3 (EV_ABS), code 1 (ABS_Y), value 16980
time 1582007536.765432 --------- SYN_REPORT --------
time 1582007536.779227 type 3 (EV_ABS), code 0 (ABS_X), value 12159
time 1582007536.779227 type 3 (EV_ABS), code 1 (ABS_Y), value 16938
time 1582007536.779227 --------- SYN_REPORT --------
time 1582007536.786433 type 3 (EV_ABS), code 0 (ABS_X), value 12223
time 1582007536.786433 type 3 (EV_ABS), code 1 (ABS_Y), value 16895
time 1582007536.786433 --------- SYN_REPORT --------
time 1582007536.805982 type 3 (EV_ABS), code 0 (ABS_X), value 12255
time 1582007536.805982 type 3 (EV_ABS), code 1 (ABS_Y), value 16852
time 1582007536.805982 --------- SYN_REPORT --------
time 1582007536.809289 type 3 (EV_ABS), code 0 (ABS_X), value 12319
time 1582007536.809289 type 3 (EV_ABS), code 1 (ABS_Y), value 16810
time 1582007536.809289 --------- SYN_REPORT --------
time 1582007536.822264 type 3 (EV_ABS), code 0 (ABS_X), value 12351
time 1582007536.822264 type 3 (EV_ABS), code 1 (ABS_Y), value 16767
time 1582007536.822264 --------- SYN_REPORT --------
time 1582007536.831691 type 3 (EV_ABS), code 0 (ABS_X), value 12383
time 1582007536.831691 type 3 (EV_ABS), code 1 (ABS_Y), value 16724
time 1582007536.831691 --------- SYN_REPORT --------
time 1582007536.854654 type 3 (EV_ABS), code 0 (ABS_X), value 12415
time 1582007536.854654 type 3 (EV_ABS), code 1 (ABS_Y), value 16682
time 1582007536.854654 --------- SYN_REPORT --------
time 1582007537.103654 type 1 (EV_KEY), code 272 (['BTN_LEFT', 'BTN_MOUSE']), value 1
time 1582007537.103654 --------- SYN_REPORT --------
time 1582007537.236717 type 3 (EV_ABS), code 0 (ABS_X), value 12479
time 1582007537.236717 --------- SYN_REPORT --------
time 1582007537.2603 type 3 (EV_ABS), code 0 (ABS_X), value 12511
time 1582007537.2603 --------- SYN_REPORT --------
time 1582007537.279146 type 1 (EV_KEY), code 272 (['BTN_LEFT', 'BTN_MOUSE']), value 0
time 1582007537.279146 --------- SYN_REPORT --------
time 1582007537.280155 type 3 (EV_ABS), code 0 (ABS_X), value 12543
time 1582007537.280155 type 3 (EV_ABS), code 1 (ABS_Y), value 16724
time 1582007537.280155 --------- SYN_REPORT --------
time 1582007537.282278 type 3 (EV_ABS), code 0 (ABS_X), value 12607
time 1582007537.282278 --------- SYN_REPORT --------
time 1582007537.292983 type 3 (EV_ABS), code 0 (ABS_X), value 12671
time 1582007537.292983 type 3 (EV_ABS), code 1 (ABS_Y), value 16767
time 1582007537.292983 --------- SYN_REPORT --------
time 1582007537.313748 type 3 (EV_ABS), code 0 (ABS_X), value 12735
time 1582007537.313748 --------- SYN_REPORT --------
time 1582007537.315358 type 3 (EV_ABS), code 0 (ABS_X), value 12895
...
...
...
time 1582007545.415462 --------- SYN_REPORT --------
This test let you identify the right /dev/input/device as well as validate that the EvTouch device is generating an input stream and you can see it is providing absolute X,Y values which is what we need.
Now you you have made sure evdev is working your are ready for getting final steps completed.
FreeBSD - Kernel & X11 configuration
Post May 2020 you should be able to get X11 Gnone desktop running on KVM / QEMU relatively simply now, due to introduction of udev input discovery.
It is not completely "automagic" to get X11 going, but it is way way simpler than before.
Some manual configuration is still required:
- /boot/loader.conf - to ensure console is used correctly and utouch evdev KLM is loaded
- /usr/local/etc/X11 - to force loading of EvTouch driver
- /etc/rc.conf - to enable and auto start GNOME desktop
Here are my working configurations:
-- Ensure utouch is loaded and enable vt console
$ cat /boot/loader.conf
utouch_load="YES"
kern.vty=vt
To get X11 going do the following:
- Remove configuration files in: /usr/local/etc/X11/xorg.conf and any configuration files in: /usr/local/etc/X11/xorg.conf.g/
- If you have hald or dbus enable via /etc/rc.conf then disable them and reboot your machine
- Run: startx
- You should get an X11 Desktop with likely working keyboard, but not mouse.
- Review your /var/log/X11.0.log and you should see something like the following results, where it reports using libinput and udev:
...
...
[ 11.644] (II) config/udev: Adding input device System keyboard multiplexer (/dev/input/event0)
[ 11.644] (**) System keyboard multiplexer: Applying InputClass "evdev keyboard catchall"
[ 11.644] (**) System keyboard multiplexer: Applying InputClass "Evdev keyboard"
[ 11.644] (**) System keyboard multiplexer: Applying InputClass "libinput keyboard catchall"
[ 11.644] (II) LoadModule: "libinput"
[ 11.645] (II) Loading /usr/local/lib/xorg/modules/input/libinput_drv.so
[ 11.660] (II) Module libinput: vendor="X.Org Foundation"
[ 11.660] compiled for 1.20.8, module version = 0.29.0
[ 11.661] Module class: X.Org XInput Driver
[ 11.661] ABI class: X.Org XInput driver, version 24.1
[ 11.661] (II) Using input driver 'libinput' for 'System keyboard multiplexer'
[ 11.661] (**) System keyboard multiplexer: always reports core events
[ 11.661] (**) Option "Device" "/dev/input/event0"
[ 11.661] (**) Option "_source" "server/udev"
[ 11.686] (II) event0 - System keyboard multiplexer: is tagged by udev as: Keyboard
[ 11.686] (II) event0 - System keyboard multiplexer: device is a keyboard
[ 11.687] (II) event0 - System keyboard multiplexer: device removed
[ 11.687] (**) Option "config_info" "udev:/dev/input/event0"
[ 11.687] (II) XINPUT: Adding extended input device "System keyboard multiplexer" (type: KEYBOARD, i
d 6)
[ 11.687] (**) Option "xkb_rules" "evdev"
[ 11.730] (II) event0 - System keyboard multiplexer: is tagged by udev as: Keyboard
[ 11.730] (II) event0 - System keyboard multiplexer: device is a keyboard
[ 11.731] (II) config/udev: Adding input device System mouse (/dev/input/event1)
[ 11.731] (**) System mouse: Applying InputClass "evdev pointer catchall"
[ 11.731] (**) System mouse: Applying InputClass "libinput pointer catchall"
[ 11.731] (II) Using input driver 'libinput' for 'System mouse'
[ 11.731] (**) System mouse: always reports core events
[ 11.731] (**) Option "Device" "/dev/input/event1"
[ 11.731] (**) Option "_source" "server/udev"
...
...
If you do not see libinput and udev being use then do an OS update (freebsd-update & pkg upgrade or if you built from source code then you can use portmaster to pull in & build updated ports.
If you look further in the X11.0.log result you will see that an EvTouch error being generated everytime you click the mouse button:
[ 11.785] (II) config/udev: Adding input device QEMU QEMU USB Tablet (/dev/input/event5)
[ 11.785] (**) QEMU QEMU USB Tablet: Applying InputClass "evdev touchscreen catchall"
[ 11.785] (**) QEMU QEMU USB Tablet: Applying InputClass "libinput touchscreen catchall"
[ 11.785] (II) Using input driver 'libinput' for 'QEMU QEMU USB Tablet'
[ 11.785] (**) QEMU QEMU USB Tablet: always reports core events
[ 11.785] (**) Option "Device" "/dev/input/event5"
[ 11.785] (**) Option "_source" "server/udev"
[ 11.786] (II) event5 - QEMU QEMU USB Tablet, class 0/0, rev 2.00/0.00, addr 3: is tagged by udev a
s: Touchscreen
[ 11.786] (II) event5 - QEMU QEMU USB Tablet, class 0/0, rev 2.00/0.00, addr 3: device is a touch d
evice
[ 11.786] (II) event5 - QEMU QEMU USB Tablet, class 0/0, rev 2.00/0.00, addr 3: device removed
[ 11.786] (**) Option "config_info" "udev:/dev/input/event5"
[ 11.786] (II) XINPUT: Adding extended input device "QEMU QEMU USB Tablet" (type: TOUCHSCREEN, id 11
)
[ 11.787] (**) Option "AccelerationScheme" "none"
[ 11.787] (**) QEMU QEMU USB Tablet: (accel) selected scheme none/0
[ 11.787] (**) QEMU QEMU USB Tablet: (accel) acceleration factor: 2.000
[ 11.787] (**) QEMU QEMU USB Tablet: (accel) acceleration threshold: 4
[ 11.787] (II) event5 - QEMU QEMU USB Tablet, class 0/0, rev 2.00/0.00, addr 3: is tagged by udev a
s: Touchscreen
[ 11.788] (II) event5 - QEMU QEMU USB Tablet, class 0/0, rev 2.00/0.00, addr 3: device is a touch d
evice
[ 13.958] qxl_surface_create: Bad bpp: 1 (1)
[ 76.296] (EE) libinput bug: Event for missing capability CAP_POINTER on device "QEMU QEMU USB Table
t, class 0/0, rev 2.00/0.00, addr 3"
[ 76.458] (EE) libinput bug: Event for missing capability CAP_POINTER on device "QEMU QEMU USB Table
t, class 0/0, rev 2.00/0.00, addr 3"
[ 83.986] (EE) libinput bug: Event for missing capability CAP_POINTER on device "QEMU QEMU USB Table
t, class 0/0, rev 2.00/0.00, addr 3"
6. Now as you likely don't have a mouse you will need to ssh into machine, so you can add the magic touch. This is to use the evdev driver as used by utouch kernel module, rather than the default libinput drive, for "QEMU USB Tablet".
Here are details of override file:
# cat /usr/local/etc/X11/xorg.conf.d/99-qemu-input.conf
#
# Overide libinput
#
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
NOTE: As of Apr 2023 it seems that FreeBSD 13.1 with latest binary pkg install, works without have specific configuration for input device.
7. Final step is just update /etc/rc.conf to start GNOME automatically on boot (note - dbus, hald are now disabled for 12.X and dbus enabled for 13.1):
# cat /etc/rc.conf
clear_tmp_enable="YES"
hostname="ME-NAME"
ifconfig_vmx0="DHCP"
ipv6_network_interfaces="none"
ipv6_activate_all_interfaces="NO"
local_unbound_enable="YES"
sshd_enable="YES"
#moused_enable="YES"
#moused_flags="-t auto -p /dev/usm0"
dbus_enable="NO"
# dbus_enable="YES" <<== enable for freebsd 13.1 hald_enable="NO" gdm_enable="YES" gnome_enable="YES" # set dumpdev to "auto" crash dumps, "no" disable < code>
Video Driver Options - scfb or qxl
There are two options avaialable for video/graphics drivers that work with FreeBSD:
- scfb - using xf86-video-scfb FrameBuffer driver. This is "lowest common denominator" driver and seems to always be available and works with QEMU qxl via option
- qxl - using xf86-video-qxl. This has enhanced performance for QEMU qxl vga, but has been deprecated fro FreeBSD ports (see more below) and so currently requires compilation from code
The simplest approach is to use "scfb". To load the driver you will need to add a very simple configuation to force loading of this driver (as used by GhostBSD). Assuming you have keep standard "/usr/local/etc/X11" configuation directories, add the following configuration to: "/usr/local/etc/X11/xorg.conf.d":
$ cat /usr/local/etc/X11/xorg.conf.d/98-qemu-video.conf
Section "Device"
Identifier "Card0"
Driver "scfb" <<=== change to "qxl" if you have working driver endsection< code>
Check /var/log/X11.0.log if X fails to start.
If you want to bite the bullet and try the qxl driver then details are in below sections. Be aware that this has tendency to break....
If you have added "xf86-video.qxl" driver then you should update the configuration file above to from: Driver "scfb" => Driver "qxl".
NOTE: For Apr 2023 FreeBSD 13.1 retest I used scfb, as qxl crashed.
FreeBSD Desktop - Result & Conclusion
It works !!
Was it worth it ...
FreeBSD provides a robust and reliable server machine, but if you want a "Unix GNOME" desktop, then I would recommend Ubuntu for Linux. The other option is MacOS for Unix with slickness and commercial applications.
Finally with introduction of udev X11 input discovery this is now much easier than before.
Update: Sept 2021 - I have verified that this all work as per notes, in combination with upstream source build of xf86-video-qxl driver (see below), but expect it will likely break again shortly...
Reference & Links:
FreeBSD 11.3 / 12.X and SCSI, VirtIO & Networking Bug with QEMU Q35 VM - when you find a bug in an Open Source reporting it and helping with diagnosis is a key way of helping to contribute. The work around for this bug is to build a custom kernel with /usr/src/sys/amd64/config/GENERIC update to disable "dev netmap" disabled.
TianoCore - the Open Source UEFI project kick started by Intel and basis of QEMU OVMF (Open VM Firmware) implementation
FreeBSD / QEMU / KVM Q35 USB Tablet (EVTouch) input device not captured by evdev - reporting bugs in Open Source can also lead to helpful tips, such as advise by Vladimir Kondratyev on using misc/utouch
FreeBSD Handbook - "The X Window System" has useful tips but does not cover QEMU / KVM setup
utouch - FreeBSD driver for absolute USB HID mouses - thanks to Vladimir Kondratyev
udev commit - X11 input discovery that greatly simplifies configuration and allows removal of hald and dbus daemons when running FreeBSD desktop
qxl video driver - was deprecated and removed from distribution, another step backwards on this and discussion thread on same, re-instated late 2022 / early 2023.
qxl build issue - "xf86Opts.h" Bool conflict with <stdbool.h> being included in qxl_drmmode.c. Workaround is to move the: #include " qxl_drmmode.h" to end of include section...
Building xf86-video-qxl from Source
As noted above the xf86-video-qxl driver has been removed from both ports and packages due to "dependency" on python 2.7.
I was able to trivally build the driver directly from upstream source (only qxl driver at this point).
To build the driver has installed the following (binary) pkgs: git, autoconf, automake, xorg-macros, m4, pkgconf, libtool, python37
NOTE: For FreeBSD 13.1 I used "python38" and will likely be python39 soon, again expect things to change.
I also had the evdev & utouch packages installed as per prior validate.
To build it was a simple matter of doing:
- Git Clone of upstream
- configure & make and make install:
---
--- Install the build tools
---
$ pkg install git autoconf automake xorg-macros m4 pkgconf libtool
$ pkg install python37 <<=== python38 for 13.1 --- clone source and make $ cd dev git https: gitlab.freedesktop.org xorg driver xf86-video-qxl.git xf86-video-qxl . autogen.sh su install< code>
This initial test did not build the full "Spice" sub-system, but did get X11 back up and running, using the same configuration instructions for QEMU EvTouch as documented above. To avoid building the "spice" modules install: libspice-server spice-protocol via pkg and then the autogen.sh will recognise that these are already available and skip this part of build process.
NOTE #1: Sept 2022 - xf86-video-qxl no longer compiles due to conflicts with an Xorg file and stdbool.hm. This can be fixed by updating the file: src/qxl_drmmode.c:
# git diff src/qxl_drmmode.c
diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c
index 337bbd7..30f2d58 100644
--- a/src/qxl_drmmode.c
+++ b/src/qxl_drmmode.c
@@ -33,7 +33,6 @@
#ifdef XF86DRM_MODE
#include <sys/ioctl.h>
-#include "qxl_drmmode.h"
#include "X11/Xatom.h"
#include "xf86DDC.h"
#include <X11/extensions/dpmsconst.h>
@@ -41,6 +40,7 @@
#include "qxl.h"
#include "qxl_surface.h"
+#include "qxl_drmmode.h"
static void drmmode_show_cursor (xf86CrtcPtr crtc);
This Issue has been raised on freedesktop.org gitlab site.. but further testing following with compilation under Ubuntu (no issues) indicates that issues is with using older code base (see NOTE #2 below). Ensure you have latests source code base!!
NOTE #2: This issues appears to resolved upstream, ensure you have lastest upstream code for "xf86-video-qxl"
So there is now need for either patch of upstream fix. Seems that FreeBSD team is happy to ignore this so I am not hopeful that the port will be quickly fixed.
Update: Sept 2021 & Sept 2022 - there has been no ports fix to restore the xf86-video-qxl driver, but I have re-verified source build process with FreeBSD 12.2 & 13.1 . I have raised bug report on issue with deprecated port.
Building xf86-video-qxl via deprecated ports tree (testing)
With removal of the xf86-video-qxl from the x11-drivers ports tree, it is very messing trying to do a build via ports.
To achive this you need to:
- Get the build tools: "pkg install git autoconf automake xorg-macros m4 pkgconf libtool"
- Clone the ports tree git repo
- Check out the last branch which has the port: "git checkout 2020Q3"
- Do binary install or current port tree install of the following package: help2man, libspice-server, spice-protocol, python37, bison, texinfo, openssl
- Go into old port tree: x11-drivers/xf86-video-qxl
- Edit makefile to remove the python explicity version dependency (just leave a plain "python".
- Build and install the driver.
Here is diff of Makefile, so currently not doing this trival change was reason for "deprecating" the driver... hmm:
# git diff Makefile
diff --git a/x11-drivers/xf86-video-qxl/Makefile b/x11-drivers/xf86-video-qxl/Makefile
index 65dbd1059ebe..42cb413cebf7 100644
--- a/x11-drivers/xf86-video-qxl/Makefile
+++ b/x11-drivers/xf86-video-qxl/Makefile
@@ -17,7 +17,7 @@ BUILD_DEPENDS= spice-protocol>=0.12.10:devel/spice-protocol \
${LOCALBASE}/include/linux/input.h:devel/evdev-proto
LIB_DEPENDS= libspice-server.so:devel/libspice-server
-USES= localbase:ldflags pkgconfig python:2.7 shebangfix xorg \
+USES= localbase:ldflags pkgconfig python shebangfix xorg \
xorg-cat:driver
USE_XORG= xfont
NOTE: This is still being testing, as while it is possible to start X11 ok (startx), when gdm/gnome there is issue with login going back to authentication screen ... (oh well back to Ubuntu ;-) ).
Old and Painful way - Now Obsolete
Before introduction of udev input discover this was the way I got this to work...
Generate a default X11 startup configuration and then edit this to load particular configuration
$ cd /usr/local/etc/X11
-- NOTE: main X11 device configuration, which has "Screen0" and "Mouse0" identifiers and AutoAddDevices options set to Off
-- This stops loading of automatically discovered devices
# cat xorg.conf
Section "ServerLayout"
Identifier "Plain"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
Option "DontZap" "Off"
Option "AutoAddDevices" "Off"
Option "Log" "sync"
EndSection
Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
FontPath "/usr/local/share/fonts/misc/"
FontPath "/usr/local/share/fonts/TTF/"
FontPath "/usr/local/share/fonts/OTF/"
FontPath "/usr/local/share/fonts/Type1/"
FontPath "/usr/local/share/fonts/100dpi/"
FontPath "/usr/local/share/fonts/75dpi/"
FontPath "catalogue:/usr/local/etc/X11/fontpath.d"
EndSection
Section "Module"
Load "glx"
EndSection
#
# ---
# NOTE: now go down to configuration directory
# qxl is the default graphics device for QEMU and you should be using this driver
you need to ensure that PCI BudID is consistent with your VM
Screen0 == matches main config above
# ---
#
# cd xorg.conf.d
# cat device-qxl.conf
Section "Device"
Identifier "Card0"
Driver "qxl"
BusID "PCI:0:1:0"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
#
# ---
# NOTE: the sreen frame buffer driver
# ---
#
# cat driver-scfb.conf
Section "Device"
Identifier "Card0"
Driver "scfb"
EndSection
#
# ---
# NOTE: Keyboard Driver configuration
# ---
#
# cat input-kbd.conf
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
#
# ---
# NOTE: evdev configuration, where Mouse0 == as per main configuration
# Device == /dev/input/event5 , as per evdev.evest result
# No oether configuration is required for EvTouch to work
# ---
# cat input-qemu-tablet.conf
Section "InputDevice"
Identifier "Mouse0"
Driver "evdev"
Option "Device" "/dev/input/event5"
EndSection
To stop xorg from loading the default mouse driver I did a rename of the mouse driver. This was required as the mouse driver is installed by default with xorg binary package and if you do a "pkg remove" then it will try to remove the xorg package as well.
# cd /usr/local/lib/xorg/modules/input
mv mouse_drv.so mouse_drv.so.bak
Finally my /etc/rc.conf to start GNOME automatically on boot (enable: dbus, hald, gdm & gnome):
# cat /etc/rc.conf
clear_tmp_enable="YES"
hostname="ME-NAME"
ifconfig_vmx0="DHCP"
ipv6_network_interfaces="none"
ipv6_activate_all_interfaces="NO"
local_unbound_enable="YES"
sshd_enable="YES"
#moused_enable="YES"
#moused_flags="-t auto -p /dev/usm0"
dbus_enable="YES"
hald_enable="YES"
gdm_enable="YES"
gnome_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"