I always wonder exactly what a precompiled package installs on my system, but this curiosity becomes vital when running programs in Linux mode. FreeBSD installs the smallest possible subset of Linux, but many programs expect to have a full Linux userland available, and these dependencies are not always recorded in the RPM file. You must confirm that the program has everything required and that your Linux environment is properly configured to support this software.
rpm(8) maintains a small database of installed packages and can tell you exactly what it installed, what files it contained, and which packages have which dependencies. Start by asking the RPM database for a list of all the installed packages. The list is in order by install date, so you want the very last entries.
# rpm --root /compat/linux --query -a glibc-2.3.2-27.9.7 glibc-common-2.3.2-27.9.7 ... libxml2-2.5.4-3.rh9 pgpcmdln-220.127.116.110-1 #
RPM knows PGP Command Line as
pgpcmdln-18.104.22.1680-1. Now ask for the contents of that package with
--query option. You might want to capture the output of this command, as you need it to finish configuring the software.
# rpm --root /compat/linux --query pgpcmdln -l /usr/bin/pgp /usr/bin/pgp-agent /usr/lib /usr/lib/debug ...
Configuring Software for Linux Mode
The two critical parts of installing a program to run under Linux mode are making sure that Linux's
ldconfig(8) knows about any included libraries and binary branding.
ldconfig(8) at boot time by reading /etc/ld.so.conf. PGP installs all of its libraries directly under /usr/lib, which is already listed. If this had changed, you would need to edit ld.so.conf and use Linux's
ldconfig(8) program to update the shared library cache, /compat/linux/etc/ld.so.cache.
Now you need to check the branding on the executables. Branding a library identifies the operating system it is built to run on. FreeBSD uses this brand to determine whether an executable is a native FreeBSD program or whether it must treat the program as a foreign program. PGP Command Line includes two binaries, /usr/compat/linux/usr/bin/pgp and /usr/compat/linux/usr/bin/pgp-agent. Branding might or might not be necessary for the proper operation of any given piece of software, but it's worth it to be careful. The
brandelf(1) program identifies the brand on a particular executable. PGP Command Line includes two executables, /usr/local/bin/pgp and /usr/local/bin/pgp-agent.
# cd /usr/compat/linux/usr/bin # brandelf pgp* File 'pgp' is of brand 'SVR4' (0). File 'pgp-agent' is of brand 'SVR4' (0). #
All programs run under Linux mode should have Linux brands. FreeBSD supports only SVR4, Linux, and native FreeBSD binaries, and will not let you assign unsupported brands to binaries. Use the
-t flag to assign a brand to a binary.
# sudo brandelf -t Linux pgp*
Finally, I want these binaries available in my regular
$PATH. Adding /compat/linux/usr/bin to
$PATH is not highly recommended, as you generally want to execute native versions of your programs or at least know that you're using Linux mode. This is easy with symlinks:
# sudo ln -s /usr/compat/linux/usr/bin/pgp /usr/local/bin/ # sudo ln -s /usr/compat/linux/usr/bin/pgp-agent /usr/local/bin/ # rehash
Once all this is done, you should be able to run the program:
# pgp --h /home/mwlucas:unknown (3078:could not create directory, Permission denied) #
Here's the good news: the program runs! The bad news is, it chokes on something. This error is listed in the PGP Command Line manual, but the description isn't exactly helpful. The trick here is to figure out what it wants to open.