My Switch to Gentoo

August 29th, 2021

Anyone that knows me knows that I really, really like to distrohop. I decided to install Gentoo on a whim. I had a weekend to spare and I had been wanting to try it for a while, and now that I had 16 gigs of ram, compiling wouldn't be an issue, so why not?

How it Started

I installed Gentoo using a System Rescue CD with a graphical environment (mainly so I could watch videos and read the handbook while going through the process). Some like to SSH into their livecd and install Gentoo that way, but I never really enjoyed doing that. I prefer to actually be interacting with the computer I'm installing an operating system onto directly rather than through SSH.

I began how I normally start any installation - I copied a few important files from my old partition to my external hard drive and ran mkfs.ext4 /dev/sdb1/. At that point there wasn't any going back. I won't go in depth on the installation process, just a standard Gentoo stage3 to tty install. I did have a few hiccups with my SCSI/IDE controller and some audio drivers but I managed to fix those with a few minutes of skimming ancient forum threads and the Gentoo wiki (how I typically fix issues).

The Struggle of Valgrind and -march=native

As the title suggests, things went fine (NVIDIA drivers, custom kernel, all drivers and software) except for my frustrating struggle with valgrind. Typically when faced with problems like these most people would give up, but I knew something simple was wrong. I searched and searched for the error message I had received. It read something along the lines of:

vex amd64->IR: unhandled instruction bytes: (blah blah blah)
vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0
==25745== valgrind: Unrecognised instruction at address 0x4019129.
==25745== at 0x4019129: get_common_indices.constprop.0 (in /lib64/
==25745== by 0x401A9A6: init_cpu_features.constprop.0 (in /lib64/
==25745== by 0x401BB35: _dl_sysdep_start (in /lib64/
==25745== by 0x4001FFE: _dl_start (in /lib64/
==25745== by 0x4001057: ??? (in /lib64/

This was annoying to say the least. For a person like me who writes in C a lot, and has a tendency to make stupid mistakes when allocating memory, not being able to use valgrind was definitely a problem. After searching for days I finally gave in and made a reddit post on r/Gentoo asking for help. Someone there with a beard much longer than mine pointed me to a page I had been searching for for a few days that listed CPUs from AMD and Intel and their respective -march options. I added a few C debug flags to my make.conf, and changed my -march to bdver2, the proper -march for an AMD FX-6300 (my CPU). I recompiled my entire system (ouch) and voilĂ , I had a working valgrind setup.

Why Gentoo?

I remember a few years ago when I first started getting into Linux, after my first time installing Manjaro as my main operating system. I was curious as to what the most complicated distro out there looked like (I'm aware of LFS, but LFS isn't really a distro) so I looked it up. I watched an hour long video of someone installing Gentoo and my mind was blown. I obviously had no idea how it worked or what any of it meant, but it still peaked my interest.

About a year down the road, I had been using Arch for a while, and Linux didn't really seem so complicated anymore. I knew how it worked, what the file structure meant, how to break and fix it, and I had become generally proficient. I enjoyed Arch, but I was started to get annoyed by systemd, and the more I read about it, the less I liked it. I wanted a lightweight system, and I felt like Arch pulled in so many different dependencies and that all the packages had a lot of things I didn't really need. I hopped back and forth between Debian and Arch for a few months, before finally revisiting Gentoo. I understood Linux well enough to know how Gentoo worked and the reason so many people talked about it.

While certainly not ideal for low spec machines, Gentoo allows those with decent hardware to build their own system exactly how they want to. I don't have a DVD drive, so why compile in support for it? I don't have an Intel CPU or a MIDI controller, so why build in support for them? Gentoo also just plain uses less RAM. I just feel like I have a more complete and personalized system, and to me that is what matters most.

Gentoo is certainly NOT for everyone, but for those who enjoy it, why not? It's certainly a fun distro to use. All that matters is that you're happy with your distro and your setup, and who is anyone else to tell you you're wrong for that? This is why I personally dislike distrowars within the Linux community, because one of the key benefits of Linux is choice, and who is anyone else to tell you what to use?