apt cannot be upgraded, and problem with /var/lib/dpkg/status
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
apt cannot be upgraded, and problem with /var/lib/dpkg/status
Hi there, my first post here, so please don't be hard on me :-P
I am having a problem with a new installation of Debian 2.6
I installed it without problems, tryied to update, but then i got into a problem with the "apt" package. It probably started to update the package, but the packages on which "apt" depends aren't upgraded...
If i try to "apt-get update"
Code:
mpisrv2:~# apt-get update
.
.
Hit http://security.debian.org stable/updates/non-free Packages
Hit http://security.debian.org stable/updates/non-free Release
Reading Package Lists... Error!
E: Unable to parse package file /var/lib/dpkg/status (1)
E: The package lists or status file could not be parsed or opened.
I tried to check wether the status file is ok, but everything seems OK... just the status of one package is "weird" :-)
/var/lib/dpkg/status file, part with apt
Code:
Package: apt
Status: install ok unpacked
Priority: important
Section: base
Installed-Size: 4216
Maintainer: APT Development Team <deity@lists.debian.org>
Architecture: i386
Version: 0.6.45
Config-Version: 0.5.28.6
Replaces: libapt-pkg-doc (<< 0.3.7), libapt-pkg-dev (<< 0.3.7)
Provides: libapt-pkg-libc6.3-6-3.11
Depends: libc6 (>= 2.3.6-6), libgcc1 (>= 1:4.1.0), libstdc++6 (>= 4.1.0)
Recommends: debian-archive-keyring
Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc, bzip2, gnupg
Conffiles:
/etc/cron.daily/apt newconffile
Description: Advanced front-end for dpkg
This is Debian's next generation front-end for the dpkg package manager.
It provides the apt-get utility and APT dselect method that provides a
simpler, safer way to install and upgrade packages.
.
APT features complete installation ordering, multiple source capability
and several other unique features, see the Users Guide in apt-doc.
If i try to finish the installation of apt, it tells me to:
Code:
mpisrv2:~# dpkg --configure apt
dpkg: dependency problems prevent configuration of apt:
apt depends on libc6 (>= 2.3.6-6); however:
Version of libc6 on system is 2.3.2.ds1-22sarge5.
apt depends on libgcc1 (>= 1:4.1.0); however:
Version of libgcc1 on system is 1:3.4.3-13sarge1.
apt depends on libstdc++6 (>= 4.1.0); however:
Package libstdc++6 is not installed.
dpkg: error processing apt (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
apt
The problem is i cannot update the libraries, because of the first problem with the /var/lib/dpkg/status file. I already tried the status-old file, but with no effect.
Any suggestions how to get a correct /var/lib/dpkg/status file or update the apt package, or the libraries?
Looking at the posted output of dpkg --configure apt, San-Raal is running Sarge.
@San-Raal:
Please switch to Etch - strictly for the fact that Sarge is in the "obsolete" section of the Debian repositories. If you're worried about the size of the download, under the "Small CDs" heading, go to the second row where the processor architectures are listed. Those installers are only 40MB in size, but they require you have an internet hookup as they are netinstall CDs.
Looking at the posted output of dpkg --configure apt, San-Raal is running Sarge.
@San-Raal:
Please switch to Etch - strictly for the fact that Sarge is in the "obsolete" section of the Debian repositories. If you're worried about the size of the download, under the "Small CDs" heading, go to the second row where the processor architectures are listed. Those installers are only 40MB in size, but they require you have an internet hookup as they are netinstall CDs.
Thanks for the advice, but the problem is, this server is in production about a half-year, and I cannot simply reinstall it now... Just need to update it at least, and that's what I am trying to do.
You have a couple of problems here; you seem to be mixing versions in your repositories and you're using an older version of Debian.
Debian GNU/Linux 3.1 (aka Sarge) was replaced by Debian GNU/Linux 4.0 (aka Etch) on the 8th of April 2007. From that point onward Sarge stopped being the stable version of Debian and became what is known as 'old stable'. Debian supports 'old stable' for about a year, giving users a large enough window to upgrade. But unfortunately they can't support it forever. Support for Sarge ended last Monday;
You really ought to consider making the jump upto Etch. I appreciate that if this is a production server then that's a serious step. However, you will be receiving no further security update for the packages you have installed.
This change in version is related to your second problem. If you look at the output of apt-get update, you have the line;
Code:
Hit http://security.debian.org stable/updates/non-free Packages
You seem to be updating against the security updates for stable and as I stated earlier stable is now Etch and not Sarge. The reason you get problems is because the security update expects a later version of libc6 than you have (i.e. the one that's in Etch rather than the one that's in Sarge). Do you know how long this has been going on?
The first thing you should do is stabilise your system. This is what I would try to do, but considering this is your production server proceed with caution as I may well be wrong.
1) Edit the file /etc/apt/sources.list and change ALL occurrences of stable with sarge. This will make sure you are updating against the correct repositories.
2) You need to clean out your packages. This is just stuff in the cache, not the actual programmes themselves. To do this use;
Code:
apt-get clean
3) Now you want to try updating with the usual apt-get update
If that all resolves well then you are now up to date with all your patches for the old stable version of Debain.
At this point you need to decide what policy you want to follow. If you're server is not exposed to any hostile environment (like the rest of the world) and your project doesn't have long to run, then leave it as it is. It's possibly the least hassle. If however this isn't the case then you really need to plan for an upgrade. An upgrade can be done without having to reinstall the OS. However, this may have an effect on whatever non Debian software you have installed on the system.
If you decide to go for an upgrade read as much as you can first;
Then build a duplicate Sarge server with your extra settings and software installed. Bring it up to date with the patches for old stable and then try an upgrade on it. It's always better to break something that isn't in use.
Good luck and let us know if that helps at all.
Last edited by redgoblin; 04-07-2008 at 10:15 AM.
Reason: Spelling
Sarge is oldstable. To use the stable repositories will involve you carrying out apt-get dist-upgrade. But first you're going to have to sort out your existing dpkg library.
I suggest you edit your /etc/apt/sources.lst to point to oldstable instead of stable. You should then be able to run apt-get update, apt-get upgrade to bring your Sarge install up to date. From there read the Debian release notes for the upgrade to Etch.
Many thanks for the quick replies, never tought that it would be that fast :-)
Just a small update on the situation:
To be honest, I was kinda "forced" into this situation half year ago, when I had 3 hours to get a system online(4:00 in the morning, till 7:00), and no other CDs than the old sarge ones, and no time to download. Then I found out that the application was designed for RedHat, so had to install it from RPM packages the hard way. After this procedure I was happy it was online, and labeled the server "don't touch, we are happy it's running"... Now I will try to get the updates working(so I can install some packages I need), but in a few months the application will be definitely moved to a new server.
The sources.list file was just copied today from another, newer server with etch, because I was really desperate about this problem, and previously had issues with a local Debian mirror not being set-up correctly. So I just gave it a try, but with no effect.
Anyways, I corrected the sources.list config file as you recommended but I am still on the same status.
Code:
mpisrv2:~# apt-get clean
mpisrv2:~# apt-get update
.
.
Hit http://security.debian.org oldstable/updates/non-free Packages
Hit http://security.debian.org oldstable/updates/non-free Release
Reading Package Lists... Error!
E: Unable to parse package file /var/lib/dpkg/status (1)
E: The package lists or status file could not be parsed or opened.
Any suggestions? Isn't there a way of getting rid of this problem just by removing any entries in the status file, or somehow removing the new apt that is trying to get installed?
Just re-installing the apt did the first trick, to get back the wrong package, that came from the sarge/etch problem.
But then the /var/lib/dpkg/status file was still corrupted. I tried all the backups i had (status-old, /var/backups/dpkg.status), but with no effect. The first status backup file from server installation date was also "corrupted" and didn't work.
So I tried a script for rebuilding the status file, not 100% correct, but after some tinkering(removing the "Size:" parameter from the status-new file) it did the job.
Code:
#!/bin/bash
get_control_info ()
{
for i in /var/lib/apt/lists/*_Packages
do
sed '/Package: '"$1"'$/,/^$/!d' $i
done
}
for i in /var/lib/dpkg/info/*.list
do
package_name=`basename $i | sed 's/.list$//'`
get_control_info $package_name >> status-new
done
sed -i -e '/^Filename: .*/d' -e '/^MD5sum:/d' -e '/^SHA1:/d' -e '/^SHA256:/d' status-new
sed -i '/^Package: /a\Status: install ok installed' status-new
Now the system is running and up to date, and apt is working. Many thanks to all of you :-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.