Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 919857 - corrupt sqlite dep cache wedges portage with no recovery explanation
Summary: corrupt sqlite dep cache wedges portage with no recovery explanation
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-13 23:58 UTC by SpanKY
Modified: 2023-12-13 23:58 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2023-12-13 23:58:20 UTC
i think portage was modifying the cache when the system rebooted, but now the corrupt cache has wedged it, and portage doesn't automatically recover, nor does it even say what file is the problem.

it really should just ignore/delete invalid caches in cases like this with a warning.

$ emerge --version
Portage 3.0.56 (python 3.10.13-final-0, default/linux/amd64/17.1/developer, gcc-13, glibc-2.38-r7, 6.6.3 x86_64)
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/portage/cache/sqlite.py", line 129, in _db_init_connection
    self._db_init_cache_size(config["cache_bytes"])
  File "/usr/lib/python3.10/site-packages/portage/cache/sqlite.py", line 240, in _db_init_cache_size
    cursor.execute("PRAGMA cache_size = %d" % cache_size)
sqlite3.DatabaseError: database disk image is malformed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.10/emerge", line 57, in main
    retval = emerge_main()
  File "/usr/lib/python3.10/site-packages/_emerge/main.py", line 1314, in emerge_main
    x["porttree"].dbapi.close_caches()
  File "/usr/lib/python3.10/site-packages/portage/dbapi/porttree.py", line 426, in close_caches
    self.auxdb[x].sync()
  File "/usr/lib/python3.10/site-packages/portage/cache/template.py", line 188, in sync
    self.commit()
  File "/usr/lib/python3.10/site-packages/portage/cache/sqlite.py", line 326, in commit
    self._db_connection.commit()
  File "/usr/lib/python3.10/site-packages/portage/cache/sqlite.py", line 102, in _db_connection
    self._db_init_connection()
  File "/usr/lib/python3.10/site-packages/portage/cache/sqlite.py", line 133, in _db_init_connection
    raise cache_errors.InitializationError(self.__class__, e)
portage.cache.cache_errors.InitializationError: Creation of instance <class 'portage.cache.sqlite.database'> failed due to database disk image is malformed

after clearing with `rm -rf /var/cache/edb/dep/*`, emerge --version works again.  i could recreate the error with:
  find /var/cache/edb/dep/ -type f -name '*.sqlite' -exec truncate -s1600 {} +