Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Ok so here is the problem in short: I run ubuntu 14.04 LTS with two desktop environments: Gnome which i usually use and spectrwm. I removed gnome (followed instructions from somewhere) and left out with spectrwm. I accidentally ran the following command: "sudo apt-get remove unity* ubuntu-desktop" Which caused a disaster (cant access any desktop environment even spectrwm, running on low graphics mode, ...) so how do I revert my last command ? By the way I tried to reinstall ubuntu-desktop and it gave me unmet dependencies errors, I did not try installing any unity package because I do not know which packages got removed because of this command.

Thank you all I really appreciate your help.

share|improve this question

marked as duplicate by bodhi.zazen, Eric Carvalho, Mitch Jun 21 '14 at 8:40

This question was marked as an exact duplicate of an existing question.

what happened is the command matched the two expressions unity* and ubuntu-desktop* to all possible packages, selected all matching packages to be removed and also removed those packages which are dependencies of above selected packages. This would be a big blow to the system, so no wonder it went into low graphics mode. What you have to do is check the logs, see which packages were removed and install them. – Registered User Jun 20 '14 at 12:15
Run sudo apt-get update then try again. If you still have unmet dependencies, see the link I gave you and update your question with the exact command and output . – bodhi.zazen Jun 20 '14 at 12:15
@bodhi.zazen I don't think these questions are dup – Registered User Jun 20 '14 at 12:15
@RegisteredUser - apt-get handles dependencies, so there is no need to check the logs. If you do not follow the duplicate question, and resolve the dependency problem, you will continue with an unmet dependency error. The link I gave as a duplicate is how to solve unmet dependencies. – bodhi.zazen Jun 20 '14 at 12:18
I tried everything in that link and did not work :) – Hussein Hammoud Jun 20 '14 at 13:10

To find all unity packages that where removed type this command:

dpkg --list | grep -P '^rc  unity.*' | awk '{print $2}'

You need to reinstall all those. After that install the package ubuntu-desktop again with:

apt-get install ubuntu-desktop
  • dpkg --list list all the packages that are installed or where installed and removed (with apt-get remove )
  • grep -P '^rc unity.*' lists all packages with state rc (removed) and start with unity
  • awk '{print $2}' prints only the package name
share|improve this answer
Can you please explain the first command ? – Hussein Hammoud Jun 20 '14 at 12:29
@HusseinHammoud see my edit, I also had a typo in the command, now it works. – chaos Jun 20 '14 at 12:34
Thank you. Just One more question, when I removed unity and ubuntu desktop, it did remove many more packages and dependencies, do I need to install them ? – Hussein Hammoud Jun 20 '14 at 12:46
Yes you removed many other packages. And they will be installed again when you reinstall the unity and the ubuntu-desktop packages. dpkg --list | grep -P '^rc' lists all packages that are removed. That could also be a important for your repair process. – chaos Jun 20 '14 at 12:50
one of the packages that the command output gave me an error upon trying to install it using apt-get. Details: sudo apt-get install unity-control-center. Gave me the following error: The following packages have unmet dependencies: unity-control-center : Depends: unity-settings-daemon but it is not going to be installed E: Unable to correct problems, you have held broken packages. Any ideas ? Thank you – Hussein Hammoud Jun 20 '14 at 13:07

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