You might get a nasty “could not open file /var/lib/dpkg/status” error or something similar if you’ve been poking around the /var/lib/dpkg/ directory and clearing things out as the root users. Most files located in /var, according to the Linux Filesystem Hierarchy Standard, are temporary and change during operation. However, that doesn’t mean that they need to be cleaned out the same way that a Web browser cache needs to be cleared.
Since most Linux users don’t have a need to poke around here, the good news is that you probably won’t get this one nearly ever. Those who are on distributions that don’t use apt-get, such as Fedora or Arch, won’t ever get this error either since it’s wholly specific to that package manager. Nevertheless, if you’re dealing with it then read on.
Method 1: Fixing a Seemingly Random could not open file /var/lib/dpkg/status Error
If this error comes out of the blue, then type ls /var/lib/dpkg/status at the command line and take a look at the output.
You might also want to use a graphical file manager to the browser over to it and take a look.
Make sure that you see a status file in the results. You’ll normally just get a line that reads /var/lib/dpkg/status with nothing else after it before it returns you straight to the prompt. If that’s the case, then you have a file there and you should be okay. Close all the programs that you were working in after saving and then reboot.
Once you’re back up and running, type sudo apt-get update followed by sudo apt-get upgrade at the terminal and follow the prompts. You’ll probably get asked for your administrator password, but once it updates you should be fine. You’ll want to watch for any odd errors.
If the file wasn’t there, then you’ll have some decisions to make.
Method 2: Recreating /var/lib/dpkg/status
Some users back all their important data up at this point before reinstalling Linux. You could do this, but there might be a way to salvage things first. There’s a backup copy of /var/lib/dpkg/status that gets made automatically, and hopefully not too much time has passed since you got the error that it caused it to be out of sync.
Try running sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status at the terminal. If this doesn’t give you an error, then you can see if this fixed the issue. This restores the most recent backup copy of the status file, but unfortunately if it was too out of date you might still be in hot water. Nevertheless, you can restart then run sudo apt-get update followed by sudo apt-get upgrade to see what sorts of dependency errors end up coming up for you. In a best-case scenario, you won’t have any and you’ll merely be able to continue working with your system again like normal.
You could also try rebuilding the status list. Type sudo touch /var/lib/dpkg/status to create an empty file as the root user and then try sudo apt-get install long-list from the terminal. There are a few scripts that do this automatically, but this is essentially the same thing and comes without the dangers of running a potentially outdated script on your machine. Be warned that you’ll need to remember what you have on your system for this to work, and the software will prompt you to remember.
You can also try ls /var/backups/dpkg.status* and see what ones are there that you might instead want to use for this.
Take a look at the list that comes up when you run that. If you see one that isn’t zipped up, then try sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status and see if that fixes things. You could always copy one of the other ones and run the gunzip command on it to decompress it. However, keep in mind that the further back you go the higher your risk of updating an obsolete file that would cause broken dependencies
- Share CrocoBlock key trọn đời Download Crocoblock Free
- Cung cấp tài khoản nghe nhạc đỉnh cao Tidal Hifi – chất lượng âm thanh Master cho anh em mê nhạc.
- Mua bản quyền sách nước ngoài: Chuyện không dễ | Mai Vàng | Báo Người Lao Động Online
- Kiến thức phân tích kỹ thuật Trade Coin từ A đến Z
- Cách in ảnh trên máy tính đẹp chi tiết nhất
- Những bài thơ hay ngày 20-11 dành tặng thầy cô – VietNamNet
- Cách bật, tắt phản chiếu màn hình iPhone lên tivi nhanh chóng nhất – Thegioididong.com