-   Debian (
-   -   apt is confused, trying to install packages that are already installed (

tomj88 09-11-2005 03:51 PM

apt is confused, trying to install packages that are already installed
Hi all,

In a fit of absolute stupidity this morning I wiped pretty much all the files in my /var directory by typing /var instead of /var/log. After a few hours of panicing, I noticed 4 days ago I had backed up /var and /etc (testing a simple python program), so I replaced the files in /var with those from my backup. Now, apt-get wants to install/upgrade a load of packages that have already been upgraded. Will it be safe just to do an apt-get upgrade even old packages will have already been replaced with new ones, or am I going to need to have to tell/trick apt into realising the files have already been upgraded.

Thanks for your time, Tom.

yanik 09-11-2005 04:20 PM

try apt-get clean, then apt-get update

tomj88 09-11-2005 04:27 PM

Nope, still wants to upgrade all the packages again. Will it be safe to just type yes? Also, before I replaced /var, I ran dpkg -l > installed_packages. Could I use this file to tell dpkg what is installed already?

yanik 09-11-2005 04:40 PM

well, unless bandwidth is a problem, I don't see anything wrong with reinstalling the packages.

tomj88 09-11-2005 04:43 PM

Ok thanks, bandwidth should be fine, I'll just leave it on overnight if neccessary. Thanks again!

tomj88 09-11-2005 05:22 PM

Hmm, I don't think it worked... Now I'm getting this error whenever I invoke apt to upgrade or install etc.

# apt-get upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages have been kept back:
  x-window-system-core x-window-system-dev xlibmesa-gl xlibmesa-gl-dbg xlibmesa-gl-dev xlibosmesa-dev xlibosmesa4
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
116 not fully installed or removed.
Need to get 0B/479kB of archives.
After unpacking 430kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously deselected package xlibs.
(Reading database ... 143825 files and directories currently installed.)
Preparing to replace xlibs 4.3.0.dfsg.1-14 (using .../xlibs_6.8.2.dfsg.1-6_all.deb) ...
cp: `/etc/X11/xkb/rules/xfree86' and `/etc/X11/xkb/rules/xorg' are the same file
dpkg: error processing /var/cache/apt/archives/xlibs_6.8.2.dfsg.1-6_all.deb (--unpack):
 subprocess pre-installation script returned error exit status 1
/var/lib/dpkg/ line 886: replace_conffile_with_symlink_rollback: command not found
dpkg: error while cleaning up:
 subprocess post-removal script returned error exit status 127
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

What does this mean? Can anyone help?

yanik 09-11-2005 05:29 PM

how about apt-get dist-upgrade? You might have to do an apt-get -f install first tho.

tomj88 09-11-2005 05:37 PM

Nope, both commands give similar output: "E: Sub-process /usr/bin/dpkg returned an error code (1)". Any more idea's? :confused:

McCloud 09-11-2005 06:20 PM

I remembered having seen this problem before, so I did some searching.

I found a link via Google that shows how to rebuild a Debian package database (that thing in /var) using a script. This is the link.

However, read the comments in that script carefully before you run it. I think you need a /var that is completely empty to be able to run this script. Also I would recommend to back-up your important data.

I don't know if it works, I don't know if it can destroy your system, I haven't tried it myself, but you can give it a go. The worst thing that can happen is that you have to completely reinstall your system :D

And an advice for the feature, don't accidently delete the /var directory again :D

Good luck and tell us if it worked.

tomj88 09-11-2005 06:23 PM

Thanks for that, will look into it.

tomj88 09-11-2005 06:33 PM

:( I moved everything from /var to /var2 for the time being, and tried the script but it kept exiting saying /var/log exists even though nothing existed there! It was strange though, I copied and pasted the shell script, and then saved it, chmod a+x, and then invoked it ./ and it just echo the contents of the file as it was working which was a little strange...

All times are GMT -5. The time now is 08:29 PM.