Setting up NetBSD

Contents

Introduction

This document describes how to set up a home workstation using NetBSD operating system. The NetBSD project has extensive documentation. The installation and compiling packages are covered for example in the NetBSD Guide. The purpose of this document is not to duplicate the existing documentation, but to give some additional practical advice on setting up the system. The instructions apply to NetBSD 1.6.1.

Optimizing compiler

As a first thing after installing the package collection you should install the devel/cpuflags package (make install clean clean-depends in /usr/pkgsrc/devel/cpuflags) and add the following lines to /etc/mk.conf:

.sinclude "/usr/pkg/share/mk/cpuflags.mk"
COPTS+=-pipe
CFLAGS+=-pipe
OBJMACHINE=yes
MKOBJDIRS=yes
MOZILLA_USE_XFT=YES
MASTER_SORT=.fi .se .no .dk

The above definitions make the compiler to produce code optimized to your processor architecture. The MASTER_SORT defines the preferred mirror sites. Modify it to match your geographical location.

Compiling kernel

I created the kernel configuration file using adjustkernel. In addition, I made the following changes.

Only one CPU is required (i686 in my case):

# CPU support. At least one is REQUIRED.
#options I386_CPU
#options I486_CPU
#options I586_CPU
options I686_CPU

Ogle requires these:

options SEMMNI=256
options SEMMNS=2048
options SHMMAXPGS=8192

Advanced Power Management (APM) support is needed e.g. to switch off the computer:

apm0 at mainbus0 # Advanced power management

The DMA in my DVD drive does not work reliably so I disabled it:

cd* at atapibus? drive ? flags 0x0f00 # ATAPI CD-ROM drives

Periodic jobs

I don't usually have my computer always on. As a consequence, the periodic system maintenance jobs that usually take place in night time are not performed. To that end I have created /var/periodic directory (mkdir /var/pediodic) and modified the root's crontab as follows (using crontab -e).

15 3 * * * /bin/sh /etc/daily 2>&1 | tee /var/log/daily.out | sendmail -t && touch /var/periodic/daily
30 4 * * 6 /bin/sh /etc/weekly 2>&1 | tee /var/log/weekly.out | sendmail -t && touch /var/periodic/weekly
30 5 1 * * /bin/sh /etc/monthly 2>&1 | tee /var/log/monthly.out | sendmail -t && touch /var/periodic/monthly
@reboot /usr/local/sbin/run-periodic

/usr/local/sbin/run-periodic is a shell script that is run at every reboot. The script runs periodic jobs if the relevant files (daily, weekly and monthly) in /var/periodic have not been touched in a day, week or month, respectively. This way the periodic jobs are run regularly even if the computer is off during the nights.

Antialiased fonts

Install antialiased fonts, as adviced in Benedikt Meurer's HOWTO.

DVD movies

I mainly use multimedia/ogle to view DVD movies. You should also install multimedia/libdvdcss to decode the DVD encryption (libdvdcss tar ball is available from VideoLAN).

The graphical user interface (GUI) of Ogle ( multimedia/ogle_gui) is broken because the NetBSD dlerror() behaves incorrectly. This is fixed in the current NetBSD branch. To get Ogle GUI working in NetBSD 1.6.1 you must patch it. Easiest way to do this is to copy patch-local-aa to /usr/pkgsrc/multimedia/ogle_gui/patches before compiling and installing ogle_gui.

You probably must tweak the kernel options. The instructions given for OpenBSD apply also for NetBSD. I had to also disable the DMA from my DVD drive since the DMA did not work properly with my VIA chipset, causing Ogle to crash to libdvdread errors (NetBSD has DMA enabled by default).

It may be more convenient to first rip the DVD to the hard disk. The hard disk is a lot faster than the DVD drive so the movies may play more smoothly and quietly. The DVD's can be mirrored to the hard disk with graphics/dvdbackup.

Switching off the system

Kernel needs the APM support compiled in to be able to switch off the power. To make things easier you can install security/sudo and add the following to sudoers file using visudo:

kaip winnie = NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff

Replace kaip with your login name and winnie with your hostname. After that you can shut down or reboot the computer by issuing a command sudo /sbin/poweroff or sudo /sbin/reboot, respectively.


http://www.iki.fi/kaip/netbsd.html

Kai Puolamäki, Kai.Puolamaki@iki.fi

[Creative Commons License]
This work is licensed under a Creative Commons License.