OpenBSD on a Dell Inspiron 1000

Table of contents:


Hardware

A Dell Inspiron 1000. 2.2 GHz Celeron CPU, 256 MB RAM, 38 GB disk. The Hitachi disk died after a little over a year, and was replaced by a 120 GB Western Digital unit.

This replaces an HP OmniBook 2100 with a 200 MHz Pentium I, 96 MB of RAM, and a 5 GB disk. BSD doesn't need a lot of hardware! Much of the below also applied to the HP Omnibook.

And that replaced a Toshiba Satellite Pro 430CDS with a Pentium I, 32 MB of RAM, and a 1.3 GB disk. Much of the below was unneeded on that system, although I would never have tried to build Ethereal/Wireshark there!

Software

I started by installing the 22 Feb 2005 snapshot of OpenBSD 3.6, due to perceived trouble with the 3.6 official. Now that it's done, I see that the 3.6 official should have worked just fine. And 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3 and later are also just fine.

You know surely know about http://www.openbsd.org/, right? Unless you're just reading this for the parts that also apply to Linux...


Initial problem — Boot failure due to APM

The system would not boot, it hung within the first 16-20 lines of output after the boot prompt. Reading the output and consulting Google revealed that it was because of problems with the automatic power management on the hardware platform. The provided Phoenix BIOS does not let me turn that off! Here's what I saw in the failed boot screen after the kernel loaded and detected the CPU and RAM:

[....]
bios0: vendor Dell Computer Corp. version "A06 (Q3B01)" date 11/05/2004
bios0: Dell Computer Corp. Inspiron 1000
apm0 at bios0: Power Management spec V2.1
uvm_fault(0xd06c9800, 0x4000, 0, 1) -> e
fatal page fault (6) in supervisor mode
trap type 6 code 0 eip d034eeee cs 8 eflags 10046 cr2 465a cpl 0
panic: trap type 6, code=0, pc=d034eeee

The operating system has halted.
Please press any key to reboot.
			

While this page is mainly about running OpenBSD, this will also present a problem with some Linux kernels unless they are booted with the noapci option.

Fix for the boot failure

  1. Ask for a configuration boot when starting the installation:
    boot> boot -c     
  2. Tell the kernel to disable the APM device, and then continue booting
    ukc> disable apm0
    ukc> quit
  3. The system should now boot. Go ahead and do the install.
  4. After the install is complete, it cannot boot from the kernel reboot from the disk because of the same problem. So reboot from the kernel now on the disk with the above trick.
  5. Login as root and reconfigure the BSD kernel to permanently use that change:
    # cp /bsd /bsd.original
    # config -e -u -o /bsd.new /bsd
    ukc> quit
    # mv /bsd.new /bsd

Configuring X

Starting with OpenBSD 4.1, you need to make some kernel settings. From the manual page for xf86(4):

ACCESS CONTROL
     Access to the /dev/xf86 device is allowed when the sysctl(8) variable
     machdep.allowaperture is greater than or equal to 1.  This variable
     (which has a default value of 0) can only be raised when the security
     level is less than or equal to 0, so it should be set in
     /etc/sysctl.conf.  The possible values for machdep.allowaperture are:

     0       the aperture driver is disabled.  Opening it returns EPERM.

     1       the aperture driver allows access to standard VGA framebuffer and
             BIOS.  Access to pci(4) configuration registers is also allowed.

     2       in addition to allowing access to pci(4) configuration registers,
             the aperture driver allows access to the whole first megabyte of
             physical memory, permitting use of the int10 emulation in X.Org
             6.8 and later.  Note that this can cause some security problems,
             since the process that has access to the aperture driver can also
             access part of the kernel memory.  This mode is not supported on
             alpha or sparc64.

So, if you want to run X on this platform, put the following into /etc/sysctl.conf
machdep.allowaperture=2

The biggest things to remember:

  1. Do not use X, use Xorg instead!
  2. Do not use xf86cfg, or, worse yet, xf86config, use xorgcfg instead!
  3. Click here for my /etc/X11/xorg.conf configuration file for the Dell Inspirion 1000
  4. Click here for my /etc/X11/xorg.conf configuration file for the HP OmniBook 2100

If you don't have X set up yet, try this:

# mv /etc/X11/xorg.conf /etc/X11/xorg.conf-old
# Xorg -configure
# mv /root/xorg.conf* /etc/X11/xorg.conf 

You can test your X setup by running a bare X server:

# Xorg 

If it works, you will get the X background pattern and a X-shaped cursor. Kill the X server with:
<Ctrl><Alt><Backspace>
See below about setting up KDE and its display manager.


Configuring KDM to Start at Boot Time

I wanted to use KDE, and had trouble getting it to run. The initial trick was to stop any running kdm process:
# pkill kdm
and then configure the KDM display manager:
# /usr/local/bin/genkdmconf

With OpenBSD 3.8 comes a move to KDE 3.4, and some profound keyboard problems. The short version is that the getty processes (which run login on the text virtual consoles) grab many of the TTY devices, /dev/ttyC[0-5]. The display manager should run on /dev/ttyC4 but it and the getty processes get into a race, the result of which is that the display manager does not have access to the keyboard on the virtual console where it is running.

Google reveals some discussion of this — one suggestion is to attempt to control either getty, kdm, or both, but that doesn't seem very promising. I figured out a kludge of a workaround based on these useful messages (which talk about the problem in Linux, but it's fairly analogous):

  1. http://lists.debian.org/debian-devel/2005/07/msg01217.html
  2. http://lists.debian.org/debian-devel/2005/07/msg01229.html
  3. http://lists.debian.org/debian-devel/2005/07/msg01268.html
  4. http://lists.suse.com/archive/suse-kde/2005-Apr/0085.html

My fix is ugly: wait a few seconds to let the getty processes quit struggling for resources, then let the display manager come in and do its thing. I added a block like the following, either at the bottom of /etc/rc or /etc/rc.local, I didn't notice any difference in behavior:

# Keyboard may already be set up, but just in case...
echo "Setting up keyboard"
kbd us
# Announce, then nap briefly before starting kdm
echo "Starting KDM"
( sleep 5 ; /usr/local/bin/kdm ) &
# Save post-boot kernel ring buffer
echo "Saving ring buffer"
dmesg > /var/log/dmesg 

Automatically Starting an SSH Agent Under KDE

SSH agents are a good thing. The problem is, KDE does not generally start one in the right way. You could try messing with the user's X configuration to get one started, but the best solution seems to be to just have KDE do it. This fix is needed on the OpenBSD port of KDE, and probably on most Linux distributions.

Go to the directory /usr/local/share/config/kdm, or on Linux, /usr/share/config/kdm. Modify the file Xsession found there. You are looking for something like a case statement that resembles the following — what you are really looking for is the call of startkde:

[... several lines deleted ...]
case $session in
  "")
    exec xmessage -center -buttons OK:0 -default OK \
        "Sorry, $DESKTOP_SESSION is no valid session."
    ;;
  failsafe)
    exec xterm -geometry 80x24-0-0
    ;;
  custom)
    exec $HOME/.xsession
    ;;
  default)
    exec /usr/local/bin/startkde
    ;;
  *)
    eval exec "$session"
    ;;
esac
[... one or a few lines deleted ...] 

Simply insert ssh-agent as shown below. That way the SSH agent is exec'ed and it spawns startkde as its child. That way an SSH agent is up and running, and every one of your KDE processes is a descendent.

[... several lines deleted ...]
case $session in
  "")
    exec xmessage -center -buttons OK:0 -default OK \
        "Sorry, $DESKTOP_SESSION is no valid session."
    ;;
  failsafe)
    exec xterm -geometry 80x24-0-0
    ;;
  custom)
    exec $HOME/.xsession
    ;;
  default)
    exec ssh-agent /usr/local/bin/startkde
    ;;
  *)
    eval exec "$session"
    ;;
esac
[... one or a few lines deleted ...] 

KDE and the Limit on Open Files

My experience has been that the Konqueror web browser will fail to load complex pages, especially if there is much already open on your desktop. This is because of the conservative limits OpenBSD places on user utilization of resouces.

If you are a csh/tcsh user:
% limit
If you are a bash user:
$ ulimit -a
Strict! And see the below discussion of Ethereal / Wireshark for another place where this causes trouble. My fix was as follows:

  1. Right-click on the Konqueror button on my taskbar, and select Configure Konqueror button.
  2. When the new window appears, click on the Application tab.
  3. The Command field will read something like this:
    kfmclient openProfile webbrowsing
    Change this to instead read something like this:
    ulimit -n 256 ; kfmclient openProfile webbrowsing

Packages, /usr/local/*bin, and ldconfig

When I installed a bunch of packages on 3.9-current, I would get unexpected error messages when I tried to run the binaries. They complained that they could not load shared libraries that had been installed. The fix:

  1. Figure out where the libraries are. Note that only some of the directories reported by the following command are really repositories of shared libraries:
    $ find /usr -name lib -type d
  2. Tell ldconfig to rebuild /var/run/ld.so.hints with this command:
    # ldconfig /usr/lib /usr/X11R6/lib /usr/local/lib /usr/local/lib/qt3/lib

Wireless

I initially thought I had a problem with wireless, but no, it was because I was trying to bring up the wireless in an environment with no other wireless devices...

Card Configuration file File contents
Linksys WPC55AG /etc/hostname.ath0 dhcp media auto mode auto
Netgear MA521 /etc/hostname.rtw0 dhcp media DS11 mode 11b -chan

Building Wireshark (formerly known as Ethereal) on OpenBSD 3.8 and later

This tends to fail. The OpenBSD community hasn't built Wireshark packages for a while, since Wireshark has a bad security track record. It has to run with root privileges to do most of what people find useful, and its packet dissectors (the modules analyzing the large set of supported protocols) are very complicated and prone to bugs. Privileged processes running untrusted code leads to big security problems!

On top of this, the Wireshark community hasn't seemed to worry about making Wireshark build cleanly from source on OpenBSD. Here is the trick, based on what I found at http://www.linbsd.org/ethereal_on_openbsd38.html The followed has worked with Ethereal, and it works with Wireshark.

  1. Install these additional packages on OpenBSD:
    autoconf
    automake
    gcc-4* (GCC version 4.*, provices /usr/local/bin/egcc)
    glib2
    gmake
    gtk+2
    libtool
    m4
    metaauto
    pkgconfig
    python
  2. See what versions of autoconf and automake you have:
    % pkg_info autoconf | head -1
    % pkg_info automake | head -1
    % ls /usr/local/bin/auto*    

  3. You will probably have to do the software build as root because of the memory requirements. Become root with:
    % su -
  4. Set two environment variables, changing the numbers as appropriate. If you see, for example, autoconf-2.59p1, then you should probably specify simply 2.59. Similarly, if you see automake-2.9.6p0, then you should probably specify simply 2.9. The ls command above is probably the most useful test.
  5. At this point we find that the INSTALL, README, and other files don't tell the whole story for OpenBSD. First, we have to generate the Makefiles:
    # ./autogen.sh
    If that command fails with a complaint about missing Python, even though you have already installed it, then you need to do something like the following as root:
    # cd /usr/local/bin     
    # ln -s python2.4 python

  6. Set the environment variable CC to the binary for GCC 4.* — if you're running tcsh or csh, do this:
    # setenv CC egcc
    If you're running bash, do this:
    # export CC=egcc
  7. Do the configuration:
    # ./configure 
  8. Edit the file wiretap/Makefile and comment out this line:
    AM_NON_GENERATED_CFLAGS = -Werror
    If you don't do that, some warning messages due to risky code in the wiretap directory will cause the build to halt because the -Werror flag tells gcc to consider warnings to be errors.
  9. Now build the software. Note that you may have to run the following as root because of the amount of memory resources required by the library building. Note also that you have to use the GNU version of make:
    # gmake 
  10. After quite a while (maybe an hour!) that should succeed. If so, you're ready to install, again being careful to use the gmake program:
    # gmake install
  11. If it did not succeed, carefully read the output. If you are building a new version after building an older version on the same machine, the error may have been caused by attempting to build the new version linked against some older version of a shared library. If that's the case, you have two ways to proceed:
  12. When you try to run Wireshark, as soon as you try to start a capture it may fail thusly: This problem is caused by Wireshark using so many shared libraries stored under /usr/local/lib and data files stored under /usr/local/share/wireshark, especially if you built it with RADIUS support. The fix is to run Wireshark in an environment where more open files are allowed. For root, the command ulimit -a shows that the Bash shell can have only 128 simultaneous open file descriptors for that shell and its child processes. So, start Wireshark like this:
    % su root -c 'ulimit -n 512 ; wireshark &'
    Or, more extremely:
    % su root -c 'ulimit -n unlimited ; wireshark &'
    For more details see man bash and read the ulimit section.

Dealing with Devices

Does... Linux OpenBSD
List USB devices [verbosely] lsusb [-v] usbdevs [-v]
List PCI devices lspci [-v] lspci [-v]
See pcitweak for far more

Using a USB-to-serial adaptor: For example, to talk to a Cisco switch or router console port. The device shows up in dmesg output after plugging it in:

uplcom0 at uhub0 port 2
uplcom0: Prolific Technology Inc. USB-Serial Controller, rev 1.10/3.00, addr 2
ucom0 at uplcom0 

The serial device is now /dev/ttyU0 if you are configuring minicom or similar.


tuxmobil.org

Home Page Site Map Public Key E-Mail
Use /bin/vi! Manipulate images with ImageMagick! Hosted on OpenBSD
Hosted on Apache Valid XHTML 1.1! Valid CSS!
© Bob Cromwell Jul 2008. Created with /bin/vi and ImageMagick, hosted on OpenBSD with Apache.    Root password available here