Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: amrecover segmentation fault

  1. #1
    Join Date
    Jun 2011
    Posts
    7

    Default amrecover segmentation fault

    I'm new with amanda. I've just installed it on RHEL 6 x64 platform, using the rpm package on amanda's site (amanda-backup_server-3.2.3-1.rhel6.x86_64.rpm).
    A changer with LTO5 drives is connected to the amanda server.
    amdump and amfetchdump works fine.
    As shown below, amrecover (run on the server) generates a segmentation fault :
    AMRECOVER Version 3.2.3. Contacting server on localhost ...
    220 micocoulier AMANDA index server (3.2.3) ready.
    Setting restore date to today (2011-06-01)
    200 Working date set to 2011-06-01.
    200 Config set to vamos.
    200 Dump host set to micocoulier.supagro.inra.fr.
    Use the setdisk command to choose dump disk to recover
    amrecover> setdisk /etc
    200 Disk set to /etc.
    amrecover> add init.d
    Added file /init.d
    amrecover> extract

    Extracting files using tape drive robot on host localhost.
    The following tapes are needed: labMTP01

    Extracting files using tape drive robot on host localhost.
    Load tape labMTP01 now
    Continue [?/Y/n/s/d]?
    Erreur de segmentation (core dumped)


    The problem seems to occur in amidxtaped, there's no debug-amindexd option in the amanda-client.conf but the result is always the same with or without. Here's the amidxtaped.xxx.debug file :
    Wed Jun 1 15:51:15 2011: amidxtaped: pid 7885 ruid 501 euid 501 version 3.2.3: start at Wed Jun 1 15:51:15 2011
    Wed Jun 1 15:51:15 2011: amidxtaped: critical (fatal): TypeError in method 'debug', argument 1 of type 'char *'

    amidxtaped: TypeError in method 'debug', argument 1 of type 'char *'

    /usr/lib64/amanda/libamanda-3.2.3.so[0x3d95a27207]
    /lib64/libglib-2.0.so.0(g_logv+0x1b9)[0x3d94642ff9]
    /lib64/libglib-2.0.so.0(g_log+0x83)[0x3d94643413]
    /usr/local/share/perl5/auto/Amanda/MainLoop/libMainLoop.so(+0x4d1f)[0x7ff7e6d0dd1f]
    /lib64/libglib-2.0.so.0[0x3d9463961b]
    /lib64/libglib-2.0.so.0(g_main_context_dispatch+0x22e)[0x3d94638f0e]
    /lib64/libglib-2.0.so.0[0x3d9463c938]
    /lib64/libglib-2.0.so.0(g_main_loop_run+0x195)[0x3d9463cd55]
    /usr/local/share/perl5/auto/Amanda/MainLoop/libMainLoop.so(_wrap_run_c+0x75)[0x7ff7e6d0c085]
    /usr/lib64/perl5/CORE/libperl.so(Perl_pp_entersub+0x5a5)[0x3d93ea6805]
    /usr/lib64/perl5/CORE/libperl.so(Perl_runops_standard+0x16)[0x3d93ea4af6]
    /usr/lib64/perl5/CORE/libperl.so(perl_run+0x338)[0x3d93e4d078]
    /usr/bin/perl(main+0xec)[0x400cac]
    /lib64/libc.so.6(__libc_start_main+0xfd)[0x3d9361ec9d]
    /usr/bin/perl[0x400af9]


    Trying to debug a little more, I used strace and it worked (I mean amrecover works) but only if I used the -f (or -ff) option:
    strace -ff -tt -o amrecover-strace9.txt amrecover vamos
    AMRECOVER Version 3.2.3. Contacting server on localhost ...
    220 micocoulier AMANDA index server (3.2.3) ready.
    Setting restore date to today (2011-06-01)
    200 Working date set to 2011-06-01.
    200 Config set to vamos.
    200 Dump host set to micocoulier.supagro.inra.fr.
    Use the setdisk command to choose dump disk to recover
    amrecover> setdisk /etc
    200 Disk set to /etc.
    amrecover> add rc.d/init.d/ntpd
    Added file /rc.d/init.d/ntpd
    amrecover> extract

    Extracting files using tape drive robot on host localhost.
    The following tapes are needed: labMTP01

    Extracting files using tape drive robot on host localhost.
    Load tape labMTP01 now
    Continue [?/Y/n/s/d]?
    Restoring files into directory /var/log/amanda/server
    All existing files in /var/log/amanda/server can be deleted
    Continue [?/Y/n]?

    ./rc.d/init.d/ntpd
    amrecover> quit
    200 Good bye.


    The logs of strace didn't help me resolving the problem (but I'm not a specialist). Of course I can post them, if someone can help.
    Thanks

  2. #2
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    1,045

    Default

    Can you try to strace the amidxtaped, or attach a debugger to it.

    Add a sleep at the beginning of the program to allow you enough time to attach strace or gdb.

  3. #3
    Join Date
    Jun 2011
    Posts
    7

    Default

    Here's the result of a strace of amidxtaped.
    Thanks
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    1,045

    Default

    The only place it could fail is in amidxtaped line 797:
    debug("CTL << $chopped");

    But I don't know how it can fail.

  5. #5
    Join Date
    Jun 2011
    Posts
    7

    Default

    You're right, if I comment this line, it works.
    In fact, it's the content of the var $chopped that causes the segmentation fault.
    If I write 'debug("CTL")', there's no error.
    In order to have more information I replace debug(..) by these few lines :
    open(F, ">>/tmp/debug.txt");
    print F "$chopped";
    close(F);
    and I obtain this in debug.txt:
    FEATURES=ffffffff9efefbffffffffff01CONFIG=vamosLAB EL=labMTP01:1FSF=1HEADERDEVICE=robotHOST=^micocoul ier.supagro.inra.fr$DISK=^/etc$DATESTA
    MP=20110531132905ENDAVAIL-DATAPATH AMANDADATAPATH-OK

    It seems that the first line produces the segmentation fault, if I "don't debug" this line (if $chopped !~ /FEATURES/ { debug(CTL << $chopped); }), amrecover doesn't recover and sends : "Got no header and data from server, check in amidxtaped.*.debug and amandad.*.debug files on server".
    Don't know if it's normal or not . Is there anything I can do to debug a little more ?
    I test on another server in Debian 6 (amd64) and I obtain the same error.

  6. #6
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    1,045

    Default

    Which perl version are you using: perl --version

    We must what make it fail, try with various debug statements:
    debug("receiving: $chopped");
    debug("CTL received: $chopped");
    debug("receiving << $chopped");
    debug("CTL << $chopped" . "");
    my $m="CTL << $chopped"; debug($m);
    debug('CTL << ' . "$chopped");

  7. #7
    Join Date
    Jun 2011
    Posts
    7

    Default

    perl -v
    This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

    I try all the statements you proposed, none of them works.
    We can work with the debug line commented, but it would be interesting to know what cause the segmentation fault.
    Can we test something else ?
    Thanks

  8. #8
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    1,045

    Default

    Can you retry your code that print chopped to a file, but a want the hex of the string, to find if there is something strange in the string:
    open(F, ">>/tmp/debug.txt");
    my $hex_chopped = $chopped;
    $hex_chopped =~ s/(.)/sprintf("%x",ord($1))/eg;
    print F "$hex_chopped\n";
    close(F);

    Can you also try to use Amanda:ebug::debug instead of just debug.

    Can you verify that you do not have other version of amanda installed, they might conflict.

  9. #9
    Join Date
    Jun 2011
    Posts
    7

    Default

    There's no other version of amanda, we are starting with this one (3.2.3):
    amanda-backup_server-3.2.3-1.rhel6.x86_64

    I added Amanda:ebug::debug without better results.

    In order to make more readable I added :
    print F "$chopped\n$hex_chopped\n";
    the result is here :
    FEATURES=ffffffff9efefbffffffffff01
    46454154555245533d66666666666666663965666566626666 66666666666666663031
    CONFIG=vamos
    434f4e4649473d76616d6f73
    LABEL=000001L5:2
    4c4142454c3d3030303030314c353a32
    FSF=2
    4653463d32
    HEADER
    484541444552
    DEVICE=robot
    4445564943453d726f626f74
    HOST=^micocoulier.supagro.inra.fr$
    484f53543d5e6d69636f636f756c6965722e7375706167726f 2e696e72612e667224
    DISK=^/etc$
    4449534b3d5e2f65746324
    DATESTAMP=20110608131617
    444154455354414d503d3230313130363038313331363137
    END
    454e44
    AVAIL-DATAPATH AMANDA
    415641494c2d444154415041544820414d414e4441
    DATAPATH-OK
    44415441504154482d4f4b

  10. #10
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    1,045

    Default

    I think the bug is because $chopped is tainted.

    Replace the line:
    my $chopped = $line;
    by:
    my $chopped = ($line =~ /^(.*)$/g);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •