Re-install ubuntu-desktop metapackage and reinstall its dependencies

Posted: 27 September 2009 in English, Ubuntu

Ubuntu-desktop is a meta-package in ubuntu that connects all the packages that are installed by default in a fresh ubuntu install. For that reason you can remove it without any damage to other packages or your system. It can be automatically removed if you remove ekiga or gnome-games.

But what if at some point you want to revert all the changes so you have the default packages reinstalled again?

Running :

sudo apt-get install --reinstall ubuntu-desktop

does not reinstall its dependencies. So the solution is :

sudo apt-cache depends ubuntu-desktop | awk -F ":" '{print $2}' | \
sed '/^$/d' | xargs sudo apt-get \
install --reinstall --install-recommends --yes

(yes this is one line :))

Enjoy

Update: 

this is the apt-get way to achieve the above easier :)

sudo apt-get install –reinstall ubuntu-desktop
sudo apt-get build-dep ubuntu-desktop
About these ads
Comments
  1. Timo says:

    Hi there

    many thanks for this tip! I really needed this one!

    Greetings

  2. TheTinyToon says:

    Thanks a lot, that saved me a good hour.

  3. Anonymous says:

    Thanks this has worked out for me.
    I have 64bit version, and I hit few issues, but manage to resolve them:
    – removed i386 references from generated sudo apt-get install
    – got lib(something, can’t remember which one) issues, so I did sudo apt-get remove –purge lib(something)
    then just run the generated sudo apt-get install again, and it worked – the lib(something) was reinstalled in the process.

  4. gourgi says:

    yes i know, i had this difficulties too in my upgraded 11.10 installation.
    removing i386 packages indeed seems to solve the errors.

  5. Robertiano says:

    Thank you!! I am reinstalling xubuntu-desktop, I let’s keep my fingers crossed.

  6. dude says:

    Thanks! This fixed my “failed to initialize ubuntu” error. I added gtkmm-dev and for some reason it uninstalled a bunch of critical unity stuff, this repaired it :)

  7. Mike says:

    Thanks…This saved my butt.

  8. bob says:

    très pratique, une variante :

    sudo apt-cache depends ubuntu-desktop | awk -F “:” ‘ ($2) \
    {print “sudo apt-get install –reinstall –install-recommends –yes”, $2}’ | sh -x

    on peut enlever le “| sh -x ” et le remplacer par “> script.sh” pour rediriger dans un fichier qu’on éditera pour vérifier et corriger (moi j’ai eu des “i386″ en trop).

    pour executer ensuite “sh -x ./script.sh”

  9. ugm6hr says:

    This should do the same (and is a lot simpler to understand / modify)
    sudo apt-get install –reinstall ubuntu-desktop
    sudo apt-get build-dep ubuntu-desktop

  10. Anonymous says:

    Thank you. This was my lifesaver. ^_^

  11. Anonymous says:

    hi,
    Many thanks….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s