• Tutorial: recover lost saved session in Firefox

    Have you noticed that sometimes the saved sessions in Firefox are lost after a crash, leaving you with a clean, default homepage when launching it?

    However if this happens to you, you’re not alone! There is a quite simple way to recover it.

    The Saved Sessions are saved in a file called sessionstore.js under your ~/.mozilla/firefox/yourprofilename.default-backup-crqashrecovery-date

    Your profile name has a series of letters and it finishes in “.default”. For example: mcwubzdq.default

    Now if you list the files in ~/.mozilla/firefox you will see various of these files, ending with a date and time (for example: mcwubzdq.default-backup-crashrecovery-20140217_075716). The trick here is to save an old sessionstore.js file and overwriting the empty one in your profile.

    So first of all close Firefox and go to your profile directory and rename sessionstore.js:

    cd ~/.mozilla/firefox/profilename.default

    mv sessionstore.js sessionstore.js.old

    and now let’s assume that you want to use the session from the 17th of February 2014:

    cp ~/.mozilla/firefox/profilename.default.default-backup-crashrecovery-20140217_075716/sessionstore.js .

    That’s it! Now you can launch Firefox and enjoy your saved session tabs!

  • 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.