It was hard to make a good title with proper English on this one because I wasn’t sure how to exactly describe what I’m doing here. Hopefully you located this blog ok and are trying to do the same thing I am.
The Goal of This Exercise
Every computer needs a new operating system ‘refresh’ at some point because of all the stuff we install (and forget about) and probably a bunch of residual files related to them. Further, Hard drives will just keep getting bigger on our operating machines if we don’t change something. For busy people, this becomes a daunting consideration. There are, the way I see it, these options:
- Go through every single file and directory on your machine and make a decision about it once and for all , backing up only what you want, then wiping the rest with the re-install (best option if you have time)
- Back up everything, and then restore everything (worst option, because you aren’t clearing off your hard memory and now both your hard drive and back up drive keep getting eternally bigger….).
Let me spend a minute on this to hit this one home. Imagine you are moving your home to the other side of the country. You decide to leave everything as is. The moving company shows up and sees the mess of your house with nothing organized or packed. They have to now quickly pack it up, throw it in the truck and off the truck goes. Then, when the truck arrives at your new home, they have to now figure out what goes where. No marked boxes… sometimes no boxes at all. All that stuff is going to suck your time, and be completely unorganized. So, as painful as it is, you should really spend a few full time days (if it hasn’t been done for a while) to thoroughly go through your computer, purging things you don’t need, and organizing it all into (at least) searchable directories. I made my point – up to you now. I’ve done both ways and this way is my new way.
- A fusion of both worlds where you do your best to select what should be backed up, back that up (only) and then wipe your machine and start again.
So, because my life is currently what it is, I will select option 3, and this is my journey and log-book which hopefully also benefits you.
OVERVIEW OF THE STEPS
This is nothing more than a kind of table of contents of where we are going:
- Step 1 – Backing up
— 1A – Doing an App-Inventory
— 1B – Backing up the Foundational Apps
— 1C – Backing up Settings - Step 2 – Re-installing ubuntu
- Step 3 – Restoring what you need
— 3A – Restoring Thunderbird
— 3B – Restoring Firefox
— 3C – Restoring SSH - Step 4 – Re-installing what you need
- Step 5 – Tweaking out
- Step 6 – Congratulate Yourself
- RESOURCE SECTION
— Regular App Inventory
— App Images
— Snaps and Flatpacks
— Docker Images
— Command Line Tool Inventory
Step 1 – Backing up what you need
If you are like me, you will be backing up mostly hard files, but you may have critical things on your machine you don’t want to lose. For this reason, I’m going to create a bit of a checklist of my own stuff so that it will trigger things you may need to consider, but for the common ones, I’ll actually explain a bit more detail.
1A – Doing an App-Inventory
If you back up your entire Home directory, 99% of your important stuff will be preserved on your hard drive so I would do this if you aren’t sure. For me, however, I’m going to be more choosy since I haven’t done this in a few years and there is probably a huge pile-up of hidden files in the home directory. This is a good way to trigger memory of what you might need to back up, but, more simply, just creates a quick way to create your own list of ‘current apps’ so that you can get everything back up and running at the re-install time instead of discovering you don’t have your daily apps when you need them. There are two main places in the ubuntu filesystem where you can get your ‘memory trigger’: 1) Snap directory located in /home/snap which is dead easy, and, 2) Home directory hidden files (which are sneaky little guys, hidden from the common man…
I create a simple text file (using Gedit or whatever stock text editor) and save it as a .md or .txt file. Then I just type out the apps / snaps I have in a master list for deciding on later.
1. Snap Directory
- Navigate to your home directory
- You will see the ‘snap’ directory
- Open it. There are your snaps that you may (or may not) want to back up and also install later.
2. Home Directory Hidden Files
- Navigate to your Home directory
- Hit control+H – this will reveal your ‘hidden files’ like a magic wand…
- Put a dot/period in the search field in Nautilus to isolate just those guys for easy scrolling and inventory-ing.
Voila, you can now see your ‘trigger list’ of things you might need to back up. For me it was: .ssh, .thunderbird, .mozilla
These triggered my memory that I would need to back up my email, browser stuff, ssh files
Bonus: I put a detailed ‘RESOURCES’ section at the very bottom of this post. You can go and see my own ‘app inventory’ to help trigger ideas and help with your own planning.
Since these three are the ones I care about most and will affect me the most every day, I figure others might too so I’ll do a quick tutorial about backing up each of those in the next section.
1B – Backing up the Foundational Apps
I call them ‘foundational’ since typically (especially in business) you’re pretty hooped if these get too far messed up.
BACKING UP THUNDERBIRD
Dead easy. Just copy this .thunderbird
file onto an external hard drive. To restore it, you just paste it right back in your Home directory where it is now, before opening Thunderbird for the first time after re-installing OS (I think…)
BACKING UP MOZILLA FIREFOX
If you’re like me this will be one of your most important parts because it has your email, settings, browser stuff, etc.
Mozilla publishes this page which I found kind of daunting.
However the way I have now started doing it is easy so, I’d like to give a simple step by step to bring down the stress level:
- Make hidden files visible in your /home/ directory
- Copy your .mozilla directory from your /home/ directory (see hidden file notes above) onto your hard drive.
That’s all you need to do for now!
BACKING UP SSH STUFF
I just copied the .ssh
directory and called it .ssh_backup
and put it on my hard drive. The restored it where it was on the newly refreshed ubuntu
Another way I’ve done this, if in a rush, is just copy all of the .files into a directory called ‘hidden_home_dir_files’ on my backup directory. Then I can bring them back into the main machine later as I need.
1C – Backing up Settings
WIFI
I always forget about wifi passwords when I re-install. So I recommend making sure you have your wifi password accessible on a simple sticky note prior to wiping and re-installing, especially if you don’t have an ethernet connection and rely on said wifi connection since Ubuntu needs the connection to update and install your apps.
OTHER SETTINGS
There may be other settings you want to scan around for in your machine. For example, I have a few custom apps on my ‘startup applications’. I might want to note those and the unique commands that run each time my computer turns on. You might have custom wallpapers, etc. Just spend a bit of time to make sure the computer’s settings and preferences have been reviewed and that you note down or backup whatever you need.
One quick way to ‘back up’ these kind of settings is to do a quick ‘screenshot collection’ where you see something custom, snap it with a screenshot software and save that to your backup directory in a memorable place
Step 2 – Re-installing Ubuntu
- Get your ubuntu.iso file onto a bootable drive. There are lots of tutorials for that. You can probably search this blog for that!
- Make sure your bios can boot. It should be fine if you are putting ubuntu back onto the same ubuntu machine, but if it’s a new machine then make sure it’s not one of those crappy locked-down microsoft bios things!
- Power off
- Put in the .iso bootable drive with your new version of ubuntu on it
- Run the install prompts. NOTE: -if you choose the ‘basic’ install option it won’t come with much so you’ll probably want to choose the full install or you may end up having to install a bunch of these apps again. Up to you.
Once it completes it will have an option to reboot and then after pressing that you will be instructed to remove the install medium and press enter key which will make it reboot into the new OS.
Step 3 – Restoring What You Need
Congrats! You’ve got a refreshed ubuntu OS on your machine. Now it’s time to make it yours again.
3A – Restoring Thunderbird
Thunderbird happens to be dead easy for some reason. Here is all I have ever had to do:
- Before opening it for the first time (because I think this starts creating new .thunderbird directories…) move the .thunderbird directory from your backup drive to your
/home/
directory, exactly where it was. - Open Thunderbird.
If everything goes well, it should work the way it was on your old version.
Note: It may take a long time and act a bit ‘special’ the first time. Mine had probably 12 email inboxes and tens of thousands of emails for at least a couple of accounts. It seemed like it was breaking but then it worked like butter in the end. Don’t try to continually open the app, either. Just one double click and then go walk away from the machine and drink a coffee is probably the best way to avoid the temptation to click it again…
3B – Restoring Firefox
Firefox is quite a bit more tricky for some reason. Especially if you try to read this official backup-restore page. As such, I’m going to write a tutorial that gives me everything I ever wanted and is not too hard to do.
On your new ubuntu machine:
- Open Firefox
- Enter this:
about:profiles
into your firefox browser url field (yes, just do it) - Click they almost camouflage ‘create profile’ button
- Give it a name you’ll remember (ie. like your username for ubuntu)
- Click the ‘Open Directory’ button to the right of the ‘Root Directory’ path. It will open a Nautilus window and you should see a randomized string with something like ‘83884jcuchdhhd.yourprofilename’ at the end.
- Double click / open that funny looking directory. You should see just ‘times.json’ in there or not much more than that since it’s a new profile. You’ll paste a few things in here in a moment so keep this window open.
- Close Firefox completely
- In a new Nautilus window, (I like doing it in a new/separate window rather than tabs so I have less chance of messing things up…) open your backup directory that contains your backed-up .mozilla folder
- Drill down into: .mozilla/firefox . In here you should see your original randomized firefox profile with a
.default-release
ending. - Hit
control + f
to search this directory for the following two files which you will then copy and paste individually into your new Firefox profile you created above in step 6:
places.sqlite
favicons.sqlite
- Re-open Firefox.
You should now have your book marks and all the kind of settings you used to. There may be a few things that aren’t the same but I have yet to find one. This process worked very well for me.
3C – Restoring SSH
- copy your .ssh directory from your backup. NOTE: When backing up, if you named it something like ‘.ssh_backup’ you probably have to either copy its contents into the new .ssh directory and replace whatever is there, or, rename this to simple
.ssh
and put it in because ubuntu (from my understanding) will search for the .ssh directory not .ssh_backup when doing ssh stuff. - paste it into your
/home/
directory on your new installation - Test an SSH connection
That should be it. Nice and easy.
Step 4 – Re-installing What you Need
In this step we’ll do a fresh install of all the apps you want. This will give you the newest version of the apps. It’s as simple as going back to your app inventory and then installing what you need. Don’t install apps you haven’t used in a year. You probably won’t use them this year and then you’ll just bloat your next hard drive…
Step 5 – Tweaking Out
In this step, you just go through your OS and make it yours. Adjust your themes, wallpapers, etc. In Firefox you may wish to change away from the invasive google default search engine to Qwant for example. Here is a list of what I did in 24.04 when I upgraded from 20.04 (big leap!). This is to trigger some ideas:
* App images didn’t run. Had to follow this blog and run this command:
sudo apt install libfuse2t64
- Had to re-set my Firefox default search engine to Qwant.com
- Had to re-pin a bunch of apps to my app launcher
- Had to change from 24hr clock to 12hr (I think…)
- Had to install some second language keyboard inputs and fonts (ie. Korean, French)
- Had to re-install some fonts for my business / brand.
- and so on.
Step 6 – Congratulate Yourself
Great work. You’re done. You’re home.
You have backed up, updated, and restored your ubuntu machine to greatness.
RESOURCE – WAYNEOUTTHERE’S APP INVENTORY
After compiling my own ‘app inventory’ I thought it would be useful to publish that so it can help trigger your own memory. It’s in no particular order
REGULAR APP INVENTORY
These are the ‘available in the software center / app center’ kind of apps:
- foundational apps: Firefox, Thunderbird
- Chat Apps: Telegram, Matrix (ie. Element), BeeBeep (awesome little app if you don’t know it…)
- Password manager (ie. KeepassXC)
- screen recording tools
- Broadcasting tools (ie. OBS)
- audio / video / video/pod casting editors
- swiss army knife media tools (ie. vlc)
- photo editing (ie. Gimp)
- world class 3D creation software (Blender)
- Shameful Proprietary stuff (ie. Zoom, Chrome, etc)
- crypto wallets
- PDF tools
- file sharing (ie. Nextcloud)
- niche tools (stuff that might be for your own little niche-world) such as: medical, dental, ham radio, etc
APP IMAGES
App images are handled differently and are becoming more common. You can just back them up in their entirety and move them back onto your new machine from the backup drive. Just wanted to make sure you considered them in your planning.
SNAPS AND FLATPACKS
I don’t have much to say other than ‘consider them according to your own planning’.
DOCKER IMAGES
Who knows? Docker goes everywhere these days and podman too.
COMMAND LINE TOOL INVENTORY
These are the sudo apt install
kind of apps that may or may not have app center versions. The following are my ‘must have’ tools…
pandoc
(will requirenet-tools
whois
curl