1
sudo apt-get install vlc
Reading package lists... Error!
E: flAbsPath on /var/lib/dpkg/status failed - realpath (2: No such file or directory)
E: Could not open file  - open (2: No such file or directory)
E: Problem opening 
E: The package lists or status file could not be parsed or opened.

Whenever I try to install any software I get this error. How do I solve this ?

5

I faced a similar issue recently with ubuntu 16.04.3 LTS, what worked for me is as following -

First you need to create an empty file, as following :-

adminuser@sandbox:~$ sudo touch /var/lib/dpkg/status

Now run update & upgrade :-

adminuser@sandbox:~$ sudo apt update && sudo apt upgrade

Probable you may end up seeing something like this --

adminuser@sandbox:~$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

adminuser@sandbox:~$ apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

But if you logout and login back, your MOTD will show you that some updates are pending -

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

108 packages can be updated.
27 updates are security updates.

At this point, you need to run dist-upgrade -

adminuser@sandbox:~$ sudo apt dist-upgrade

This should fix the issue, but make sure it shouldn't push you ahead to actually upgrade the Ubuntu to a new version. As well as I understand, until the launch of Ubuntu 18.04 LTS this should work. Good Luck

4

Step 1: cd /

Step 2: cd var/lib/

Step 3: mkdir dpkg

Step 4: touch status

This worked for me. :)

  • This solution works for me. I accidentally remove dpkg directory. – EsmaeelE Aug 23 at 13:52
0

You have to recreate a /var/lib/dpkg file structure, which does require backups or luck (and maybe both). See here.

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.