17

I have been playing with package management by adding sources from older Ubuntu releases in order to get older versions of some software (e.g. PHP). Unfortunately at some point I must have overdid it as now every attempt to use apt-get or synaptic ends in an error message being displayed saying that there is no candidate available to install.

I would like to start fresh - remove all the installed packages and added sources. Is there a quick way to do this, or do I need to reinstall the OS?

jrg
  • 60,611
silvo
  • 1,239

3 Answers3

7

You can do an installation of Ubuntu over top of an existing installation. You'll lose all of your (non-local [1]) system files and applications, but it will preserve everything in /home.

Select the advanced partitioning option from the menu of either the desktop CD installer or the alternate CD installer. Set the mountpoint of your existing root partition to / and make sure the format box is not checked. Repeat these steps for your home partition, if you have one.

1: Where local system directories would be /usr/src, /usr/local, and /var/local.

Jorge Castro
  • 71,754
Evan
  • 5,048
6

You could always remove all packages (making a few exceptions for apt-get, etc.)

Then run:

sudo apt-get install ubuntu-desktop

This installs the desktop metapackage which has pretty much every other package as a dependency.

Nathan Osman
  • 32,155
3

Remove all but the current release of Ubuntu you're running from /etc/apt/sources.list. Then sudo apt-get update; sudo apt-get dist-upgrade. Let me know if you still have trouble.

You may have to reinstall.

lfaraone
  • 4,697