0

I have already looked at these (and others):

disk I/O error with SQLite3 in Python 3 when writing to a database

Error: disk I/O error on a newly created database

Might be similar/related to SQLite disk I/O error (3850)

I am parsing an iOS full extraction image (about 61G) from zip file. The file is copied from the zip into a temp folder and is read from there. I do not create the database nor do anything else to it.

So running this code errors inside of VMware 16.2.1 using a Windows 10 Host and a Windows 10 virtual machine. If I run this directly on the host, it will work fine -- change "Z:\" to "D:\VM Shares" + the rest of the path.

import sqlite3

from pathlib import Path

>>> file_path = Path('Z:\\Forensics\\CTF21_Marsha_iPhoneX_FFS_Premium_2021_07_29\\xLEAPP_Reports_2021-11-23_Tuesday_115054\\temp\\filesystem2\\containers\\Shared\\SystemGroup\\30CCFC92-08E6-458A-B78B-DA920EF2EF82\\Library\\Database\\com.apple.MobileBluetooth.ledevices.other.db')
>>> db = sqlite3.connect(f'file:{file_path}?mode=ro', uri=True)
>>> cursor = db.cursor()
# The line below provides a method to check: Did I just open a sqliteDB? Errors if not 
# a sqliteDB. I have seen that you can basically open a text file through the connect()
# statement and get a cursor. So this just a check before other code would run.
>>> cursor.execute("PRAGMA page_count").fetchone()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
sqlite3.OperationalError: disk I/O error

Now, if I change the connect() statement to the following:

>>> db = sqlite3.connect(f'file:{file_path}?mode=ro&immutable=1', uri=True)

You can read about immutable object on SQL Uniform Resource Identifiers (section 3.3. This seems to work leading me to believe the DB is locked somehow.

I have reboot the virtual machine and rebooted the host. I did notice copying the DB in the same directly (sometimes) works but copying to another directly (even one higher) always works.

I thought it might be done to the length of the path name. I've tried added "\?", "\\?\", or other variations for the longer paths but this does not work. The path length is under 256 anyway.

This is related to xLEAPP with the problematic code located in abstract.py.

Added a issue on Github for it - xleapp#5

flamusdiu
  • 1,722
  • 2
  • 14
  • 31

0 Answers0