SHARE

On it's own, Ubuntu is a solid desktop Linux experience. It offers ample application choices and it's easy to use. But one area I would like to see greater focus is mirroring one desktop to another. That is, being able to find the same documents and other files I use on both desktop machines. In this article I'll explore options I've found useful in creating a unified Ubuntu Experience.

Keeping files in sync

I would never advocate the idea behind syncing your root directory or your entire home directory from one computer to another. It's likely to create problems with the destination PC and is also widely considered unnecessary. There is something to be said about keeping specific commonly used directories in sync though. For example, your Documents, Pictures, Videos and so forth are prime candidates for two-way synchronization.

To best handle user-level two way synchronization I prefer to use Unison. What makes Unison effective is that it can easily handle updates from both PCs, even if they differ, and keep the new unified directory structure intact without any data loss. That's a fancy way of saying you won't accidentally overwrite any important files because you made a change on one PC, and another change on the other.

Now if your goal isn't two way synchronization where files could be changing at both destinations, then my next suggestion would be rsync. I prefer to use rsync for reliable one way synchronization tasks like keeping an archive of a critical directory. Even though you "could" run rsync two ways for back and forth directory synchronization, I prefer to use it as an archiving tool instead.

Unison user case scenario

It's no secret that using cloud synchronization options for Firefox and Chrome are less than perfect. Far too often, Chrome nags me to sign in because it's not currently connected. To make matters worse, I've found that all this feature really does is slow down your system.

Thankfully, I've found a better alternative for my needs using Unison. I use Unison to synchronize my ~/.mozilla and ~/.config/google-chrome directories. I advise against trying to synchronize your entire ~/ or ~/.config directories as there are enough differences here between machines that you could create new problems. But assuming you're not using the browsers on both machines at the same time, Unison is a fantastic option over built-in browser synchronization.

Another important use case scenario is keeping my Documents directory in sync. Because I've been known to switch machines mid-day, knowing my work is available on either box is a real plus.

One area I would not recommend using Unison is with your Steam directory in your ~/.steam directory. While it might seem like a good idea at the time, it will create issues as it contains PC specific data that could screw up a working Steam install on the second PC. Instead, just rsync a backup archive for EACH computer instead. This way if you need to restore it after something goes wrong, it's readily available.

Uniform software across two PCs

In an enterprise or education environment, the best way to provide a uniform desktop experience is to use disk imaging or the virtual equivalent. In a small office or at home, however, this is a bit of overkill. This is especially true when you're simply wanting to make sure that your software installed matches the software installed on another computer. Obviously there are commercial solutions that could help with this but for the typical home user or small office, this isn't an affordable solution.

In the past, it was widely recommended to use the Ubuntu Software Center to backup the installed software titles via an Ubuntu One user account. Now even though links in the Software Center still provide limited use of Ubuntu One, past cancellation of their cloud services has left me hesitant to recommend it going forward. My concern is: will recommending it make this article dated in a year should they decide to cancel it?

So this leaves us with solutions such as dpkg –get-selections. On the surface, this should work just fine and does as a single PC backup of software packages. Unfortunately bridging this out to another computer can create problems due to various "lock files" that will be included in the directory containing the dpkg output. In short, I recommend using dpkg –get-selections as a backup tool and not as a synchronization tool.

My advice: avoid uniformly synchronizing all of your software between machines. Instead, use Unison to carefully select key ~/ based directories that contain user specific application data, not the applications themselves. You can do this for nearly any application that relies on user-specific data. As a rule, you'll find this user data under ~/.SoftwareName or ~/.config/ SoftwareName.

So what about keeping track of those software titles? Can they be synchronized between machines? Assuming PPAs aren't in play as this would require manual scripting with grep, I'd just create a script to run daily to see if your key software is installed.

For example: apt-get install package package1 package2 and so on. The script could be rsync'd from the main PC to the second, thus allowing you to keep the list updated easily. By no means, is this something I'm recommending. Rather, I'm pointing out that it's possible. If you needed to add PPA support, it would be a pain as this would have to happen with each PPA...but this could be added to said script.

the_ppa=... # set appropriately if ! grep -q "$the_ppa" /etc/apt/sources.list /etc/apt/sources.list.d/*; then # commands to add the ppa ... fi

Again, this is just a rough example of what could be done if you were testing this in a non-critical environment. Personally, I recommend against it as it might lead to problems down the road.

For keeping things safe, I recommend synchronization of your application-specific user data and then manually installing the software as needed. It may not be as fancy as running random scripts, but it's definitely not going to slow down your productivity.

Optimizing Ubuntu

Creating a cohesive, unified user experience is difficult to resist. But I prefer to keep my PCs safe and grounded by using what is referred to as the KISS principle. The KISS principle stands for "Keep It Simple Stupid" and it has served me well for many years.

The best rationale I can point to is this: lost software is a mere command away. Lost data, on the other hand, can end careers. Put your efforts into syncing your data, not your entire desktop. Both your health and your boss will appreciate the thoughtful restraint.