FreeBSD 14.1-RELEASE on Raspberry pi 4

Here are my steps of running and troubleshooting 14.1-RELEASE on RPI4 (Firmware updated for USB boot, tested with external USB-SSD with RTL9210B).

My goal is to duplicate usability to match a linux system which is being used as DNS cache, NAS, and display btop output for other systems.

1. Download compressed image and CHECKSUM file, and test the image is not corrupted.

# shasum -a 512 --ignore-missing -c CHECKSUM.SHA512-FreeBSD-14.1-RELEASE-arm64-aarch64-RPI


2. Load image on SSD by image writer on Ubuntu 22.04.


3. After booting, root:root or freebsd:freebsd is already present and logged in as root. System greets with some suggestions like checking version (uname -a) and updating repo (pkg update). Change default root and freebsd user password.

# passwd
# uname -a
# pkg update

At this point, I had an error 'Certificate verification failed'.. It also says there's no prebuilt pkg available. But portsnap is unavailable too.
The error was showing for every single certificate for a fresh image.

After setting a correct date, it worked.

# date 202406081200


4. Getting some tools

# pkg install sudo vi nano bash


5. Add user and give permission, removed comment from '%wheel' line

# adduser
# nano /usr/local/etc/sudoers
# pw groupmod wheel -m myusername
# cat /etc/group | head

The line containing wheel shows myusername added at the end.
Login as myusername, and test 'sudo ls' works.


6. Get package manager

# pkg install portsnap
# portsnap fetch extract
Complains that directory does not exist.

# mkdir -p /var/db/portsnap

Portsnap is not included in base anymore as git will be used from 14.0 on (https://forums.freebsd.org/threads/portsnap-and-git-getting-ports.82833/).


7. Getting GUI and desktop manager, enable it, start services (Retract or ignore this step for headless system)

# pkg install xorg xfce lightdm lightdm-gtk-greeter
# echo 'dbus_enable="YES"' >> /etc/rc.conf
# echo 'hald_enable="YES"' >> /etc/rc.conf
# echo 'lightdm_enable="YES"' >> /etc/rc.conf
# service dbus start
# service hald start
# service lightdm start

Starting hald gets it to complain: hald does not exist in /etc/rc.d or the local startup directories, or is not executable.

# ls /usr/local/etc/rc.d
Showed that it indeed does not exist. According to this post there is no need to enable hald anymore as devd is used to detect devices in xfce (https://forums.freebsd.org/threads/question-over-etc-rc-conf-and-hald_enable.52967/).

Reboot and logging in as newly created user shows that desktop environment loads okay for root, but not for user when startx was invoked.

# echo "exec startxfce4" > ~/.xinitrc

Reboot and now gui shows up on boot. But the resolution is quite low at this point. I won't be looking for wrapper or prioritary binaries since this RPI will be headless once configuration is complete. For output, I will workaround the terminal output (tmux) and script that into html to check it from other system.



8. Setting up DNS cache

# pkg install unbound

Edit /usr/local/etc/unbound/unbound.conf

server:
interface: 0.0.0.0
access-control: 192.168.9.0/24 allow
verbosity: 1

forward-zone:
name: "."
forward-addr:8.8.8.8
forward-addr:8.8.4.4

Instead of echoing, sysrc can be used to enable unbound on startup.

# sysrc unbound_enable="YES"
# service unbound start

Test whether DNA cache works using dig.

# dig @127.0.0.1 somewebsite.com

Dig was not found (https://forums.freebsd.org/threads/where-is-dig.49265/) use drill instead.

# drill @127.0.0.1 somewebsite.com

Previously, Query time was 3+ms, now it shows 0ms. Set the DNS server to this RPI.



9. Setting up NAS

# pkg search samba
# pkg install samba419
# mkdir -p /srv/samba/share
# chown -R nobody:nogroup /srv/samba/share
# chmod -R 0775 /srv/samba/share

Update configuration file for samba at /usr/local/etc/smb4.conf
An example configuration file is seen here (https://minnie.tuhs.org/Blog/2019_06_27_FreeBSD_NAS.html).

[global]
workgroup = WORKGROUP
server string = FBSD14RPI4SMB
netbios name = rpi4
security = user
map to guest = Bad User

[share]
path = /srv/samba/share
browseable = yes
writable = yes
guest ok = yes
create mask = 0775
directory mask = 0775

Enable samba and add user.

# sysrc samba_server_enable="YES"
# service samba_server start
# pdbedit -a mysambausername

At this point, I was able to access the share from Ubuntu 22.04, but unable to create or read anything.

Updated configuration file and checked attributes (https://forums.freebsd.org/threads/...n-privilege-changed-since-update.90685/page-2) where the issue persist.

Cat works, but no touch to create new files, saying permission denied.

On server side 775 permission is visible, as per config and actual file attributes. On client side, it shows as 700.
On server side nobody:nogroup ownership is visible, but client side shows mysambauser:mysambauser.

Since this NAS is configured locally, dropped all security as per (https://www.server-world.info/en/note?os=FreeBSD_14&p=samba&f=1). and Now rw access is available from other systems.

# create new
[global]
unix charset = UTF-8
workgroup = WORKGROUP
server string = FreeBSD
# network range you allow to access
interfaces = 127.0.0.0/8 10.0.0.0/24
bind interfaces only = yes
map to guest = bad user

# any Share name you like
[Share]
# specify shared directory
path = /home/share
# allow writing
writable = yes
# allow guest user (nobody)
guest ok = yes
# looks all as guest user
guest only = yes
# set permission [777] when file created
force create mode = 777
# set permission [777] when folder created
force directory mode = 777


Thank you for any comments and suggestions!
 
Some quick notes...

date 202406081200 --> ntpdate <insert-ntp-server-here> Given Internet access is available
pw groupmod wheel -m myusername Unnecessary if you read what adduser asks you for =)
portsnap Deprecated, stop using it and it has nothing to do with pkg (your package manager)
Why do you want to run unbound locally? Most applications will bypass it anyway unless you edit /etc/resolv.conf and if you still want to dnsmasq, blocky, adguardhome are likely better alternatives for your scenario
If you're going to use non Windows clients it's probably less of a hassle to use NFS which also is in base
 
Thank you so much for sharing this wealth of information,alclsdkrak1.
What is your pkg configuration file look like
root@Ghost14-selfbuilt-rpi4B-nginx-tst1:/usr/local/etc/pkg/repos # pwd
/usr/local/etc/pkg/repos
root@Ghost14-selfbuilt-rpi4B-nginx-tst1:/usr/local/etc/pkg/repos # ls
FreeBSD.conf PersonalBSD.conf
FreeBSD.conf.orig PersonalBSD.conf.origin
GhostBSD.conf test
GhostBSD.conf.May25_2024 usr_local_etc_pkg_repos_conf_files.tar.gz
GhostBSD.conf.orig

# cat FreeBSD.conf
# $FreeBSD$
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
# mkdir -p /usr/local/etc/pkg/repos
# echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
# url: "pkg+http://pkg.freebsd.org/${ABI}/latest",
# url: "pkg+http://pkg.freebsd.org/FreeBSD:14:aarch64/latest",
url: "http://pkg.freebsd.org/FreeBSD:14:aarch64/latest",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
# enabled: no
}


Does HDMI audio sound work on your 14.1-RELEASE FreeBSD?
https://ghostbsd-arm64.blogspot.com/2024/01/hdmi-audio-sound-patches-into-ghostbsd.html
HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024. Here are directions for FreeBSD and GhostBSD-Arm64 to compile patches for enabling sound in the kernel source code.

https://ghostbsd-arm64.blogspot.com/ My blog about running GhostBSD-Arm64 kernel on Raspberry Pi 4B hardware.

Yes, I understand you just need a headless box to perform a task for your situation. I hope others can chime in and comment about using HDMI Audio Sound on the FreeBSD 14.1-RELEASE kernel on BCM2711 Raspberry Pi 4B ( 400 keyboard model sbc) hardware. Has anyone got HDMI sound to work on the BCM2712 Raspberry Pi 5?


I use this HDMI sound to play YouTube Audio out the television speakers. Works nice that method of playing Video and Audio on a television. Enabling USB Headphones also works well. Keeps other family members happy, too. They do not have to listen to your audio blaring out in the room.


3.5mm analog audio does work on the 4B hardware, too. With the VCHIQ patches compiled into the kernel for FreeBSD.
 
Thank you so much for sharing this wealth of information,alclsdkrak1.
What is your pkg configuration file look like
root@Ghost14-selfbuilt-rpi4B-nginx-tst1:/usr/local/etc/pkg/repos # pwd
/usr/local/etc/pkg/repos
root@Ghost14-selfbuilt-rpi4B-nginx-tst1:/usr/local/etc/pkg/repos # ls
FreeBSD.conf PersonalBSD.conf
FreeBSD.conf.orig PersonalBSD.conf.origin
GhostBSD.conf test
GhostBSD.conf.May25_2024 usr_local_etc_pkg_repos_conf_files.tar.gz
GhostBSD.conf.orig

# cat FreeBSD.conf
# $FreeBSD$
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
# mkdir -p /usr/local/etc/pkg/repos
# echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
# url: "pkg+http://pkg.freebsd.org/${ABI}/latest",
# url: "pkg+http://pkg.freebsd.org/FreeBSD:14:aarch64/latest",
url: "http://pkg.freebsd.org/FreeBSD:14:aarch64/latest",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
# enabled: yes
enabled: no
}


Does HDMI audio sound work on your 14.1-RELEASE FreeBSD?

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024. Here are directions for FreeBSD and GhostBSD-Arm64 to compile patches for enabling sound in the kernel source code.

https://ghostbsd-arm64.blogspot.com/2024/01/hdmi-audio-sound-patches-into-ghostbsd.html

Some notes on enabling sound for x86_64 GhostBSD kernel (should work for FreeBSD, too)
https://ghostbsd-arm64.blogspot.com/2024/03/sound-how-do-i-hear-thee-not-let-me.html This has some configuration files setup for FreeBSD 14.0-RELEASE to enable sound on a Raspberry Pi 4B hardware (or 400 Keyboard model SBC)

https://ghostbsd-arm64.blogspot.com/ My blog about running GhostBSD-Arm64 kernel on Raspberry Pi 4B hardware.


Yes, I understand you just need a headless box to perform a task for your situation. I hope others can chime in and comment about using HDMI Audio Sound on the FreeBSD 14.1-RELEASE kernel on BCM2711 Raspberry Pi 4B ( 400 keyboard model sbc) hardware. Has anyone got HDMI sound to work on the BCM2712 Raspberry Pi 5?

I use this HDMI sound to play YouTube Audio out the television speakers. Works nice that method of playing Video and Audio on a television. Enabling USB Headphones also works well. Keeps other family members happy, too. They do not have to listen to your audio blaring out in the room.

3.5mm analog audio does work on the 4B hardware, too. With the VCHIQ patches compiled into the kernel for FreeBSD.

Does the 'extra' serial ports on the Raspberry Pi 4B hardware BCM2711, work when enabled using a DTC file in the MSDOS configuration boot file directory? Like Uart2, Uart3, Uart4, Uart5. Seems like there is missing firmware that is not there to support extra Serial Uarts. only Uart0, Uart1.
 
wb7odyfred Can you use VideoCore GPU in FreeBSD?
I can play youtube videos, but I believe that is Software supported and not using the internal VideoCore GPU ability to decode. NetBSD 10.0 for Arm64 can also play youtube videos. I wonder if it supports the internal Video Core GPU.
https://ghostbsd-arm64.blogspot.com/2024/05/netbsd-aarch64-100-install-on-raspberry.html


I see that Firefox browser for Debian Raspberry Pi does support the Video4Linux V4L hardware decode of a video stream. I am hoping that FreeBSD might ( will in future ) provide V4L interface to the hardware Video Core GPU and that a Firefox Browser will see that and use that Video Core GPU. Other than using 'htop' to check cpu usage. I am not sure how to test and validate if the hardware Video Core GPU is being used for video decode or is just being performed in software Arm64 by the quad core CPUs.

Look at and check the FreeBSD ARM mailing list for work on Video Core GPU:
https://lists.freebsd.org/archives/freebsd-arm/

D2526 review about RPI 4 X805
sys/arm/broadcom/bcm2835/bcm2838_xhci.c
87–88There is a device tree node, but it's disabled and in any case we do not use it. The controller is discovered through ordinary enumeration of the PCI bus, both on Linux and in the driver I wrote.
The intention of the device tree inspection here is so I can check if the computer is a Raspberry Pi 4. The VIA controller is a commodity controller, but this quirk where the Pi Foundation removed the firmware EEPROM is limited to the Pi SBC.

https://reviews.freebsd.org/D25261?id=74934
 
I past i was using omxplayer, which plays videos and use hardware acceleration in FreeBSD, but as now that's deprecated.
 
Back
Top