Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

It seems that my aptitude is somehow broken

sudo aptitude update
0% [Working]Segmentation fault

[223282.616599] aptitude[30972]: segfault at 67707f ip 7f954dcfae5d sp 7ffff5a5f950 error 4 in libapt-pkg-libc6.7-6.so.4.6.0[7f954dca5000+bd000]

so I would like to reinstall aptitude by using apt-get

Unfortunately it seems apt-get doesn't have a reinstall option.

Any ideas how I could get aptitude to work again?

Edit : It's possible that I found the root cause for aptitude's segfault. Here is how I can reproduce it:

  1. ssh remote login into the debian machine via cygwin's rxvt terminal (from a Windows-7 64bit german edition).
  2. enlarge the rxvt window so that it spans across two monitors (yes I have two monitors)
  3. run aptitude update. Note: when I resize the rxvt terminal to normal then I don't have these segfaults!
share|improve this question
add comment

3 Answers

up vote 55 down vote accepted
$ man apt-get | grep reinsta -A2
           Re-Install packages that are already installed and at the newest
           version. Configuration Item: APT::Get::ReInstall.

So, to use it to reinstall aptitude use:

sudo apt-get install --reinstall aptitude
share|improve this answer
what's that -A5 you are grepping ? –  Vokuhila-Oliba Jan 30 '10 at 12:51
man grep | grep -- "-A" –  grawity Jan 30 '10 at 13:04
add comment

You can reinstall a package with sudo apt-get install --reinstall packagename. This completely removes the package (but not its dependencies), and then re-install the package.

This is the only way when working with a package with a large number of dependencies.

share|improve this answer
Thank you for being the only correct, complete, non-snarky answer. –  Cerin Apr 5 '13 at 4:55
@Cerin: I wouldn't call the other answers overly snarky: even the "read the man page" one actually gave the answer as well as how to find it. –  David Spillett Apr 5 '13 at 13:50
@DavidSpillett, I strongly disagree. The man pages are usually very poorly written and are very unfriendly to newbies. For example, the paragraph on the "--reinstall" option doesn't mention that you have to use it with the "install" argument. A newbie might rightfully ask "why do I have to tell it to install AND reinstall?" An answer telling someone to RTFM is the worst kind of answer and it pains me to see it with the most votes, especially when a complete and actually helpful answer is near the bottom. –  Cerin Apr 5 '13 at 21:34
add comment

You should be safe to remove aptitude and reinstall, as that won't affect the other apt utilities. So: apt-get remove aptitude followed by apt-get install aptitude, or if that still fails try apt-get purge aptitude followed by apt-get install aptitude.

Before doing either of the above, I recommend a full file-system and bad-block check in case there is a problem there that caused the problem (depending on the problem, if there is one, further activity could make things worse). Also, make sure you review what will be removed in the remove/purge step before letting it proceed (it should pause to ask for permission if anything extra is changed as a result of removing that one package), to double check my thought that this is safe.

share|improve this answer
Thanks a lot! apt-get remove followed by apt-get install did the trick! –  Vokuhila-Oliba Jan 30 '10 at 0:32
It's a long time ago that I did things like a full filesystem check or similar. Could you please give me a short hint howto do that? –  Vokuhila-Oliba Jan 30 '10 at 0:50
fsck -f <block_device> such as fsck /dev/sda1. The filesystem will need to be unmounted or mounted read-only at the time so as this is likely to be your root filesystem you should reboot into single-user-mode or boot from something else like a live cd. –  David Spillett Jan 30 '10 at 1:24
You can use tune2fs to mark the filesystem as having been mounted more times than its set limit, that should force a check next boot. Assuming the filesystem is ext2/3/4: tune2fs -C 99 <device>, or in case you have mount count based checking turned off, turn it on at the same time with something like tune2fs -c 17 -C 99 <device>. –  David Spillett Jan 30 '10 at 13:20
touch /forcefsck;reboot –  user23307 Jan 30 '10 at 14:53
show 1 more comment

Your Answer


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.