LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 09-11-2005, 03:51 PM   #1
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Rep: Reputation: 30
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.
 
Old 09-11-2005, 04:20 PM   #2
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Rep: Reputation: 30
try apt-get clean, then apt-get update
 
Old 09-11-2005, 04:27 PM   #3
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Original Poster
Rep: Reputation: 30
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?
 
Old 09-11-2005, 04:40 PM   #4
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Rep: Reputation: 30
well, unless bandwidth is a problem, I don't see anything wrong with reinstalling the packages.
 
Old 09-11-2005, 04:43 PM   #5
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Original Poster
Rep: Reputation: 30
Ok thanks, bandwidth should be fine, I'll just leave it on overnight if neccessary. Thanks again!
 
Old 09-11-2005, 05:22 PM   #6
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Original Poster
Rep: Reputation: 30
Hmm, I don't think it worked... Now I'm getting this error whenever I invoke apt to upgrade or install etc.
Code:
# 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
  xlibosmesa4-dbg
The following packages will be upgraded:
  xlibs
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/tmp.ci/postrm: 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:
 /var/cache/apt/archives/xlibs_6.8.2.dfsg.1-6_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
What does this mean? Can anyone help?
 
Old 09-11-2005, 05:29 PM   #7
yanik
Member
 
Registered: Oct 2003
Location: Montreal Beach
Distribution: Debian Unstable
Posts: 368

Rep: Reputation: 30
how about apt-get dist-upgrade? You might have to do an apt-get -f install first tho.
 
Old 09-11-2005, 05:37 PM   #8
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Original Poster
Rep: Reputation: 30
Nope, both commands give similar output: "E: Sub-process /usr/bin/dpkg returned an error code (1)". Any more idea's?
 
Old 09-11-2005, 06:20 PM   #9
McCloud
Member
 
Registered: Sep 2004
Distribution: Debian Etch
Posts: 179

Rep: Reputation: 30
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

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

Good luck and tell us if it worked.

Last edited by McCloud; 09-11-2005 at 06:21 PM.
 
Old 09-11-2005, 06:23 PM   #10
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Original Poster
Rep: Reputation: 30
Thanks for that, will look into it.
 
Old 09-11-2005, 06:33 PM   #11
tomj88
Member
 
Registered: Apr 2005
Location: Wolverhampton, England
Distribution: Ubuntu
Posts: 334

Original Poster
Rep: Reputation: 30
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 ./dpkg.sh and it just echo the contents of the file as it was working which was a little strange...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure apt-get to install suggested packages? davidas Debian 20 02-25-2013 12:59 AM
apt-get returns lots of errors and wont install packages... StrangeBiscuit Debian 14 09-25-2006 05:18 PM
using apt to install recommended packages? MaTrIx709 Linux - Software 2 08-12-2005 01:04 AM
Is there a parameter for apt-get to install all recommended / suggested packages? Akhran Debian 5 08-08-2005 02:42 AM
Do you install packages manually in addition/instead of apt-get? R00ts Debian 5 07-11-2004 02:31 AM


All times are GMT -5. The time now is 12:47 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration