DEV Community

loading...

My Journey With Linux (September 2015 to present)

heraldofsolace profile image Aniket Bhattacharyea ・22 min read

(This is a repost from my blog which I thought would be a good place to post here)

Linux — the first thing that comes to mind when you hear this word is the image of a nerdy, bearded person, running commands after commands like a blaze.

I also had this image, and honestly, I used to be scared of Linux. People around me had (and still have) vague ideas about Linux. Nobody knew what it is, and told me not to try it.

So, I tried it. And fell in love with it.

This story captures my journey with Linux, starting from 2015, When I got my first computer, to the present time, and to the future. You will see a noob heading towards achieving perfection in this story —

P.S: After trying Linux, I am really a nerdy, bearded guy, typing commands after commands (not like a blaze).

Reasons for trying it out

I wanted to make a custom ROM for my phone in 2015. On XDA, all the guides used Linux. I was a Windows lover back then (yes, I was) and had zero experience with Linux. Then I found out about Cygwin Linux emulator. But the XDA threads said it’s buggy, unstable and it installs about 1gb of software. I didn’t have unlimited internet back then, and Ubuntu was almost of the same size. So I thought if both of them are the same size, why not download the stable one? After all, I’m all about learning.


First try — Puppy Linux

I decided to go for Ubuntu (Sep 2015), but noticed that I didn’t have enough data. So, searching for something light, I came across Puppy Linux (250mb) and decided to try it.

The installation of Puppy had instructions about “full” and “frugal” installation, which were beyond my understandings at that moment. Nevertheless, booted up the live CD, and in order to create a partition, opened GParted. I knew nothing about filesystems and formatted the whole drive as ext4. The result? My windows won’t boot up. Tried to reinstall Windows, but the installation disk would not list any partition. Somehow I managed to format the drives as NTFS and installed Windows 7.

What I learned —

Never try to mess with your partitions without having a vast idea.


2nd try- Ubuntu

Oct 2015, decided to go again. This time, Ubuntu Vivid Vervet 15.04

This time, everything went fine and set up a working installation. It was a bit uncomfortable first, especially the buttons being on the left side of the toolbar. But I grew accustomed with time. Still, I preferred Windows. Some things (like installing apps via CLI) were new to me, and not having enough knowledge resulted in a lot of things not working. But I didn’t lose patience and kept learning.

What I learned —

Basics of Linux, simple terminal commands.


3rd try- Kali Linux

Feb 2016, replaced Ubuntu with Kali Linux 2016.1 rolling. This is the distro which made me fall in love with Linux. Meanwhile, windows started showing some bugs. So I started spending more and more time with Linux. Using Kali Linux, I even built my Linux from scratch. Also, the troubleshooting in kali gave me a deep knowledge about Linux.

What I learned —

More commands and concepts of Linux.


4th try — Linux from Scratch

Using Kali, I made a Linux from Scratch and named it Papiya Linux after my mom. Although it never went public, it gave me a HUGE knowledge.

What I learned —

  • Concepts of Linux — how packages work, how two softwares communicate with each other and the kernel, different states of processes.
  • More commands.
  • Use of sed and grep and find.
  • Writing complex bash scripts using if, while, for, head, tee, cut etc.
  • Compiling softwares from source.
  • Analyze the output of make and troubleshoot.
  • Use of aclocal, configue, autoreconf and make.
  • Vim.

Arch Linux

Since August last year, I have been using Arch as my main OS. Windows is still there. And an empty partition where I try out new OS’s.

I really love Arch, because of its super fast pacman, a huge repository, and an awesome Wiki.

However, October last year, I ran into a problem. I converted my ext4 installation into btrfs. For those who don’t know, btrfs offers a tool to convert from ext4 to btrfs without losing data, and it also creates a backup image in case you want to revert.

After trying btrfs for a week, I felt no need of reverting, so deleted the backup image. Wrong choice!!

For some reason I opened Windows, and being Windows, it couldn’t recognize my btrfs partition, and corrupted it. And Arch won’t boot.

I saved it by using the tools btrfs offers (btrfs — check-extent-tree and btrfs — init-csum), however a few days later, Windows corrupted it again, this time drastically.

All my executables were corrupted, and it was beyond repair, and my only choice was to reinstall. But I would lose all the data.

My home partition was on the same drive as the root, and if I reinstalled, I would lose everything. But since “reinstall and start from scratch” is so Windows style, I figured out a way.

I had to save my home directory.

So, I booted a live cd, mounted another partition, and rsynced my home directory in this drive. Now I could reinstall the OS. But what about my apps those were installed?

Well, it’s Linux.

I found out pacman stores the data about packages in /var/lib/pacman/local. Each package gets its own directory in this format - package _ name — version — revision So, I could do this -

for i in /mnt/var/lib/pacman/local
do
echo $i >> list
done
This would create a file called “list” which would contain the list of packages to install, but it would contain the version numbers too, which I don’t want. So, I used Bash’s string splitting to split the string from the second last hyphen. This would get only the package name -
for i in /mnt/var/lib/pacman/local
do
i = ${i%- * }
i = ${i% — *}
echo $i >> list
done

Could this be done in any other way? Tell me in the comments.

This created the desired list. The rest was easy, booted the Arch live CD, fed this file to pacman, and pointed pacman to the installation path. After everything was installed, created the user, and restored my home directory, BUT this time to a separate partition, so in case anything goes wrong with the root partition, I can save my home directory.

What I learned —  1. Never delete backups. 2. Never trust Windows. 3. Always keep your home directory on a separate partition. 4. Use your goddamn brain. 5. Fix your own shit yourself.

In April this year, I screwed up once again. I decided to ditch Windows and Fedora completely and make Arch the only OS. Also, I wanted to clean up my HDD, which was one hell of a mess of partitions.

So, I rsynced my root and home partition to another NTFS partition and by the time I realised my mistake, it was too late. Yes, you can guess what happened. As I backed up to NTFS, I lost all the permissions. All the files were set to rwxrwxrwx.

After banging my head on the desk for a few hours, I remembered pacman can check for file integrity. So, it must store the data somewhere. After looking at the database (/var/lib/pacman/local/) I found out pacman stores the metadata in a mtree file under package directories. These mtree files are nothing but a gzipped data file.

I tried to restore the permissions with BSD mtree but it gave some errors because the format was not recognised. So, I wrote my own parser in Bash (sorry lost the code). It parsed the permission data from the mtree files, and applied them. There were 5 or 6 edge cases where my coding magic did not work, but I could fix them manually.

What I learned —

Backups are important, and be sure where you are backing up.


January 2018

It’s only been 1 month of 2018, but the Linuxer (is that even a word?) inside me is urging for something better. So I decided to “upgrade” my installation.

First thing I noticed, I was still using BIOS and MBR, which was, unknowing to me, chosen by the one who installed Windows on my laptop when I bought it.

My first target was to convert it to EFI and GPT.

The first part was easy —

  1. Create an ESP partition.
  2. Mount it to /boot/efi
  3. Install grub-efi.
  4. Update grub files.

The last two parts I had done before, and there was no way I could fuck that up and I did.

After 1 hour of grub not being recognized, I realised I had to copy grub64.efi to ESP/EFI/Boot/BOOTx64.efi.

After I did so, grub was recognized, but it didn’t boot.

After 2 hours of grub not finding the kernel and initrd files, I found out it was due to an issue with incorrect mount path.

After successfully configuring grub, I was satisfied and confident. So I nuked grub, and installed Refind, and got it running in the first try :)

The next part was easier, I just used gdisk to convert MBR to GPT and it worked flawlessly.

I also made zsh my default shell. After years of loving Bash, I finally moved on to new horizons.

What I learned —

Sometimes changes are refreshing.

Rest of 2018

I did not do much of a change in 2018. I got an internship and later a work from home job, so inevitably I resisted to breaking changes. There were few hiccups along the way, but not too challenging.

But it doesn’t mean I learned nothing new. I worked as a System administrator and backend developer in my work and had to use Linux extensively. In particular, I learned -

  1. Docker and Gitlab CI/CD
  2. Server deployment and Apache and Nginx configuration.

January 2019

In December 2018, however, I built a new PC, which meant I had a place to start from scratch. Although I built it in December, there were some issues with the motherboard so I had to wait until January to get it working.

This time, unlike the previous ones, I knew what I wanted, and I knew how to do it. I set up an LVM with two LVs — one for root and one for home and installed Arch Linux.

The installation was not so smooth because my WiFi adapter needs a driver that doesn’t ship with the kernel by default. Thankfully it’s available in AUR.

I also switched to Fish shell. It’s not POSIX compliant so few of my favourite features don’t work (&& and || for example, although they added them to fish a few weeks after I started using it. What a time to be alive), but change is a good thing.

I also have only Plasma on the desktop and not every single Window manager in existence like the laptop. I also have a strict no-experimentation rule with the work machine.

One good thing I did was customizing Vim. I took inspiration from here and changed a few things — replaced Pathogen with Vundle, changed some old plugins to better ones, added a few more, changed some configurations, and replaced Vim with Neovim. As an end result, my Vim is nowhere short of an IDE. Epic Linux guy moment!

April 2019

I recently came to know about NixOS. It has a unique approach to package management. It’s kinda like Yast, but better. The idea is, you write all your packages and configuration in a central location and the OS will build itself according to it. Upgrades are atomic, you can rollback any time. And packages are sandboxed so you can install multiple versions of the same package without conflict, or install packages without worrying about dependencies.

So I said bye to the Arch on my laptop and installed NixOS. So far, it’s been a little unconventional to work with, but hopefully I’ll adapt to it soon.


Conclusion

People will say, “Linux is shitty.”, “it does not have many softwares,” “I used to have this on Windows and it’s not on Linux.” etc. Believe me, I felt the same for the first two months, but I didn’t lose patience, cause I’m switching OS, so I must expect things not to be the same. I’ve been to the dark sides of Linux, and I have seen what it can do.

I have leaened a lot of things. I have gained a lot of experience. It was hard to learn all by myself without any guide, but if I can do it, anyone can.

I will update this story with new milestones.

Discussion (1)

Collapse
rezmed profile image
rezmed

that was a cool adventure thank you for the great work

Forem Open with the Forem app