Amanda-Users

Re: amrecover failures

2006-07-10 20:46:15
Subject: Re: amrecover failures
From: Frank Smith <fsmith AT hoovers DOT com>
To: Jerlique Bahn <jerlique AT webscene.com DOT au>
Date: Mon, 10 Jul 2006 19:39:14 -0500
Jerlique Bahn wrote:
>> Jerlique Bahn wrote:
>>>>> I have recently configured Amanda to backup our data.  I am now trying
>>>> to
>>>>> restore some of the data that I have backed up, and I am having
>> problems
>>>>> doing so.  The client and server are the same machine. I have chg-
>> manual
>>>>> configured so that the first and last slot are both 1. I am running
>>>>> amrecover as root. I am guessing that its because the changer think
>> that
>>>> it needs a different tape, but I cannot work out why.
>>>>> # ammt -f /dev/nsa0 status
>>>>> /dev/nsa0 status: ONLINE ds == 0x0001 er == 0x0000
>>>>>
>>>>> # amtape backup reset
>>>>> changer: got exit: 0 str: 1 /dev/nsa0
>>>>> amtape: changer is reset, slot 1 is loaded.
>>>>>
>>>>> ## this is from /tmp/Amanda/amidxtaped....
>>>>> Looking for tape backup-1...
>>>>> changer: got exit: 0 str: 0 1 1
>>>>> changer_query: changer return was 1 1
>>>>> changer_query: searchable = 0
>>>>> changer_find: looking for backup-1 changer is searchable = 0
>>>>> changer: got exit: 2 str: /usr/local/amanda/libexec/chg-manual: cannot
>>>>> create /dev/tty: Device not configured
>>>> I'm not very familiar with the chg-manual script, but as a wild guess
>>>> you might have the wrong console device specified for your OS.
>>> I don't think so, because the commands that are failing from within
>>> chg-manual work if I type them in eg:
>>>
>>> SRV# echo "insert tape into slot $1 and press return" >/dev/tty
>>> insert tape into slot  and press return
>>> SRV# read ANSWER </dev/tty
>>>
>>> SRV#
>>>
>>>>> amidxtaped: could not load slot /usr/local/amanda/libexec/chg-manual::
>>>>> cannot create /dev/tty: Device not configured
>>>>> amidxtaped: time 0.186: could not load slot
>>>>> /usr/local/amanda/libexec/chg-manual:: cannot create /dev/tty: Device
>>>> not
>>>>> configu
>>>>> red
>>>>> amidxtaped: time 0.186: pid 5948 finish time Mon Jul 10 23:01:39 2006
>>>>>
>>>>>
>>>>> ## This is from the changer.debug
>>>>> MT -> /usr/local/amanda/sbin/ammt -f
>>>>> DD -> /usr/local/amanda/sbin/amdd
>>>>> Args -> -slot next
>>>>>      -> rewind /dev/nsa0
>>>>> /dev/nsa0 rewind failed: Permission denied
>>>> Looks like this is your main problem, you don't have permissions to
>>>> the tape drive.  Odd, since you say you are running amrecover as
>>>> root.  Is the tape actually loaded in the drive?  Can you (from the
>>>> command line) run 'mt -f /dev/nsa0 rewind' successfully?
>>> I agree, however from the command line I have full access:
>> On poking around my installation, the changer scripts are all
>> owned by my Amanda user, not root.  Can you 'su -' to your Amanda
>> user and still run these commands?
> 
> Ahh very good point!! I've been running it as root, and this is what is in
> the Amanda.conf file but I compiled with user=backup.  In inetd I'm running
> the services as user root.
> 
> SRV# su backup -c "/usr/local/amanda/sbin/ammt -f /dev/nsa0 rewind"
> /dev/nsa0 rewind failed: Permission denied 
> 
> SRV# la /usr/local/amanda/sbin/ammt -rwxr-xr-x  1 backup  backup  14857 Jul
> 10 14:13 /usr/local/amanda/sbin/ammt 
> 
> SRV# la /usr/local/amanda/sbin/amdd -rwxr-xr-x  1 backup  backup  13153 Jul
> 10 14:13 /usr/local/amanda/sbin/amdd 
> 
> What do you think I should do?

Easiest fix is probably add your user 'backup' to whatever group has
write permissions to your tape drive.  I believe the docs recommend
making your backup user a member of whatever group owns the devices
on your OS to avoid problems such as this.  You may also run into
permissions problems on your backups as well.  The tar wrapper is
suid root so it won't care, but if you use dump it needs access to
the disk device and can fail on permissions.
   Not sure which fix I would recommend. If adding backup to the
group owning the tape device solves your problem, then go with that,
but if you foresee  future issues with dump (I'm assuming the backup
group doesn't own your disks) you might want to go through the pain
of changing backup's group and chgrp-ing all Amanda's files.

Frank
> 
> JB
> 


-- 
Frank Smith                                      fsmith AT hoovers DOT com
Sr. Systems Administrator                       Voice: 512-374-4673
Hoover's Online                                   Fax: 512-374-4501