Wednesday, October 04, 2006

Recovering from Bad FreeBSD Packages

Recently I've encountered problems with some of the packages built by the FreeBSD team. In the case I described earlier, libtclx8.4.so and libmysqltcl.so.3 were somehow damaged in the .tbz packages I installed on one of my systems. I recovered by using good copies from another system.

Yesterday I ran into the following error after I upgraded my packages.

orr:/home/richard$ firefox
/libexec/ld-elf.so.1: /usr/local/lib/libplds4.so.1:
Undefined symbol "gethostbyname_r"

orr:/home/richard$ thunderbird
/libexec/ld-elf.so.1: /usr/local/lib/libplds4.so.1:
Undefined symbol "gethostbyname_r"

Uh oh. Email I can live without, but it's difficult to troubleshoot a problem without a Web browser. I had to turn to another laptop running Windows (for shame) to search for clues. I found one post on a Chinese Website with the same errors, but nothing else.

I found the pkg-plist for the linux-firefox and linux-thunderbird ports contained this entry:

lib/%%APP_NAME%%/libplds4.so

so it appeared the problem was one in the package for Firefox and Thunderbird.

I don't run either app on other computers, so I decided to try recovering by building new packages myself. I built them on another system, poweredge.

poweredge:/usr/ports/www/firefox# make package-recursive BATCH=1

I used "BATCH=1" to accept the defaults, thereby avoiding problems where the build process stops while waiting for me to select various options. I used package-recursive so the end result would include all packages needed for Firefox, in the event I needed to do a wholesale replacement of packages on my primary system.

When done I compared the libraries on the broken and package building systems.

orr:/home/richard$ ls -al /usr/local/lib/libpld*
-rw-r--r-- 1 root wheel 8960 Sep 24 02:59 /usr/local/lib/libplds4.a
lrwxr-xr-x 1 root wheel 13 Sep 24 02:59 /usr/local/lib/libplds4.so
-> libplds4.so.1
-rwxr-xr-x 1 root wheel 184784 Sep 24 02:59 /usr/local/lib/libplds4.so.1

poweredge:/home/richard$ ls -al /usr/local/lib/libpld*
-rw-r--r-- 1 root wheel 8960 Oct 3 17:32 /usr/local/lib/libplds4.a
lrwxr-xr-x 1 root wheel 13 Oct 3 17:32 /usr/local/lib/libplds4.so
-> libplds4.so.1
-rwxr-xr-x 1 root wheel 185062 Oct 3 17:32 /usr/local/lib/libplds4.so.1

The sizes are certainly different -- no need to hash them. I then copied over the 185062 file from poweredge and moved the 184784 version on orr out of the way. Sure enough, I was able to start Firefox and Thunderbird without any problems with the new libplds4.so.1 in place.

No comments: