Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Recently I executed this command:

sudo apt-get remove debian-keyring debian-archive-keyring

To prevent this such error message:

WARNING: The following packages cannot be authenticated!
  openerp

My plan was executing these commands:

sudo apt-get remove debian-keyring debian-archive-keyring
sudo apt-get clean
sudo apt-get update
sudo apt-get -y install debian-keyring debian-archive-keyring

Accidentally I got this error message when trying to continue executing code:

[ps193731]$ sudo apt-get clean
sudo: apt-get: command not found
[ps193731]$ sudo apt-get -y install debian-keyring debian-archive-keyring
sudo: apt-get: command not found

As additional information I'm adding this information:
Result of sudo dpkg --configure -a:

[ps193731]$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of apt:
 apt depends on libstdc++6 (>= 4.6); however:
  Version of libstdc++6 on system is 4.4.5-8.
dpkg: error processing apt (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libapt-pkg4.12:
 libapt-pkg4.12 depends on libstdc++6 (>= 4.6); however:
  Version of libstdc++6 on system is 4.4.5-8.
dpkg: error processing libapt-pkg4.12 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 apt
 libapt-pkg4.12

Result of apt-cache policy libstdc++6 apt libapt-pkg4.12:

[ps193731]$ apt-cache policy libstdc++6 apt libapt-pkg4.12
apt-cache: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by apt-cache)
apt-cache: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12)

Result of dpkg -l libstdc++6 apt libapt-pkg4.12:

[ps193731]$ dpkg -l libstdc++6 apt libapt-pkg4.12
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                       Version                    Description
+++-==========================-==========================-====================================================================
iU  apt                        0.9.7.9+deb7u1             commandline package manager
iU  libapt-pkg4.12             0.9.7.9+deb7u1             package managment runtime library
ii  libstdc++6                 4.4.5-8                    The GNU Standard C++ Library v3

Result of sudo dpkg -C:

[ps193731]$ sudo dpkg -C
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
 apt                  commandline package manager
 libapt-pkg4.12       package managment runtime library

Content of /etc/apt/sources.list:

# Generated by ndn-autoupdate

deb http://debian.di.newdream.net/ squeeze ndn
deb http://debian.newdream.net/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb http://debian.newdream.net/ squeeze-updates main contrib non-free
deb http://www.backports.org/debian/ squeeze-backports main contrib non-free
deb http://nightly.openerp.com/7.0/nightly/deb/ ./

I also have the problem installing libstdc++6 version 4.6 or above for debian squeeze.
Because there no libstdc++6 version 4.6 or above for debian squeeze.
How can I fix the apt command to be useable again?

share|improve this question
    
It sounds like you have accidentally removed the apt-get command. Can you check and see what the status of the apt package is? dpkg -l apt. –  Faheem Mitha Feb 8 at 8:42
    
@FaheemMitha: Yep, here is the result: tny.cz/bba3ccd0 I'm using tinypaste, for tidier code view. ^^^ –  Akmal Dirgantara Feb 8 at 12:10
    
Ok. Add that to your answer. You can format it by clicking on the curly brackets symbol. That will just indent the whole thing by 5 spaces. –  Faheem Mitha Feb 8 at 12:14
    
@FaheemMitha: Ok, i have edited again my question by adding dpkg -l apt as additional information. Can you check it again please? –  Akmal Dirgantara Feb 8 at 12:21
    
See man dpkg-query. The first field is i meaning installed, The second isU meaning unpacked. It should also be i. Try dpkg --configure -a, and post the output in your question. It is possible that will fix the problem, depending on what other problems your system may have. –  Faheem Mitha Feb 8 at 12:22

3 Answers 3

apt-get -s remove debian-keyring debian-archive-keyring
NOTE: This is only a simulation!
The following packages will be REMOVED:
  apt apt-show-versions debian-archive-keyring debian-keyring debtags
  python-software-properties python3-software-properties
  software-properties-common tasksel tasksel-data unattended-upgrades
  upgrade-system
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  apt debian-archive-keyring (due to apt)
0 upgraded, 0 newly installed, 12 to remove and 6 not upgraded.

So, what you did... you literally removed apt and ignored the warning, then hell broke loose. Never ever, remove stuff without checking and double checking what is being done.

So, to summarize:

If you use 32-bits:

wget http://ftp.us.debian.org/debian/pool/main/a/apt/apt_0.8.10.3+squeeze1_i386.deb http://ftp.us.debian.org/debian/pool/main/g/gcc-4.4/libstdc++6_4.4.5-8_i386.deb

if you use 64-bits:

wget http://ftp.us.debian.org/debian/pool/main/a/apt/apt_0.8.10.3+squeeze1_amd64.deb http://ftp.us.debian.org/debian/pool/main/g/gcc-4.4/libstdc++6_4.4.5-8_amd64.deb

Download the keyring:

wget http://ftp.us.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2012.4_all.deb

Now remove and install

sudo dpkg -P libapt-pkg4.12 apt
sudo dpkg -i libstdc++6_4.4.5-8_*.deb apt_0.8.10.3+squeeze1*.deb debian-archive-keyring_2012.4_all.deb

Check everything is ok:

sudo dpkg --configure -a
sudo apt-get check

Now this should be a life lesson. Don't mess with something shall not be messed with.

share|improve this answer

As can be seen in the comments, the problem is that the poster somehow installed package for Wheezy on Squeeze, namely apt and libapt-pkg4.12. The poster verified that those were the only packages misconfigured, by doing

[ps193731]$ sudo dpkg -C
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
 apt                  commandline package manager
 libapt-pkg4.12       package managment runtime library

Therefore, the obvious remedy is to manually download (since apt is currently broken) a Squeeze apt packages for the poster's arch, and install it using dpkg -i. libapt-pkg4.12 doesn't exist for queeze, so should be removed.

The poster hasn't specified his arch, but assuming amd64 this link should work:

http://ftp.us.debian.org/debian/pool/main/a/apt/apt_0.8.10.3+squeeze1_amd64.deb

If it is i386, substitute that for amd64. So

STEP 1:

dpkg -P libapt-pkg4.12

STEP 2:

wget -c http://ftp.us.debian.org/debian/pool/main/a/apt/apt_0.8.10.3+squeeze1_amd64.deb

STEP 3:

dpkg -i apt_0.8.10.3+squeeze1_amd64.deb

NOTE: It is possible that just STEP 1 + running a dpkg --configure -a will suffice to install apt, but it will still be the wrong apt for squeeze, so the preceding steps are preferable.

EDIT: @Braiam points out that dpkg will not remove libapt-pkg4.12 if there is anything depending on it. But you have the wheezy apt depending on it. So you may need to do

dpkg -P --force libapt-pkg4.12

Alternatively, as @Braiam suggests, one can do

dpkg -P libapt-pkg4.12 apt

The latter version is probably preferable, since using a --force flag is best avoided except when absolutely necessary.

share|improve this answer
    
He needs to remove apt along libapt or dpkg will not follow due dependency issues with apt. Check with dpkg --no-act -P libapt-pkg4.12 –  Braiam Feb 8 at 16:44

Download the apt package(s) to a local directory and install them directly with dpkg --install.

(or try aptitude if it's installed)

Note: the answer to the unasked question... openerp isn't signed, so you're always going to see that warning.

share|improve this answer
    
It always have required dependencies when I want to install apt_0.9.7.9+deb7u1_amd64.deb, Cause when I install libapt-pkg4.12, I got this problem: libapt-pkg4.12 depends on libstdc++6 (>= 4.6). And my big problem is there no libstdc++6 version 4.6 or above for debian squeeze. –  Akmal Dirgantara Feb 8 at 12:27
    
As others have said below, that's the wrong apt... version 0.8.10.3+squeeze1 is the current release for squeeze. –  Ricky Beam Feb 8 at 21:28
    
And its possible to get rid of that warning by editing sources.list and setting it to trusted. Or at least so says the documentation. –  derobert Feb 10 at 16:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.