Menu

Segmentation fault in partclone with xfs filesystem

2014-12-05
2015-01-23
  • Steve Falco Imagine

    I am attempting to run clonezilla live 2.2.4-12 to clone a Centos 7 system. Here is the list of the partitions on the hard drive:

    [root@dt sbin]# df
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda2 1952047860 136193804 1815854056 7% /
    /dev/sda1 505580 118680 386900 24% /boot

    I got a segfault when using the clonezilla iso, which is hard to debug, so I decided to try booting the Centos 7 OS itself, and then manually cloning a partition. First I unmounted the /boot partition:

    [root@dt sbin]# umount /boot

    Next I tried running partclone.xfs under gdb. Unfortunately, there are no symbols in the executable, but here is what I did get:

    [root@dt sbin]# gdb ./partclone.xfs
    (no debugging symbols found)...done.
    (gdb) run -o ~/foo -s /dev/sda1 -c
    Starting program: /home2/sfalco/mnt/usr/sbin/./partclone.xfs -o ~/foo -s /dev/sda1 -c
    Partclone v0.2.73 http://partclone.org
    Starting to clone device (/dev/sda1) to image (/root/foo)
    Reading Super Block
    Calculating bitmap... Please wait...
    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000406aa3 in ?? ()
    (gdb) bt
    0 0x0000000000406aa3 in ?? ()
    1 0x00000000004078c5 in ?? ()
    2 0x0000000000401976 in ?? ()
    3 0x00000000004655f3 in ?? ()
    4 0x0000000000403089 in ?? ()
    5 0x00007fffffffe4b8 in ?? ()
    6 0x0000000000000000 in ?? ()
    (gdb) quit

    I'm not sure where to go from here. I would try compiling partclone with symbols, but it doesn't appear to be buildable on Centos 7:

    saf$ pwd
    /home/sfalco/partclone-0.2.74
    saf$ ./configure --enable-ncursesw --enable-xfs
    ... stuff omitted ...
    configure: checking for XFS Library and Header files ... ...
    checking xfs/libxfs.h usability... no
    checking xfs/libxfs.h presence... no
    checking for xfs/libxfs.h... no
    configure: error: *** XFS header (libxfs.h) not found

    Apparently, it is looking for a header file that it cannot find. I do have the development library for xfs installed:

    saf$ rpm -qa | grep xfs
    xfsprogs-3.2.0-0.10.alpha2.el7.x86_64
    xfsprogs-devel-3.2.0-0.10.alpha2.el7.x86_64

    And I do have xfs.h in /usr/include/xfs, but there is no file called libxfs.h

    saf$ ls /usr/include/xfs
    handle.h linux.h platform_defs.h xfs_fs.h xqm.h
    jdm.h platform_defs-x86_64.h xfs.h xfs_types.h

    Please advise me how I might proceed.

    Thanks,
    Steve
    
     
  • Kevin Mott

    Kevin Mott - 2014-12-05

    This might not be super helpful, but have you downloaded all your kernel headers through the kernel-devel package? You might still be missing some xfs libraries as well, but I'm not too sure, just download everything that sounds mildly important after running a yum search xfs. It could also be that the computer needs something out of /boot and you've unmounted it so it gets confused. You can't really reliably image partitions of a system while it's running, or at least, that's been my experience. If you really don't want to use clonezilla you can boot into a live ubuntu desktop usb or something and try partclone from there. Getting partclone to work on redhat based systems is a pain compared to debian anyway.

    If none of that works then I don't really know how to fix it. I'm currently working on imaging a Scientific Linux 7 machine with xfs partitions, which runs the same kernel as Centos 7 I believe, and I've been able to create and restore an image using clonezilla. I might have gotten something similar to this error early on, but my only suggestion would be to try using a live USB instead of a physical CD for clonezilla. Centos 7 and its analogues seem to not really play well with others from what I've experienced so far. With the switch to systemd and grub2 essentially nothing that applied to older kernels applies anymore, but online documentation is pretty scarce since Centos 7 hasn't even been out for a year.

    I hope any of this was helpful,

    Kevin

     
  • Steve Falco Imagine

    Thanks for the suggestions. I looked at the xfstools package more closely, and apparently the libxfs.h file is part of xfsprogs-qa-devel rather than xfsprogs-devel on Centos 7. The following comment is shown in the build script:

    xfsprogs-qa-devel contains headers needed to build the xfstests
    QA suite.

    You should install xfsprogs-qa-devel only if you are interested
    in building or running the xfstests QA suite.

    I'm not sure why partclone is using this header file, since it is not part of a QA suite, but I've installed that package, and will go back to trying to build partclone.

     
  • Steve Falco Imagine

    After a bit of hacking, I got partclone to build on Centos 7. Here is what happens when I run it:

    Partclone v0.2.74 http://partclone.org
    Starting to clone device (/dev/sda1) to image (/root/foo)
    note: 
    Reading Super Block
    Calculating bitmap... Please wait... 
    Program received signal SIGSEGV, Segmentation fault.
    set_bitmap (bitmap=bitmap@entry=0x6688b0, pos=pos@entry=18446744073709551615, 
        length=length@entry=1048576) at xfsclone.c:83
    83      xfsclone.c: No such file or directory.
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7_0.1.x86_64 libuuid-2.23.2-16.el7.x86_64 ncurses-libs-5.9-13.20130511.el7.x86_64
    (gdb) bt
    0  set_bitmap (bitmap=bitmap@entry=0x6688b0, 
       pos=pos@entry=18446744073709551615, length=length@entry=1048576)
       at xfsclone.c:83
    1  0x0000000000409935 in readbitmap (
       device=device@entry=0x7fffffffe7ad "/dev/sda1", image_hdr=..., 
       bitmap=bitmap@entry=0x6688b0, pui=pui@entry=0) at xfsclone.c:401
    2  0x0000000000403f26 in main (argc=<optimized out>, argv=<optimized out>)
        at main.c:263
    (gdb)
    

    I'm about out of time for today, but Monday I'll look at it further.

     
  • Steve Falco Imagine

    I added some printing to set_bitmap:

        pos_block   = pos/source_blocksize;
        block_count = length/source_blocksize;
    
        fprintf(stderr, "\ncount %d\n", block_count);
        for (block = pos_block; block < pos_block+block_count; block++){
            fprintf(stderr, "%d, mark block %lx pos %lx len %x\n", i++, block, pos, length);
        pc_set_bit(block, bitmap);
        log_mesg(3, 0, 0, fs_opt.debug, "block %i is used\n", block);
        }
    

    The attached file, yyy.gz, contains the output (it will uncompress to a file called zzz). The program runs for a while, finding various groups of blocks, but then winds up finding a group of 256 blocks where the first block is 0xfffffffffffff. At that point we get a segfault.

    I've run "xfs_repair -v /dev/sda1" on the filesystem, so I don't think it is corrupt. It certainly works fine when mounted.

    I don't know anything about the internals of xfs, so I don't think I can go much further on my own.

    Is anyone on the partclone team interested in working on this? The filesystem is fairly small, 500 megs or so. I could dd and gzip it and put it on an ftp server for analysis if anyone wants to take a look at it.

     
  • Steven Shiau

    Steven Shiau - 2014-12-19

    Is this issue reproducible on the latest Clonezilla live?
    i.e. 20141208-utopic or 2.3.1-18.

    I remember there was an update about partclone which addressed the xfs issue.

    Steven

     
  • Steve Falco Imagine

    Yes, it is reproducible on 2.3.1-18. I am not surprised because the fix you mentioned went in at 2.2.3-28 but I had already tested with 2.2.4-12.

    I have a filesystem image on an ftp server if you want to investigate. I can send you the access information via private email if you like.

     
  • Steven Shiau

    Steven Shiau - 2015-01-12

    Any difference for Clonezilla live >= 2.3.2-5?
    http://clonezilla.org/downloads.php
    It comes with Partclone 0.2.75 so the results might be different.

    Steven.

     
  • Steve Falco Imagine

    I just tried 2.3.2-7 and got the same error.

     
  • Thomas

    Thomas - 2015-01-14

    I just finish my scientificlinux 7 with xfs file system backup so I guess there are some detial and special different in yours.

    did you check your memory before clone? try memtest.

    or send me your file system dump and i can do more test for you.

    thank you.

     
  • Steve Falco Imagine

    I've sent you a message through sourceforge with the URL of the partition dump, along with my private email address.

    Thanks for looking at it.

     
  • Thomas

    Thomas - 2015-01-16

    I received your image and segfault happened. I also fixed this issue and release 0.2.76 and will be soon to clonezilla.

    thanky you for this bug report and your image is really helpful!

     
    • Steve Falco Imagine

      Excellent! Glad I could help, and thanks for partclone / clonezilla!

       
  • Steven Shiau

    Steven Shiau - 2015-01-17

    This updated Partclone will be used in the next testing Clonezilla live, which is scheduled to be uploaded next Tuesday.

    Steven.

     
  • Steve Falco Imagine

    Confirmed XFS working in clonezilla-live-2.3.2-8. Good Job!

     
  • Steven Shiau

    Steven Shiau - 2015-01-23

    Cool! Thanks for your confirmation.

    Steven.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.