I was installing a package from source and checkinstall produced

dpkg:error: reading package info file '/usr/local/var/lib/dpkg/status': Is a directory

The "status" directory was missing i went and made the directory but dont know how to make the info file. I may have some backups but not sure which one to use. From what i've been reading I think dpkg has been corrupted sort of.

phantom@AsusK53E:~$ tree -d /usr/local/var/lib/dpkg
├── alternatives
├── info
├── methods
│   ├── disk
│   ├── floppy
│   ├── ftp
│   ├── mnt
│   └── multicd
├── parts
├── status
└── updates

11 directories

Copied the status and availalbe files from /var/lib/dpkg to /usr/local/var/lib/dpkg and the checkinstall completed without error.

  • 2
    You did something wrong, usually DPKG-cache is located in top-level - /var/lib/dpkg/status. And deb-files created with checkinstall are saved to this database. Please add output of tree -d /usr/local/var/lib/dpkg to the question. – N0rbert May 26 '18 at 9:30

Just creating a directory called status won't get you what you need. /var/lib/dpkg/status is supposed to be a file, not a directory as seen below:

ll /var/lib/dpkg/status
-rw-r--r-- 1 root root 3466281 May 26 06:17 /var/lib/dpkg/status

Provided all you've done wrong is delete the status file and attempt to replace it with a directory you should be able to simply issue the following commands:

rmdir /var/lib/dpkg/status

sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status

if you've somehow managed to move the entire /var/lib/dpkg branch and graft it to the /usr/local branch you'll need to move it back first.

the /var/lib/dpkg branch typically looks like this:

tree -d  /var/lib/dpkg
├── alternatives
├── info
├── parts
├── triggers
└── updates

Source: shamelessly modified from this answer to this question.

| improve this answer | |
  • /var/lib/dpkg/status is present. The error from checkinstall shows the file is missing from this path usr/local/var/lib/dpkg/status – m0ng00se May 26 '18 at 20:13
  • cp the status-old to /usr/local/var/lib/dpkg/status it checkinstall completed without error – m0ng00se May 26 '18 at 20:58
  • @m0ng00se I'm glad my answer was helpful to you! Cheers! – Elder Geek May 31 '18 at 16:24
  • @ElderGeek, How to move it back to /var/lib/dpkg if I accidentally managed it to /usr/local. I already create new dir in /var/lib/dpkg, but it still gives me error when installing software: update-alternatives: error: cannot append to '/usr/local/var/log/alternatives.log': No such file or directory. – bagustris Aug 8 '18 at 0:22
  • @bagustris If you have a different question feel free to ask and link to this one if you feel it provides context. There are many answers here on how to move a file. – Elder Geek Aug 9 '18 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.