Re: Recovering dpkg database
MoiN On Sun, Apr 22, 2001 at 11:58:15AM -0500, Taral wrote: On Sat, Apr 21, 2001 at 10:49:20PM -0700, Joseph Carter wrote: From then on (sorry, I know of no other way) you will simply have to get a list of installed packages (dpkg --get-selections, you can use cut or sed and grep or something to cut the list down to just the ones you want) and feed the result to apt-get install.. If you do it cleverly, you can do it on one cmdline. Actually, dpkg is likely not to want to install them. Answer: apt-get clean apt-get -d install `dpkg --get-selections | awk '$2 == install { print $1 }'` dpkg -i /var/cache/apt/archives/*.deb This will force a reinstall. You just have to hope that upgraded packages don't break on you. Nope, this will only upgrade to new versions. You need to add the switch '--reinstall' to the invocation of apt-get. I also suggest that you let apt-get do the install ordering instead of doing 'dpkg -i *.deb'. Otherwise dpkg probably will fail on unconfigured predependencies... apt-get --reinstall install `dpkg --get-selections | awk '$2 == install { print $1 }'` But--no guarantee this is going to work out of the box, you probably need to mess around with apt, dpkg and/or debconf first. Ingo -- 16 Hard coded constant for amount of room allowed for cache align and faster forwarding (tunable) -- seen in /usr/src/linux-2.2.14/net/TUNABLE
Re: Recovering dpkg database
On Mon, Apr 23, 2001 at 03:46:19PM +0200, Ingo Saitz wrote: apt-get clean apt-get -d install `dpkg --get-selections | awk '$2 == install { print $1 }'` dpkg -i /var/cache/apt/archives/*.deb Nope, this will only upgrade to new versions. You need to add the switch '--reinstall' to the invocation of apt-get. I also suggest that you let apt-get do the install ordering instead of doing 'dpkg -i *.deb'. Otherwise dpkg probably will fail on unconfigured predependencies... Oh, that works too. I had used apt-get -d to download and dpkg -i to install (dpkg will reinstall packages with plain -i). -- Taral [EMAIL PROTECTED] Please use PGP/GPG encryption to send me mail. Any technology, no matter how primitive, is magic to those who don't understand it. -- Florence Ambrose pgpBpRxXMRy5E.pgp Description: PGP signature
Re: Recovering dpkg database
On Sun, Apr 22, 2001 at 12:07:37AM +0200, Klaus Reimer wrote: My harddisk containing /var has crashed (and I am a fool without a backup). I was able to recover /var/lib/dpkg/status but all other files in /var/lib/dpkg except some files from /var/lib/dpkg/info are gone. Is there any way to reconstruct all other files and directories (alternatives, info, diversions) without reinstalling all packages? The fact that you were able to recover status is an amazing feat in and of itself. It greatly simplifies matters as you at least know what is installed. First thing you must do in order to fix dpkg is this: # apt-get update # apt-cache dumpavail avail # dpkg --update-avail avail You'll also need to recreate the dpkg directory structure, the contents file on the archive will help you do that. From then on (sorry, I know of no other way) you will simply have to get a list of installed packages (dpkg --get-selections, you can use cut or sed and grep or something to cut the list down to just the ones you want) and feed the result to apt-get install.. If you do it cleverly, you can do it on one cmdline. Expect that you'll have to rerun it a few times. The popularity of apt has caused many maintainers to become lax in their dependencies since apt will usually figure it out if you rerun it a few times. The whole point of apt's resolver was to make that no longer necessary, but that's another rant for another week. You literally must reinstall the packages to rebuild the database or apt will not know what files are installed (rebuildable with the contents file and a good script or two) or the pre and post scripts, debconf information, etc.. Just in case you need it said: BACKUP BACKUP BACKUP! I have ... uh, 1082 packages installed here personally and together they total enough space that rebuilding the database by reinstalling the packages would be a very painful experience. In fact, it happened once (thank you ext2 and DRI, I much appreciated that..) and as the system was recently installed I had no backup yet. It took me all night on a DSL line, so I pity anyone with just a modem. -- Joseph Carter [EMAIL PROTECTED]Free software developer The less you know about computers the more you want Microsoft! -- Microsoft ad campaign, circa 1996 (Proof that Microsoft's advertising _isn't_ dishonest!) pgpu6GEOZQrME.pgp Description: PGP signature
Re: Recovering dpkg database
On Sat, Apr 21, 2001 at 10:49:20PM -0700, Joseph Carter wrote: From then on (sorry, I know of no other way) you will simply have to get a list of installed packages (dpkg --get-selections, you can use cut or sed and grep or something to cut the list down to just the ones you want) and feed the result to apt-get install.. If you do it cleverly, you can do it on one cmdline. Actually, dpkg is likely not to want to install them. Answer: apt-get clean apt-get -d install `dpkg --get-selections | awk '$2 == install { print $1 }'` dpkg -i /var/cache/apt/archives/*.deb This will force a reinstall. You just have to hope that upgraded packages don't break on you. -- Taral [EMAIL PROTECTED] Please use PGP/GPG encryption to send me mail. Any technology, no matter how primitive, is magic to those who don't understand it. -- Florence Ambrose pgpUiPIQN4ikb.pgp Description: PGP signature