Quickly test FreeBSD 11 with KMS/VT (NewCons) support, hald and your keyboard layout

This is my super short how to install the latest X.org on FreeBSD 11 with KMS, hald enabled and a particular keyboard layout. Want to make a quick test on KVM/virt-manager or on your spare system with Intel or Radeon graphics? Here you go.

First of all, if you haven’t done it already, install the latest FreeBSD 11 image that contains VT (NewCons) support already built in. It rockes. The images are downloadable from here, just make sure to choose the image that has “VT” in the name.

ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/ISO-IMAGES/11.0/

From FreeBSD 11 we will have everything required to run on the latest and greatest platforms, that is:

* VirtIO drivers (network, block devices, PCI and memory ballooning) for KVM/libvirt/virt-manager on Linux already integrated in the kernel
* Intel KMS drivers for Intel chipsets (loadable as modules)
* Radeon KMS drivers for discrete and AMD APU integrated Radeon chipsets (loadable as modules)

Install the latest X.org

Use PKGNG and install the latest and greatest xorg meta package. This will pull in all additional requirements:

# pkg install xorg

After installing, add the proper startup lines for DBus and Hald. People tend to disable Hald to set different keyboard layouts, but it’s not actually true. By disabling Hald and the option to auto add devices you lose the ability to dock and undock your laptop and things like that.

To start the services at boot add the following two lines in /etc/rc.conf:

dbus_enable="YES"
hald_enable="YES"

Then start the services:

service dbus start
service hald start

Now you can plug and unplug your devices while the system is running.

Load your appropriate KMS driver

The examples here use both Intel and Radeon drivers, just use the one for the hardware you have, or add them both, it makes no harm. Simply the driver will not be used.

Type one the following commands in a root shell to load the appropriate drivers:

kldload i915kms
kldload radeonkms

Your screen should change and you should have now a nice prompt on the native resolution of your monitor. To load the module at boot, edit the file /boot/loader.conf and add these lines:

i915kms_load="YES"
radeonkms_load="YES"

Configure your keyboard layout

By googling around I could not find an easy yet clean solution for having hot plug capabilities in X and at the same time set my keyboard layout. By looking at a Fedora system, I discovered that is actually very simple. Just create an /etc/X11/xorg.conf file with the following content (set the XkbLayout option to your desired language):

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "it"
EndSection

This will create a rule to match all keyboards attached to the system and set the appropriate layout. Easy, isn’t it?

Now start X in your preferred way, xinit, startx or whatever.

5 thoughts to “Quickly test FreeBSD 11 with KMS/VT (NewCons) support, hald and your keyboard layout”

  1. Hi,
    instead of net-mgmt/wifimgr now I’m using net/wpa_gui… they are both graphical interfaces for wpa_supplicant but I found wpa_gui to be less buggy and easier to configure.
    I don’t know about 3g support.. I tried to get it working manually with an USB 3g internet key with no success.. as far as I remember the first steps were loading u3g modules first, then switch usb-mode since once plugged the system recognized it by default as an external storage drive and not as a 3g modem.
    I have stopped messing with that because I don’t need it anymore since now I’m using an Android phone as a w-fi modem through tethering and it works fine…

  2. thanks for your post. I tried a nightly and finally they got suspend resume working on my laptop (thinkpad T430).

    The basic support was all there, but graphic driver didn’t work when resuming. Now, with VT/newcons, I can finally use the KMS driver and everything works fine, suspend/resume, tty switching, xorg, xorg to tty and vice versa.

    Only one note: there’s no longer a ‘vt’ build, vt is now part of GENERIC, but isn’t enabled by default.

    it must be enabled setting
    ‘kern.vty=vt’
    in /boot/loader.conf

    I’m really interested in knowing if they plan on using VT by default, and when they’d make such a change.
    Along with PKG(ng), FreeBSD could, I had almost lost hope on it, become a (power)user-friendly desktop os, without all the systemd/mandatory dbus (have you read of wicked?)/wayland crash-friendly bullshit.
    If only it had a better point-and-click wifi support… net-mgmt/wifimgr still lacks 3g support.

  3. Hi,
    I’ve tried this new version of FreeBSD on a laptop with an integrated Intel HD4000… now switching from graphical/text consoles through CTRL+ALT+FKeys finally works out of the box, unluckily suspension in RAM still don’t’ work but from what I’ve seen I can say that KMS drivers and newcons are a very welcome improvement 😀

  4. “By disabling Hald and the option to auto add devices you lose the ability to dock and undock your laptop and things like that.”
    This presupposes the reader has a laptop, no? Supposing you have a desktop, how do you lose out?

Leave a Reply to nonnaccioCancel reply