BSD DevCenter
oreilly.comSafari Books Online.Conferences.


Running Commercial Linux Software on FreeBSD
Pages: 1, 2, 3

Troubleshooting with truss

Once you learn how to use truss(1), you'll wonder how you ever solved any problems without it. truss watches a running program and lists the system calls it makes. Whenever I have a problem getting a program to run in Linux mode, I run it under truss and gather all sorts of details.

One drawback to truss is that it requires a FreeBSD-native procfs. While procfs is not part of the FreeBSD new world order, it is still required on rare occasions. I recommend adding an entry for /proc to /etc/fstab but marking it noauto so that it is not automatically mounted at boot. That way, you only have to remember to type mount /proc before running truss, instead of digging through the procfs(5) man page.

proc                /proc           procfs  rw,noauto       0       0

Once you have /proc mounted, run your Linux program under truss. This will generate a lot of output, so you might want to use script(1) to capture the output. Simply asking the version generates 308 lines of truss output to skim through for the error. The simplest thing to do is to search the truss output for directory. Near the end of the output are several lines like:

# truss pgp --version
linux_open("/home/mwlucas/.pgp/randseed.rnd",0x8002,00) ERR#2 'No such file or
linux_open("/home/mwlucas/.pgp/randseed.rnd",0x80c1,0600) ERR#2 'No such file
    or directory'
linux_open("/home/mwlucas/.pgp/randseed.rnd",0x8002,00) ERR#2 'No such file or

Aha! PGP Command Line can't open /home/mwlucas/.pgp directory, as the directory doesn't exist. Once I create a .pgp directory, I get:

# pgp --version
PGP Command Line 9.0.2 build 560
Copyright (C) 2005 PGP Corporation
All rights reserved.

A few more complicated tests show that the software runs exactly as documented in the PGP Command Line manual. While I'm not sure I could get official corporate support for this install, everything I've tried works perfectly. I get excellent results installing Linux programs on FreeBSD by configuring the environment properly, branding the software correctly, and using truss(1) to identify problems. Good luck!

Absolute OpenBSD

Related Reading

Absolute OpenBSD
UNIX for the Practical Paranoid
By Michael W. Lucas

Michael W. Lucas

Read more Big Scary Daemons columns.

Return to the BSD DevCenter.

Sponsored by: