Recreated part of /var/lib/dpkg/info; apt reinstall now fails with "Internal Error, No file name"



I investigated further.
  • apt-cache policy, apt-cache show, and apt-cache showpkg all look normal.
  • The relevant .deb files exist in /var/cache/apt/archives/.
  • apt reinstall fails for openssh-server, rsyslog, and samba-common with:
E: Internal Error, No file name for <package>:amd64

Additionally:

$ dpkg -V apt apt-utils
dpkg: warning: files list file for package 'apt' missing
dpkg: warning: files list file for package 'apt-utils' missing

and

$ ls /var/lib/dpkg/info | grep '^apt'
aptkit.conffiles
aptkit.list
aptkit.md5sums

There are no apt.* or apt-utils.* files under /var/lib/dpkg/info, although

dpkg -l apt apt-utils

reports both packages as installed (ii).
Could the missing metadata for apt itself explain the repeated No file name internal error, or is there another APT state that I should investigate?
 
I have changed the thread title to reflect the current focus of my troubleshooting.

At this point, it seems that the internal apt/dpkg malfunction needs to be resolved before attempting any broad package reinstallation. My repeated apt reinstall attempts consistently fail with:

E: Internal Error, No file name for <package>:amd64

so I believe that issue should be understood first.
 
sudo apt distclean
sudo apt update

If the above doesn't work take a look at:

Number 13 here has a good answer https://unix.stackexchange.com/questions/161866/how-to-recreate-var-lib-dpkg-status

You can re-create

/var/lib/dpkg/status by copying the backup from /var/backups/​

 
sudo apt distclean
sudo apt update

If the above doesn't work take a look at:

Number 13 here has a good answer https://unix.stackexchange.com/questions/161866/how-to-recreate-var-lib-dpkg-status

You can re-create

/var/lib/dpkg/status by copying the backup from /var/backups/​

Thanks. apt update completes successfully, and /var/lib/dpkg/status appears to be intact.

The remaining blocker is that every apt reinstall ends with


E: Internal Error, No file name for <package>:amd64


even though:
  • apt-cache policy looks correct,
  • apt-cache show reports the expected Filename:,
  • the corresponding .deb file exists in /var/cache/apt/archives/.
Also, dpkg -V apt apt-utils reports that the .list files for apt and apt-utils are missing from /var/lib/dpkg/info.

Do you think that missing metadata for apt itself could explain the "No file name" internal error?
 
I have major resource restraints, i.e. storage space and money.
This demands more careful actions. Having a system backup is the best way to prevent disaster, but if that isn't possible, disaster must be avoided by thinking carefully about everything before pressing the Enter key. Live and learn, but I'm not sure you can do much other than live with what you have or reinstalling. Neither is ideal, but the ideal fix of restoring from a backup isn't possible, so the choices become limited.
 
Top