Linux has been around for 25 years now. I started using it as my main OS around 2 years back (was quite young then and n00bish). I did not care to learn much about it, I just used it to do my homework and some personal stuff. Not long ago I decided to switch to ArchLinux from Ubuntu Mate. I started getting into hacking, and installing tools wasn’t that easy for me on Ubuntu (well it is, but i did not understand much then, and yeah, i went through the katoolin nightmare). The switch was also because I used to visit #archlinux too often just to see what linux guys talk about. I was very excited and I did the install by following the wiki. I was expecting to see some Display Manager for my password prompt and instead, i got a tty. Well, I thought it must be some minimal login manager, so I continued. Now, i was dropped to the bash shell. I was like “u w0t m8!?!?”. Where’s the applications panel? Where’s the GUI stuff? What the f*ck is this? It did not take me long to realise that what I had just installed is a minimal distro. You gotta start from the base up and configure the system. Arch helped me learn a lot, atleast about the things in user-land. I now understood what linux was actually like, and Arch helped me have a taste of the KISS philosophy. I’d recommend beginners to start with Arch. Yes, I agree there’s a high chance you’ll screw things up, but Ubuntu just ruins you. If you want to learn what linux is like, use something that requires you to do things yourself. However, this is my personal opinion. Arch pushes you to learn stuff. Ofcourse you can go back to other distros rather than take the hassle of maintaining your system once you’re comfortable with things.
Then around October, I started getting bored of Arch, although I still had not gone into much details. I started looking for a distribution that was harder at me. Something that punished me more for my mistakes. Gentoo was the thing I was looking for (although I did the install with a single shot, I do keep lying that it took me 4 hrs. It took me a complete day to understand what each step of the install procedure did). Well, I was looking to try LFS and I am 100% sure I can do it, I am afraid using it as my daily distro would not be possible. Also, I dont have much time till April now. LFS demands a lot of time to get things in order. Some people using LFS don’t even install a package manager and rebuild everything once an update comes out. Gentoo is really a convenient way to do something like LFS. It’s LFS made easy. And if you do the Gentoo install with allnoconfig (no defaults preselected for the kernel, i did that) and take the manual route of doing things, you’re pretty much doing LFS. I personally dont feel much difference. Though I’ll be trying it atleast once as soon as I get some time. I might do a post on my experience as well. No promises though.
Much being said, that was all about how I got into things. I wanted to share this with the community.
One thing that I do want to point out is with linux, you gotta have your own opinion, and the best way is to try out things yourself. You’ll hear some saying Gentoo is a complete waste of time, from, say, Debian users (and windows users, ofcourse). Now this might be a conclusion from someone who has not even booted the Gentoo live CD, or someone who is experienced enough and Gentoo makes things difficult for his work. Some people don’t really want a source- based distro and that’s alright. This is something I realised very recently. Vim vs Emacs vs Nano (lol nano, it shouldn’t even be here without -w), Intel vs AT&T, Linux vs Windows, Nvidia vs AMD, systemd vs OpenRC, and the list goes on. There are a number of factors affecting someone’s opinion. It’s always nice to hear about what someone thinks of something, because then you get to know what made them arrive at that conclusion, but your opinion is yours, you don’t need to be necessarily affected by someone else’s. This is really weird as its coming from me, but in the end, I realised it.
Alright, let’s go on to understand what Gentoo is and why I feel its such a great distro.
Gentoo Linux was initially created by Daniel Robbins as the Enoch Linux distribution (Dec 1999). The goal was to create a distribution without precompiled binaries that was tuned to the hardware and only included required programs.
Gentoo appeals to Linux users who want full control of the software that is installed and running on their computer. People who are prepared to invest the time required to configure and tune a Gentoo system can build very efficient desktops and servers. Gentoo encourages users to build a Linux kernel tailored to their particular hardware. It allows very fine control of which services are installed and running; also, memory usage can be reduced, compared to other distributions, by omitting unnecessary kernel features and services.
Alright, so you now know that Gentoo allows you to have a lot of control over how your system works and behaves.
1. The Kernel
You get to customize your kernel, omitting features that you don’t want. You’ll probably never use ReiserFS or you don’t really need support for an Nvidia card. Other distributions have a kernel built to satisfy most of the machines, and they include support for things you’ll never even use. This is why Arch & Debian work out-of-the-box on all machines, because the kernel includes support for most hardware. With Gentoo, you only include the things you need. Things like genkernel which automatically build a kernel for you still include a lot of unnecessary options, and leave out some important ones. You’re advised to start with allnoconfig, which sets all kernel option to no, and then select and review each option to build a lightweight, custom and tailor-made kernel just for your machine. This will surely require more time and effort. You can also skip this configuration part for now and do it later after installing the system. You can always reconfigure it and rebuild it. Instead of using genkernel, we can also manually build the kernel and its modules and install it. Also, until you’re working with RAID and/or LVM, you dont really need an initramfs. The advantage with doing a custom build is that the speed of your system increases, you have a lightweight kernel, and you know the ins and outs of your system. As far as kernel modules are concerned, this is not a thing to worry about. Things like drivers and firmware should be built as modules, since you’ll need to reload them often and making them built-in and rebooting every time isn’t really a smart choice. Though things like your GPU drivers can be built-in, it really comes down to what you want in your robust custom kernel and what you want outside of it. I do know that you can do custom kernel builds on other distros as well, but you’re going out of your way then. It’s better to do smart work than hard work everytime.
As some of you might already know, systemd isn’t the only init option on linux. There’s this homebrewed init by the Gentoo Devs called OpenRC. Although its based on the traditional inits we all have been working with in the past, its pretty robust and simple to use. Also, the boot time isn’t as bad as people think, and its even better with parallel init enabled, as in systemd. Gentoo supports both systemd and OpenRC. It’s no big deal, and the some of the Gentoo Devs use systemd too. It really comes down to personal preference. Now, to understand the difference between the two, you have to know why OpenRC isn’t systemd. systemd isn’t just an init but has support for a journal daemon (which stores logs in binary form, which has been criticised by Linus himself, and hence no grepping and parsing logs with systemd), a login daemon, an init, and other small things here and there. It has a support for a lot of things, going as far as a boot graph generator. OpenRC is simply an init. It divides services into different runlevels, the boot services like udev etc go into the boot or sysinit runlevel, the user services in the default runlevel, and the stopping of services and preparing for shutdown goes into the shutdown runlevel. Pretty straightforward eh? Also, the systemd infrastructure isnt as easy to understand. Its a lot more complex. If you’re beginner, you ought to get a taste of traditional init and you must go with OpenRC. You do need a system logger (sysklogd works out-of-the-box, syslog-ng is highly customisable, can send your logs to a server if configured to, and its my choice, metalog is also another good choice). Having a cron daemon with logrotate as a cronjob is another good option, to flush out the old logs and keep things clean. I hope I don’t start a flamewar with this, but I prefer OpenRC for its simplicity.
3. It’s source based and it has USE flags
Heh, now you must be thinking is that all Gentoo is about? Nope. The next big thing about Gentoo is that it’s a source based distro, though not completely ending support for binaries. You have the choice of building your programs from source, or downloading binaries (this is done for really huge programs). Building from source is sensical, because then you get another customization option, and i.e USE flags. Let’s take an example of a program which has support for sound, video, systemd, a gtk interface and a qt interface by default. On other distros, all these features will be packaged in the binary you download. With Gentoo, if you dont have the systemd and qt USE flags, your package comes with only sound, video, and gtk support. This also minimises the number of dependencies and hence your package is smaller. You only get what you want! You don’t need GUI support for a package on your server! This also tells us the fact that since there is a lot of customisation involved, no two Gentoo systems are the same. That has a lot of things to say.
4. Few other things here and there
There is this concept of profiles on Gentoo. Each profile brings with it some default USE flags for package support. There is a systemd profile if you want to go that way. There is a kde profile if you’re installing kde. Theres a desktop/kde profile which includes extra support for X, sound, and media along with kde. There are some hardened profiles ad SELinux profiles as well. All in all, you have to determine the best profile for yourself and work on it. You can view what each USE flag is for on the main website. USE flags can be enabled manually as well after choosing a very minimal system profile.
The package management system used is called Portage. This includes emerge which is used to install packages and build them with specific USE flags. There is a make.conf file as well where you can set some optimisation flags to make package building a faster and efficient process. I have -march=native for building packages exactly for my architecture and -j5 as my make option to use all my 4 cores.
Apart from this, there is a common set of files among all profiles, which are included in the stage3 tarball. This immensely reduces the amount of things required to install later and you get a base system right away to work with.
Once you’re done with the base installation, you are free to experiment and play around. Many people like to keep their system as minimal as possible. They use light apps. Others like to have a more rich desktop experience with full-fledged application support. I spend majority of my time in the tty and I don’t even bother starting X until I have to fire up qemu vms or do some other stuff. It’s totally up to you how you want your system to be. Though one thing is true for sure, Gentoo surely depicts the fastest swimming Gentoo Penguin, because after all this trimming down, your machine would surely achieve more speed and performance, and not to mention the knowledge you gain from this experience and the control you have on your system now. You know exactly what you’re doing.
I am really looking forward to what others think, especially on subjects like init and custom kernels. I’ll be really happy to hear from y’all. Also, throw all your questions at me regarding this article.
Proudly sponsored by Schmoe Inc.