FreeBSD on ZotacNano - hpaluch/hpaluch.github.io GitHub Wiki

FreeBSD on Zotac NANO CI327

After lot of years using dual-boot with Win 10 Home (acquired with that PC) and openSUSE LEAP with Xfce I decided to try bare-metal FreeBSD on Zotac Nano CI327. You can find many hardware details ZotacNano. Brief overview:

  • 4 core Intel(R) Celeron(R) CPU N3450 @ 1.10GHz (1094.40-MHz K8-class CPU)
  • integrated GPU: Intel HD Graphics 500 (Iris)
  • 4GB RAM
  • now using SATA3 Samsung EVO 1TB SSD (on-board M.2 32GB SSD failed after 2 years of service)
  • using GPT+UEFI mode (disabled "secure" boot) - required by Win 10 Home, because recovery disk expects UEFI mode only.

Actually I played with FreeBSD on various machines (including version 2.x on 386SX, etc. or recent versions on other machine - MSI-7250 with AMD X2 Opteron), but it is first time when I'm using it on bare-metal Zotac NANO.

I'm curious because Zotac is my only machine that should support bhyve Hypervisor (it is not possible to use Opteron X2, because it has no nested page table support).

Here is list of reasons why I'm considering leaving Linux (after using Linux since 1993):

  • avoid systemd
  • avoid Wayland (but it is coming also to BSD...)
  • avoid hostile GNOME (forcing empty useless desktop and 2 clicks on opposite side edges of screen to just use launch application with Dash, or Totem Video player that does not allow 1:1 scale - window is always maximized - and lot of other madness...)
  • very bad Q&A in case of openSUSE LEAP 15.6 (totally broken SVN client that was unable to connect to any https SVN server, and totally broken Chromium 126 that crashed after few minutes of use). What is even worse - both mentioned bugs were reported on Tumbleweed 1 month before LEAP release - but nobody in SUSE cared.
  • uncertain future of openSUSE LEAP 16 - official end of LEAP 15.x is Dec 2025, but there is still no beta of LEAP 16 (Aug 2024). This is problem, because for example GitLab will need considerable time to prepare and test production release for LEAP 16, etc....

I have currently 2 candidates to replace openSUSE LEAP:

  • Alpine Linux - no systemd, very slim and fast busybox based system + uses musl instead of glibc. However some unexpected quirks needed (for example, no login history - because musl has no wtmp/utmp support for some reason).
  • FreeBSD 14.1 (using UFS, because having only 4GB RAM is not suitable for ZFS)

NOTE: I intentionally avoid rolling Linux distributions (Arch, Gentoo and even Fedora - it is formally release based but actually rolling in last few years...) I'm tired of having system that may change overnight in unexpcetd ways making it impossible to test upgrades on other instance...

In all cases I use Xfce as my favorite GUI.

Using moused with CHESEN PS2 to USB Converter

I still use PS/2 keyboard and PS/2 Mouse connected to USB via CHESEN PS2 to USB Converter (there is no PS/2 connector on Zotac Nano). There are practical reasons to use PS/2 keyboard:

  • it is last one having sane layout - usable when typing with 10 fingers
  • recent USB keyboards have "innovations" that make them unusable to type with 10 fingers (having ENTER too far, right Control to far, rotated navigation keys block and other nonsense)

To use local console for Copy & Paste I added following lines to /etc/rc.conf:

moused_enable=YES
# comment out line below:
#moused_nondefault_enable="NO"
moused_type="auto"
moused_port="/dev/ums0"

Please note that although PS/2 mouse is connected, it is handled as USB mouse - thus only allowed type auto and using USB specific device.

To avoid reboot I directly run /etc/rc.d/moused start for the 1st time.

Once moused is running you can mark text by left-button hold and move, and paste with middle button.

Installing Handbook

Once I can use mouse to copy & paste text on Console it is right time to download and extract handbook from: https://download.freebsd.org/doc/handbook/handbook_en.tar.gz

After unpack I also install lynx with pkg install lynx and then I can browse HTML pages and be able to copy & paste all required commands - which is useful, for example to configure X-Window.

Installing X-Window with Xfce

Here is my condensed setup to install Xorg for Intel Iris HD card with Xfce:

pkg install drm-kmod libva-intel-driver mesa-libs mesa-dri xorg xfce
sysrc kld_list+=i915kms
# command below used to just avoid reboot - monitor may blank for short time:
kldload i915kms
pw groupmod video -m MY_USERNAME
sysrc dbus_enable="YES"
# do this only once to avoid reboot:
/usr/local/etc/rc.d/dbus start

Now I invoke Xfce from local console using startxfce4

Configure audio

Good news is that stock driver is working (no setup needed):

$ dmesg | grep pcm

pcm0: <Realtek ALC892 (Left Analog)> at nid 20 and 24 on hdaa0
pcm1: <Realtek ALC892 (Rear Digital)> at nid 30 on hdaa0
pcm2: <Intel Broxton (HDMI/DP 8ch)> at nid 3 on hdaa1

In my case:

  • pcm0 is right one (3.5mm audio jack for headphones)
  • pcm1 is SPDIF digital output (never used)
  • pcm2 is audio on HDMI (never used - I have VGA monitor only)

You can also try command mixer -a to see all current audio settings.

To get basic Audio support I install:

pkg install xfce4-mixer audacious audacious-plugins

Then add to your toolbar new item 'Audio Mixer(search formixer`).

In case of audacious you need to

  • go to menu Output -> Audio Settings ... -> Output Plugin:
  • change from Pulse to OSS4 Output (Linux kernel 1.0.x also used OSS, but there were later some license clashes and Linux switched to Alsa)
  • now Audacious should be able to play music

NOTE: generally Audacious is a bit unstable on FreeBSD - seeing for example:

ERROR ../src/libaudcore/plugin-load.cc:70 [plugin_load]: /usr/local/lib/audacious/Input/sid.so could not be loaded: /usr/local/lib/libsidplayfp.so.6: Undefined symbol "__kmpc_fork_call"

And sometimes it dumps core on exit.

configure Video

I install two players:

pkg install mpv vlc gstreamer1-vaapi

NOTE: It is currently unclear for me if FreeBSD supports hardware video playback acceleration on Intel GPU cards (VAAPI while NVIdia uses VDPAU).

Mounting ext4 partition read-only

To have access and copy data from my existing openSUSE LEAP I need access (read-only is fine) to ext4 partition.

I was unable to find concise guide, just some issues on forums, for example:

I installed:

pkg install fusefs-ext2

And performed quick test:

kldload fusefs
# lookup your Linux partition
gpart show
fuse-ext2 -o ro /dev/ada0p5 /mnt

To ensure that module fusefs is loaded at boot, use this command:

sysrc kld_list+=fusefs

Other tools

Missing nslookup - one can bring it back:

pkg install bind-tools

Although there exists tool drill it is way too verbose to be useful for daily use (like dig). Details are here: https://forums.freebsd.org/threads/nslookup-does-not-come-with-freebsd-10-1-release.50912/

IPv6 and IPv6 sockets (both listening and open) can be listed with:

sockstat -46

Although there exists netstat it does not list open sockets (unlike Linux version).

Using bhyve Hypervisor

First enable auto-load of bhyve hypervisor module - vmm

sysrc kld_list+=vmm

Next we need to do similar thing as in Proxmox: move out network configuration from interface to bridge, so more than one "virtual interface" can share physical interface.

I commented out in /etc/rc.conf:

#ifconfig_re0="DHCP"
#ifconfig_re0_ipv6="inet6 accept_rtadv"

Following official guide at https://docs.freebsd.org/en/books/handbook/virtualization/#virtualization-host-bhyve I created new configuration entries, for network card re0, my IP address 192.186.0.50 and gateway 192.168.0.1:

ifconfig_re0="up"
ifconfig_bridge0="inet 192.168.0.50/24 addm re0 addm tap0"
cloned_interfaces="bridge0 tap0"
static_routes="ext"
route_ext="-net 0.0.0.0/0 192.168.0.1"

And reboot machine. After reboot verify that your network and DNS is still working (DNS should be left from previous configuration)

Next I downloaded installation iso:

mkdir -p /opt/iso
cd /opt/iso
curl -fLO https://download.FreeBSD.org/releases/ISO-IMAGES/14.1/FreeBSD-14.1-RELEASE-amd64-disc1.iso.xz
xz -d FreeBSD-14.1-RELEASE-amd64-disc1.iso.xz

And prepared empty disk image:

mkdir -p /opt/images
cd /opt/images
truncate -s 10g fbsd1.img

To invoke installation I run:

chmod +x /usr/share/examples/bhyve/vmrun.sh
/usr/share/examples/bhyve/vmrun.sh -c 1 -d /opt/images/fbsd1.img -i -I /opt/iso/FreeBSD-14.1-RELEASE-amd64-disc1.iso -m 1G fbsd1

And proceed install as usual.

After installation we can run same VM with just:

/usr/share/examples/bhyve/vmrun.sh -c 1 -d /opt/images/fbsd1.img -d /opt/images/fbsd1.img -m 1G fbsd1

TODO: Linux guest