Tuesday, January 13, 2004

Installing FreeBSD 5.2 REL on the Thinkpad a20p

Today I installed FreeBSD 5.2 REL on my Thinkpad a20p. I used the FreeBSD Laptop Compatability List and Paul Roe's example for guidance. I posted my results, such as dmesg output, and my XF86Config for others to reference.

Here are a few tweaks to get the system working:

I enabled sound with these entries in /boot/loader.conf


I enabled my SMC wireless NIC with this entry in /etc/rc.conf:

ifconfig_wi0="inet netmask
ssid myssid wepkey 0xmywepkeyinhex wepmode on"

My biggest challenge and favorite achievement was getting Java to work properly. A visit to the FreeBSD Foundation Java site showed it was behind the times. It did give me a pointer to the FreeBSD-Java mailing list, which would prove to be invaluable. I eventually found FreeBSDDom and their patch sets of the Sun JDKs. I also read about the FreeBSD Java Project's work.

I decided to give the /usr/ports/java/jdk14 port a try. I saw it used the 1.4.2p5 patch set, so I downloaded it to /usr/ports/distfiles. Next I downloaded the following and also placed them in /usr/ports/distfiles:


The first three were available at the Sun Java 2 Download site. The last was in a different section, but it can be found here (or more generically, here).

Then, within /usr/ports/java/jdk14, I executed:

make install

Along the way I received some messages which prompted me to act:

This Java VM will attempt to obtain some system information by
accessing files in linux's procfs. You must install the Linux
emulation procfs filesystem for this to work correctly. The JVM
will exhibit various problems otherwise. This can be accomplished
by adding the following line to your /etc/fstab file:

linprocfs /compat/linux/proc linprocfs rw 0 0

and then, as root, executing the commands:

kldload linprocfs
mount /compat/linux/proc

I did as the instructions warned. At one point the installation stopped with this error:

ERROR: JAVAWS_BOOTDIR does not point to a valid Java 2 SDK
Check that you have access to
and/or check your value of ALT_JAVAWS_BOOTDIR.

ERROR: BOOTDIR does not point to a valid Java 2 SDK
Check that you have access to
and/or check your value of ALT_BOOTDIR.

Exiting because of the above error(s).

gmake: *** [post-sanity] Error 1

I realized I needed to install the linux-sun-jdk14 port so I took these actions:

cd /usr/ports/java/linux-sun-jdk14/
make && make install

After that I returned to the /usr/ports/java/jdk14 directory, executed 'make', and continued installing the JDK. I received instructions on additions to my XF86Config file:

URW font collection for X.

You'll have to add /usr/X11R6/lib/X11/fonts/URW
to your X font path by either:

$ xset fp+ /usr/X11R6/lib/X11/fonts/URW
$ xset fp rehash

or by adding it to your X-server configuration file

I made the change as apparent in my XF86Config file. Once the JDK installation finished, I added Mozilla as a package. To get Mozilla to work with Java, I added the following symlink:

mkdir /usr/X11R6/lib/browser_plugins
ln -s /usr/local/jdk1.4.2/jre/plugin/i386/ns610/libjavaplugin_oji.so

At this point I thought I was ready to go, but Java refused to work. Thanks to a FreeBSD-Java thread, I learned the JDK didn't work well with IPv6. I disabled IPv6 by a sysctl command and made the appropriate entry in /etc/sysctl.conf:

sysctl net.inet6.ip6.v6only=0
echo "net.inet6.ip6.v6only=0" >> /etc/sysctl.conf

When I fired up Mozilla, I was able to see the Java security news plug-in worked.

The last challenge was setting up OpenOffice.org. Luckily I found precompiled packages for FreeBSD 5.2 REL. Here are the highlights:

pkg_add -v openoffice-1.1.0_1.tbz
Requested space: 306061008 bytes, free space: 4291790848 bytes
in /var/tmp/instmp.TMcvUV
dckage openoffice-1.1.0_1 registered in /var/db/pkg/openoffice-1.1.0_1
OpenOffice.org Build 1.1.0 Personal Install How-To
Written by: Martin Blapp

There are some wrappers installed for fast startup.
Add "${PREFIX}/bin/" to your PATH and you will be able
to use them.


If you have chosen US-ASCII as locale, you cannot load
and save documents with special characters and these
characters are also not available in swriter and scalc.

I ran 'openoffice-1.1' and chose 'local installation'. I specified '/usr/local/jdk1.4.2/jre' for my Java Runtime Environment, and OO found jdk1.4.2-p5 and used it. When I was done with the installation process, I reran 'openoffice-1.1', and found myself inside OO.

Aside from the length of time it took to install Java, the process worked very well.

My last work for the day involved checking to see if the laptop could suspend. I had downloaded and used IBM's stndalhd.exe program prior to installing FreeBSD to create a suspend partition. It created a partition of type 160 decimal or 0xa0. Unfortunately it did not create the partition table properly, as my first install of FreeBSD complained during setup and then refused to boot when done. I scrapped the old partition table and created a partition type 160 inside FreeBSD's fdisk during the FreeBSD installation. Once FreeBSD was installed I used newfs_msdos to create a FAT partition for my suspend work.

I allowed FreeBSD to boot with ACPI enabled. By experimenting I found I could suspend the laptop with acpiconf:

  • turn off laptop: 'acpiconf -s 5'

  • suspend to disk: 'acpiconf -s 3'

  • wake up from suspend: 'Fn' key or raise cover after 'acpiconf -s 3' and closing cover

I found 'shutdown -h now' didn't work completely with ACPI, and shutting the laptop cover had no effect. When I return from a suspend, I have to reinitialize wi0 and HUP moused. The built-in NIC, fxp0, works fine after suspending.

Overall I'm really pleased with this new FreeBSD distro and I'm using it as my primary system.

Update: I've decided to abandon ACPI. I boot with ACPI disabled and use the Fn-F4 key to suspend the laptop. When it resumes I re-ifconfig any needed interface and run ntpdate to bring the system clock up to speed.

I installed xmms and mplayer. After a fresh reboot each works, but after resuming from suspending neither works. This appears to be a hardware issue as others report having the same problem with Linux.