Description

Installation

Boot disk

Create a bootable installation USB stick from FreeBSD.org. Install the disk by:

OS

Command

MacOS

sudo dd if=FreeBSD-12.2-RELEASE-amd64-memstick.img of=/dev/diskX bs=4m

Linux

sudo dd if=FreeBSD-12.2-RELEASE-amd64-memstick.img of=/dev/sdX bs=4=M

Disks

The best solution is using ZFS. Downside, it will take your whole disk. Encrypt your disk and swap file.

Configuration

Users

Add the users:

General packages

pkg install bash htop pstree tree

Kernel

svnlite checkout https://svn.freebsd.org/base/release/12.2.0 /usr/src

Window manager

pkg install xorg xfce
pkg install chinese/arphicttf chinese/font-std hebrew/culmus hebrew/elmar-fonts japanese/font-ipa japanese/font-ipa-uigothic japanese/font-ipaex japanese/font-kochi japanese/font-migmix japanese/font-migu japanese/font-mona-ipa japanese/font-motoya-al japanese/font-mplus-ipa japanese/font-sazanami japanese/font-shinonome japanese/font-takao japanese/font-ume japanese/font-vlgothic x11-fonts/hanazono-fonts-ttf japanese/font-mikachan korean/aleefonts-ttf korean/nanumfonts-ttf korean/unfonts-core x11-fonts/anonymous-pro x11-fonts/artwiz-aleczapka x11-fonts/dejavu x11-fonts/inconsolata-ttf x11-fonts/terminus-font x11-fonts/cantarell-fonts x11-fonts/droid-fonts-ttf x11-fonts/doulos x11-fonts/ubuntu-font x11-fonts/isabella x11-fonts/junicode x11-fonts/khmeros x11-fonts/padauk x11-fonts/stix-fonts x11-fonts/charis x11-fonts/urwfonts-ttf russian/koi8r-ps x11-fonts/geminifonts x11-fonts/cyr-rfx x11-fonts/paratype x11-fonts/gentium-plus

NVIDIA

Updated the ports

nvidia-driver

distinfo

SHA256 (NVIDIA-FreeBSD-x86_64-460.27.04.tar.gz) = b9c0e676b5e66569d2f71a25ab1e782bb8a52cbcb3e413e854b72debc37b6623
SIZE (NVIDIA-FreeBSD-x86_64-460.27.04.tar.gz) = 103234112

Makefile

-DISTVERSION?=   440.100
+DISTVERSION?=   460.27.04

-SUB_PATCHES=   extra-patch-src-Makefile \
-               extra-patch-src-nv-freebsd.h \
-               extra-patch-src-nv-misc.h \
-               extra-patch-src-nvidia_ctl.c \
-               extra-patch-src-nvidia_dev.c \
-               extra-patch-src-nvidia_linux.c \
-               extra-patch-src-nvidia_pci.c

-.if ${NVVERSION} >= 358.009
-# Initialize memory allocations to avoid spurious "lock re-initialization"
-# errors.  A little more detail can be found in bug 201340 starting around
-# comment #50.
-EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src_nvidia-modeset_nvidia-modeset-freebsd.c
-.endif

removed some includes

In /boot/loader.conf:

nvidia-modeset_load="YES"

pkg install nvidia-xconfig nvidia-settings

run nvidia-xconfig

linix--nvidia-libs

distinfo

SHA256 (NVIDIA-Linux-x86_64-460.27.04.run) = a654eab5ce50650c0cd1fdcc78c655d0de573a2b925c20839252ffab2cbc1ccf
SIZE (NVIDIA-Linux-x86_64-460.27.04.run) = 171853284

99a100
>               libnvidia-fatbinaryloader.so.${PORTVERSION} \
109a111
>               libnvidia-fatbinaryloader.so.${PORTVERSION} \
119a122
>               '\,${LINUXBASE}.*libnvidia-fatbinaryloader\.so,d' \
122,126c125
< .if ${NVVERSION} >= 460.027
< LINUX_LIBS+=  libnvidia-egl-wayland.so.1.1.5
< LINUX_LINKS+= libnvidia-egl-wayland.so.1.1.5 libnvidia-egl-wayland.so.1
< PLIST_RE+=    '\,${LINUXBASE},s/(libnvidia-egl-wayland\.so)\.X/\1.1.1.5/'
< .elif ${NVVERSION} >= 440.026
---
> .if ${NVVERSION} >= 440.026

pkg-plist

50a51
> %%LINUX32%%%%LINUXBASE%%/usr/lib/libnvidia-fatbinaryloader.so.%%SHLIB_VERSION%%
120a122
> %%LINUXBASE%%%%LINUX_LIBDIR%%/libnvidia-fatbinaryloader.so.%%SHLIB_VERSION%%

Xorg

Section "Device"
        Identifier      "Card0"
        Driver          "nvidia"
        # BusID         "PCI:0:8:0:0"
EndSection

    Section "Module"
        Load           "freetype"
        Load           "bitmap"
        Load           "type1"
        Load           "glx"
    EndSection

In /etc/rc.conf:

dbus_enable="YES"
hald_enable="YES"

Login manager

pkg install slim
pkg install slim-themes slim-freebsd-themes slim-freebsd-dark-theme slim-freebsd-black-theme slim-freebsd-themes

In /etc/rc.conf:

slim_enable="YES"

XFCE

pkg install xscreensaver xdg-user-dirs redshift xrandr

.config/user-dirs.dirs

XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_TEMPLATES_DIR="$HOME/templates"
XDG_PUBLICSHARE_DIR="$HOME/public"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_VIDEOS_DIR="$HOME/videos"

.config/redshift.conf

[redshift]
temp-day=5700
temp-night=3600
gamma=0.8
adjustment-method=randr
location-provider=manual

[manual]
lat=52.1
lon=5.2

xscreensaver -no-splash &
xdg-user-dirs-update &
redshift &
exec startxfce4

Audio

/boot/loader.conf

snd_driver_load="YES"

kldload snd_driver

Rearange your mixer to one usable Get the information. Look in your dmesg.

sysctl dev.hdac.0.pindump=1
sysctl dev.hdac.1.pindump=1
dmesg |grep hdaa

See device.hints(5) and snd_hda for more information. Long story short, as is the group of devices, seq is the sequence. An as of 0 is disable this device. A seq of 15 will override the 0.

/boot/device.hints

hint.hdac.0.cad0.nid4.config="as=0"
hint.hdac.0.cad0.nid5.config="as=0"
hint.hdac.0.cad0.nid6.config="as=0"
hint.hdac.0.cad0.nid7.config="as=0"
hint.hdac.1.cad0.nid17.config="as=0"
hint.hdac.1.cad0.nid20.config="as=1 seq=0"
hint.hdac.1.cad0.nid22.config="as=1 seq=1"
hint.hdac.1.cad0.nid21.config="as=1 seq=2"
hint.hdac.1.cad0.nid27.config="as=1 seq=15"
hint.hdac.1.cad0.nid24.config="as=2 seq=0"
hint.hdac.1.cad0.nid26.config="as=2 seq=1"
hint.hdac.1.cad0.nid25.config="as=2 seq=15"
hint.hdac.1.cad0.nid30.config="as=0"

change your default output: /etc/sysctl.conf

hw.snd.default_unit=0

reboot. (Thanks BSDForum.

Suspend

Suspend to memory is supported on FreeBSD. Suspend to disk isn't... You can test if your suspend to memory works by running as root:

acpiconf -s 3

If that works, your suspend is going to work. You can change what to do in /etc/rc.suspend and /etc/rc.resume. To start your suspension as a user, you have to be of the operator group.

pw group mod operator -m youruser

Now you can use zzz to suspend your system.

To also get it working within your XFCE, install polkit (pkg install polkit) and make a new file /usr/local/etc/polkit-1/rules.d/85-suspend.rules

polkit.addRule(function (action, subject) {
  if ((action.id == "org.freedesktop.consolekit.system.restart" ||
      action.id == "org.freedesktop.consolekit.system.stop")
      && subject.isInGroup("operator")) {
    return polkit.Result.YES;
  }
});

// For those who have working suspend/resume:

polkit.addRule(function (action, subject) {
  if (action.id == "org.freedesktop.consolekit.system.suspend"
      && subject.isInGroup("operator")) {
    return polkit.Result.YES;
  }
});

// Explicitly disallow hibernation because it's not supported by the OS.

polkit.addRule(function (action, subject) {
  if (action.id == "org.freedesktop.consolekit.system.hibernate") {
    return polkit.Result.NO;
  }
});

Bash autocompletion

Install bash and the autocomplete

pkg install bash bash-completion

Add in your $(HOME)/.bashrc:

if ! shopt -oq posix; then
  if [ -f /usr/local/share/bash-completion/bash_completion.sh ]; then
    . /usr/local/share/bash-completion/bash_completion.sh
  fi
fi

Windows shares

/boot/loader.conf

smbfs_load="YES"

kldload smbfs

/etc/fstab

# SMB
//username@server/home  /home/luser/documents     smbfs  rw,late 0   0

/etc/nsmbrc (Hostname, username and share has to be in CAPITALS)

[SERVER:USERNAME]
password=your_password

Sensors

/boot/loader.conf

amdtemp_load="YES"

kldload amdtemp

pkg install hwstat

Yubikey/U2F

pkg install yubioath-desktop yubikey-personalization-gui yubikey-manager-qt

In /etc/rc.conf:

pcscd_enable="YES"

service devd restart
service pcscd start
pw group mod u2f -m <user>
exit

U2F should work now, for example github. Also the tools for configuration will work.

SSH

pkg install opensc
ssh-add -s /usr/local/lib/opensc-pkcs11.so

Linux compat

/boot/loader.conf

linux64_load="YES"

kldload linux64

pkg install emulators/linux_base-c7

/etc/fstab

# Linux compat
linprocfs   /compat/linux/proc  linprocfs       rw      0       0
linsysfs    /compat/linux/sys   linsysfs        rw      0       0
tmpfs    /compat/linux/dev/shm  tmpfs   rw,mode=1777    0       0

 mount -a 

wine

pkg install wine wine-mono

BHyve

First, check if your virtualisation is enabled in your BIOS. Mine wasn't (Gighabyte and AMD).

Install packages

pkg install vm-bhyve grub2-bhyve
zfs create -o mountpoint=/vm pool/vm

in /etc/rc.conf

vm_enable="YES"
vm_dir="zfs:freggel/vm"

tutorial

vm init
cp /usr/local/share/examples/vm-bhyve/* /vm/.templates/
vm switch create public
vm switch add public igb0

Create a debian VM:

vm create -t debian vmname
vm iso https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.7.0-amd64-netinst.iso
vm install vmname debian-10.7.0-amd64-netinst.iso
vm console vmname

Howto/FreeBSDDesktop (last edited 2021-03-06 07:39:03 by Sciuro)