Amanda-Users

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

2005-04-11 22:06:07
Subject: Re: Newbie: amlabel: could not load slot "current": changerfile must be specified in amanda.conf
From: "Jesus Salvo Jr." <jesus.salvo AT communicator.com DOT au>
To: amanda-users AT amanda DOT org
Date: Tue, 12 Apr 2005 12:01:13 +1000
I knew I should have posted more information ... anyway ...

On Monday 11 April 2005 23:57, Jon LaBadie wrote:
>
> You indicate that chg-zd-mtx is "working".  Just to be certain:
>
> Have you exercised the changer script by invoking it directly with all
> the possible commands including "current" (if that is a chg-zd-mtx cmd).

Yes. I went  through the chg-zd-mtx test:

bash-2.05$ pwd
/usr/local/etc/amanda/Daily
bash-2.05$ ../../../libexec/chg-zd-mtx -reset
1 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
2 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot current
2 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
3 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
4 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
5 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
6 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
7 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot next
1 /dev/rmt/1n
bash-2.05$ ../../../libexec/chg-zd-mtx -slot current
1 /dev/rmt/1n

Clearly, the chg-zd-mtx script works and is able to read the chg-zd-mtx.conf 
file in /usr/local/etc/amanda/Daily, based on the debug files in /etc/amanda.

For example:

bash-2.05$ pwd
/tmp/amanda
bash-2.05$ more chg-zd-mtx.20050412111424.debug
chg-zd-mtx: debug 1 pid 624 ruid 60008 euid 60008: start at Tue Apr 12 
11:14:24 2005
11:14:25 Using config file /usr/local/etc/amanda/Daily/chg-zd-mtx.conf
11:14:25 Arg info:
         $# = 2
         $0 = "../../../libexec/chg-zd-mtx"
         $1 = "-slot"
         $2 = "next"
11:14:25 Running: /usr/local/sbin/mtx status
11:14:25 Exit code: 0
         Stdout:

>
> Have you exercised the changer script by invoking it with amtape and
> all the possible commands including "current".

It was earlier complaining:

bash-2.05$ amtape Daily reset
amtape: could not load tapelist "/usr/local/etc/amanda/Daily/tapelist"

... and the amanda man page says:

TAPE MANAGEMENT
     The tapelist file contains the list of tapes in active  use.
     This file is maintained entirely by Amanda and should not be
     created or edited for normal operation.  It  contains  lines
     of the form:
<...>

After searching, it turns out that one has to create the tapelist file 
manually first, even though the document says:

     tapelist "string"
          Default:  tapelist.   The  file  name  for  the  active
          tapelist  file.  Amanda maintains this file with infor-
          mation about the active set of tapes.

Anyway, after creating an empty file tapelist in /usr/local/etc/amanda/Daily, 
I then run amtape again:

bash-2.05$ amtape Daily reset
amtape: could not reset changer: changerfile must be specified in amanda.conf

The debug output in /tmp/amanda says:

bash-2.05$ cat amtape.20050412112910.debug
amtape: debug 1 pid 1077 ruid 60008 euid 60008: start at Tue Apr 12 11:29:10 
2005
changer: got exit: 2 str: <none> changerfile must be specified in amanda.conf
amtape: could not reset changer: changerfile must be specified in amanda.conf
amtape: pid 1077 finish time Tue Apr 12 11:29:10 2005


So .. I now run amgetconf:

bash-2.05$ amgetconf Daily changerfile
/usr/local/etc/amanda/Daily/chg-zd-mtx

Of course, there is really no such file as that, since the script chg-zd-mtx 
says:

# All variables are in "changerfile".conf where "changerfile" is set
# in amanda.conf.  For example, if amanda.conf has:
#
#       changerfile="/etc/amanda/Dailyset1/CHANGER"
#
# the variables must be in "/etc/amanda/Dailyset1/CHANGER.conf".
#
# If "changerfile" is a relative path, it is relative to the directory
# that contains amanda.conf.  That also happens to be the directory Amanda
# makes current before running this script.

In fact, the chg-zd-mtx script will not work if the changerfile entry in 
amanda.conf is not valid / incorrect. In chg-zd-mtx script:

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


Here are the files in /usr/local/etc/amanda/Daily:

bash-2.05$ pwd
/usr/local/etc/amanda/Daily
bash-2.05$ ls -alt
total 56
drwxr-xr-x   2 amanda   backup       512 Apr 12 11:53 .
-rw-r--r--   1 amanda   backup         0 Apr 12 11:29 tapelist
-rw-r--r--   1 amanda   backup         2 Apr 12 11:20 chg-zd-mtx-slot
-rw-r--r--   1 amanda   backup         3 Apr 12 11:17 chg-zd-mtx-access
-rw-r--r--   1 amanda   backup      1170 Apr 12 10:57 chg-zd-mtx.conf
-rw-r--r--   1 amanda   backup     20311 Apr 11 15:30 amanda.conf
-rw-r--r--   1 amanda   backup         0 Apr 10 17:52 chg-zd-mtx-barcodes
-rw-r--r--   1 amanda   backup         2 Apr 10 17:52 chg-zd-mtx-clean
-rw-r--r--   1 amanda   backup       901 Apr 10 12:00 chg-scsi-solaris.conf
drwxr-xr-x   3 amanda   backup       512 Apr  8 19:00 ..


>
> As I recall you have to edit chg-zd-mtx.conf.  

I modified the example to match my environment. All the changes are what I 
intended it to be:

firstslot=1               #### First storage slot (element) -- required
lastslot=7                #### Last storage slot (element) -- required
cleanslot=-1               #### Slot with cleaner tape -- default is "-1"
                          #### Set negative to indicate no cleaner available
driveslot=0               #### Drive slot number.  Defaults to 0
                          #### Use the 'Data Transfer Element' you want
autoclean=0               #### Set to '1' or greater to enable

havereader=0              #### If you have a barcode reader, set to 1.

offline_before_unload=1   #### Does your robot require an
                          #### 'mt offline' before mtx unload?

poll_drive_ready=60        #### Time (seconds) between tests to see if
                          #### the tape drive has gone ready (default: 3).

max_drive_wait=180        #### Maximum time (seconds) to wait for the
                          #### tape drive to become ready (default: 120).

initial_poll_delay=70     #### initial delay after load before polling for
                          #### readiness


> Perhaps some inadvertant 
> editing change messed it up.  Try running the diff command on the original
> source and on your edited script and see if all the changes are those you
> intended.
>
> I only played a bit with chg-zd-mtx.  I use the more 'primitive' chg-mtx.
> But I see my chg-zd-mtx config file is executable.  Don't recall if it had
> to be, but you might check.
>
> Some have reported mysterious problems with chg-zd-mtx that disappeared
> when using a POSIX-compatible shell.  On solaris, /bin/sh is a true Bourne
> shell, not many of them around any more.  If the changer file has a #!
> first line, you might point it to a POSIX shell, bash, ksh, or on Solaris,
> /usr/xpg4/bin/sh (actually ksh with perhaps a few tiny mods).
>
> jl