My new FreeBSD Laptop: Dell Latitude 7390

As a FreeBSD developer, I make a point of using FreeBSD whenever I can — including on the desktop. I've been running FreeBSD on laptops since 2004; this hasn't always been easy, but over the years I've found that the situation has generally been improving. One of the things we still lack is adequate documentation, however — so I'm writing this to provide an example for users and also Google bait in case anyone runs into some of the problems I had to address.

A few months ago, after my System76 Galago Pro had its second experience with a dead/swelling batery, I decided that it was time to replace it. On February 15th, I ordered a Dell Latitude 7390.

This is an older model of laptop — it originally launched in 2018 — but I've always found that Dell Latitudes are well built, and this one came with a very attractive price tag: Rather than the original price of $3599 CAD ($2600 USD), Dell Canada was selling it for $1049 CAD ($750 USD). I can only assume that it was the last of their stock and they wanted to clear out that production line.

The laptop came with:

The laptop arrived on March 6th, and I made a couple upgrades:

In addition to giving me double the disk space, upgrading the disk allowed me to keep the Windows installation intact in case I ever want to put this laptop back into use running Windows.

After these upgrades, I didn't quite have my ideal laptop — I would have preferred 32 GB of RAM (Dell's specifications state that this laptop supports a maximum of 16 GB), a second disk (theoretically the "WWAN" PCIe slot can hold an M.2 2242 NVMe disk, but comments online suggest that the Dell BIOS doesn't allow SSDs in that slot) and a TrackStick — but for what I paid I really can't complain.

Installing FreeBSD

I downloaded the "memstick" image from the latest FreeBSD 12.1-STABLE weekly snapshot using my old laptop and wrote it to a USB Disk. Normally I would use a RELEASE image (which would make some later steps easier too) but a few recent changes I had made and some of the code needed to support the I2C touchpad weren't in the last release. (If you're reading this a few months into the future, use 12.2 or a later release instead of the 12-STABLE branch.)

To boot from a USB stick on the Dell Latitude 7390, I needed to press F12 when I turned the system on to enter the boot disk selection menu.

Installing FreeBSD was easy for me, as I've done it many times in the past; but I did change several defaults:

After the installation completes, I asked the installer to reboot the system and removed the USB disk.

Initial FreeBSD configuration

The first thing I did was to turn off the annoyingly loud console beep:
# echo kern.vt.enable_bell=0 >> /etc/sysctl.conf
and then I told FreeBSD to use "link aggregation" networking, failing over automatically from the wired ethernet (if connected) to the WiFi network
# sysrc wlans_iwm0="wlan0"
# sysrc ifconfig_wlan0="WPA"
# sysrc ifconfig_em0="ether MY:WI:FI:MAC:ADD:RESS"
# sysrc cloned_interfaces="lagg0"
# sysrc ifconfig_lagg0="laggproto failover laggport em0 laggport wlan0 DHCP"
provided my WiFi network credentials via /etc/wpa_supplicant.conf
network={
	ssid="MY NETWORK SSID"
	psk="MY NETWORK PASSWORD"
}
and started the network (service netif restart). I want a firewall, so I enabled FreeBSD's pf with a very simple configuration:
# echo "block in all" > /etc/pf.conf
# echo "set skip on lo0" >> /etc/pf.conf
# echo "pass out all keep state" >> /etc/pf.conf
# sysrc pf_enable="YES"
# service pf start

Now for the most annoying part: Because I'm running 12.1-STABLE rather than 12.1-RELEASE (due to the aforementioned patches and recently added support fo the I2C touchpad) I couldn't rely completely on packages built by the FreeBSD Project. Instead, I needed to build two packages of kernel modules — drm-kmod and iichid — via the ports tree.

This meant:

  1. Downloading and extracting a ports tree:
    # portsnap fetch extract
    
  2. Building the ports:
    # make -C /usr/ports/graphics/drm-kmod install clean BATCH=YES
    # make -C /usr/ports/sysutils/iichid install clean BATCH=YES
    
  3. And locking those packages to ensure that they won't be "upgraded" automatically to versions compiled on FreeBSD 12.1-RELEASE:
    # pkg lock -y -g '*kmod*' iichid
    
If I had been able to install 12.2-RELEASE (which does not exist yet at the time I am writing this), those steps would simply have been pkg install iichid drm-kmod.

Now that I had those packages in place, I could download the other ones I needed to get a basic GUI running:

# pkg install xorg kde5 sddm

And then do some basic configuration to turn on the GUI:

At this point I could reboot and watch my laptop boot into a GUI where I logged in as cperciva, opened a console (Ctrl-Alt-T), and used su to become root so I could do more configuration.

More FreeBSD configuration

The BIOS on the Dell Latitude 7390 configures the speakers and headphone jack as being independent audio outputs. This isn't what I want — I want to have sound go to the speakers by default but switch to the headphone jack and mute the speakers automatically if I plug in headphones. To do this, I told FreeBSD that the headphones (which are nid33 on this laptop) are part of the same audio set (as=1) as the speakers but should use mute-and-switch-to-headphones behaviour (seq=15):
# echo 'hint.hdaa.0.nid33.config="as=1 seq=15"' >> /boot/loader.conf
Speaking of audio, there's a bug in the HDMI codec which results in annoying warnings ("Unexpected unsolicited response with tag 63" and "Command timeout on address 2") being logged to the kernel console. Ed Maste has been working on fixing the underlying issues, but he provided a workaround which let me silence the warnings:
# echo 'compat.linuxkpi.i915_disable_power_well="0"' >> /boot/loader.conf
My preferred (KDE) environment doesn't need D-Bus for much, but one place it is needed is to allow the GUI tools to see the battery state and interact with power management:
# sysrc dbus_enable="YES"
CPU bugs often get fixed via microcode patches, so I want to have those:
# pkg install devcpu-data
# echo 'cpu_microcode_load="YES"' >> /boot/loader.conf
# echo 'cpu_microcode_name="/boot/firmware/intel-ucode.bin"' >> /boot/loader.conf
I want my laptop to boot faster — which means not having the boot loader wait 10 seconds in case I want to change how I boot, and not having the FreeBSD kernel wait for USB devices before mounting the root filesystem (I know that my root filesystem is on the NVMe disk):
# echo 'autoboot_delay="0"' >> /boot/loader.conf
# echo 'hw.usb.no_boot_wait="1"' >> /boot/loader.conf
As mentioned above, I like to use qmail rather than sendmail; I also use spiped to tunnel email to and from my mail server:
# pkg install netqmail ucspi-tcp spiped
# echo `hostname` > /var/qmail/control/me
# echo ":127.0.0.1:8025" > /var/qmail/control/smtproutes
# rm /var/qmail/alias/.qmail-*
# echo cperciva > /var/qmail/alias/.qmail-default
# cp /var/qmail/doc/mailer.conf.sample /etc/mail/mailer.conf
# sysrc qmailsend_enable="YES"
# sysrc qmailsmtpd_enable="YES"
# sysrc qmailsmtpd_host="127.0.0.1"
# echo "127.0.0.1:allow" > /etc/tcp.smtp
# sysrc spiped_enable="YES"
# sysrc spiped_pipes="SMTP POP3"
# sysrc spiped_pipe_SMTP_mode="client"
# sysrc spiped_pipe_SMTP_source="[127.0.0.1]:8025"
# sysrc spiped_pipe_SMTP_target="mail.tarsnap.com:8025"
# sysrc spiped_pipe_SMTP_key="/etc/spiped/smtp.key"
# sysrc spiped_pipe_POP3_mode="client"
# sysrc spiped_pipe_POP3_source="[127.0.0.1]:110"
# sysrc spiped_pipe_POP3_target="mail.tarsnap.com:8110"
# sysrc spiped_pipe_POP3_key="/etc/spiped/pop3.key"
And finally while the webcam daemon is installed already (the kde5 package pulls it in as a dependency) I want it to be enabled and I want the cperciva user to be able to access it:
# echo 'cuse_load="YES"' >> /boot/loader.conf
# sysrc webcamd_enable="YES"
# pw groupmod webcamd -m cperciva

Desktop configuration

At this point I had a fully functional desktop environment, but it wasn't set up exactly how I wanted. I don't like the default KDE wallpaper, so I installed new wallpaper
# pkg install wallpapers-freebsd-kde
and told KDE to use it (right click on desktop; "Configure Desktop"; scroll down and select the right wallpaper).

I want to be able to print from within KDE, so I enabled CUPS (which was already installed as a KDE dependency) and started it (necessary since I wanted to use it without rebooting):

# sysrc cupsd_enable="YES"
# service cupsd start
and then told KDE about my printer ("System Settings" -> "Printers" -> "Add Printer"; manual URI of http://192.168.1.60:631/ipp and the Generic PostScript Printer driver).

I want to be able to control the brightness of the screen (aka. the backlight connected to the Intel video chipset):

# pkg install intel-backlight
and in particular to be able to control it via the function keys (Fn+Up, Fn+Down) which Dell exposes via ACPI:
# echo 'acpi_video_load="YES"' >> /boot/loader.conf
# cp /usr/local/share/examples/intel-backlight/acpi-video-intel-backlight.conf \
    /usr/local/etc/devd/

There's a long list of software I want to be able to use (or in some cases, would prefer to avoid, but need nonetheless):

# pkg install firefox libreoffice thunderbird chromium
# pkg install nano konversation
# pkg install xournal ImageMagick7 pdftk
# pkg install texlive-full
# pkg install git subversion diffstat portlint sloccount
# pkg install autoconf autoconf-archive automake libtool
# pkg install base64 wkhtmltopdf
# pkg install tarsnap

And finally I want to perform hourly backups to Tarsnap — but in the background, and not spinning up the CPU to perform them (line wrapping added in the first line to avoid breaking web browsers):

# echo '47 * * * * root nice /usr/local/bin/tarsnap -c --keyfile /root/tarsnap.key
    -f `date +\%Y-\%m-\%d:\%H` /root /etc /usr/local/etc /usr/home' > /etc/cron.d/tarsnap
# sysrc powerd_flags="-N"

KDE configuration

Like most desktop environments, KDE has a myriad settings which can be adjusted, and I change many to match my personal taste, ranging from the Application Launcher (I prefer the "menu" version) to the keyboard shortcuts for changing desktops (I use Meta+Tab for this, since I don't make use of KDE "Activities").

The one particularly noteworthy option I set is to tell KDE to "Sleep" when the laptop lid is closed; in combination with the (default) setting to lock the screen when sleeping, this gives me a convenient way to "put the laptop away" when I don't want to shut it down completely. (Note however that it is unable to "Hibernate" since FreeBSD does not have the necessary support for Suspend-to-Disk.)

Current status

So where are we at now? Here's a short summary:

After the above installation and configuration — which took 75 minutes, mostly spent downloading 4 GB worth of packages — there's just one things left to do: Copy all my data across from my old laptop.

What didn't work the first time

While the above installation and configuration process all worked in the end, it wasn't nearly as smooth the first time — or the second time, or the third time. Some of the issues I ran into:

Conclusion

Is FreeBSD ready for the desktop? Yes and no. Yes, in that I have a very nice FreeBSD laptop where everything works the way I want. But no, in that it took me two months worth of fiddling with this in my spare time to fix some of the "glitches" which arose; while there wasn't anything particularly challenging, I expect that most people would give up long before they fixed all of the issues I ran into.

On the other hand, can FreeBSD be ready for the desktop? Absolutely. I've fixed the issues I ran into — and once we have FreeBSD 12.2-RELEASE with packages built for that release the process of bringing up a GUI will be much easier, as well. The biggest thing FreeBSD needs is to have developers acquiring laptops and carefully working their way through the issues which arise; the FreeBSD Foundation has already started doing this, and I hope in the months to come they — and other FreeBSD users — will publish reports telling us which laptops work and what configuration they need.

Posted at 2020-05-22 01:20 | Permanent link | Comments
blog comments powered by Disqus

Recent posts

Monthly Archives

Yearly Archives


RSS