Table of Contents


FreeBSD is a freely available and open source implementation of the Berkeley version of the UNIX operating system.This system is in the same family of operating systems as Solaris, AIX, HP-UX, and Digital UNIX. The original UNIX operating system can trace its roots back to the 1960s. The designers of UNIX created a design so flexible and powerful that even 30 years later, UNIX (and thus FreeBSD as well) remains one of the most versatile, well-respected operating systems available. It runs on the following platforms: AMD64, ARM, ARM64, I386, MIPS, PC98, PPC, SPARC, XBOX, RPI, PICO. FreeBSD offers advanced networking, performance, security and compatibility features today which are still missing in other operating systems, even some of the best commercial ones.

Goals and ideas project

* More information about FreeBSD OS.

* More information about network layer

* More information about kernel

* Porting kernel for other unfriendly platforms

* Porting or Run kernel for other unfriendly android mobile phones or tablet.

* More desktops with BSD ! ….

Derivates FreeBSD OS

Derivate FreeBSD Use Link
FreeBSD Easy use https://www.freebsd.org/
TrueOS / PCBSD Easy use https://www.trueos.org/
GhostBSD Easy use http://www.ghostbsd.org/
DesktopBSD Easy use http://www.desktopbsd.net/
HardenedBSD Easy use https://hardenedbsd.org/
MidnightBSD Easy use http://www.midnightbsd.org/
DragonFly Easy use https://www.dragonflybsd.org/
TrustedBSD Easy use http://www.trustedbsd.org/
Frenzy Easy use http://frenzy.org.ua/eng/
Debian FreeBSD Easy use https://wiki.debian.org/Debian_GNU/kFreeBSD
Gentoo FreeBSD Easy use https://wiki.gentoo.org/wiki/Gentoo_FreeBSD
Raspbsd Easy use http://www.raspbsd.org/
Freesbie Easy use http://www.freesbie.org/
MfsBSD http://mfsbsd.vx.sk/
True-Pico https://www.trueos.org/trueos-pico/

Information about FreeBSD

Comparing BSD and Linux

For Beginner

FreeBSD is not Windows

FreeBSD Myth (For linux users)

FreeBSD features

FreeBSD tips and tricks

FreeBSD Video

FreeBSD Video ZFS


FreeBSD Kernel Porting

FreeBSD Kernel for beringer

FreeBSD Port

FreeBSD Jails

How to build package


Making new port

How to Become a FreeBSD Committer

FreeBSD Sound

Steam on FreeBSD

FreeBSD as Bitcoin Full Node

Avoiding Linuxisms

Quick start for Linux users


Purpose FreeBSD command Linux® command (Red Hat) Linux® command (Debian)
Install package from remote repository pkg install package yum install package apt-get install package
Install local package pkg add package rpm -ivh package dpkg -i package
List installed packages pkg info rpm -qa dpkg -l
List PCI devices pciconf lspci lspci
List loaded kernel modules kldstat lsmod lsmod
Load/Unload kernel modules kldload / kldunload modprobe modprobe
Trace system calls truss strace strace

FreeBSD handbook

Support Laptops

Tuning Power Laptops

First step after installation FreeBSD

First step after installation system is good donwload security patches for operating system and donwload new files for operating system and install.

freebsd-update fetch install
shutdown -r now

Next step is update ports collection for operating system.

for updating information for FreeBSD ports developers is /usr/ports/CHANGES

portsnap auto


portsnap fetch
portsnap extract

Update ports is east command

portsnap fetch update

Security audit for package and FreeBSD

pkg audit -F

Apply security patches FreeBSD update, upgrade

Apply security patches

freebsd-update fetch
freebsd-update install

Upgrade FreeBSD

freebsd-update fetch
freebsd-update upgrade -r 11.0-RELEASE or other version
freebsd-update install

Desktop Environments

FreeBSD have several desktop enviroments - Xfce4, Mate, Gnome3, Cinnamon, KDE, Lumina

How install Mate desktop

pkg install mate-desktop mate xorg slim

Enable components for kernel in etc/rc.conf

You need enable this component:

zfs_enable="YES"  - if you use ZFS file system

if you want enable crash dump, if dont you write “NO”


Next step is create file .xinitrc in /root/ and /home/user/ with command

exec mate-session
and reboot.

How install Xfce desktop

pkg install xfce4-desktop xfce xorg slim

Enable components for kernel in etc/rc.conf

You need for run desktop

zfs_enable="YES"  - if you use ZFS file system

if you want enable crash dump, if dont you write “NO”


Next step is create file .xinitrc in /root/ and /home/user/ with command

exec startxfce4
and reboot.

How to set slim theme

# pkg install slim-themes
# cd /usr/local/share/slim/themes
# fetch http://daemon-notes.com/downloads/assets/themes/slim-freebsd.tar.bz2
# tar jxvf slim-freebsd.tar.bz2
# rm slim-freebsd.tar.bz2

Edit and set /usr/local/etc/slim.conf
#current_theme       default
current_theme       freebsd


NTPD synchronize


Or manualy update time and date

securelevel on 2 then you cannot set time only about second.

ntpdate -b pool.ntp.org
sudo service ntpd start

Disable Beep

# sysctl hw.syscons.bell=0
# reboot

or if you use XFCE

set bell-style none

Enable sudo

You must edit sudoers file


Change standard shell to fish

You must add line in /etc/shells for example fish shell


Change shell and path your favorite shell

chsh -s /usr/local/bin/fish


Paths for shell

If you need PATH for example compiler or some options

# ASAN settings
set -x ASAN_SYMBOLIZER_PATH /usr/local/llvm50/bin/llvm-symbolizer
set -x ASAN_OPTIONS verbosity=1
set -x ASAN_OPTIONS symbolize=1
set -x ASAN_OPTIONS detect_stack_use_after_scope=1

# UBSAN settings
set -x UBSAN_SYMBOLIZER_PATH /usr/local/llvm50/bin/llvm-symbolizer
set -x UBSAN_OPTIONS verbosity=2

set -x MSAN_SYMBOLIZER_PATH /usr/local/llvm50/bin/llvm-symbolizer
set -x MSAN_OPTIONS fsanitize-memory-track-origins=2
set -x MSAN_OPTIONS verbosity=2
set -x MSAN_OPTIONS symbolize=1

Nano tuning

set constantshow
set smooth
set autoindent
set casesensitive
set historylog
set morespace

syntax "comments" ".*"
color blue "^#.*"

## nanorc files
include "/usr/local/share/nano/asm.nanorc"
include "/usr/local/share/nano/awk.nanorc"
include "/usr/local/share/nano/c.nanorc"
include "/usr/local/share/nano/cmake.nanorc"
include "/usr/local/share/nano/css.nanorc"
include "/usr/local/share/nano/debian.nanorc"
include "/usr/local/share/nano/fortran.nanorc"
include "/usr/local/share/nano/gentoo.nanorc"
include "/usr/local/share/nano/groff.nanorc"
include "/usr/local/share/nano/html.nanorc"
include "/usr/local/share/nano/java.nanorc"
include "/usr/local/share/nano/makefile.nanorc"
include "/usr/local/share/nano/man.nanorc"
include "/usr/local/share/nano/mgp.nanorc"
include "/usr/local/share/nano/mutt.nanorc"
include "/usr/local/share/nano/nanorc.nanorc"
include "/usr/local/share/nano/objc.nanorc"
include "/usr/local/share/nano/ocaml.nanorc"
include "/usr/local/share/nano/patch.nanorc"
include "/usr/local/share/nano/perl.nanorc"
include "/usr/local/share/nano/php.nanorc"
include "/usr/local/share/nano/pov.nanorc"
include "/usr/local/share/nano/python.nanorc"
include "/usr/local/share/nano/ruby.nanorc"
include "/usr/local/share/nano/sh.nanorc"
include "/usr/local/share/nano/tcl.nanorc"
include "/usr/local/share/nano/tex.nanorc"
include "/usr/local/share/nano/xml.nanorc"

Mount Devices

Mount msdosfs

# ls /dev/da*
# mount_msdosfs /dev/da0 /media/usb

Mount ext2/ext3/ext4

Fuse-ext2 mounts an ext2/ext3/ext4 partition or image file

For control kernels fuse modules is command:


If you dont have fuse.ko module in kernel you use this command

kldload fuse

Then mount your partition

fuse-ext2  /dev/your_partition /media/

Mount NTFS

For mounting ntfs file system you must kernel modul loaded.

For control kernels fuse modules is command:


and load FUSE kernel module:

kldload fuse

and then you can mount ntfs filesystem.

# ls /dev/da*
# ntfs-3g  /dev/your_partition  /mnt/

Automounting Removable Media

Uncomment in config file in /etc/auto_master

/media		-media		-nosuid

Add lines to /etc/devd.conf

notify 100 {
	match "system" "GEOM";
	match "subsystem" "DEV";
	action "/usr/sbin/automount -c";

Reload service

service automount reload
service devd restart

and added configuration /etc/rc.conf



portmaster -L - Check all update for ports
portmaster -a - Upgrade ports
portmaster -af - Rebuild of installed application

Debug ports

Just put the following in /etc/make.conf and then recompile the ports you want to include debug symbols:


more information


Compiling programs

Python3, Py3-QT5

First thing is add version python to /etc/make.conf .If you havent this file you must create. This conf file is for every compilation in system.

DEFAULT_VERSIONS+= python=3.5 python3=3.5

Next step is compile with default version python3.5

sudo portmaster python3

How to setup MYSQL Database

First step is installation

sudo pkg install mysql56-server

next step is enable in /etc/rc.conf

sudo sysrc mysql_enable=yes

Remember to run mysql_upgrade the first time you start the MySQL server after an upgrade from an earlier version.

Now start MYSQL Server

sudo service mysql-server start

then set database

sudo mysql_secure_installation


Simple script for create jail on zfs filesystem

# Donwload i386 base, ports tree FreeBSD OS
# and unpack base OS to your jail folder
# Create new zfs dataset for jail - only once
#zfs create -o mountpoint=/usr/local/jails zroot/jails
# Create jail folder 
zfs create zroot/jails/$name_jail 
rm /tmp/base.txz
rm /tmp/ports.txz
echo "Fetching package from FreeBSD server ..."
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/$arch_jail/11.1-RELEASE/base.txz -o /tmp/base.txz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/$arch_jail/11.1-RELEASE/ports.txz -o /tmp/ports.txz
mkdir /usr/local/jails/$name_jail
echo "Unpacking Freebsd base OS ..."
tar -xf /tmp/base.txz -C /usr/local/jails/$name_jail
tar -xf /tmp/ports.txz -C /usr/local/jails/$name_jail
cp /etc/resolv.conf /usr/local/jails/$name_jail/etc
echo "Done"


# /etc/jail.conf

# Global settings applied to all jails.

exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";

# The jail definition for freebsd386
freebsd386 {
    host.hostname = "freebsd386.domain.local";
    path = "/usr/local/jails/freebsd386";
    interface = "lagg0";
    ip4.addr =;

Packet forwarding

#Define the interfaces
ext_if = "em0"
int_if = "lagg0"
jail_net = $int_if:network

#Define the NAT for the jails
nat on $ext_if from $jail_net to any -> ($ext_if)

Run jail

bsd@ ~> sudo jail -c freebsd386
bsd@ ~> jls
bsd@ ~> sudo jail -m jid=28 allow.raw_sockets=1


Mount ZFS

zpool import

For control command mount.

Mount ZFS from Live CD

zpool import -fR /media zroot

Tuning zfs on i386

If you will have i386 OS you must set wm.kmem_size=“512M” and vm.kmem_size_max=“” is minimal value.

This is little tunables more information on http://www.freebsd.cz/doc/handbook/zfs-advanced.html


Resize partition

We added space for virtual disk (VirtualBox, or other) but we have disk CORRUPT

lol@ ~/> gpart show ada0
=>      40  41942960  ada0  GPT  (39G) [CORRUPT]
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  37744640     3  freebsd-zfs  (18G)
  41940992      2008        - free -  (1.0M)

Fix is easy :

gpart recover ada0

Now we need resize partion 3.

lol@ ~/> gpart show 
=>      40  81919920  ada0  GPT  (39G)
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  37744640     3  freebsd-zfs  (18G)
  41940992  39978968        - free -  (19G)
lol@ ~/> zpool list
zroot  17.9G  17.3G   621M         -    76%    96%  1.00x  ONLINE  -

For device is Busy , we have set this value:

lol@ ~/> sysctl kern.geom.debugflags=16
kern.geom.debugflags: 0 -> 16

Now resize partition number 3

lol@ ~/> gpart show 
=>      40  81919920  ada0  GPT  (39G)
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  37744640     3  freebsd-zfs  (18G)
  41940992  39978968        - free -  (19G)

lol@ ~/> sudo gpart resize -i 3 ada0

ada0p3 resized

lol@ ~/> gpart show 
=>      40  81919920  ada0  GPT  (39G)
        40      1024     1  freebsd-boot  (512K)
      1064       984        - free -  (492K)
      2048   4194304     2  freebsd-swap  (2.0G)
   4196352  77723608     3  freebsd-zfs  (37G)

Last step with zfs pool:

lol@ ~/> sudo zpool set autoexpand=on zroot
lol@ ~/> sudo zpool online -e zroot ada0p3 ada0p3

Control space in zpool.Size of zroot is right.

lol@ ~/> zpool list
zroot    37G  17.3G  19.7G         -    36%    46%  1.00x  ONLINE  -
lol@ ~/Desktop> sudo sysctl kern.geom.debugflags=0
kern.geom.debugflags: 16 -> 0


Virtuabox in FreeBSD

Added line with kernel module to /boot/loader.conf


Added line for bridged or host-only networking to /etc/rc.conf


Added to group

pw groupmod vboxusers -m yourusername
chown root:vboxusers /dev/vboxnetctl
chmod 0660 /dev/vboxnetctl

Permanent permisions added lines to /etc/devfs.conf

own     vboxnetctl root:vboxusers
perm    vboxnetctl 0660

FreeBSD as guest Virtualbox

Write to /etc/rc.conf


Wifi and FreeBSD

How to setup WIFI card

pciconf -l - look for if see wifi hardware
sudo ifconfig wlan0 create wlandev wpi0
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf

How to setup USB WIFI

Add kernel module to /boot/loader.conf

# Kenel drives for wifi 

# Next wifi modules

Add to configure /etc/rc.conf this lines. Configure you wifi device.

create_args_wlan0="wlanmode sta country CZ mtu 1500 indoor"

Look to your hardware if you have drivers.

# Look for if see wifi hardware (wpi, run0)
pciconf -l 

# Create device with name wlan0
sudo ifconfig wlan0 create wlandev wpi0

# Create wpa_supplicant configure file with ssid network 
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf

# Scan your wifi networks
ifconfig wlan0 up scan 
lol        00:13:46:49:41:76   11   54M -90:96   100 EPS  WPA WME
trololo    00:11:95:c3:0d:ac    1   54M -83:96   100 EPS  WPA

# ip adress from DHCP server
sudo dhclient wlan0


Install CD -> Partition -> Shell

gpart create -s gpt vtbd0
gpart add -t freebsd-boot -s 512k -a 4k vtbd0
gpart add -t freebsd-ufs -a 1M vtbd0
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 vtbd0

geli init -b -g vtbd0p2
geli attach vtbd0p2

newfs -j /dev/vtbd0p2.eli
mount /dev/vtbd0p2.eli /mnt

- /tmp/bsdinstall_etc/fstab
/dev/vtbd0p2.eli / ufs rw,noatime 1 1

- /tmp/bsdinstall_boot/loader.conf

exit (installer will continue)

Change  /dev/vtbd0p2.eli to gptid/rawuuid (gpart list):
/dev/gptid/015ceb9a-90a4-11e6-b8fc-1392a9ed1847 / ufs rw,noatime 1 1

FreeBSD Kernel

Source code FreeBSD kernel

sudo pkg install subversion  
sudo svn checkout https://svn0.us-east.FreeBSD.org/base/stable/you_version_system /usr/src
svn up /usr/src

Profiling and debugging kernel

Performance observality tools


Kernel module

Simple kernel module.

FreeBSD Security

Security on FreeBSD

To check the status of the securelevel on a running system: Add to /etc/sysctl.conf


more : http://www.freebsd.cz/doc/faq/security.html

Enabling and Utilizing Process Accounting

Tracking information such as CPU statistics and executed commands.

touch /var/account/acct
chmod 600 /var/account/acct
accton /var/account/acct
echo 'accounting_enable="YES"' >> /etc/rc.conf



If you use notebooks, is better enable acpi driver in /boot/loader.conf For IBM notebooks is command:



If you use notebooks, is better enable acpi driver in /boot/loader.conf For HP notebooks is command:


More : https://www.freebsd.org/cgi/man.cgi?acpi_ibm

Linux® Binary Compatibility

# kldload linux
# kldload linux64

# kldstat - you can look for modules
 1   72 0xffffffff80200000 1fa7c38  kernel
 2    1 0xffffffff821a9000 30aec0   zfs.ko
 3    2 0xffffffff824b4000 adc0     opensolaris.ko
 4    1 0xffffffff824bf000 231f8    if_urtw.ko
 5    1 0xffffffff82621000 4fac     ng_ubt.ko
 6    5 0xffffffff82626000 befc     netgraph.ko
 7    1 0xffffffff82632000 a58f     ng_hci.ko
 8    3 0xffffffff8263d000 107c     ng_bluetooth.ko
 9    1 0xffffffff8263f000 2a05     uhid.ko
10    1 0xffffffff82642000 3710     ums.ko
11    1 0xffffffff82646000 677b     u3g.ko
12    1 0xffffffff8264d000 53df     ucom.ko
13    1 0xffffffff82653000 d57d     ng_l2cap.ko
14    1 0xffffffff82661000 1b187    ng_btsocket.ko
15    1 0xffffffff8267d000 393d     ng_socket.ko
16    1 0xffffffff82681000 978bd    i915kms.ko
17    1 0xffffffff82719000 55180    drm2.ko
18    4 0xffffffff8276f000 26e8     iicbus.ko
19    1 0xffffffff82772000 1c75     iic.ko
20    1 0xffffffff82774000 1e70     iicbb.ko
21    1 0xffffffff82776000 3de40    linux.ko
22    2 0xffffffff827b4000 7b08     linux_common.ko
23    1 0xffffffff827bc000 389f4    linux64.ko

and add line to /etc/rc.conf:

Troubleshooting with FreeBSD


Too many authentication failures

If You are not able to authenticate via ssh and mesage “Too many authentication failures” is logged in /var/log/auth.log you probably have more than 2 keys loaded in your ssh agent that are failing to authenticate. To solve this unload keys you are not using from ssh agent (ssh-add -d path/ ssh-add -D), use ssh -i path_to_key or create appropriate section in your ~/.ssh/config with IdentityFile.


Fatal double fault FreeBSD 10.3 - i386 , FreeBSD 11 - i386

Fatal double fault is problem on FreeBSD - i386 with ZFS file system.

As described in /usr/src/UPDATING entry 20121223, rebuilding the kernel with options KSTACK_PAGES=4 has been observed to resolve the boot-time crash. This, however, is not an ideal solution for inclusion in the GENERIC kernel configuration, as increasing KSTACK_PAGES implicitly decreases available usermode threads in an environment that is already resource-starved.

You must do this steps for new kernel:

# mkdir -p /usr/src
# svnlite co svn://svn.freebsd.org/base/releng/10.2 /usr/src
# make -C /usr/src kernel-toolchain
# printf "include GENERIC\noptions KSTACK_PAGES=4\n" > /usr/src/sys/i386/conf/ZFS
# make -C /usr/src buildkernel KERNCONF=ZFS
# make -C /usr/src installkernel KERNCONF=ZFS

For FreeBSD 10.3 - More information on page https://www.freebsd.org/releases/10.3R/errata.html

For FreeBSD 11.0 - More information on page https://www.freebsd.org/releases/11.0R/errata.html

How to boot from live CD

If you have problem with boot on freebsd and cannot run system.

Back to FreeBSD menu and choose option 3. ( Escape to loader prompt ) For help in commandline is command help or ? (list of commands ) help set are options for command set

For boot from CD is commnad

set boot_cdrom (for mount filesystem)

Look for mounted filesystem with command mount.If you havent zfs filesystem mounted you must run command and connect zpool :

zpool import -f zroot
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki