pymobiledevice3 icon indicating copy to clipboard operation
pymobiledevice3 copied to clipboard

Backup creates an error after reaching 100%

Open BlueFalconHD opened this issue 8 months ago • 4 comments

Test environment

  • macOS 15 DB 1
  • iPhone 13 iOS 18 DB 1

Describe the bug When doing a full backup, an error occurs. The backup files are saved but something is off, see the additional context section

To Reproduce Steps to reproduce the behavior:

  1. Plug in the device
  2. Run pymobiledevice3 backup2 backup -v --color --full .
  3. Wait for the device to fully backup

Expected behavior The backup completes without any errors.

Logs

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/service_connection.py", line 120, in sendall
    self.socket.sendall(data)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/ssl.py", line 1211, in sendall
    v = self.send(byte_view[count:])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/ssl.py", line 1180, in send
    return self._sslobj.write(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2406)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/mobilebackup2.py", line 365, in device_link
    yield dl
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/mobilebackup2.py", line 91, in backup
    dl.dl_loop(progress_callback)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/device_link.py", line 62, in dl_loop
    self._dl_handlers[command](message)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/device_link.py", line 91, in download_files
    self.service.sendall(struct.pack(CODE_FORMAT, CODE_FILE_DATA) + data)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/service_connection.py", line 122, in sendall
    raise ConnectionTerminatedError from e
pymobiledevice3.exceptions.ConnectionTerminatedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/bin/pymobiledevice3", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/__main__.py", line 100, in main
    cli()
  File "/Users/hayes/.local/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hayes/.local/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/hayes/.local/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hayes/.local/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hayes/.local/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hayes/.local/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/cli/cli_common.py", line 147, in wrap_callback_calling
    callback(service_provider=service_provider, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/cli/backup.py", line 47, in backup
    backup_client.backup(full=full, backup_directory=backup_directory, progress_callback=update_bar)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/mobilebackup2.py", line 60, in backup
    with self.device_link(backup_directory) as dl, \
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/mobilebackup2.py", line 367, in device_link
    dl.disconnect()
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/services/device_link.py", line 191, in disconnect
    self.service.send_plist(['DLMessageDisconnect', '___EmptyParameterString___'])
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/service_connection.py", line 179, in send_plist
    return self.sendall(build_plist(d, endianity, fmt))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/site-packages/pymobiledevice3/service_connection.py", line 120, in sendall
    self.socket.sendall(data)
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/ssl.py", line 1211, in sendall
    v = self.send(byte_view[count:])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.12/ssl.py", line 1180, in send
    return self._sslobj.write(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLError: [SSL: BAD_LENGTH] bad length (_ssl.c:2406)

Additional context When trying to use a tool like https://github.com/matan1008/pyiosbackup with the backup that was saved and unbacking the contents of the backup, errors occur, saying something about paddding bytes or missing bytes.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

BlueFalconHD avatar Jun 19 '24 15:06 BlueFalconHD