#180 ✓resolved
Wael Nasreddine

Can't backup iPhone4

Reported by Wael Nasreddine | November 15th, 2010 @ 03:40 PM | in 1.2.0 Release

Hello,

I'm trying to backup my iphone4 iOS 4.1, on Ubuntu 10.10 using:

  • libimobiledevice1 1.0.3-1ubuntu1~maverick1
  • libimobiledevice-utils 1.0.3-1ubuntu1~maverick1

But the backup doesn't even start (The iPhone is paired)

the debug log is attached

$ idevicebackup backup /home/wael/iPhone/Backup Backup directory is "/home/wael/iPhone/Backup"
Started "com.apple.mobilebackup" service on port 53271.
Reading Info.plist from backup.
Starting backup...
Reading existing Manifest.
Could not read Manifest.plist, switching to full backup mode.
Creating Info.plist for new backup.
Requesting backup from device...
ERROR: Could not start backup process: device refused to start the backup process.

Comments and changes to this ticket

  • Wael Nasreddine

    Wael Nasreddine November 15th, 2010 @ 03:46 PM

    I just tried with my GF's iPhone 3GS, the exact same error happened...

  • Nikias Bassen

    Nikias Bassen November 20th, 2010 @ 12:48 PM

    • State changed from “new” to “open”
    • Milestone set to 1.2.0 Release
    • Milestone order changed from “190890” to “0”

    Hi, the reason for this to fail is that iOS 4.x has a new backup protocol. The implementation is WIP and can be found here http://cgit.sukimashita.com/libimobiledevice.git/log/?h=mobilebackup2
    It will be merged into master as soon as we complete the restore support and integrate it in idevicebackup.

    Regards
    Nikias

  • Wael Nasreddine

    Wael Nasreddine November 20th, 2010 @ 01:06 PM

    Hi,

    Thank you for your reply, can you give us an ETA? (No need to be precise but in a month? two? a year?) Just to get an idea of how much work you're going to do..

    Thank you.

  • Nikias Bassen

    Nikias Bassen November 20th, 2010 @ 04:39 PM

    I would say in about a month we should finally have this working.

  • hilbert

    hilbert January 8th, 2011 @ 02:27 PM

    I have exactly the same issue here with iPhone 3GS and fw 4.1

    libimobiledevice 1.0.4

    Not to harry you up, but do you have an ETA for the merging?

    Thanks for all your work...

  • hilbert

    hilbert January 8th, 2011 @ 03:11 PM

    One more thing. I've just tried the mobilebackup2 branch and the backup is working. Dunno about the restore.

  • Nikias Bassen

    Nikias Bassen January 8th, 2011 @ 03:53 PM

    hilbert, I just updated the mobilebackup2 branch, and restore is now working too. You need to use the idevicebackup4 tool for that.
    We now have to put things together so that we have a general idevicebackup utility. Should take a two or three weeks to merge things together.

  • hilbert

    hilbert January 8th, 2011 @ 03:57 PM

    great! great!! great!!! Let me enjoy the latest snapshot then... Do you mind dropping a line here when the final merge will be ready?

  • Nikias Bassen

    Nikias Bassen January 8th, 2011 @ 04:04 PM

    Yes, the ticket will be set to resolved when it's done.

  • hilbert

    hilbert January 9th, 2011 @ 08:14 PM

    While trying to do a restore I got the following error:

    toto@toto-VirtualBox:~/test$ bin/idevicebackup4 restore /home/toto/Documents/iphone-backup
    Backup directory is "/home/toto/Documents/iphone-backup"
    Started "com.apple.mobilebackup2" service on port 57210.
    Reading Info.plist from backup.
    Starting Restore...
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Status.plist': (189 bytes)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.plist': (15.0 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.mbdb': (493.9 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.mbdx': (110.1 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Info.plist': (22.7 KB)
    Copying 'bbe847655d3602e71d3325ad0163b76e626aea0d' to 'bbe847655d3602e71d3325ad0163b76e626aea0d-20110109-210930', please wait (TODO: implemented)
    Error opening '/home/toto/Documents/iphone-backup/bbe847655d3602e71d3325ad0163b76e626aea0d-20110109-210930/Info.plist' for writing: No such file or directory
    Segmentation fault

    Is it normal?

  • Nikias Bassen

    Nikias Bassen January 9th, 2011 @ 08:24 PM

    Well, this one:

    Error opening '/home/toto/Documents/iphone-backup/bbe847655d3602e71d3325ad0163b76e626aea0d-20110109-210930/Info.plist' for writing: No such file or directory

    is expected, since the copying from uuid to uuid-date-time folder is not yet implemented (see line above).

    However the segmentation fault is unexpected. If you can reproduce this, it would be helpful if you could run idevicebackup4 with gdb to see where it crashes.

    gdb idevicebackup4
    

    inside gdb:

    run restore /home/toto/Documents/iphone-backup
    

    if it stops, you can type "bt" (without quotes) and paste the resulting lines here.

  • hilbert

    hilbert January 9th, 2011 @ 09:00 PM

    Now, unfortunately I can't because the iPhone is with my wife and no more in front of the computer. I have only one concern. When it seg-fault'ed, the iPhone was switching off completely. Is it safe to redo-it? I wouldn't like to brick my wife jewel...

    If, in your opinion, it is safe... then I'll for sure try to debug it and send you the output.

  • Nikias Bassen

    Nikias Bassen January 9th, 2011 @ 10:01 PM

    Well, I can't promise it will be safe. However if the device reboots during restore it would only write back the files that were transferred correctly so I don't expect any damage. It's up to you :) but if there's still a bug we will find it ourselves during testing.

  • hilbert

    hilbert January 10th, 2011 @ 06:10 PM

    Ok I've tried to repeat the restore with the gdb and this is the output:

    (gdb) run restore /home/toto/Documents/iphone-backup
    Starting program: /home/toto/test/bin/idevicebackup4 restore /home/toto/Documents/iphone-backup
    [Thread debugging using libthread_db enabled]
    Backup directory is "/home/toto/Documents/iphone-backup"
    [New Thread 0xb7fe9b70 (LWP 1746)]
    Started "com.apple.mobilebackup2" service on port 51465.
    Reading Info.plist from backup.
    Starting Restore...
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Status.plist': (189 bytes)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.plist': (15.0 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.mbdb': (493.9 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.mbdx': (110.1 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Info.plist': (22.7 KB)
    Copying 'bbe847655d3602e71d3325ad0163b76e626aea0d' to 'bbe847655d3602e71d3325ad0163b76e626aea0d-20110110-190800', please wait (TODO: implemented)
    Error opening '/home/toto/Documents/iphone-backup/bbe847655d3602e71d3325ad0163b76e626aea0d-20110110-190800/Info.plist' for writing: No such file or directory
    
    Program received signal SIGSEGV, Segmentation fault.
    0x0804a8bc in handle_receive_files (message=<value optimized out>, 
        backup_dir=<value optimized out>) at idevicebackup4.c:1051
    1051            fname[r] = 0;
    (gdb) bt
    #0  0x0804a8bc in handle_receive_files (message=<value optimized out>, 
        backup_dir=<value optimized out>) at idevicebackup4.c:1051
    #1  0x0804bb55 in main (argc=3, argv=0xbffff454) at idevicebackup4.c:1645
    

    I hope it is useful.

    cheers,

  • Nikias Bassen

    Nikias Bassen January 10th, 2011 @ 08:01 PM

    Hi,

    thanks for the feedback. Now we know where to start; we need to check for more error conditions.

  • Nikias Bassen

    Nikias Bassen January 11th, 2011 @ 04:24 AM

    Ok I added more error checking to the appropriate function. You can try if it works now. If not, gdb is your friend.
    Remember to do a fresh backup before messing up the device.

  • hilbert

    hilbert January 11th, 2011 @ 11:08 PM

    No luck again. But looking at the output of gdb I think we are pretty close to the solution now. Here it is:

    toto@toto-VirtualBox:~/test$ gdb bin/idevicebackup4
    GNU gdb (GDB) 7.2-ubuntu
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-linux-gnu".
    For bug reporting instructions, please see:
    http://www.gnu.org/software/gdb/bugs/...
    Reading symbols from /home/toto/test/bin/idevicebackup4...done.
    (gdb) run restore /home/toto/Documents/new_bck Starting program: /home/toto/test/bin/idevicebackup4 restore /home/toto/Documents/new_bck
    [Thread debugging using libthread_db enabled] Backup directory is "/home/toto/Documents/new_bck"
    [New Thread 0xb7fe8b70 (LWP 5213)] Started "com.apple.mobilebackup2" service on port 49177.
    Reading Info.plist from backup.
    Starting Restore...
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Status.plist': (189 bytes)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.plist': (15.2 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.mbdb': (508.2 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Manifest.mbdx': (113.0 KB)
    Sending file 'bbe847655d3602e71d3325ad0163b76e626aea0d/Info.plist': (22.7 KB)
    Copying 'bbe847655d3602e71d3325ad0163b76e626aea0d' to 'bbe847655d3602e71d3325ad0163b76e626aea0d-20110112-000549', please wait (TODO: implemented)
    Error opening '/home/toto/Documents/new_bck/bbe847655d3602e71d3325ad0163b76e626aea0d-20110112-000549/Info.plist' for writing: No such file or directory
    ERROR: mb2_handle_receive_files: too long device filename (1651534953)!
    trashing padding

    Program received signal SIGSEGV, Segmentation fault.
    0x0804ae92 in fprintf (message=, backup_dir=) at /usr/include/bits/stdio2.h:98
    98 return fprintf_chk (stream, USE_FORTIFY_LEVEL - 1, fmt,
    (gdb) bt #0 0x0804ae92 in fprintf (message=, backup_dir=) at /usr/include/bits/stdio2.h:98 #1 debug_buf (message=, backup_dir=) at idevicebackup4.c:99 #2 mb2_handle_receive_files (message=, backup_dir=) at idevicebackup4.c:876 #3 0x0804bc54 in main (argc=3, argv=0xbffff454) at idevicebackup4.c:1352 (gdb)

  • Nikias Bassen

    Nikias Bassen January 12th, 2011 @ 07:37 PM

    Hi,

    many thanks for the debugging output. The problem lies here:

    ERROR: mb2_handle_receive_files: too long device filename (1651534953)!
    
    the size 1651534953 in hex is 62706c69 which is the start of a plist document. '<pli'.
    So there seems to be a communication error as an xml plist is totally unexpected here.
    I need to think of why this is happening. I'll let you know when there's new code for testing ;)
  • hilbert

    hilbert January 12th, 2011 @ 08:54 PM

    many thanks to you for all your efforts in doing such a nice job!

  • hilbert

    hilbert January 13th, 2011 @ 09:28 PM

    There is an additional problem.

    I'm trying to compile the mobilebackup2 branch on Fedora 13 and I got an error (undefined GStatBuf in tools/idevicebackup4.c). Indeed GStatBuf is not defined in glib/gstdio.h (version 2.24), but only in later one as 2.26 that is the installed with Ubuntu.

    I've made an horrible patch by hand to gstdio.h and it compiles, but we should avoid this for the release.

  • Martin S.

    Martin S. January 17th, 2011 @ 03:42 PM

    @hilbert: Simply replace the "GStatBuf" occurrence in the sources with "struct stat" and it compiles. This is going to be fixed in a release and probably better than modifing the glib header. ;)

  • juju42

    juju42 March 31st, 2011 @ 05:48 AM

    Hello,

    I'm using ubuntu 10.10 with libimobiledevice 1.0.7.
    As I have a problem with wifi on my iphone 3G w 4.1.2, I want to switch to 1.1.0 to make a full backup of the iphone before resetting it.

    I download package source for next ubuntu release (https://launchpad.net/ubuntu/+source/libimobiledevice/1.1.0-1) and build the packages with dpkg-buildpackage. It installed ok whereas 1.0.x is still installed but I don't know how to switch apps to 1.1.0
    uninstall 1.0 or adding env var ?
    local path makes 1.1 default but ...

    For now, I tried to make a backup but with same result than 1.0.x

    $ time idevicebackup -d backup 20110331-idevicebackup Backup directory is "20110331-idevicebackup"
    Started "com.apple.mobilebackup" service on port 49329.
    Reading Info.plist from backup.
    Starting backup...
    Reading existing Manifest.
    Could not read Manifest.plist, switching to full backup mode.
    Creating Info.plist for new backup.
    Requesting backup from device...
    ERROR: Could not start backup process: device refused to start the backup process.

    • ideviceinfo-20110331.log

    Any help ?

    Thanks

  • Martin S.

    Martin S. March 31st, 2011 @ 10:18 AM

    @juju42: idevicebackup only works for iOS 3.x devices. For backup or restore of iOS 4.x devices you have to use idevicebackup4 from the similar named git branch. idevicebackup4 will be available in the next stable 1.2.0 release and is still WIP.

  • juju42

    juju42 March 31st, 2011 @ 01:30 PM

    Thanks for the reply Martin.

    was hoping 1.1.0/unstable contain this branch. so tried 1.2.0

    $ git clone -b mobilebackup2 git://git.sukimashita.com/libimobiledevice.git $ ./autogen.sh --prefix=/usr/local --enable-dev-tools && make $ sudo make install $ sudo dpkg -r --ignore-depends libimobiledevice2 libimobiledevice-utils libimobiledevice-dev libimobiledevice-doc $ sudo dpkg --ignore-depends=libimobiledevice1 -r libimobiledevice1

    after, idevicebackup4 seems to work with some error message:
    plenty of "Received an error message from device: Input/output error (5)"
    and some "Device is not ready yet. Going to try again in 2 seconds..."

    thanks for your work.
    do you need some logs about above errors ?
    Else, is restore command stable enough for use ?

  • Martin S.

    Martin S. March 31st, 2011 @ 02:29 PM

    The errors are infact not really problematic and they come from the device. They are basically output because idevicebackup4 is in "development". Thanks but no need for logs, we can debug this ourselfs so far.

    Yes, restore mode works as we try that no commit breaks runtime functionality.
    However, the thing with the restore is, that even if the it might fail inbetween for whatever reason, it is rather safe to try as it only restores the files that were "correctly" transmitted to the device, then reboots the system.

  • Piotr Wlodarczyk

    Piotr Wlodarczyk April 11th, 2011 @ 03:00 PM

    I have this with iPad 4.3.1:

    idevicebackup4 backup /media/usb0/ipad_backup1

    Backup directory is "/media/usb0/ipad_backup1"
    Started "com.apple.mobilebackup2" service on port 49852.
    Could not perform backup protocol version exchange, error code -5

    (I got libimobiledevice today by git clone -b mobilebackup2 git://git.sukimashita.com/libimobiledevice.git)

  • Martin S.

    Martin S. April 11th, 2011 @ 05:57 PM

    @Piotr: The branch is a bit outdated and might fail with iOS 4.3+. I rebased it now on master which contains some important iOS 4.3 fixes. Please try again, for me it is working again on an iPad 4.3.1 just fine. You'll also have to force pull since I rebased the branch.

  • Martin S.

    Martin S. April 28th, 2011 @ 07:10 PM

    • State changed from “open” to “resolved”

    Support for the new iOS 4+ backup protocol is ready and merged into git master and available in libimobiledevice 1.1.1.
    Both backup and restore operations are fully supported alongside a few other new operations using the new "idevicebackup2" tool.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A project around supporting the iPhone in Linux.

See http://libimobiledevice.org

Referenced by

Pages