Extended Brain Storage

FreeBSD: Post Installation Steps

Posted on December 19, 2015

Some steps that may be useful after a successful installation of the FreeBSD

System Bell

The irritating beeper (system bell) can be turned off as follows:

$ sysctl hw.syscons.bell=0
$ echo "hw.syscons.bell=0" >> /etc/sysctl.conf

Console Window Resolution

By default, the new virtual terminal console driver vt (previously known as Newcons) does not support the screen resolution in VirtualBox.

However, it is still possible to switch to the old “syscons” driver sc as follows:

$ echo "kern.vty=sc" >> /boot/loader.conf

Available console resolutions can be listed as follows:

$ vidcontrol -i mode
$ vidcontrol -i mode | grep 1024 # for a more granular selection

In order to have a higher CLI resolution (e.g. MODE_280):

$ echo 'allscreens_flags="MODE_280"' >> /etc/rc.conf

A reboot is necessary for the settings to take effect.

Console Window Scrolling

The scrolling option depends on the console driver used. In case of the syscons, sc driver or the newcons, vt driver, it is possible to scroll the console window history using the Scroll Lock key on the keyboard, which enters the scrolling mode.

Arrows Up and Down (slower) as well as Page Up and Page Down (faster) move through the history. Pressing Home or End triggers jumps to the beginning or end of the available history. Finally, pressing the Scroll Lock key again exits the scrolling mode back to normal. Finally, some usage for this key, LOL.

Note: If the Pause or Break key is still present, it has the same functionality as the Scroll Lock (should it be missing).

Disabling IPv6

If not in use, IPv6 support can be switched off as follows:

$ echo 'ipv6_activate_all_interfaces="NO"' >> /etc/rc.conf
$ echo '# ipv6_enable="NO" # this one is obsolete' >> /dev/null

Network Setup

If necessary, the network service can be restarted as follows:

$ service netif restart

A WiFi card (e.g. using the iwn driver) can be enabled to work with the WPA supplicant as follows:

$ pkg install wpa_supplicant
$ echo 'wlans_iwn0="wlan0"' >> /etc/rc.conf
$ echo 'ifconfig_wlan0="WPA SYNCDHCP"' >> /etc/rc.conf
$ echo 'network={\n\tssid="MYSSID"\n\tpsk="MYSECRET"\n}' >> /etc/wpa_supplicant.conf

The global routing tables can be checked as follows:

$ netstat -nr        # both IPv4 and IPv6
$ netstat -nrf inet  # just IPv4
$ netstat -nrf inet6 # just IPv6

Disabling Sendmail

For a desktop machine, it may be useful to disable sendmail as follows (if not used of course):

$ echo 'sendmail_enable="NO"' >> /etc/rc.conf
$ echo 'sendmail_submit_enable="NO"' >> /etc/rc.conf
$ echo 'sendmail_outbound_enable="NO"' >> /etc/rc.conf
$ echo 'sendmail_msp_queue_enable="NO"' >> /etc/rc.conf

Software Installation

3rd party software (packages) can be installed either as pre-compiled binaries or from source code (ports). More info can be found in FreeBSD: Handling Ports and Binary Packages.

Changing Shell

A shell can be changed as follows:

# chsh -s /path/to/shell USERNAME

X Server and XFCE

As an example, the XFCE4 environment will be used with X.Org server on a desktop machine as follows:

$ pkg install xorg
$ pkg install xfce xfce4-goodies
$ pkg install lightdm lightdm-gtk-greeter

The HAL and DBUS daemons are required for X server to run properly:

$ echo 'dbus_enable="YES"\nhald_enable="YES"\nlightdm_enable="YES"' >> /etc/rc.conf

Adding the non-privileged user into the operators groups can be done as follows:

$ pw user mod USERNAME -G wheel,operator

The non-privileged users can select, which X windows environment will they use as follows:

$ echo "exec startxfce4 --with-ck-launch" > ~./xinitrc

If FreeBSD runs inside a VirtualBox (as a guest), the following needs to be installed:

$ pkg install virtualbox-ose-additions

Add these lines need to be added to /etc/rc.conf:

$ echo 'vboxguest_enable="YES"\nvboxservice_enable="YES"' >> /etc/rc.conf

CPU Frequency and Power Control

CPU frequency and power control can be configured as follows:

$ echo 'cpufreq_load="YES"\nkern.hz=100' >> /boot/loader.conf
$ echo 'powerd_enable="YES"' >> /etc/rc.conf
$ echo 'powerd_flags="-a adaptive -b adaptive -n adaptive"' >> /etc/rc.conf
$ echo 'performance_cx_lowest="C3"' >> /etc/rc.conf
$ echo 'economy_cx_lowest="C3"' >> /etc/rc.conf

System Upgrade

In order to upgrade a system a new release number needs to be known (e.g. 10.3). The following commands will trigger the necessary steps:

$ freebsd-update -r 10.3-RELEASE upgrade
$ freebsd-update install

Now, the system must be rebooted with the newly installed kernel before the non-kernel components are updated.

$ reboot

Consequently, the freebsd-update command needs to be run again in order to install the new userland components:

$ freebsd-update install

It may be necessary (the administrator will be prompted to do so), another run is necessary:

$ freebsd-update install

A final reboot brings the administrator into the new RELEASE:

$ reboot

Tags: #FreeBSD #security

⏴ Previous Post Next Post ⏵