Category Archives: VirtualBox additions

Configuring X.org on FreeBSD guests running in VirtualBox

Configuring X11 is more or less a dark art, and you must almost be a wizard of the Slytherine House to get modern X.org 1.14.7 working on a FreeBSD guest in VirtualBox.

Nonetheless, through lots of experimentation this evening, have I finally arrived at this configuration file:

Section "InputClass"
  Identifier      "Keyboard Defaults"
  Driver          "keyboard"
  MatchIsKeyboard "on"
  Option          "XkbLayout" "no"
EndSection

Section "InputClass"
  Identifier      "Mouse Defaults"
  Driver          "mouse"
  MatchIsPointer  "on"
EndSection

Section "InputDevice"
  Identifier      "Mouse0"
  Driver          "vboxmouse"
  Option          "CorePointer" "on"
EndSection

Somehow, you need both the InputClass and the InputDevice sections to get the mouse working as it did in previous versions of X.org. The option CorePointer is also key to the success.

Not only have I achieved Norwegian keyboard layout, the mouse sends its events to the X Server, and the mouse cursor is able to leave the FreeBSD guest whenever I want.

Maybe I’m the next Voldemort afterall. :P

VirtualBox 4.3.18 and AHCI

Update 2014-11-30

Upgrading to Oracle VirtualBox 4.3.20 removed the timeout messages shown below.

The bug was acknowledged in the change log as

Storage: fixed an interrupt acknowledge issue causing hanging guests or slower I/O (4.3.18
regression)


Since upgrading Oracle VirtualBox from 4.3.16 to 4.3.18 on my Windows 7 x64 host, most of my FreeBSD guests from time to time shows kernel messages like the ones below.

ahcich2: Timeout on slot 7 port 0
ahcich2: is 00000008 cs 00000000 ss 00000000 rs 00000080 tfd 50 serr 00000000 cmd 1000c717
(ada2:ahcich2:0:0:0): WRITE_FPDMA_QUEUED. ACB: 61 40 62 d4 9c 40 00 00 00 00 00 00
(ada2:ahcich2:0:0:0): CAM status: Command timeout
(ada2:ahcich2:0:0:0): Retrying command

It doesn’t matter if your FreeBSD guests run version 4.3.16 or version 4.3.18 of the emulators/virtualbox-ose-additions port.

Someone else reported similar kernel messages on physical servers, making me believe some recent changes in FreeBSD can be blamed. Or, maybe this is just a coincidence, despite the similarities.

Local slave port for emulators/virtualbox-ose-additions without OpenGL and X11

I have a bunch of FreeBSD VMs running in VirtualBox. They all share a number of virtual harddrives, and among them are a virtual harddrive with the common contents of /var/db/ports.

My ports configuration of emulators/virtualbox-ose-additions have the OPENGL and X11 options set. This is useless on some of my simpler VMs, as those VMs have no need for any X11 ports, but they could sure benefit from having the VirtualBox additions installed. These simpler VMs are usually used only to test ZFS in FreeBSD in various configurations.

I could juggle the settings for emulators/virtualbox-ose-additions for each time I’m updating the VirtualBox additions port on my VMs, but I decided to create a local slave port disabling the OPENGL and X11 options. Maybe this port, with the necessary tweaking, could sit among its siblings in the official emulators category.

OPTIONS_EXCLUDE=	OPENGL X11

MASTERDIR=	${.CURDIR}/../../emulators/virtualbox-ose-additions
.include "${MASTERDIR}/Makefile"

CATEGORIES=		local
VALID_CATEGORIES+=	local

COMMENT=	VirtualBox additions for FreeBSD guests without OPENGL and X11

PATCHDIR=	${MASTERDIR}/../${PORTNAME}/files

PKGNAMESUFFIX=	-additions-nox11

PKGORIGIN=	${CATEGORIES}/${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}

# EOF

For now you must copy the /var/db/ports/local_virtualbox-ose-additions-additions-nox11/options file to /var/db/ports/emulators_virtualbox-ose-additions-additions-nox11/options, or else dialog4ports(1) will keep nagging you until kingdom come.

I guess this problem stems from early processing of bsd.port.mk as done by the master Makefile at a time when the CATEGORIES variable was set to emulators.