Amanda-Users

Re: Newbie: amlabel: could not load slot "current": changerfile must be specified in amanda.conf

2005-04-12 08:51:17
Subject: Re: Newbie: amlabel: could not load slot "current": changerfile must be specified in amanda.conf
From: Jon LaBadie <jon AT jgcomp DOT com>
To: amanda-users AT amanda DOT org
Date: Tue, 12 Apr 2005 08:37:39 -0400
On Tue, Apr 12, 2005 at 01:19:52PM +1000, Jesus Salvo Jr. wrote:
> On Tuesday 12 April 2005 13:07, Jesus Salvo Jr. wrote:
> > I think I know what the problem maybe, though I do not know the solution:
> >
> > The test that I did with chg-zd-mtx works only if I run it in
> > the /usr/local/etc/amanda/Daily directory.
> >
> > If I do it anywhere else, I get the exact same error as amtape does:
> >
> > bash-2.05$ pwd
> > /export/home/amanda
> > bash-2.05$ /usr/local/libexec/chg-zd-mtx -reset
> > <none> changerfile must be specified in amanda.conf
> >
> > bash-2.05$ set | grep PATH
> > LD_LIBRARY_PATH=:/usr/local/lib
> > MANPATH=:/usr/local/man
> > PATH=/usr/bin::/usr/local/bin:/usr/local/sbin:/usr/local/libexec
> >
> > Based on changer.c, amtape simply exec / calls chg-zd-mtx, so the error is
> > the same.
> >
> > What must I do so that chg-zd-mtx will work from any directory ?
> > I must have missed a very simple step.
> >
> 
> More info:
> 
> I changed chg-zd-mtx so that I added an echo line just before it calls 
> amgetconf:
> 
> echo "amgetconf$SUF changerfile"
> changerfile=`amgetconf$SUF changerfile 2>/dev/null | grep -v BUGGY`
> if [ -z "$changerfile" ]; then
>         Exit 2 \
>              "<none>" \
>              "changerfile must be specified in amanda.conf"
> fi
> 
> ... and here is the output:
> 
> bash-2.05$ /usr/local/libexec/chg-zd-mtx -reset
> amgetconf changerfile
> <none> changerfile must be specified in amanda.conf
> 
> So chg-zd-mtx script does not pass the <config> parameter to any of the am* 
> executables, including amgetconf. Thus, amgetconf called from within 
> chg-zd-mtx only works from within the directory containing the amanda.conf 
> file.
> 
> Anyway to resolve this without modifying the changer script ?
> 


Interesting.

An aside, as I understand it, changer scripts generally don't work
from any directory except the config directory.  I don't think they
are passed the config name, so chg-zd-mtx assumes it is in the config
directory and the directory name is the same as the config name.  The
code doing that seems to be:

   314  config=`pwd 2>/dev/null`
   315  config=`expr "$config" : '.*/\(.*\)'`

So your early observation on this point is "as expected".

For amgetconf the config argument is optional.  If given, it uses the
appropriate amanda.conf, but if not given, it uses the amanda.conf in
the current directory.  So the behavior of chg-zd-mtx in not giving
the config name is understandable, it expects to be run from the
config directory and amgetconf does not need the config name then.

That leads me to question from what directory is chg-zd-mtx being executed
when run by amtape or amcheck?  Perhaps a few debugging statements to report
the current directory in the script would be informative.

Alternatively, on Solaris, there are the "proc" command (in /usr/proc/bin on
Solaris 8 and 9) and the /proc file system.  Using either you could interogate
the running commands to determine the current directories of amtape and its
child processes.  Perhaps using pstop to pause them if they are too fast.


BTW you gave a thorough answer to lots of my questions earlier.  But stopped
at the last couple of paragraphs.  One thing I'd like to hear is whether a
POSIX shell, probably /bin/ksh on your Solaris, sees to work around the problem
It has for others though the reason has not been determined.  Change #!/bin/sh
to #!/bin/ksh at line 1.

jl
-- 
Jon H. LaBadie                  jon AT jgcomp DOT com
 JG Computing
 4455 Province Line Road        (609) 252-0159
 Princeton, NJ  08540-4322      (609) 683-7220 (fax)