My dalliance with Gentoo Linux

January 19, 2006
I am a self confessed Linux addict. Seriously, I just love to try out new Linux distributions and see how they fare against one another. Now this addiction of mine has got its own advantages. For example, it gives me a fair idea about the pros and cons of each distribution, its weaknesses and strengths. And this experience form a basis on which I decide which should be my dominant distribution at any given time. Not surprisingly, I have reserved a ext3 partition of 6 GB size, specifically for installing and trying out new Linux distributions on my machine.

For quite some time now, I had wanted to install and try out Gentoo. But the experiences of other people showed that I should perhaps start installing it when I have at least a few days to myself. So the weekend prior to last when I got a few days off, it was Gentoo's chance for getting installed on this partition I talked about earlier.

I dutifully downloaded the ISO image for Gentoo. Actually, Gentoo is all about choice and even for downloading it, the user is faced with choices. I found that, broadly speaking, I had a choice of downloading the Universal installation ISO which included all that was needed to get a workable Gentoo on your hard disk like the stage 3 files (I will come back to it later), the source code for extra applications as well as the Gentoo hand book which is a must read if you are to install Gentoo on your machine.

Alternatively, you could also download the minimal installation ISO image which will only configure your network for you and allow you to connect to the internet from where, you will have to download the additional files including the stage 3 tar balls. The second option is better if you have a broadband internet connection of 512 kpbs or more because then you get the latest versions of packages. But since I had less than the 512 Kpbs line, I chose to download the universal installation ISO image and burn it to the CD.

Next I booted my machine using the Gentoo Universal CD and Gentoo automatically detected all the hardware like sound, PCI slots, USB and so on and put me in the root shell.

From here it was a matter of opening the Gentoo Handbook in links (a web browser) on one of the terminals and carrying out the tasks listed in the book on the other terminal. I had around 5 terminals at my disposal and I could easily switch from one terminal to the other using the [Alt+Fn] Key combination.

A word about stages in Gentoo
There are three stages in Gentoo. They are as follows:
  1. Stage 1 : In this stage the system must be bootstrapped and the compilers and essential libraries need to be compiled first from the source.
  2. Stage 2 : In a stage 2 tar ball, the system has already been bootstrapped for you, but you still have to compile all the packages from source.
  3. Stage 3 : A stage 3 tar ball contains all the essential files like compilers and libraries in a binary format. When you are installing Gentoo on your machine, it is recommended to use the stage 3 tar ball unless you have a lot of time to kill on your hands. The advantage of using stage 3 is that the user is saved from the mundane tasks of starting from the very beginning.
Gentoo uses Portage to install software
Each Linux distribution out there has adopted one or the other form of automation for installing packages on an end user's system. If Red Hat has adopted Yum, Debian based distros swear by apt-get.

Gentoo also has developed its own way of automating the whole task. And that is using portage. Portage is a python based package management system similar to those found in FreeBSD which downloads the source of a software and compiles them on the end user's machine. So suppose, I want to install abiword on my machine running Gentoo, I can achieve it through just one command - that is :
# emerge abiword
The emerge script will download the source of the Abiword package along with the source of any other dependency packages to my machine, compile it using the parameters I have opted for and install it on my machine. It is as simple as that.

I will not go into the exact steps I took in installing Gentoo on my machine. The best and the right place for that would be the Official Gentoo Handbook which has done an excellent job of detailing in a simple manner, the steps to be taken in installing this fine distribution . Any way, if you intend to install Gentoo on your machine, you will compulsorily have to read the book at least once so there is no point in detailing the steps here.

Gentoo makes heavy use of environment variables. One environment variable you can be sure of dealing with is the USE variable. I found the use of this variable really unique and useful (no pun intended). Another environment variable I had to set was the CFLAGS variable which specified the architecture and processor make of my machine.

For example, there are a lot of GPLed libraries like gtk, gtk2, qt and so on. If I do not intend to install KDE applications or KDE desktop on my machine, I can easily disable the support for Qt library in my programs at the time of compilation. This I accomplish using the USE variable.
# USE="-qt gnome gtk gtk2" emerge abiword
... will download the source and compile abiword on my machine without any support for Qt but with support included for gnome, gtk and gtk2 libraries.

The environment variables are usually inserted one per line in the /etc/make.conf file. But as far as USE variable is concerned, you can also pass values at the time of emerging as shown in the above example.

Gentoo helps understand Linux better
One thing I found unique to Gentoo was the knowledge gained by the user in the process of installing it on the hard disk. And if you are an experienced Linux user / administrator, it will be a revision time well spent. Some of the things you will understand more are as follows:
  • Partitioning the hard disk using fdisk utility.
  • Creating file system of ones choice on the partition.
  • Turning on swap using the swapon command.
  • Mounting the partitions on to a mount point (/mnt/gentoo in my case)
  • chrooting to a directory or partition
  • Configuring the kernel parameters and compiling and installing the kernel the old fashioned way (If you are not opting for the stock genkernel that is).
Advantages of Gentoo
  • After all this trouble, what you get is a Linux distribution which is tailor made for your machine, blazing fast, with just the packages you need devoid of unnecessary baggage. In fact, if you can correlate other Linux distributions to a Honda motorcycle, ie rolled out from a factory assembly line, all looking and working alike, then Gentoo is a Harley Davidson of Linux distributions; no two installs identical to each other.
  • Another advantage for Gentoo is a very strong user community with prompt help support.
The down side of installing Gentoo
  • Unlike other distributions, it takes a lot of time for installing gentoo on the machine. In my case it took a larger part of 4 days to finish installing gentoo with X and the applications I needed. Coming back to our bike analogy, same way as a Harley Davidson bike is a fuel guzzler, Gentoo is a time guzzler.
  • To successfully install Gentoo on your machine, at some point of time, an internet connection is mandatory.
  • Finally, you should stock yourselves with a large dose of patience.
A suggestion to the developers of Gentoo
One thing which grabbed my attention was the inordinate time it took to download and install software on the machine. This is especially evident when there are dependency packages to be installed. For example, when I gave the command:
# emerge kde-base/kgoldrunner
It started downloading the first package, unpacking it in a directory and compiling and installing it. Then downloading the second package, unpacking,compiling and installing it and so on. In fact it was a download - compile - install - download - compile - install cycle.

The down side of following this cycle is your internet connection should be maintained at all times till the installation of all the packages are completed.

I feel it would be better if the emerge script is tuned to download all the package sources including the dependencies first at a single stretch and then, start the compile and install process. This way, once the download is complete, the internet connection is not important any more and even if the internet goes down, it will not hamper the installation in any way.

40 comments:

  • You can of course get around the download-compile-install-download.. cycle e.g:

    emerge --fetchonly kde-base/kgoldrunner
    emerge kde-base/kgoldrunner

  • Ravi

    @anonymous
    Thanks for that tip. I started using Gentoo just a few weeks back. so I was not aware of the --fetchonly flag.

  • I had always wanted to install and try out Gentoo. But since I do not have a broad band internet connection, I am put off from installing it.

    But a nice review all the same.

  • If you do not have a broadband connection at home, but have access to one at another location (e.g work), check out this web page:

    http://gentoo-wiki.com/TIP_Downloading_distfiles_on_another_machine

    I used to do this with my gentoo/modem machine at home, and it worked fine. I love gentoo, and I can notice the difference in speed between my gentoo machine at home and my (faster) Red Hat machine at work. But it does take time and patience to install and update.

  • Better than --fetchonly would be if the emerge script would download a package, start compiling that package, and continue downloading the rest of the dependencies in another process while the first package was compiling. By the time the first package was done compiling, the next one would either be ready to unpackage and compile, or at least be that much closer to being downloaded.

  • Nice review, just must warn you about those USE flags. In general it's not recommended to set them before emerge like in your example, for that you have /etc/portage/package.use file, where you can set USE flag for each package if you dont like global settings from make.conf. In /etc/portage you can also set keywords (in package.keywords) for each package, mask or unmask specific problematic package (package.mask etc.) and so on. So if you update your system with #emerge --update world portage dosent overwrite your USE settings for those packages. It's all in portage man page. I hope you will have a lot of fun with Gentoo :)

  • Is Gentoo fast simply because you have to build it from the ground up? Or are there other things unique to Gentoo which make it fast? For example, I could build a SuSE system from the kernel up to make it faster. Would Gentoo still be faster?

  • ferringb

    FEATURES="parallel-fetch" is what you're looking for offhand.

    Exists only in the 2.1* releases in the tree (none stable yet), but it'll be available in a stabled release sometime in the near future.

    Alternatively, either can raid the 2.0 patch for it from my devspace, or do
    (emerge -f target &); emerge target

    as a hackish equivalent- that method has been supported since 2.0.51_pre14 offhand.

  • alucardX

    Great review, I like Gentoo and I have it in all machines from $HOME and $WORK :-)

    I have tried RH,FC and Debian (Debian in use for a six years ago) but I swith to Gentoo in 2004 forever. It's the most exciting Linux OS since Slackware :-)

    Cheers from Bilbao, Basque Country

    alucardX

  • Some points to note.

    Gentoo is fast because of proper customization, if a rookie tweaks a Harley, it would bring down performance, same with gentoo. Do bad optimzations, it will not be fast. SuSE and other distributions have this advnatge of basic tweaking. Some simple things to speed up SuSE include recompile and install custom kernel, shutdown unneccessary services.

    You could compile SuSE from ground up from sources, but it would be useless. Another system that does the same is LFS (Linux From Scratch) which is the best distro to do things and will take you 7 days to install. Gentoo has more automation and thus speeds up things. Especially portage, which is the best package management tool. I like my mplayer to support every codec, use ASCII , gif jpeg as output etc. I can't do that with any other distro. As ravi said, the downside is time.

    Fortunately there is a solution. People with same architecture and USE Flags can share binary gentoo packages. I used to do that to speed up gentoo installs. I installed, whole gentoo from stage up in 4 hours this way. It also comes in handy should I need to reinstall my system (happened only when I had to shift to a new hard disk, since gentoo has seamless upgrades).

    I recommended n00bs to install linux from stage 3 using both the universal and package install CDs. If none of the USE flags are modified, gentoo can be installed in 2-4 hrs without any network connection depending on familiarity with linux and some understanding of gentoo. After your PC is up start a stage 3/1 install from gentoo-wiki.com

    Like anon above, those with slow internet connections are advised to install packages this way.

    emerge -f package && emerge -b package

    the -b option is to build binary package, for use later.

    Lastly, use gentoo powerfully, run KDE with all options, it rocks and performance is dynamite. Make sure to use good CFLAGS to compile.

  • Yeah! Gentoo Linux is my workhorse of choice. I have tried RH, PLD, MDK and many others. But switching to Gentoo 2004 on my old Athlon-XP box gave me what I always wanted. No more unressolved deps, no more broken installs, and speed... Oh yeah! Gentoo is like NOS to your car engine :)
    Cheers from Poland
    Martin.K - emerged by Gentoo :)

  • If you don't want to take the time to compile packages, use a BINHOST.

  • I just emerged thunderbird and read this blog.... it is my first time on gentoo i i had no problems installing it. there is plenty of documentation on wiki and on the gentoo forums for almost every need, far better than with any other distro. i tried suse, kubuntu and some others, but there were always problems with installing this and that but now, using almost only the stable releases (not masked by ~x86), there were no problems at all. until now i had only one problem with my ipod shuffle and udev, but that was solved by revdep-rebuild and one hour of recompiling... but true, patience is needed.

  • Christopher T

    I think the one of very few distros that is comparable to Gentoo in speed is Arch Linux (http://www.archlinux.org). It's a i686 optimized package based distro (as oposite to source based as Gentoo). Where Gentoo has portage/emerge Arch has pacman. Just wanted to mention Arch as an alternative for those who don't want to spend hours compiling, while still have a pretty fast, optimized, customized system :)

  • Donald

    wow i was already considering going for a Gentoo installation.. this review deffinitly encouraged me.. (As suprising as this is, Slackware is bisbehaving on my machine, plus I'm looking to learn as much as possible (which means gentoo or LFS) )

  • easier way to do it :)

    emerge -afv "package_name" && emerge -v "package_name"

    substitute the package_name part with anything you want to emerge...

    plus, read the wiki, its a great place to just learn how to mess around with stuff...

    one thing many people will like is the compiler cache thing...its very handy, plus actually enabling a few use flags gets you better compilation performance...

    as always, the official docs + wiki + #gentoo @ freenode = 1337ness :)

    -cyanide

  • If you don't have broadband or don't want to spend so much time installing Gentoo. Do what I do . Gentoo based distro(S)

    Phaeronix, VLOS, Kororaa

    found in distrowatch

    ALso another gentoo install method for eager learners "Conrad" found in irc.freenode.net #conrad, for Phaeronix irc.freenode.net #phaeronix

    Yay!

  • Ravi, thanks for this review of gentoo. This is a well balanced review of Gentoo you have written. But I have a question though.
    I have installed Gentoo on my machine. But when I do an emerge of firefox, I get only the firefox 1.09 version. Is there any way to install the latest firefox 1.5 version in Gentoo ?

  • I have a simple doubt. Will gentoo run on old hardware? I have heard that it takes a long time to compile softwares including kernel on old hardware. I am talking about celeron 1Ghz, 64MB RAM machines. Some help would be appreciated.

    Skuller
    Washington DC

  • > # emerge kde-base/kgoldrunner
    >
    >It started downloading the first package, >unpacking it in a directory and compiling and >installing it. Then downloading the second >package, unpacking,compiling and installing it >and so on. In fact it was a download - compile >- install - download - compile - install >cycle.

    There will be sth like background download in portage-2.1 so there is nothing to be fear about :)

    One more thing. In Gentoo we uses cfdisk more then fdisk :)

    I hope that you really enjoyed using Gentoo :)


    --
    Damian "thunder" Florczyk
    Gentoo/NetBSD Development Lead

  • One very important thin about gentoo is, that there aren't real releases. If you do an emerge -u world you get a up to date Gentoo.

    Gettinf firefox 1.5 for gentoo is quite simple. Check which versions are in portage (go to /usr/portage.... or check on packages.gentoo.org or ....). Then go to /etc/portage and make an entry in package.keywords. I think it was something like
    =mozilla-firefox-1.5-r9 ~x86


    So you can decide on packagelevel if you wan't to use the stable package or not. You can even freeze a package to an older version.

  • For people having trouble configuring their USE or FEATURE flags, I suggest Sourcemage Linux. It's a small distribution with a ncurses interface for the configuration.

    It also features background downloading and offers cvs versions for xorg, firefox, e17, etc... with automatic update. It uses only official versions of the softwares, with packages downloaded on their respective official sites.

    It's my distribution of choice after having problems with Gentoo amd64 and masked packages

    The only drawback I have found is the relative lack of packages

  • I suggest a full gentoo stage 1 install for anyone who thinks they might want to be a linux systems administrator just for the experience they will gain.

    When I first installed gentoo years ago, I learned a ton about the linux internals and how things fit together. Although I'm not a fan of gentoo for day to day stuff (takes to long to compile everything short of setting up a distcc cluster), it's a great learning experience. Everyone should try gentoo at least once.

  • You don't have to compile everyday ;)

    And apart from the initial time it takes to set up a Gentoo Desktop System, nothing takes a long time. You don't have to do a emerge --sync everyday. Nor emerge --deep --newuse --update world everyday.

    Do it once a week or even less often, and stick to upgrading when security fixes are released.

    Some people even do an glsa-check and only compile when there's a security fix.

  • I didn't have to recompile the whole system when upgrading GCC. It's the safest path but not at all necessary.

    This link gives a few details about upgrading GCC.
    http://www.gentoo.org/doc/en/gcc-upgrading.xml

  • Ravi

    I have heard that it takes a long time to compile softwares including kernel on old hardware. I am talking about celeron 1Ghz, 64MB RAM machines.

    Skuller, perhaps you should pose this question at the Gentoo forum. My belief is that it is doable. But it will take a long time to compile the packages. For example, I have a Celeron 333MHz machine with 98MB RAM. To compile the kernel (not gentoo) on this machine, it took 30 minutes. So if you are compiling say KDE, it might take days.

  • Dgn

    Ive been running Gentoo for years (I tried slack for a bit, but Im on gentoo again) & I love it

    I now run it on about the machine Skuller described.. (slightly less cpu, double the ram) & altough it does indeed take some patience to compile everything it IS doable! Some packages do take long (X, KDE, Openoffice .. several days) but in the end, its not like you have to click or type, so you can just let it sit (& if you use a screen session - I advise this to everyone - you wont even loose a terminal to it!)
    I had it on during a week for a full emerge world (250 pkgs, including OpenOffice) and never stopped using it, only noticing minor discomfort. (I use it as a fileserver and desktop. No monitor, mouse, keyb.. , all trough samba, ssh & vnc)

    So Yes, given patience, Gentoo will do fine on older hardware! (even older than the box you re thinking about)


    Nice review :) I didnt even realise that most linux users are alien to chroot, swapon and the other things you mentioned in the Pros..
    Tnx!

  • I installed gentoo on a 300Mhz. It took for ever to compile everything. Also, did a recompile of the whole system. (emerge -u world or whatever) and it took the better part of 5 days to compile

  • In the past I've usually put the harddrive from my slow machine in a new machine. Loaded the LiveCD and done the Gentoo install to the second harddrive. Once it's finished pop the drive out and boot your slow machine. I usually end up boot the LiveCD again on the slow machine to fix something I missed in kernel parameters or grub, but the install is done in afew hours.

    kashani

  • Donnie Berkholz

    If you're impatient about the install time, you can use GRP (binary packages for use in installing). Also, there's a GUI installer available. See http://www.gentoo.org/proj/en/releng/installer/.

  • For those who are looking all this over, and want to try the other side of the coin, where no hard drive installation is done at all in linux, Check out my Getting started guide to my livecd knoppix remaster.
    If you ever had a big hard drive go bad on you, and lost all your installs (I have), then you will want to go the LiveCD route, especially if you must keep on working, and cannot have equipment related downtime. One thing I notice when running linux this way is that the hard drive does not work nearly as hard, sometimes going for quite a while without any activity. Try that with windows 98! I experience something like 10% of the windows activity running linux, maybe even less. So if you don't have a lot of time to spend on a hard disk install, give it a try.
    RapidWeather

  • I am a gentoo user (a newbie really). And I find that each time I boot into gentoo, I have to explicitly turn on the networking using the command :

    # dhcpcd eth0

    Is there any work around for this ? My IP card gets address via DHCP.

    I will be happy for some pointers.

    John
    New Jersey

  • Dgn

    if I am not mistaken, you should configure your network to use DHCP in the *ehrm* /etc/conf.d/net file by adding (go trough the file, youll see it somewhere, read the text..) config_eth0=("dhcp")

    This might do the trick, tough I'm not entirely sure..

    And if its not correct .. ehrm .. sorry .. eehrm.. & I'm sure somebody else will be able to come up with a better answer :)

  • You then will probably have to add net.eth0 to the default runlevel. Do this with rc-update add net.eth0 default

  • The virtues of Gentoo are undeniable, but I found that it needs plenty of disk space to complete an installation. I tried it on a Pentium 1 with 32 MB of RAM and 2 GB of disk space. After 30 hours of non-stop compiling, it had nearly finished the base installation, when the disk filled up and brought the job to a halt. Unlike a binary distro, Gentoo needs space for all the source code and a lot of work in progress, besides the installed code itself. There's probably a way to cross-compile binary packages on a bigger machine, but these days I run Debian on my oldest and smallest hosts. It's the only other up-to-date distro I know that doesn't demand a bootable CD drive and X Windows just to perform the installation.

  • Tried debian, slack, gentoo, arch...
    gentoo + arch were the fastest.
    slack was good.
    debian is just so slow.

    I found arch to be better for desktops and day-today use becuase they is virtually no diffrence in speed between it and gentoo and there are no compile times. It is also very fast to install, incase somthing goes wrong. I use gentoo on my server, which I dont ever touch/update. People using gentoo on their desktop may want to try arch, belive me, their isnt a noticable diffrence in speed.

  • prakash

    Hey author of this blog!ur blog is really helpful!
    Will you update this gentoo article please?already gentoo2008 livecd is released(beta).
    thanks!

  • Prakash J K

    I am very much thankful for your intro to Gentoo.
    your blog too is very interesting.
    I will like to see you update this gentoo article covering USE= flags and other optimization options.
    as the livecd installer are buggy(both cli and gui),ppl still *may* prefer installing everything manually.
    do cover this with a updated article.
    Thank You! :)

  • a real nice blog!

    just started to install 2 hours ago - using a macbook core2duo 2ghz cpu and 2gb ram

    ... waiting waiting waiting :)

    anybody got an idea how long it will take?
    (incl. gnome openoffice)

    greetz, chris

  • Philip

    I installed Gentoo from the Stage3 tarball and used genkernel to compile the kernel for me, though later I rebuilt it to reduce the size and support my graphics card. The install took five hours on my little Gateway solo 1450. 1.33GHz processor and 256MB RAM. The laptop had to have the charger on the whole time and it got so hot my fingers sweated from touching the keyboard! Gentoo is nice, but it takes so long to install software. I may end up sticking with Arch.