Archive for June, 2006
Nice Feature of Konqueror
Occasionally, I found a nice feature of Konqueror, which further frees me from mouse browsing.
When you open a webpage in konqueror, pressing ctrl (either left or right) will give you a list of shortcut for all links on that page, so you can follow any of them by entering the character/number appearing at the link location. In a framed webpage, it will capture links in the current frame, so switch focus using tab to your desired region first.
Add comment June 14, 2006
How to recover from a dpkg disaster
I am a newbie about linux and encounter trouble in almost every software I try tune. In the last month dpkg crashed twice on my Ubuntu Dapper LTS. After some apt-get upgrade command and normal downloading process, the installation ended up with such an error message:
dpkg: can’t mmap package info file `/var/lib/dpkg/available’: Invalid argument
OK, so now even package management stops working, what to do?
First I searched for possible reasons for such crash, my /var/lib/dpkg/available and /var/lib/dpkg/status look fine under text editors, and dpkg didn’t complain about any package specificly, soon I find out this may be aroused by an insufficient memory size allocated to dpkg, as reported by some Debian users. So I add this line to my /etc/apt/apt/conf:
APT::Cache-Limit 10000000;
I guess that means apt can use as much memory as it wants.
But it is not over yet. I tried several backups for /var/lib/dpkg/status, none of them work for me, and I simply have no backup for /var/lib/dpkg/available. So I realized I have to rebuild both of them by myself, to some extent at least.
So here is my solution, I borrowed several scripts from the web. Before that you may want to read the last part of this article, and perhaps the Debian apt-howto, they explain what are needed to make dpkg work again.
- backup you current /var/lib/dpkg/available and /var/lib/dpkg/status files, you may still need them later, for reference at least.
- Create a new /var/lib/dpkg/available, simply quote out fundamental packages from your backup, such as libc6, locales, belocs etc. Start from libc6 package and follow the dependency it requires.
- Use this perl script to generate your new status database, if your available file is fine, then you wil be almost done, otherwise this file will look much smaller than it should be.
- run “apt-get upate”.
- run “apt-get dist-upgrade”. After the packages are downloaded apt will complain for missing debconf or dpkg, whatever, ignore it.
- Turn to /var/cache/apt/archives, and install packages manually with command “dpkg -i #package name#” #package name# should be replaced with the following packages, one by one: libncurses* perl-base* libstdc++* dselect* dpkg* . If it complains about extra dependence, apt-get that package and use dpkg to install it.
- Run this script to reinstall libc6, reinstall the base system and recover your status of other packages you have installed. Unlike the perl script above, this script uses information in /usr/share/doc, rather than /usr/lib/dpkg/available, so it will find back all installed packages.
- Clear up the mess, run “dselect-update” to rebuild your /usr/lib/dpkg/available and you are up-to-date again!
If you available package is not corrupted (lucky you), only status runs wild, then simply run this script. It didn’t work for me because my bad available package prevents it from generating the right status file in the first place, but maybe you will save most trouble with it.
Add comment June 2, 2006