Author: rahul

  • Website migrated to WordPress

    After running this website on Drupal 7 for over a decade, I’ve now migrated it to WordPress. This change was prompted by the official end-of-life for Drupal 7 in January of this year.

    I considered upgrading to Drupal 10, but ultimately chose WordPress for several reasons:

    • Popularity and Ecosystem: WordPress is the most widely used CMS globally, with an extensive ecosystem of plugins and themes. This makes it much easier to configure and customize the site exactly how I want it—without reinventing the wheel.

    • Simpler Maintenance: My hosting server runs on Debian, which provides native WordPress packages. This makes ongoing updates, especially security patches, smoother and less labour-intensive.

    • Upgrade Path: Major version upgrades in Drupal often involve significant database schema changes, making transitions between versions more complex. WordPress upgrades tend to be far less disruptive.

    • Platform Evolution: WordPress has matured from a simple blogging tool into a full-fledged CMS. Meanwhile, Drupal has increasingly become a framework aimed at building complex, enterprise-level applications. While it’s still capable of powering simpler sites, WordPress aligns better with the straightforward needs of this blog.

    Because of all these factors, moving to WordPress felt like the right choice. The new site is still a bit minimal in appearance, but I’ve successfully carried over all the key functionality from the old Drupal version. I’d also like to make a special mention of FG Drupal to WordPress plugin (premium version) which has considerably reduced my effort involved with this migration.

    I appreciate your patience during this transition. If you notice anything that seems broken or missing, feel free to reach out. I’m excited about the flexibility WordPress offers and look forward to using it to share more content with you in the days ahead.

  • Personal Update

    After living in London and working at Meta for four years, I’ve relocated back to India earlier this month to reunite with my wife and daughter, who moved back about a year ago.

    There was a lot of contemplation after our third year in London about whether we should settle down there. But considering our personal circumstances and preferences, we ultimately decided to move back, as we didn’t see ourselves settling down there in the long run.

    As I leave London, I carry with me many wonderful memories — both personal and professional. It was the first time I had lived and worked outside India, and exploring the city and country with my wife and young daughter was a lot of fun.

    Professionally, I had the opportunity to work with some of the best engineers and cross-functional partners. The learnings — from both technical and product perspectives — were invaluable, and I’m sure they’ll continue to shape my journey ahead.

    Now comes the big question: What’s next?

    I’m planning to take a break from full-time work and instead explore freelancing, while also upskilling and experimenting with indie hacking — something I’ve been keen to try for a while. I’m also open to partnering on the right idea if it comes along. The plan is to explore this path over the next few months and then decide on the next steps.

    Wishing myself the best in this new phase! ?

    Original Link

  • Debian on self-encrypting drive using cryptsetup OPAL support

    Context

    For a long time, I have been using a hard drive with cryptsetup LUKS software encryption for my desktop. However, I recently decided to purchase a new hard disk and this time went for SSD instead of HDD. Interestingly, the SSD came with built-in support for hardware encryption. What this meant was that instead of having the CPU waste cycles on encryption / decryption, the SSD would take care of it, thereby freeing up CPU resources. The challenge? Setting up disk encryption is complicated. Until Aug 2023! Because that is when crypsetup, the tool that I have been using for software encryption, introduced support for hardware OPAL disk encryption. And this is what I have used to set up disk encryption for my Debian OS. I have documented the steps that I followed (mostly for self-reference), but I hope others find it useful.

    Some caveats before you start:

    1. Support for hard disk OPAL encryption landed in cryptsetup 2.7.0. Debian stable (bookworm) still has cryptsetup 2.6.0. If you want to use this, you will either have to use Debian testing (trixie) or if you intend to use Debian stable, upgrade cryptsetup from the testing repo (which is what I did)
    2. I have not installed Debian but instead, once disk encryption along with LUKS encrypted LVM was set up, I just copied all files from my existing OS to this. If you want to do a fresh installation, I believe you can do it, once you create the all partitions. The LVM is purely optional, and I prefer to use it for convenience.
    3. I also have tow additional mount points (/stuff/ and /gallery/) which are in no way required or even a standard. Again, this is just my personal preference. Feel free to ignore them.
    4. I have a EFI partition as my motherboard uses the UEFI interface for booting.
    5. You can set up disk encryption only or disk encryption with software encryption. As my need was to provide basic protection, I decided t go for disk only encryption.
    6. The SSD was identified as /dev/sda and that is what I have used below. The device location might be different in your case.
    7. Last but not the least, if you are copying over an existing OS, have a proper backup.

    If you have any queries, feel free to leave a comment and if I have an answer to them, I will get back to you.

    Setup

    • Fix the new disk to the laptop
    • Prepare a usb drive with Debian live
    • Boot into Debian live. While booting:
    • Pass the boot option libata.allow_tpm=1 so that sedutil-cli --scan works fine
    • Pass the boot option efi=runtime if you use EFI for booting your system

    Check disk support for hardware encryption

    $ sudo apt install sedutil
    $ sudo sedutil-cli --scan
    Scanning for Opal compliant disks
    /dev/sda 2 CT2000MX500SSD1 M3CR046
    /dev/sdb No
    No more disks present ending scan
    

    If you see a number in the second column, like the 2 above, your drive supports OPAL.

    Reset your OPAL drive

    You will need to have your PSID to reset the drive. You can mostly find the PSID on your drive, printed on a sticker. If the PSID has dashes, ignore them.

    $ sudo cryptsetup luksErase --hw-opal-factory-reset /dev/sda
    Enter OPAL PSID:
    

    Create partitions

    My system partitions layout with mount points /dev/sda1 fat32 /boot/efi /dev/sda2 ext4 /boot /dev/sda3 luks encrypted LVM   /dev/mapper/media-vg–root ext4 /   /dev/mapper/media-vg–home btfs /home   /dev/mapper/media-vg–swap_1 swap   /dev/mapper/media-vg–stuff btrfs /stuff (optional partition that I use for storing general stuff)   /dev/mapper/media-vg–gallery btrfs /gallery (optional partition that I use for storing images/videos)

    Create partitions

    $ sudo parted /dev/sda
    (parted) mklabel gpt
    (parted) mkpart ESP fat32 1MiB 526MiB
    (parted) set 1 boot on
    (parted) mkpart primary ext4 526MiB 1550MiB
    (parted) mkpart primary 1550MiB 100%
    (parted) print
    (parted) quit
    

    Create encrypted OPAL disk partition

    As mentioned earlier, ensure that you have cryptsetup 2.70 or newer. Older versions of cryptsetup will not work.

    $ sudo cryptsetup luksFormat /dev/sda3 --type luks2 --hw-opal-only
    

    The –hw-opal-only flag tells cryptsetup to use hardware encryption only. If you want to use software encryption on top of hardware encryption, pass the –hw-opal flag instead.

    Check configuration with luksDump. This output will be different if you used –hw-opal flag.

    $ sudo cryptsetup luksDump /dev/sda3
    LUKS header information
    Version: 2
    ...
    Data segments:
    0: hw-opal
    offset: 16777216 [bytes]
    length: ... [bytes]
    cipher: (no SW encryption)
    HW OPAL encryption:
    OPAL segment number: 1
    OPAL key: 256 bits
    OPAL segment length: ... [bytes]
    Keyslots:
    0: luks2
    Key: 256 bits
    ...
    

    If you used –hw-opal flag, output will be something like this.

    LUKS header information
    Version: 2
    ...
    
    Data segments:
    0: hw-opal
    offset: 16777216 [bytes]
    length: ... [bytes]
    cipher: (no SW encryption)
    HW OPAL encryption:
    OPAL segment number: 1
    OPAL key: 256 bits
    OPAL segment length: ... [bytes]
    Keyslots:
    0: luks2
    Key: 256 bits
    ...
    

    Create LVM

    Mount LUKS partition

    $ sudo cryptsetup open /dev/sda3 sda3_crypt
    

    Create a PV

    $ sudo pvcreate /dev/mapper/sda3_crypt
    

    Create a volume group of physical volume

    $ sudo vgcreate media-vg /dev/mapper/sda3_crypt
    

    Verify VG configuration

    $ sudo vgdisplay
    

    Create logical volumes

    $ sudo lvcreate -n root -L 100g media-vg
    $ sudo lvcreate -n home -L 100g media-vg
    $ sudo lvcreate -n swap_1 -L 20g media-vg
    $ sudo lvcreate -n stuff -L 200g media-vg
    $ sudo lvcreate -n gallery -l 100%FREE media-vg
    $ sudo lvdisplay
    

    Format partitions

    $ sudo mkfs.fat -F32 /dev/sda1
    $ sudo mkfs.ext4 /dev/sda2
    $ sudo mkfs.ext4 /dev/media-vg/root
    $ sudo mkfs.btrfs /dev/media-vg/home
    $ sudo mkswap /dev/media-vg/swap_1
    $ sudo mkfs.btrfs /dev/media-vg/stuff
    $ sudo mkfs.btrfs /dev/media-vg/gallery
    

    Mount partitions and restore data

    Set up folder structure and mount partitions

    $ sudo mount /dev/media-vg/root /mnt/
    $ sudo mkdir /mnt/boot/ && sudo mount /dev/sda2 /mnt/boot/
    $ sudo mkdir /mnt/boot/efi && sudo mount /dev/sda1 /mnt/boot/efi
    $ sudo mkdir /mnt/home/ && sudo mount /dev/media-vg/home /mnt/home/
    $ sudo mkdir /mnt/stuff/ && sudo mount /dev/media-vg/stuff /mnt/stuff/
    $ sudo mkdir /mnt/gallery/ && sudo mount /dev/media-vg/gallery /mnt/gallery/
    

    Now, copy over all the files from the old system to the new system. If you are using rsync for the transfer, here are some pointers on how you can do it.

    Note: If you are installing OS freshly, then you can stop following the guide here as the next steps will no longer be relevant and proceed with the OS installation the usual way. As a matter of fact, I believe, once you created the encrypted OPAL disk partition (/dev/sda3), then itself, you could have switched to the installation tool and created LVM from it. However, I have not tried fresh installation. So can’t confirm.

    chroot into the system

    First bind mount points

    $ for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -o bind $i /mnt$i; done
    

    chroot into the system

    $ sudo chroot /mnt/
    

    Update partition and LVM related information

    Update /etc/fstab. To generate UUID, use blkid command. Below is the one for my system.

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # /dev/mapper/media--vg-root / ext4 errors=remount-ro 0 1
    # /boot was on /dev/sda2 during installation
    UUID=e63fbce3-8e20-40ed-af1a-17b73768f853 /boot ext4 defaults 0 2
    # /boot/efi was on /dev/sda1 during installation
    UUID=CDDE-67F3 /boot/efi vfat umask=0077 0 1
    /dev/mapper/media--vg-home /home btrfs defaults 0 0
    /dev/mapper/media--vg-swap_1 none swap sw 0 0
    /dev/mapper/media--vg-gallery /gallery btrfs defaults,nofail 0 0
    /dev/mapper/media--vg-stuff /stuff btrfs defaults,nofail 0 0
    

    Update /mnt/etc/crypttab. To get UUID of luks partition, run cryptsetup luksUUID /dev/sda3. Below is the one for my system.

    sda3_crypt UUID=42834177-2cb5-45ef-897f-af1c85f35bf1 none luks,discard
    

    Additionally, generate LVM metadata backup

    # vgcfgbackup media-vg
    

    Finally, update initramfs (not sure if this step is really needed)

    # update-initramfs -u -k all
    

    Reinstall grub from within chroot

    Reinstall GRUB

    # grub-install --target=x86_64-efi
    

    Generate the GRUB configuration file:

    # update-grub
    

    More information about the GRUB bootloader can be found here. Of special interest are the grub-install command arguments --efi-directory and --bootloader-id, which default to /boot/grub and debian respectively on Debian.

    Boot into system

    Now, exit chroot and reboot the system, remove Debian live and boot into the new system.

    References

  • Relocation to London

    About two years back, I relocated to London with my family.

    It was not something really pre-planned. I was looking for job opportunities in late 2020 and a recruiter from Meta (then Facebook) reached out to me. I had managed to close a couple of other big tech job offers and was almost sure to join one of them. But then when Meta extended an offer, I decided to take it and explore what it was like living outside India.

    Two years down the line, I can definitely say it has been a unique experience. From theatres to parks to museums, London has a lot to offer for everyone. The excellent public transport system makes it easy to travel anywhere. Compared to Bangalore where I lived for 8 years, pollution almost seems to be non-existent. The weather is a bit unpredictable and winters could be a bit gloomy but the fesitive spirit in November and December doesn’t make that time that hard. Education and health (although a bit stressed of late) are free which is probably the reason why people don’t worry about building a huge pension pot and spend more on entertainment and hobbies.

    However, there are things which we definitely miss when compared to India, the most important being family. The warmth and affection of immediate family members is something that we yearn for here. I do have extended family in UK and I get to see my parents about two times a year, which to some extent makes up for it. When it comes to friends, we are making new friends here it but it doesn’t make up for the decades old-friendships that we have back in India. The impromptu guest visits and the frequent family functions, which sometimes we found a bit overwhelming when we lived in India, are what we realized actually made life more dynamic. And with comparable tech salaries in India now, I definitely have more financial freedom to puruse things of my interest rather than worry about mortgage and increasing cost of living.

    We are at a juncture where we are strongly trying to form an opinoin whether to come back to India or continue staying here. And the more we think about it, the harder it gets. Our decision keeps changing every other month. What I finally feel is that whether we decide to stay back in London, or go back to India, there is something to lose and something to gain. Probably what matters more than the decision we take is being content with the decision and how we shape our lives once we make the decision.

  • The Ultimate Hack for Chewing Food Properly

    Chewing your food properly and eating slowly is universally recommended. However, in spite of trying to be aware of this, I still used to end up eating very fast. Until a colleague of mine, Jyotsana J, gave a key insight into why most of us tend to eat fast. This is one of those posts which might sound too trivial to write a blog entry about but it has been so effective in my case that I felt it is worth sharing with others. So, please don’t judge me on this 🙈.

    Most of us tend to eat food this way. We take in a morsel of a dish and while chewing it, we tend to get ready the next morsel to be consumed. And often these two activities are done in parallel and coordinated so that as soon as we swallow the morsel of food in our mouth, the next chunk is ready on a spoon (or in your fingers) to be consumed. The downside of this approach is that we subconsciously try to optimize this process by ensuring that the chewing of the food is more or less done by the time we get the next morsel ready. And hence we end up chewing lesser that we should be doing.

    Instead, try this hack. When you take in a morsel, don’t be in a hurry to get the next morsel ready. Instead, sit back and comfortably chew your food. Only once you are done swallowing the chunk in your mouth, proceed to get ready the next morsel.

    Here are some of the things that I have observed with this change:
    1. Chew my food better and eat my food more slowly
    2. Because I tend to eat more slowly, I am also tending to eat a bit less
    3. Relish the food more because when I sit back and focus on chewing the morsel in my mouth, the taste is better observed
    4. Talk less over meals (not sure if this is good or bad though :))

    So, if you are fast eater like I was, this technique is worth trying out. And if it works, do share your experience in the comments.

  • Work environment upgrades

    After many months of contemplation, I have finally gone ahead and purchased a standing desk and a chair. Deciding on either of these is not easy as you are spoilt for choice. However, after some evaluation, I finally decided to go for a dual motor electric height adjustable desk frame from MojoDesk and a chair made by Aster.

    MojoDesk

    Standing desks do not come cheap and the ones from branded companies (such as Featherlite and Godrej) cost around 45-50K. I initially considered them but found none of them was satisfying all my criteria. I looked at some standing desks in Alibaba as well but didn’t feel confident ordering it from overseas. That is when I came across MojoDesk. Although MojoDesk has been in this business recently, they have already sold about 700 standing desks. Furthermore, their desks come with a 3-year warranty, which further increased my confidence with them. The dual motor electric height adjustable desk frame has three main features that I was looking for – 1. memory positions 2. minimum height adjustable to almost 2 feet and 3. width and height of the table top could be of my selected dimension. And under a discount pricing, I was able to get it for only 30 K. Although only the frame was being supplied, I was told that the table top would cost me additional 5 K (it actually cost me only 3.5K everything inclusive), implying that the total cost would be well under 35K, which was very reasonable. Taking into account all these factors, I went ahead and ordered a MojoDesk.

    I received the MojoDesk standing desk frame within the estimated delivery time and it came in proper packaging. The instructions to fix it were straight-forward and there was no hassle in getting it set up. I immediately followed up with a few carpenters in my locality and got the table top made as well. It is recommended to have the table top made of plywood rather than particle board. Also, while the MojoDesk website recommends the board thickness to be 25mm, for plywood, 19mm should probably suffice unless you are planning to place a lot of heavy stuff on the table.

    I have been using MojoDesk for a few weeks now and I am simply in love with it. The low height that it can be adjusted to (almost 2 feet) is very useful as your legs are not left dangling in the air when you are sitting and working. Also, the memory positions make it convenient to set it once and keep using it. And finally, the lack of a top gives you the flexibility to have one made of your own preferred dimension. MojoDesk definitely felt like one awesome purchase. Here are some photos of the standing desk.

    MojoDesk standingMojoDesk sitting

    MojoDesk memory positions

    Aster chair

    The other piece of equipment that I invested in recently was a chair. I visited a few showrooms and really liked the Featherlite Optima chair which was costing around 25K. However, my experience with chairs has been that unless you sit and work on them for a few days, you might not really be able to figure out if they are comfortable. Because of this, I was reluctant to buy a very expensive chair. While shopping around, I came across another brand Aster, which exclusively makes chairs. I visited their showroom and found their products to be of decent quality. One of their models, Icon High Back, was very similar to Featherlite Optima model. The finish and the quality obviously were not as good as Featherlite Optima but at less than half the price, it seemed like a pretty good deal. I have been using this chair for a couple of weeks as well and so far have no major complaints.

    Aster Chair, Icon High Back Model

    A chair and a desk are few of the things on which you spend a lot of time in a day. I definitely think that any investment in these two is worth it and I help my article will encourage you to invest in having a more ergonomic work environment.

  • Roopkund Trek – Summing up my experience

    This post is part of Roopkund Trek – An unforgettable adventure!. The previous article in the series is Arriving at Hyderabad.

    Some of the key learnings for me from the trek were:

    • Exercise and be physically fit before your trek. People often underestimate the level of fitness required for trekking. A good target for a medium-difficult trek such as Roopkund would be to jog 4 km in 30 mins or brisk walk 5 km in 45 mins (or equivalent aerobic exercises). Equally important is that you focus on stretching so that your body is flexible.
    • Give time to break in new shoes. Don’t buy them at the last minute and directly start trekking.
    • Don’t rely on a poncho. When it rains, it rains pretty bad and having a raincoat is much better.
    • Keep yourself hydrated. It is recommended to drink at least 4-5 litres of water while trekking.
    • Keep measuring your oxygen levels and pulse using an oximeter. If your oxygen levels are falling, you should consider going on a course of Diamox.
    • Be ready for unexpected events. Not everything might go as planned and accept it. This is the whole point of the trek.
    • When trekking with a larger group, you will have to maintain some average pace. If you want to do it at your own pace (either slower or faster), then you can consider forming a private group with a private guide.
    • Indiahikes makes your trek safe and comfortable, to an extent where you feel part of a family. I would highly recommend it.

    So, what about the experience of going on a holiday all by oneself? Well, there are two things here: one is going on a holiday alone and the second being trekking solo. Frankly speaking, considering that I have always been with a group except for my flight to-and-fro from my hometown, it didn’t feel like I was travelling alone. However, at times, it did feel that travelling with a known group of friends or family, would have been much more fun. Trekking solo, however, is a completely different experience, something which I don’t think I want to do anytime soon!

    About two years ago, I had done the Valley of flowers trek and also went on my first international holiday to Thailand. I’ve always been wanting to blog about them but somehow never did it and have completely stopped blogging. With the Roopkund trek blog, I hope to restart blogging and blog more frequently going ahead!

  • Roopkund Trek – Day 9: Driving back to Kathgodam and heading for home

    This post is part of Roopkund Trek – An unforgettable adventure!. The previous article in the series is Day 8: Return to basecamp Lohajung.

    The descent continued the next day, although, this time it was by vehicle and no longer by foot. At this point, group members began to split. Kapil, along with his buddies, decided to leave the earlier day itself. Others decided to proceed to their own destinations. However, a majority of us, including me, decided to head to Kahtgodam and catch the train to Delhi.

    As we descended, we could see the clouds float in the air. And as we began to gain lower altitude, we came across wide paddy fields. At this point, the heart really feels like quitting the city life and to relocate to the mountains.

    After a long 11 hour journey, including a stop at a restaurant for lunch, we reached Kahtgodam. We had a dinner at a restaurant, which was run by the brother-in-law of one of the group members. Post dinner, we boarded the train for an overnight journey to Delhi.

    Go on to the next article in the series: Arriving at Hyderabad.

  • Roopkund Trek – Arriving at Hyderabad

    This post is part of Roopkund Trek – An unforgettable adventure!. The previous article in the series is Day 9: Driving back to Kathgodam and heading for home.

    We reached Delhi railway station before sunrise. Having a flight to catch in a few hours, I headed to the airport with few other trek mates who had a flight to catch as well.

    Upon reaching the airport, I had a quick breakfast at the Domestic Lounge and hoped on to the flight to Hyderabad. As I flew through the clouds, I recollected about the events in the past few days and how true what Shivam, our trek lead said was – “When we have a lot of new experiences, time feels to slow down”. And the last one week certainly felt a whole longer. I think it was also a moment of realization that I need to focus on having more newer experiences to continue to keep me motivated and energetic in life.

    After a couple of hours, I finally landed in my hometown, Hyderabad and was back with my wife and kid.

    Go on to the next article in the series: Summing up my experience

  • Roopkund Trek – Day 8: Return to basecamp Lohajung

    This post is part of Roopkund Trek – An unforgettable adventure!. The previous article in the series is Day 7: An attempt to reach Roopkund and down to Bedni Bugyal.

    And, our prayers finally seem to be answered. We got up to realize that the rains had finally stopped after three days and the skies were clear. Not wanting to lose any time, we had a quick breakfast and began our descent to Wan. As mentioned earlier, our base camp, Lohajung was a 1-hour drive from Wan.

    Having trekked in the rain for two consecutive days, the descent now felt pretty pleasant. The clear views of the mountains were a treat to the eyes compared to the fog that covered them during the past couple of days. We reached Wan after a few hours, where vehicles were readily waiting to take us to our base camp, Lohajung.

    Upon reaching Lohajung, we got into our rooms and settled down. I realized that this was actually the first time after 7 days that I stepped into a concrete building.

    Post dinner, we returned some of the things that Indiahikes had provided us and then had a quick debrief. All the trekkers shared their individual experiences and what their takeaways were from the trek. Our trek lead, Shivam, too shared his experiences. Among the many points he shared, three of them have definitely stuck in my mind.

    The first thing he told us is that although none of us made it to Roopkund, the weather conditions under which we trekked was much more difficult compared to the ascent to Roopkund under normal weather conditions. He went on to say that the unexpected harsh weather was what made the trek so much more interesting and that the next time when we’d do a trek which is predictable, this element of adventure will be missed.

    The second thing he told us is what another trek lead told us at Bhagwabhasa. Doing a trek with IndiaHikes is pretty comfortable but for a truly enriching experience, one must do a solo-trek. A solo-trek helps a person see life differently. When he said this, I sure decided to do a solo-trip, at least if not solo, maybe with a couple of friends and a personal guide.

    And finally, he told us that for him, these treks were mainly about human connections. The greenery, the waterfalls and the mountains all become routine once you being to live in them but it is for the new connections that he finds his job as a trek lead so exciting!

    That was indeed some good takeaways, something which I’ll definitely remember. For me, the fact that we faced adverse conditions and were able to embrace and overcome it successfully defined the true human spirit!

    Finally, as a memento, we were given a certificate and had the option of buying a shirt mentiong that we had been on the Roopkund high altitude trek.

    Go on to the next article in the series: Day 9: Driving back to Kathgodam and heading for home.