You are not logged in.

#1 2010-04-28 06:23:54

chisiyuan
Member
Registered: 2009-10-18
Posts: 24

[solved]/var/lib/pacman lost, pacman has no idea what I have installed

Hi!

I had a partition /dev/sda6 mounted as /var, and deleted /dev/sda6 in a LiveCD environment without backing up data in /var.

So, almost all pacman things (database, cache, log, etc) were lost. Now I run 'pacman -Q', it shows nothing.

But, as you know, I do have packages installed. For example, I have an executable /usr/bin/vim while pacman does not think the vim package is installed.

The problem is how to retore pacman's knowledge of whick packages are installed.

I searched the forum, only to find I am the only fool.

Any idea?

Many many thanks!

chi

Last edited by chisiyuan (2010-04-29 07:42:09)


Awesome is awesome.

Offline

#2 2010-04-28 08:33:07

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [solved]/var/lib/pacman lost, pacman has no idea what I have installed

I have never had to do anything like this, but the instructions below suggest it's more of a problem if you don't have the log and you may have to do a reinstall.

http://wiki.archlinux.org/index.php/Pac … l_database

Hopefully, someone will have an easier solution.


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#3 2010-04-28 09:52:37

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: [solved]/var/lib/pacman lost, pacman has no idea what I have installed

Maybe you can do something with pkgfile. Like make a list with all files in / , search with pkgfile which package it belongs to and do pacman -S on that things.
Or pacman --asdeps -S
...


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#4 2010-04-28 20:26:29

rwd
Member
Registered: 2009-02-08
Posts: 671

Re: [solved]/var/lib/pacman lost, pacman has no idea what I have installed

We all do stupid stuff like this at some point, and then you learn to make  backups.

Offline

#5 2010-04-28 21:25:09

grey
Member
From: Europe
Registered: 2007-08-23
Posts: 679

Re: [solved]/var/lib/pacman lost, pacman has no idea what I have installed

chisiyuan wrote:

I searched the forum, only to find I am the only fool.

You're not: http://bbs.archlinux.org/viewtopic.php? … 22#p641222

I had a package list somewhere, which helped. Then again I didn't know about --asdeps, so I reinstalled all packages explicitely and pacman -Rs was worthless for a while.

As a first step I'd do pacman -Sy --force base.


Good ideas do not need lots of lies told about them in order to gain public acceptance.

Offline

#6 2010-04-28 22:00:20

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: [solved]/var/lib/pacman lost, pacman has no idea what I have installed

I wrote a script for this once: http://bbs.archlinux.org/viewtopic.php?pid=670876


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#7 2010-04-29 07:39:14

chisiyuan
Member
Registered: 2009-10-18
Posts: 24

Re: [solved]/var/lib/pacman lost, pacman has no idea what I have installed

I just did a fresh installation. It's like starting a new life.

The two things I learn from this accident are that

    a. Just like @rwd says, we should make backups
    b. We have a filelist called "files" in /var/lib/pacman/local/PACKAGE/. it would be helpful if there were the same thing in /var/lib/pacman/sync/REPO/PACKAGE/.

Anyway, Thanks  guys!

@Xyne, your script is interesting except that it's in perl which I know nothing about.


Awesome is awesome.

Offline

Board footer

Powered by FluxBB