Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
1  
I'd really recommend a fresh install. Just backup your /home/ (including invisible files) and insert it in the new installation. –  wegsehen Jan 30 '13 at 12:34

3 Answers 3

up vote 10 down vote accepted

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.

share|improve this answer
    
Good idea, I hadn't thought of that. I'll be interested to see if it will work here! –  Eliah Kagan Jan 30 '13 at 13:35
    
@EliahKagan: I've tested in a chroot. jpeg* packages only affect some graphical applications, so the necessary 'ingredients' (i.e. NetworkManager for Internet connectivity, APT, terminal emulators and so on) are still on the OP system. –  Andrea Corbellini Jan 30 '13 at 13:40
    
@EliahKagan: of course, I made the (non-obvious) assumption that the OP hasn't removed anything else. –  Andrea Corbellini Jan 30 '13 at 13:41
2  
Please include a warning to never use tasksel to remove a task - see nasty tasksel-bug –  guntbert Jan 30 '13 at 14:56

The best way for you to fix this problem might be to reinstall Ubuntu. (You should back up your documents first, even if you plan to reinstall without reformatting.)

If you do want to try to fix the system in place, then look at the package manager's log files to see what packages were removed, and reinstall them:

  • /var/log/dpkg.log (full information, but hard to read)
  • /var/log/apt/history.log (abbreviated by will tell you every package removed or otherwise modified - likely your best bet)
  • /var/log/apt/term.log (if you removed the packages with apt-get in the terminal, this should show what you saw then, including lists of what packages were going to be removed - so this might be the best way)

Reinstalling just packages whose names start with jpeg won't work, because many (almost certainly most) of the packages that were removed were removed because they relied on those packages.

In the future, I recommend carefully checking the consequences of uninstalling a package. If you're working from the command-line, you'll always be notified. (Unless you use the -y option, in which case, usually not. I recommend against using that option unless you know what you're doing, especially for removals.)

One way to check the consequences of a package management operation carried out with apt-get, without risking them happening, is to run apt-get -s instead of sudo apt-get. This merely simulates the action specified, and reports what packages are would be affected as a result and how.

share|improve this answer

Install the ubuntu-desktop Install ubuntu-desktop package

sudo apt-get update && sudo apt-get install ubuntu-desktop

It will install necessary packages for your system.

share|improve this answer

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.