-1

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.

  • 1
    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
  • 1
    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 . – Panther Jun 20 '14 at 12:15
  • @bodhi.zazen I don't think these questions are dup – Registered User Jun 20 '14 at 12:15
  • 2
    @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. – Panther Jun 20 '14 at 12:18
  • I tried everything in that link and did not work :) – Hussein Hammoud Jun 20 '14 at 13:10
  • Please help us help you by adding exactly what you tried and the results to your question. "I tried everything in that link and did not work" doesn't give us anything to go on. Thank you! – Elder Geek Jun 20 '14 at 13:32
  • ok by i tried everything i was talking about the solution existing in the given link.

    i tried installing ubuntu-desktop using apt-get and got the following:

    The following packages have unmet dependencies: ubuntu-desktop : Depends: ubuntu-session but it is not going to be installed Depends: unity-control-center but it is not going to be installed Depends: unity-settings-daemon but it is not going to be installed Recommends: xul-ext-webaccounts but it is not going to be installed E: Unable to correct problems, you have held broken packages

    – Hussein Hammoud Jun 20 '14 at 13:42

1 Answers1

0

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
chaos
  • 27,506
  • 12
  • 74
  • 77
  • 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
  • That do not surprise me, you will have many errors. Keep going, and try them later. You removed essetial parts of ubuntu. – chaos Jun 20 '14 at 13:09
  • ok so how do I avoid this error ? I mean I have to repair this and I tried everything in the link given in one of the comments to my question. (link) – Hussein Hammoud Jun 20 '14 at 13:16
  • This link is one of the best ressources for those kind of errors. I cannot say more. You can try with a new question mentioning your exact error message, but it may end in a close due to a possible dublicate. – chaos Jun 20 '14 at 13:22