Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created May 14, 2022 21:04
Show Gist options
  • Save bnoordhuis/15da15addf4b0c55e74858698b49c632 to your computer and use it in GitHub Desktop.
Save bnoordhuis/15da15addf4b0c55e74858698b49c632 to your computer and use it in GitHub Desktop.
How to fix: unable to install (supposed) new info file /var/lib/dpkg/tmp.ci: Operation not permitted

A system crash at an inopportune time left my file system in a corrupted state. Fixing it up with fsck(1) worked just fine but made a subsequent system upgrade fail with an unusual error:

dpkg: error processing /var/cache/apt/archives/libfoo-1.2.3_amd64.deb (--unpack):
unable to install (supposed) new info file `/var/lib/dpkg/tmp.ci/symbols': Operation not permitted

The directory /var/lib/dpkg/tmp.ci did not exist. Creating it manually and re-running the upgrade failed exactly the same way (and removed the directory again.)

Internet searches didn't turn up useful answers. People have been running into this error since at least 1998 but no solutions were presented except reformat and reinstall.

strace(1) showed that dpkg(1) errored when it tried to access a file called /var/lib/dpkg/info/libfoo-1.2.3:amd64.symbols. The file was there but had the telltale signs of file system corruption:

  1. Bogus group ID
  2. Bogus file attributes printed by lsattr(1)
  3. rm, mv, chown, chattr, etc. all failed with "Operation not permitted", even as root
  4. stat(1) printed the inode but debugfs(8) insisted no such inode existed

Since I couldn't delete or move the file, I solved my problem as follows:

  1. Move /var/lib/dpkg/info out of the way, then recreate it with mkdir(1)
  2. Copy all files except the problematic one back to /var/lib/dpkg/info
  3. Run apt --fix-broken install
  4. Resume the upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment