Gentoo Linux

I suspect Gentoo Linux is a complete mystery to most Linux users, let alone everyone else. It is a Linux distribution I would never recommend to a newcomer to Linux or to someone not used to the command line, as it requires a certain amount of experience and knowledge when something goes wrong. This is especially true for Gentoo’s Testing Branch. Take upgrading Gentoo Testing on my main laptop today as a good example of what I mean…

Unlike most Linux distributions, Gentoo is a ‘source distribution’, meaning that the software is compiled and installed on your machine from source code downloaded by Gentoo build scripts called ‘ebuilds’, not installed pre-compiled as in a ‘binary distribution’. Furthermore, Gentoo is a ‘rolling distribution’, meaning that you do not periodically install a new release of the operating system, you install it once via the Internet using a lengthy set of commands, and thereafter ‘roll’ it forward by upgrading the installed packages (one, or several at a time) ad infinitum as new versions are released. The upgrading of all installed packages on your machine to their latest versions is called a ‘world update’. For Gentoo Stable you would expect this to be straightforward and trouble-free, and usually it is. But problems are to be expected in the case of Gentoo Testing.

To illustrate the level of detail a user of Gentoo Testing may need to go into, I’ll talk you through what happened to me today when I upgraded the world on my main laptop. I will not explain precisely what each command does; I just want to illustrate the sort of troubleshooting a Gentoo user has to perform from time to time.

I kicked off the world upgrade:

# emerge --sync
# layman --sync-all
# emerge --update --verbose --deep --newuse --keep-going world

This upgraded several installed packages but the last package in the list to be upgraded, version 6.7.0 of a suite of tools named mkvtoolnix, failed to compile. The error message displayed in the terminal window left me none the wiser, so I surfed over to the Gentoo Bugzilla Web site and searched for bug reports on mkvtoolnix. I found Gentoo Bug No. 499332 (‘media-video/mkvtoolnix-6.7.0 should DEPEND on >=dev-lang/ruby-1.9′).

From the title of the bug report I knew I should have a look at the ebuild (an ‘ebuild’ is a script file that Gentoo uses to compile and install a package), so I searched for it on my laptop using the command:

# locate mkvtoolnix | grep 6.7.0.ebuild

which found the file /usr/portage/media-video/mkvtoolnix/mkvtoolnix-6.7.0.ebuild, so I used the text editor nano to look at the ebuild’s code and changed ‘dev-lang/ruby’ to ‘>=dev-lang/ruby-1.9′, then recreated the package manifest:

# cd /usr/portage/media-video/mkvtoolnix
# ebuild mkvtoolnix-6.7.0.ebuild manifest

Gentoo is ‘slotted’ (i.e. different versions of the same package can be installed), so I checked the currently selected version of Ruby:

# eselect ruby list
Available Ruby profiles:
[1] ruby18 (with Rubygems) *
[2] ruby19 (with Rubygems)
[3] ruby20 (with Rubygems)
[4] ruby21 (with Rubygems)

and changed it to be Ruby version 1.9 as follows:

# eselect ruby set 2
# eselect ruby list
Available Ruby profiles:
[1] ruby18 (with Rubygems)
[2] ruby19 (with Rubygems) *
[3] ruby20 (with Rubygems)
[4] ruby21 (with Rubygems)

Then I tried again to install the mkvtoolnix-6.7.0 package:

# emerge --oneshot --verbose mkvtoolnix

and this time it was built and installed without trouble.

Lastly, I used a Gentoo tool to check, and if necessary fix, dependencies:

# revdep-rebuild --ignore

The output from revdep-rebuild told me everything was fine, so revdep-rebuild did not need to rebuild any packages and I did not need to do anything further.

Actually, I probably could have skipped editing the mkvtoolnix ebuild and just selected Ruby 1.9 using the eselect tool before trying to re-install mkvtoolnix-6.7.0, but if mkvtoolnix depends on Ruby 1.9 or higher then the ebuild for Version 6.7.0 ought to be modified in any case.

If you have read down to here, perhaps now you can see why using Gentoo requires a fair amount of prior knowledge.

About these ads

About Fitzcarraldo
A Linux user with an interest in all things technical.

One Response to Gentoo Linux

  1. Anonymous says:

    And that’s an example of __wrong__ approach to coping with dependency problems — please state this with big red letters somewhere at the top of the post just in case someone else get here from Google output as I did.

    Portage (as a structure of .ebuild files comprising package database) is not intended to be modified locally. Doing so makes any troubleshooting and support almost impossible. And of course, all your changes will be obliviated on next ‘emerge –sync’.

    For custom ebuilds there’s such things as patches (http://wiki.gentoo.org/wiki//etc/portage/patches) and local overlays (http://wiki.gentoo.org/wiki/Overlay/Local_overlay).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 52 other followers

%d bloggers like this: