Amanda on Cygwin HOWTO

by Doug Kingston, 30 January 2003.  Based on Cygwin 1.3.18, and Amanda 2.4.3-20021027 and some fixes which will be in the official release by the time you see this.

With thanks to Enrico Bernardini from whom I have borrowed some material from an earlier attempt at documenting the installation of Amanda on Cygwin in 2001.  Please send annotations and corrections to amanda-hackers@amanda.org. I can be reached as dpk (at) randomnotes.org (do the obvious).

1. Install Cygwin

The following Cygwin packages are required for binary installation (may be incomplete):

You need also these packages to build from source (may be incomplete):

I have most or the basic utilities and libraries installed so I cannot give you a more specific list of what is required.  If someone has a more definitive list, I would appreciate and email to amanda-hackers.

One user reported some problems with access rights when running under Cygwin, which he solved by setting the CYGWIN environment variable to nontsec.  I do not believe this is necessary if you run the amanda daemon as System (see below).

2. Other Preparation

When doing backups on a NT, Windows 2000 or Windows XP system, the choice of user and group will be important if you are to properly interact with the security mechanisms of these more modern Microsoft product.  For Windows 95/98/ME this is probably a non-issue.  The most privileged account on the Windows systems is 'System', and I have chosen to use this account for Amanda backups to ensure that I can access the widest set of files.  On Unix we would run as root, with equivalent access permissions.  I have also chose to run under the 'Administrators' group, another standard Windows group.  Ensure these exist before you continue - or identify another account to use.  The Cygwin installation postinstall script should have already populated /etc/passwd and /etc/group with these entries.
I used /home/root.  You'll need to put the .amandahosts file here later.  The relevant lines from my /etc/passwd file are:
SYSTEM:*:18:18:,S-1-5-18:/home/root:
root:*:18:18:,S-1-5-18:/home/root:

3. Compile Amanda

After installing Cygwin, unpack the Amanda sources, typically in /usr/src/amanda or something similar.  In the Amanda directory, you will need to execute:
automake  # this may not be necessary in the official release
autoconf  # this may not be necessary in the official release
 
./configure --without-server \
  --without-force-uid \
  --with-user=yourlogin \
  --with-group=Administrators
make
make       # yes, I needed to run it a second time
make install

The use of  your own login instead of SYSTEM requires some explanation.  If you were to call runconfigure with SYSTEM instead of your own login id as part of the -with-user parameter, the installation process will fail due to the way Cygwin and the NT/W2K/XP security system interact.  Once you chown a file to another user (like SYSTEM) you are no longer able to chgrp or chmod the file.  The installations process will abort at this point.  By installing the files owned by yourself, you will be able to chgrp and chmod them as expected.  Note that you still RUN as SYSTEM from inetd.conf (see below).

4. Configure Cygwin files

You have to modify some config files:

Comment out any entries you do not need by placing a '#' at the start of the lines.  This is just good practice, and if any of the entries reference non-existent users (e.g. uucp) inetd may not start up.

Then create the following AMANDA directories and the amandates file:
mkdir -p /usr/local/var/amanda/gnutar-lists

mkdir /tmp/amanda

touch /etc/amandates

5. Configure Windows system files

Update the Windows services list
where WINDIR is C:\WINNT\system32\drivers\etc or something similar.  The last two lines are needed if you want to use amrecover.

Ensure that the default Windows PATH environment variable include your Cygwin /bin directory.  This is necessary since inetd and hence the amandad that it spawns will not have the advantage of being started by the standard bash shell startup script and won't find the needed dynamic libraries (e.g. cygwin1.dll). My PATH is:

  %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\cygwin\bin


This is on XP; My Computer, right click - Properties, click on Environment Variables (at the bottom).  Yours may vary, but make sure the Cygwin bin directory is represented somewhere in the PATH.

6. Configure Inetd to run automatically as a service

If you want to test your installation, you can call inetd from bash prompt:

/usr/sbin/inetd -d

Windows 98/ME

Windows NT/2000/XP

From bash prompt, type:

 /usr/sbin/inetd --install-as-service
Then, to start/stop inetd service use the Services control panel or the following Windows command:
 net start/stop inetd

7. Notes on Amanda backup options

Compression
Currently, client side compression does not work, probably due to problems in pipe emulation in Cygwin.  I have not tried to debug this yet.  This may be addressed in a subsequent release, or it could be fixed in later releases of Cygwin.  Due to this issue, we recommend that if you want compressed dumps from Windows clients, you configure Amanda for server compression in amanda.conf on your Amanda server:

define dumptype srv-comp-tar {
    global
    comment "partitions dumped via tar with server compression"
    program "GNUTAR"
    compress server fast
    exclude list ".amanda.exclude"
}

Exclude Lists
A note on exclude lists is also in order.  If you specify a relative path, it will be expect ed that the file is in or relative to the root of the directory you are planning to dump.  Typically this will not be '/' but '/cygdrive/c' or something similar if you want to get the Windows files and the Cygwin files.  '/' is taken to be the root of the Cygwin tree, normally something like C:\cygwin or possibly C:\Program Files\cygwin.

Debugging Files
Amanda will leave debugging files in /tmp/amanda if it exists.  I have recommended creating the directory above.