GentooLinux

From HerzbubeWiki
Jump to: navigation, search

Overview

The Gentoo Handbook is the ultimate source of information about Gentoo Linux. It is well written, up-to-date, and should be consulted as soon as you have your system up and running.


Installation Notes

Grub

See the GRUB manual for more information.

GRUB can natively boot into Linux, FreeBSD, NetBSD, OpenBSD and GNU Mach. It can also boot Windows by chain-loading the windows boot loader. Either way, the following things are required to make it work:

  • First, have a boot directory that contains GRUB's files
    • this directory is usually /boot/grub
    • often /boot is an entire small partition for itself
    • /boot/grub contains what is called GRUB's stage 1, stage 2 and stage1_5 files
  • Second, install GRUB into the MBR of a drive, or the boot sector of a partition
    • Fire up grub. It will show its command line interface
 # grub
    • Set the root device, i.e. the partition that contains the /boot directory
 grub> root(hd0,6)
    • Install GRUB into the MBR
 grub> setup(hd0)
  • Last, create the configuration file
    • the file is /boot/grub/grub.conf


stage1

The stage1 file is the file that is placed into the boot sector of a partition, or the MBR of a drive. stage1 is exactly 512 bytes in size, because this is the size of PC boot sectors. The purpose of stage1 is to load either stage1_5, or stage2. Because of the 512 byte size restriction, stage1 has no idea about file systems - it encodes the location of what it is supposed to load in some special format.

stage1_5

The purpose of the stage1_5 file is to load stage2, i.e. it is the bridge between stage1 and stage2. The stage1_5 file understands file systems, and for every file system that GRUB supports there is one stage1_5 file (e.g. e2fs_stage1_5, reiserfs_stage1_5, etc.). The stage1_5 file is bigger in size than stage1, but not as big as stage2.

stage2

The core image of GRUB.

Notes about Portage

To configure Portage, you usually make changes in /etc/make.conf.

By default, Portage uses wget (see wget manual) for downloading source code from the Internet. The Gentoo Handbook explains how to change this.


Proxy

To use a proxy with Portage you could set the HTTP_PROXY variable in /etc/make.conf. The syntax for an URL to include authentication, host and port is:

 http://username:password@proxy.company.com:8001/

A better approach would be to configure wget to work with your proxy. For a system-wide change, edit /etc/wget/wgetrc to include the following lines (replace username/password with real values). If you want the change to become active only for one user, add the lines to the user's ~/.wgetrc.

 http_proxy=http://212.94.36.117:80
  ftp_proxy=http://212.94.36.117:80
  proxy_user=<username>
  proxy_passwd=<password>


Gentoo Mirrors

See the Gentoo Handbook.

To select a Gentoo mirror, you can either manually edit /etc/make.conf and set the environment variable GENTOO_MIRRORS, or you can let mirrorselect do the work for you:

 emerge mirrorselect (if you haven't emerged it yet)
 mirrorselect -i

Upgrading the system

Most of the information in this chapter is described here: http://www.gentoo.org/doc/en/gentoo-upgrading.xml and http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1

The portage tree

The upgrade the portage tree in /usr/portage (i.e. the list of packages known to portage), there are several possibilities:

  • emerge --sync
  • emerge-webrsync (if you are behind a firewall and the previous command does not work)
  • do it manually, i.e. download and install an up-to-date snapshot of the portage tree
cd /tmp
wget http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/snapshots/portage-latest.tar.bz2
mkdir /usr/x
cd /usr/x
tar xfpvj /tmp/portage-latest.tar.bz2
chown -R root:root portage
mv portage ../portage-<yyyymmdd>
ln -sf portage-<yyyymmdd> portage


After the portage tree has been upgraded, you will probably want to build the newest software packages:

emerge --update --deep world

If you have also changed the USE flags, try this:

emerge --update --deep --newuse world


The profile

When you emerge a packet, after you have updated the portage package tree in /usr/portage, you may get the following warning:

!!! Your current profile is deprecated and not supported anymore.
!!! Please upgrade to the following profile if possible:
         default-linux/x86/2005.0

In order to perform the suggested upgrade, you have to do the following things:

emerge portage
cd /etc
rm make.profile
ln /s /usr/portage/profiles/default/linux/x86/<desired profile>

Usually you will want to use the newest profile available.

A new profile may come with a new set of default packages in the base system. When switching to a new profile, it's a good idea to:

emerge -uavD system

Updating Config Files

The information in this section comes from running

 emerge --help config

When you emerge a package, you may get a warning about config files in /etc that need to be updated. The reason for this is that when a package is emerged, its configuration file in /etc is not overwritten by the default configuration file built by the emerge. Instead, the default configuration is placed into a file called ._cfg0000_foo (or ._cfg0001_foo, if the 0000 variant already existed).

There are 2 possibilities how to resolve the situation: - manually merge the default with the existing configuration file, then delete the ._cfg0000_foo file - run etc-update. This tool will automatically merge trivial changes, for the rest it will ask you what to do.

If you want to see the configuration files that need updating, run this command:

 find /etc -iname '._cfg????_*'


System configuration

System time

The hardware clock is read during system startup by the tool hwclock. The operating system time is then set to a value that is derived from the hardware clock time. Theoretically, the hardware clock may be kept in an arbitrary time, although practically this depends on what operating systems are run on a machine, and what time these systems set the hardware clock to.

Windows usually sets the hardware clock to the local time that the user sees and understands. Linux, on the other hand, usually sets the hardware clock to UTC, which of course is different from what the user usually wants to see.

If the same machine runs both Windows and Linux, the operating systems must somehow agree on how they interpret the hardware clock. As usual, Linux can be configured and Windows cannot.

Edit the file

/etc/conf.d/clock

and set the line containing CLOCK= to one of the following values

  • "local", if you run Windows on the same machine
  • "UTC", if you run only Linux on the machine


Network configuration

Edit the file

/etc/conf.d/net

and set the corresponding interface line to something that looks like one of the following lines (depending on whether you want DHCP or manual network interface configuration):

iface_eth0="dhcp"
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"


X11 multihead

Edit the file

/etc/X11/xorg.conf

and do the following things:

  • add a new section "ServerLayout"
    • use the same input devices as the original ServerLayout
    • add two "Screen" lines
Screen 0 "Screen1" 0 0
Screen 1 "Screen2" RightOf "Screen1"
    • the screens should be indexed starting with 0
    • the first screen (index 0) should be placed at coordinate 0/0
    • the second screen (index 1) should be placed to the right of the first screen
  • add two new sections "Screen"
    • the sections must have the identifiers "Screen1" and "Screen2"
    • the sections are identical with the exception of the device that they are referring to
Device "Card1 Head0"
Device "Card1 Head1"
  • add two new sections "Device"
    • the sections must have the identifiers "Card1 Head0" and "Card1 Head1"
    • the sections are identical with the exception of the head that the they are referring to
Screen 0
Screen 1
    • for instance, a complete device section might look like this:
Section "Device"
        Identifier  "Card1 Head0"
        Driver      "mga"
        VendorName  "Matrox"
        BoardName   "Matrox Millenium G400 AGP (rev 133)"
        BusID       "PCI:1:0:0"
        Screen      0
EndSection