Ubuntu – Ubuntu system is broken after accidentally uninstalling many packages


I accidentally removed all the packages starting with the name jpeg with:

sudo apt-get remove jpeg*

This screwed up a lot of things, removed Unity, Firefox, Flash player etc.

I somehow managed to recover the desktop and unity but then a lot of things are still buggy. For example .rpm files and .tag.gz just won't open up at all.

What I want is a way to fix everything that's amiss. Something that is the equivalent of a 'repair installation' with a windows disc.

Any tips, anyone?

Best Answer

You can install the ubuntu-desktop task:

sudo apt-get install ubuntu-desktop^

This will install all the packages of the standard Ubuntu Desktop you have removed. It won't restore packages you had installed that are not part of the standard desktop (i.e. it will reinstall Unity and Firefox, but not Flash player).

To install those packages, you can look into /var/log/apt/history.log and see exactly what you had removed.

Note: installing the ubuntu-desktop^ task is not the same as installing the ubuntu-desktop package. The first will give APT some hints to resolve dependencies involving virtual packages, the latter will give APT the freedom to choose packages (and will end up installing useless stuff like ubiquity).

Why has the problem happened? apt-get remove jpeg* will not remove all packages starting with jpeg. It will instead remove all packages containing jpe in their name. This is because apt-get works with regular expression, so that jpeg* means: everything containing jpe followed by zero or more g.

Related Question