Installation/OS Specific Notes/Installing Amanda on FreeBSD

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)
Revision as of 04:05, 3 April 2008 by Alticon-Brian (talk | contribs) (added troubleshooting section and details on installing 2.6.0 on FreeBSD 7.0)
Jump to navigationJump to search

Port history

To determine if there are issues that concern your situation in the Amanda ports available, check the port history at freshports.org:

Threading and -pthread

With the introduction of the glib dependency in version 2.6.0, Amanda uses threads. Versions of gcc before 4.0 have a peculiar way of linking threaded libraries on FreeBSD. Specifically, a shared library linked with -pthread does not include a DT_NEEDS section to automatically pull in the threading library, is it does on other systems. In the case of a regular C application, this isn't a problem -- the base executable should pull in the threading library, so that it's already present when the shared library is loaded. This freebsd-stable thread describes the situation in detail.

The problem, for Amanda, comes when loading Perl libraries. Perl itself is not (in most builds) threaded, and thus does not load a threading library. When an Amanda extension module such as Amanda::Device is loaded, perl loads libDevice.so and any dependencies it describes. On FreeBSD, that does not include a threading library, but does include libgthread-2.0.so, which also does not include a threading library in its dependencies. The result is unresolved symbol errors for threading-related symbols, because none of the shared objects in the chain (perl, libDevice, libgthread) took responsibility for pulling in a threading library.

The solution, then, is to explicitly link the perl extension modules to a threading library. Such linking can be accomplished with --with-perlextlibs. By default, on FreeBSDs before 7.0, Amanda adds -lpthread. This works for a "stock" FreeBSD system, but is unnecessary if gcc-4.x is in use, and may cause headaches if the system's threading library is not libpthread. As such, ports maintainers and those who have customized their systems should use --with-perlextlibs=-l{systemthreadinglib} or --without-perlextlibs.

An alternative solution is to build Amanda with gcc-4.x: install ports/lang/gcc42 and add CC=gcc42 to the configure invocation.

Note that mixing threading libraries may yet work, due to some clever use of "weak" symbol references in gthread. This is untested, and may link but lead to subtle bugs due to semantic incompatibilities.

Thanks to John E. Hein for his invaluable advice on this section, most of which is paraphrased from his emails.

Versions

FreeBSD 6.3

Installation from package tree

As of March 2008, the Amanda packages are not available from /pub/FreeBSD/releases/i386/6.3-RELEASE/packages/Latest on mirrors checked, so it is not possible to install Amanda using remote pkg_add:

sudo pkg_add -r amanda-server   # does not work 
sudo pkg_add -r amanda-client   # does not work 

Instead, it was necessary to download the packages manually prior to installation:

sudo pkg_add -r wget gtar 
mkdir ~/packages
cd ~/packages
wget 'ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.3-RELEASE/packages/misc/amanda-server-2.5.1p3_3,1.tbz'  
wget 'ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.3-RELEASE/packages/misc/amanda-client-2.5.1p3_1,1.tbz'
sudo pkg_add amanda-client-2.5.1p3_1,1.tbz  amanda-server-2.5.1p3_3,1.tbz

Gnuplot

If installing gnuplot with the command sudo pkg_add -r gnuplot the dependency on pdflib-7.0.2.tbz is not available from the package tree and pkg_add reports:

Error: FTP Unable to get 
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.3-release/All/pdflib-7.0.2.tbz: 
File unavailable

It can be built instead from /usr/ports/print/pdflib if you have the ports tree installed.

cd /usr/ports/print/pdflib 
sudo make install clean 

Installation locations

After installing Amanda, I found it useful to update the locate database in background.

sudo /etc/periodic/weekly/310.locate &
% locate amandad 
/usr/local/lib/libamandad-2.5.1p3.so
/usr/local/lib/libamandad.a
/usr/local/lib/libamandad.la
/usr/local/lib/libamandad.so
/usr/local/libexec/amanda/amandad

% locate amadmin 
/usr/local/man/man8/amadmin.8.gz
/usr/local/sbin/amadmin
/usr/local/share/amanda/amadmin.8.txt

% locate amanda.conf 
/usr/local/man/man5/amanda.conf.5.gz
/usr/local/share/amanda/amanda.conf.5.txt
/usr/local/share/examples/amanda/amanda.conf

The FreeBSD package does not create the directory /usr/local/etc/amanda/, but it does provide an example under /usr/local/share/examples/amanda/. Most command binaries are under /usr/local/sbin/, but many components are under /usr/local/libexec/amanda/.

Package origins

With the portupgrade package installed:

sudo pkg_add -r portupgrade 
sudo pkgdb -u   # force package database refresh 

one can query the origin of specific files installed:

% sudo pkg_which pkg_which
portupgrade-2.4.3_2,2
% sudo pkg_which amadmin
amanda-server-2.5.1p3_3,1
% sudo pkg_which /usr/local/libexec/amanda/amandad
amanda-client-2.5.1p3_1,1
% sudo pkg_which /usr/local/share/examples/amanda/amanda.conf
amanda-client-2.5.1p3_1,1

FreeBSD 5.1

Nicolas Ecarnot <[email protected]> discovered that for FreeBSD 5.1 (maybe earlier, and surely further), you have to set the net.inet.udp.maxdgram TCP/IP variable to 65535. The default is 9216, and this is a problem when trying to backup a large number of clients as indicated by errors in during amcheck or the estimate phase.

You can just run the command:

sysctl net.inet.udp.maxdgram=63535

but this won't last until the next reboot.

To make it permanent, just add this line:

net.inet.udp.maxdgram=65535

in the file /etc/sysctl.conf.

FreeBSD 4.9

Sep. 28th, 2004: Jason Miller <[email protected]> reported problems with setting up the AMANDA-client on FreeBSD 4.9. He wrote:

Due to the need for read permissions for AMANDA-client the default user and group for this on FreeBSD 4.9 is "operator:operator" which I found a write up on that as well. Just a note the port wanted to install it with these user permissions by default and I initially changed them to match my Redhat 9.0 install. So just doing a make distclean uninstall install AMANDA_SERVER=servername

fixed that for me. Then I just followed the below instructions and everything was good to go.

Refer to this link for more details: http://www.freebsd.org/cgi/query-pr.cgi?pr=59302.

FreeBSD 4.7

Found this in the amanda list archives. Was regarding FreeBSD 4.11, but worked on my 4.7.

Re: amanda 2.5.1 doesn't compile on FreeBSD 4.11 - atoll

Error:

.libs/amandad amandad.o ./.libs/libamandad.so
../common-src/.libs/libamanda.so -lm -lreadline -ltermcap -lcam
../common-src/.libs/libamanda.so: undefined reference to `atoll'
*** Error code 1
Stop in /usr/local/src/amanda/amandad-src.
*** Error code 1

Solution:

1.Edit ./common-src/amanda.h file and modify this line:
Old line:
 # define OFF_T_ATOI (off_t)atoll
New line:
 # define OFF_T_ATOI (off_t)atol
2. run autogen
3. run configure
4. run make
This issue will be fixed in 2.5.1p2 release and post-2.5.1 releases.

FreeBSD 3.0

chg-scsi was not updated to support the new camlib.h-dependent chio.h, so chg-scsi will be automatically disabled if camlib.h is found. You may use chg-chio instead.


Troubleshooting

Some users experience unpredictable behavior with amanda in the case of improper installation, both through ports, pkg_add, and source installs. Specifically, some users will find that running the various utilities (amlabel, amandad, etc) will result in errors such as the following:

 chown(/tmp/amanda/amandad/amandad.20080402210055.debug, 2, 5) failed. <Operation not permitted>

This is due to corrupted libraries causing amanda to dump core. The solution is to remove all of the files from both the server and client install (make uninstall in the case of an install from a source tarball or make uninstall in both /usr/ports/misc/amanda-client and /usr/ports/misc/amanda-server). Once all binaries & libraries have been removed, run a make clean and then re-run make all and make install.

In the case of installing amanda 2.6.0 on FreeBSD 7.0, make sure to set the user and group and configure time. If this is not done, the software will compile correctly but will fail without a detailed error message mid way through gmake install. Additionally, one must use gmake instead of the standard make (gmake ... instead of make ...) when installing from a source tarball.