FreeBSD

FreeBSD

configuration > operating_systems > freebsd

Maintenance

Updates

freebsd-update fetch; freebsd-update install
pkg update
cd /usr/ports/; make update; portupgrade -a
ezjail-admin update -Pu
jls name | xargs -I%  pkg -j% upgrade

package management

pkg info -a         ;# lists all installed packages 
pkg info -l <PKG>   ;# lists files installed by a specific <PKG>
pkg info -D <PKG>   ;# displays the 'install-message' once again
pkg info <PKG>      ;# displays verbose information about an installed package
pkg search -f <PKG> ;# displays verbose information about any package (not only installed)

tips

There is no watch(8) in the base system, but a package cmdwatch(8) under FreeBSD, which does not support intervals under one second. But we know how to help ourselves, don't we:

while (true); do $CMD; sleep .1;  clear; done

We can manually adjust the resolution and other screen properties of the console:

vidcontrol -g 100x37 VESA_800x600 green
vidcontrol MODE_280

Check, which kernel is currently installed against which one is currently running (read: tell, if a reboot is required):

uname -r && freebsd-version -k

Change the name of the root user (from its default “Charlie Root”)

pw usermod -n root -c 'www jail root'

oder zusammen mit anderen Angaben im $Editor:

chpass

problems and solutions

Issue: It is not possible to add, modify or delete users using pw(8) or adduser(8) and one of the following messages is shown:

pw: entry inconsistent
user disappeared during update

This happens, when the password files get out of sync. To synchronize /etc/passwd, /etc/master.passwd and /etc/pwd.db one of the following commands can be used:

pwd_mkdb -p /etc/master.passwd
vipw

Issue: Crashes in the night time

check your cronjobs, because you may have several instances of find / running within the security check pre-configured to run at 03:01. Furthermore the pkg-backup script uses xz to compress. Watch out for simultanious running jobs in jails and try not to execute the jobs in parallel. Add daily_backup_pkg_jails="*" to your /etc/periodic.conf.local to have the host executing the pkg backup script, deactivate it in every jail with something like

daily_backup_pkgdb_enable="NO"
daily_backup_pkgng_enable="NO"
daily_backup_pkg_enable="NO"

and you are good to go (I have no good solution for the security job atm).

loader.conf typo in module name and boot kernel panic

This may even prevent you from entering single user mode, but can easily be fixed using the boot loader prompt:

disable-module vesa
disable-module vboxdrv
unset hint.apic.0.disabled
boot-conf
boot

would effectively override vesa_enable="YES" in /boot/loader.conf

J1900: No sound

dev.hdac.0.polling=1

disable bell (console beep)

sysctl kern.vt.enable_bell=0

or permanently:

kern.vt.enable_bell=0

keyboard: repeat rate

keyrate=330.40

WiFi in FreeBSD 11

FreeBSD does not automatically create a wlan0-device. Also ifconfig cannot longer be used to find the devices name. Instead there is a new sysctl value, which can be used like this:

sysctl net.wlan.devices
ifconfig wlan0 create wlandev ath0
wpa_supplicant -i wlan0 -c /usr/local/etc/wpa_supplicant.conf

(where for some reason using wpa_passphrase (3) did not work for me, just plain text passwords)

Slow WiFi Speed

The reason may be a misconfigured country code, which leads to reduced trasmission power rate.

ifconfig wlan0  ;# part of ifconfig's output is the country, usually 'US'
create_args_wlan0="wlanmode sta country Germany"

Also I found some Forum posts where -ht was added to improve the stability. Notice, that using this option also reduces the transfer speeds dramatically.

Package Management

Information about the currently installed packages are in the file /var/db/pkg/local.sqlite, which should therefore be backed up, where deleting /var/db/pkg/repo-FreeBSD.sqlite will recreate (and may therefore 'repair') the package database next time one runs pkg. The /etc/pkg/FreeBSD.conf contains the url to the pkg database. By default it is set to pkg+http://pkg.FreeBSD.org/${ABI}/quarterly, but it can make sense to use latest instead of quarterly when using ports and pkg's at the same time, because they are theoretically in sync (practically there are other ports trees which may not be in sync, but not in the default configuration). - thanks to “blackflow” on irc/freenode

assign an IPv6 alias address
# set
ifconfig re0 inet6 2a01:04f8:XXXX:YYYY::1:1 alias
# unset
ifconfig re0 inet6 2a01:04f8:XXXX:YYYY::1:1 -alias
deactivate ntp

If sockstat -l | grep 123 displays many entries, one for each of your jails, the service may not be running within the jail. Add to the hosts /etc/ntpd.conf:

interface ignore wildcard
interface listen 127.0.0.1
interface listen ::1

…and restart ntpd.

sub categories



top