Arch Linux – First Impressions

So thanks to the recent Creator’s Update from Microsoft, my Ubuntu partition became inaccessible due to what I believe is a dirty bit being set. After recovering all my data and ranting about the ordeal online, I decided to reinstall Linux so I could get back to work. That’s when it hit me that I finally had the opportunity to really get Arch Linux working on my laptop and make it my primary distro moving forward. After silently thanking Microsoft’s bad update, I got to work.

Now fair warning, installing Arch is crazy hard, simply because you have to do everything yourself. All the way from configuring the BootLoader to partitioning your device to mounting your filesystem, it’s a lot of work and very overwhelming at first. Thankfully, the Arch Wiki is one of the greatest resources for all things Linux on the internet today.

After 4 painstaking hours of going through mounds of documentation and double checking various things to make sure I wasn’t making mistakes, I finally had Arch installed. I did document each step to streamline the process so hopefully it should take far less time the next time I attempt this herculean labour again. I now had a fully functioning Arch Linux desktop.

Finally, I began installing the necessary packages to set up my development environment. Let me go ahead and say this, pacman is one of the best package managers out there! Every package installation was smooth, the output messages were clear and meaningful, and I could see the benefit of the Arch philosophy since I always had the latest version of everything.

Software that did not have dedicated packages could be easily installed using the ArchLinux User Repository and the makepkg command, which is simply just git cloneing a repo and running a make like command on it to install the software. Indeed, this is how I installed a lot of packages such as VS Code.

The best part about Arch though was the speed. My previous Ubuntu installation would often lag on the UI end, but even with the GNOME desktop, Arch was smooth as butter.

Battery life also improved significantly. It helped that Arch was so trimmed down and didn’t waste time installing useless junk I wouldn’t use.

The main downside to Arch was its lack of mainstream support. ROS isn’t as easy to install, RVM was considerably broken due to its own fault of not supporting OpenSSL 1.0, and lots of the latest packages were just simply missing. While I hope Linuxbrew gains more momentum as the de facto way to install packages, my productivity did take a bit of a hit.

That said, Arch Linux was well worth the patience and burden to get installed. Given the option, I would always choose Arch and encourage others to do the same. Hopefully, a time will come when Arch does become mainstream and the Arch way continues to prevail without facing the same fate as Canonical.

Recovering URLs from Chrome, and other data

Last evening, while working on some C# code on Windows, I saw a notification for the Windows Creator’s Update. Well this was cool since a lot of people having been raving about it and I happily installed the updated hoping for the latest and greatest.

However, later that evening when I booted into my Linux partition, I was greeted with a boot into the Emergency Mode. I assumed that the Windows update must have reset some of my old settings which Windows has been notoriously known to do, so I booted back into Windows, and updated the settings again, booted from a Live-USB to run fdisk and clean any dirty bits on my partitions, but to no avail.
Sadly, after messing around with various solutions off the internet, I had to concede defeat and accept the fact that I could no longer boot into my linux OS. After some strong cussing at Microsoft and rage yelling, I decided to pick up the pieces and recover as much data as I could.

Booting Into Your System

One of the reasons I love working with Linux is the fact that I can use Live-USBs. This is a whole operating system that boots from your USB and runs off your RAM without actually installing the OS on your machine, i.e. it does not touch the secondary memory (HDD/SSD/etc). This is extremely useful since now you can boot into your system and go rummaging through your old linux filesystem without affecting it. Since it runs off the RAM, it’s a bit slower than a native installation, but hey, this is only for recovery purposes.

The easiest way is to just create a Ubuntu Live-USB on Windows. The distro and version doesn’t matter since this is only for recovery, but I generally create a Live-USB of the distro I would end up installing again in order to save time.

Make sure you’re booting off the USB and when you come to the GRUB screen, select Try without installing. This will boot you into Ubuntu where you can use the File Explorer GUI to select the old partition (which I will henceforth refer to as the partition) and mount it. Now I could go exploring into the file system as normal. I had to chown -R $USER some directories in order to be able to access them, but I managed to recover all the data and code from my system onto an external HDD.

Now the only thing remaining was recovering my Chrome tabs from my last web browsing session. This was non-trivial since I now had to find out how Chrome stored my previous session tabs and I also had to go about understanding OneTab’s structure to recover the URLs saved there. If you don’t use OneTab, you should – it’s great!

Thankfully, Stack Overflow was once again a saving grace and I was able to get straightforward solutions without too much trouble.

Recovering Session Tabs

Head over to ~/.config/google-chrome/Default on the partition. This will be under the /media directory and will mostly be denoted by custom GUIDs which you can identify by looking at the folder’s properties from the GUI. Once you’re in the the Default directory, all you need to do is copy over 2 files: Current Session and Current Tabs. The files are binary files so you can’t just read them from a text editor despite the Unix philosophy of everything is a file.

Now to recover your session tabs, we need to use a Chrome browser on another machine. You need to save all the tabs on your Chrome browser (OneTab is great for this), then you should export those tabs to a text file, shut down the Chrome browser and make sure you kill all the Chrome tasks. Then you go to the same location on your alternate machine. The location for different OSes can be found here. Replace the existing Current Session and Current Tabs files with the one you retrieved from the partition. Start up Chrome and you should see all your “supposedly” lost tabs in front of you in all their glories.

In case it didn’t work, just make sure you close Chrome completely, include any background working processes and try the above process again. Since you have all the old as well as new URLs backed up, there shouldn’t be any cause for concern.

Recovering OneTab URLs

Now comes the other bit: Recovering your saved URLs from the OneTab extension. Luckily, this is easier than it sounds. First off, ensure you save your current saved URLs in OneTab. This can be done by exporting them and saving them in a text file. Time to recover data!

In the same config directory ~/.config/google-chrome/Default there is a directory called Local Storage. Inside that directory you’ll see a bunch of files, with the extensions .localstorage and .localstorage-journal. Each of these pairs of files correspond to an extension installed in Chrome and are the data storage files for the extension. The extension corresponding to each file can be identified by the unique ID of the extension, hence for OneTab, you’re looking for the following files:

  • chrome-extension_chphlpgkkbolifaimnlloiipkdnihall_0.localstorage-journal
  • chrome-extension_chphlpgkkbolifaimnlloiipkdnihall_0.localstorage

Copy these files over to your alternate system in the same Local Storage directory. Restart Chrome completely and run the OneTab extension and voila! You should now see all the tabs saved in OneTab from your old system. You can import your previously exported tabs into OneTab again and you should have a combination of both sets of tabs.

Conclusion

Hopefully, at this point you should be able to resume working on your machine with no interruptions. With a little bit of understanding of how Chrome saves its data, we were able to easily recover previous sessions and extension data. Not too bad, huh?

References

  • Session Tab recovery courtesy of this SO thread.
  • OneTab URL recovery from here.