• Migrate between Ubuntu distro or change desktop environment?

    One of the most visible changes (but not the only one!) between different Ubuntu distro is the Desktop Environment.

    Looking at the official information page about Ubuntu derivatives we can see many distributions like Lubuntu, Kubuntu, Xubuntu and so on, all officially maintained by Canonical.

    The beauty of any linux distro is that you can customize it as you want. Ubuntu is shipped with Unity desktop environment, however if you want to test (or remove) another environment, it’s quite easy:

    Install Ubuntu Unity:
    sudo apt-get install ubuntu-desktop

    Remove Ubuntu Unity:
    sudo apt-get purge ubuntu-desktop

    Install LUbuntu LXDE:
    sudo apt-get install lubuntu-desktop

    Remove LUbuntu LXDE:
    sudo apt-get purge lubuntu-desktop

    Install Ubuntu GNOME:
    sudo apt-get install ubuntu-gnome-desktop

    Remove Ubuntu GNOME:
    sudo apt-get purge ubuntu-gnome-desktop

    Install KUbuntu KDE:
    sudo apt-get install kubuntu-desktop

    Remove KUbuntu KDE:
    sudo apt-get purge kubuntu-desktop

    Install XUbuntu XFCE:
    sudo apt-get install xubuntu-desktop

    Remove XUbuntu XFCE:
    sudo apt-get purge xubuntu-desktop

    Remember that when you install a desktop environment you normally install extra software like games, accessories, etc, therefore once you have removed one using the “purge” option, you can then run:

    sudo apt-get autoremove --purge
    To clean up all the extra software. This is because the extra software is not uninstalled when you uninstall the main environment.

    Another option is to skip the installation of extra software by slightly tweaking the command. For example to install KUbuntu KDE environment just add –no-install-recommends as shown below:

    sudo apt-get install --no-install-recommends kubuntu-desktop

    Finally I have noticed that even if you remove completely the desktop environment associated to your distribution (for example you remove Unity from Ubuntu) leaving another one installed, as soon as a new version of the distribution is available, the original desktop environment is installed and set as default again. Therefore I’ve learned that the best way to migrate your Ubuntu distribution to another distribution is to download and burn the ISO of the next version (or even the same version!) and launch the installer.

    LUbuntu installation screen

    LUbuntu installation screen

    As you can see from the screenshot, by using this method you can migrate your distribution to another, without worrying about losing your settings or reverting back to the original one.

  • Ubuntu: Restore / Refresh Gnome settings

    Spent some time doing “cool experiments” with your Gnome environment? Icons cannot be changed anymore, fonts are not appearing as they should, windows graphic has become messy… Well think it’s good time to remove all those “messy changes” and start from the scratch with a default Gnome environment.

    To find out what is wrong because you don’t want to restore all the settings is something that may need A LOT of time, so I will explain three methods to restore Gnome defaults, one way to start investigating the source of the issues and one way to avoid issues like this to happen.

    Restore Gnome Settings (Method #1)
    – Open a terminal by hitting CTRL + ALT + F1
    – login to your account, and run the following command:
    sudo service gdm stop

    – If you are using an old version of Ubuntu, the previous command will not work and you’ll have to use:
    sudo /etc/init.d/gdm stop

    – Then you can run the following commands:
    mv .gnome .gnome_old
    mv .gnome2 .gnome2_old
    mv .gconf .gconf_old
    mv .gconfd .gconf_old
    mv .metacity .metacity_old

    – Again, for recent Ubuntu version (like Maverick or Intrepid) run:
    sudo service gdm start

    – For older versions run:
    sudo /etc/init.d/gdm start

    Restore Gnome Settings (Method #2)

    – Open a terminal by hitting CTRL + ALT + F1
    – login to your account, and run the following commands:
    mv .gnome .gnome_old
    mv .gnome2 .gnome2_old
    mv .gconf .gconf_old
    mv .gconfd .gconf_old
    mv .metacity .metacity_old
    – Get back to your GUI desktop by hitting CTRL + ALT + F7

    Restore Gnome Settings (Method #3)
    When you run an Ubuntu system it’s probably a good idea to use Ubuntu Tweak. If you launch it and choose the section called “Desktop”, you will be able to select the category “Desktop”. You will then notice the buttons at the bottom right called “Recover”, “Reset” and ” Backup”. The option “Reset” will automatically restore Gnome’s default settings. The difference between this function and our manual methods is that this tool will DELETE your settings while we just save them with a different name. Bear in mind that it’s always good to know how to fix things manually (especially when Gnome is badly damaged and you don’t have an environment where you can easily work on.

    Investigate what went wrong

    Now that your graphic environment is working at its defaults, you can start investigating what wasn’t working properly. Please note that as we’ve previously renamed the original folders by appending a “_old” to all of them, therefore we haven’t removed all your settings. This means that the problem you want to identify is inside one (or more) of those renamed folders.

    So if now we switch back to the terminal with CTRL + ALT + F1, login into the system, we’ll be able to see that all those folders have been recreated using the Gnome defaults. This means that now we can rename one of those folders and give back the original name to the non working one :

    For example let’s say that we will rename “.gnome”:
    mv .gnome .gnome_new
    mv .gnome_old .gnome

    By running those two command we’ve saved some of Gnome defaults into .gnome_new and restore some of the non working ones. Go back to your GUI with CTRL + ALT + F7. Is Gnome broken again? You’ve found the folder that contains the issue… Is Gnome working fine? This means that the issue will probably be inside another folder but now we know how to proceed.

    How to prevent this kind of issues
    As we’ve already seen in the Method #3 to restore Gnome’s defaults, you can use Ubuntu Tweak and its “Reset” function. However we have the “Recover” and ” Backup” one. The last one takes a snapshot of the current settings, that can be later restored by clicking on “Recover”.
    Yes, you’re right, you can take different snapshots of your settings and then go back to the one you want. To be honest, you can do it manually by copying your .gnome, .gnome2, .metacity, etc, folders somewhere easy for restoring them in case something is going wrong, but this tool works very well taking the snapshots and restoring them. I’ve tested by taking various snapshots and changing different settings between one snapshot and the other and the tool was always able to restore the right data in the right way.

    This has been a long article, but I hope it will be useful to you as I’ve seen this kind of issues on different machines. Please remember that Gnome settings are a per-user-settings so you can alway log into the system as another user or using the Rescue CD to rename/remove the offending folders.