How should I recreate /var/lib/dpkg/info/* ?

Halvor Raknes

Member
Joined
Apr 19, 2021
Messages
153
Reaction score
15
Credits
1,215
I accidentally deleted /var/lib/dpkg/info/* on Linux Mint 22.1 (Ubuntu 24.04). I have since run apt --fix-broken install, and sudo apt check now reports no problems. However, dpkg --audit reports that almost all installed packages are "missing the list control file in the database, they need to be reinstalled". There are about 2863 installed packages but only 77 .list files remain in /var/lib/dpkg/info. What is the recommended way to regenerate the missing .list files? Is apt reinstall $(dpkg-query ...) the right approach, or is there a better/safer method?
 


Do you have Timeshift snapshots ?

If you do, simply Restore to a snapshot taken prior to the /var/lib/dpkg/info/* deletion
 
What happens when you run an "apt update" on the system, I would think that would re-populate itself as it's only info of package information?
 
What happens when you run an "apt update" on the system, I would think that would re-populate itself as it's only info of package information?
I haven't tried that yet. I've been going up until now with the help from LLMs. First DeepSeek got me into this trouble, now I've been getting help from ChatGPT. It actually recommended I get som advice from real people on this part of the repair rather than simply following its advice…
 
I haven't tried that yet. I've been going up until now with the help from LLMs. First DeepSeek got me into this trouble, now I've been getting help from ChatGPT. It actually recommended I get som advice from real people on this part of the repair rather than simply following its advice…
Can you try running "apt update" and "apt upgrade" from the command-line and see if those run correctly without errors?
 
I followed your suggestion and ran sudo apt upgrade.

The results were encouraging:
  • Before the upgrade I had only 77 .list files in /var/lib/dpkg/info/.
  • After the upgrade I now have 585 .list files, so many package metadata files have been regenerated.
  • sudo apt check now reports no dependency problems.
However, dpkg --audit still reports that many packages are missing their .list files, and sudo dpkg --configure -a fails on these packages:
  • openssh-server
  • rsyslog
  • samba-common
  • smbclient
  • samba-common-bin
The first three all fail with:

installed <package> package post-installation script subprocess returned error exit status 10

The corresponding postinst scripts are present, and openssh-server.postinst ends with exit 0, so the failure appears to come from a command executed within the script rather than an explicit exit 10.

Does this give you any idea what the next step should be?
 
Did you als run "apt update"? Just try running a reinstall on them?
Code:
sudo apt reinstall  openssh-server rsyslog samba-common smbclient samba-common-bin
 
The first three all fail with:

installed <package> package post-installation script subprocess returned error exit status 10

The corresponding postinst scripts are present, and openssh-server.postinst ends with exit 0, so the failure appears to come from a command executed within the script rather than an explicit exit 10.

Does this give you any idea what the next step should be?
Can you share the output?
 
Is this a relevant data?

halvor@halvor-X551MA:~$ sudo apt install --reinstall openssh-server
Reading package lists... Done Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
libwayland-server0:i386
Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 15 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for openssh-server:amd64 halvor@halvor-X551MA:~$
 
Try running this?
Code:
sudo apt update
sudo apt --fix-broken install
sudo dpkg --configure -a
sudo apt install --reinstall openssh-server
 


Follow Linux.org

Staff online

Members online


Top