Sudo apt-get error: flAbsPath on /var/lib/dpkg/status failed - No such file or directory
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 ?
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
Step 1: cd /
Step 2: cd var/lib/
Step 3: mkdir dpkg
Step 4: touch status
This worked for me. :)
sudo mkdir -p /var/lib/dpkg/{alternatives,info,parts,triggers,updates}
#Still you need to copy this file
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
apt-get download dpkg sudo dpkg -i dpkg*.deb apt-get download base-files sudo dpkg -i base-files*.deb sudo apt-get update sudo apt-get check