{"id":28429,"library":"ubi-reader","title":"ubi-reader","description":"A Python library to extract files from UBI (Unsorted Block Images) and UBIFS (UBI File System) images. Supports UBI headers, volumes, and UBIFS nodes. Latest version 0.8.13 (requires Python >=3.10). Released about once every few months.","status":"active","version":"0.8.13","language":"python","source_language":"en","source_url":"https://github.com/jrspruitt/ubi_reader","tags":["UBI","UBIFS","filesystem","embedded","extraction"],"install":[{"cmd":"pip install ubi-reader","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Binary data parsing library used for UBI/UBIFS structures.","package":"construct","optional":false}],"imports":[{"note":"Package name uses underscore, not hyphen.","wrong":"from ubi_reader import UBI","symbol":"UBI","correct":"from ubireader import UBI"},{"note":"extract_files is a function in the ubifs submodule.","wrong":"from ubireader import extract_files","symbol":"extract_files","correct":"from ubireader.ubifs import extract_files"}],"quickstart":{"code":"from ubireader import UBI\nfrom ubireader.ubifs import extract_files\nfrom ubireader.ubifs.output import extract_common\n\nwith open('image.ubi', 'rb') as f:\n    ubi = UBI(f)\n    for volume in ubi.volumes:\n        if volume.type == 'UBIFS':\n            extract_files(volume, 'output_dir')","lang":"python","description":"Load a UBI image and extract UBIFS volume contents to a directory."},"warnings":[{"fix":"Pre-decompress the image if using other algorithms.","message":"The library does not handle UBI images with encryption or compression other than LZO (if supported by construct). Ensure image is raw or LZO compressed.","severity":"gotcha","affected_versions":"all"},{"fix":"Iterate over ubi.volumes and pass each volume of type 'UBIFS' to extract_files.","message":"extract_files expects a volume object, not the whole UBI object. Common mistake: passing the UBI object directly.","severity":"gotcha","affected_versions":"all"},{"fix":"Use extract_files from ubireader.ubifs for UBIFS volumes.","message":"The old API ubireader.UBI.extract_all() is deprecated in favor of per-volume extraction.","severity":"deprecated","affected_versions":"<0.8.0"},{"fix":"Use ubireader.ubifs only for UBIFS volumes inside UBI images.","message":"The library only reads UBI images, not UBIFS images directly. To handle a standalone UBIFS image, you must wrap it in a minimal UBI structure or use an alternative.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use: from ubireader import UBI","cause":"Incorrect import: using ubi-reader (hyphen) or importing wrong module.","error":"AttributeError: module 'ubireader' has no attribute 'UBI'"},{"fix":"call: extract_files(volume, 'output_dir')","cause":"extract_files requires an output path as second argument.","error":"TypeError: extract_files() missing 1 required positional argument: 'output_path'"},{"fix":"Verify image integrity (e.g., using mtd-utils ubiinfo).","cause":"Image may be corrupted or not a valid UBI image.","error":"Construct.core.ExplicitError: Error in parsing field ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}