This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Handbuch:PPC/Installation/System
Dateisysteminformationen
Über fstab
Unter Linux müssen alle Partitionen, die im System genutzt werden, in /etc/fstab aufgelistet werden. Diese Datei beinhaltet die Mountpunkte ("Einhängepunkte", also wo sie im Dateisystem erscheinen) dieser Partitionen, wie sie eingehängt werden sollen und mit welchen speziellen Optionen (automatisch einhängen oder nicht, können Benutzer sie einhängen, etc.)
fstab erstellen
Die Datei /etc/fstab verwendet eine tabellenartige Syntax. Jede Zeile besteht aus sechs Feldern, die jeweils von Leerräumen (Leerzeichen, Tabulatoren oder beides gemischt). Jedes Feld besitzt seine eigene Bedeutung:
- Das erste Feld beinhaltet die Partition, die diese Zeile beschreibt (den Pfad zur Gerätedatei)
- Das zweite Feld zeigt den Einhängepunkt, an dem die Partition eingehängt werden soll
- Das dritte Feld zeigt das Dateisystem der Partition
- Im vierten Feld stehen die Einhängeoptionen, die von mount genutzt werden, wenn Partitionen eingehängt werden. Da jedes Dateisystem seine eigenen Optionen hat, empfiehlt sich ein Blick in die Manpage (man mount), wo sich eine vollständige Liste findet. Mehrere Einhängeoptionen werden mit Kommata getrennt.
- Das fünfte Feld wird von dump verwendet, um herauszufinden ob die Partition in einem Dump-Backup berücksichtigt werden soll. Dieser Eintrag kann üblicherweise auf 0 (null) belassen werden.
- Das sechste Feld wird von fsck verwendet, um die Reihenfolge festzulegen, in der Dateisysteme nach einem unsauberen Neustart überprüft werden. Das root-Dateisystem (/) sollte hier 1 steheh haben, alle anderen Dateisysteme 2 (oder 0, wenn eine Dateisystemprüfung nicht nötig ist.)
The default /etc/fstab file provided by Gentoo is not a valid fstab file but instead more of a template.
root #
nano -w /etc/fstab
In the remainder of the text, we use the default /dev/sd* block device files as partition.
Filesystem labels and UUIDs
Both MBR (BIOS) and GPT include support for filesystem labels and filesystem UUIDs. These attributes can be defined in /etc/fstab as alternatives for the mount command to use when attempting to find and mount block devices. Filesystem labels and UUIDs are identified by the LABEL and UUID prefix and can be viewed with the blkid command:
root #
blkid
If the filesystem inside a partition is wiped, then the filesystem label and the UUID values will be subsequently altered or removed.
Because of uniqueness, readers that are using an MBR-style partition table are recommended to use UUIDs over labels to define mountable volumes in /etc/fstab.
Partition labels and UUIDs
Users who have gone the GPT route have a couple more 'robust' options available to define partitions in /etc/fstab. Partition labels and partition UUIDs can be used to identify the block device's individual partition(s), regardless of what filesystem has been chosen for the partition itself. Partition labels and UUIDs are identified by the PARTLABEL and PARTUUID prefixes respectively and can be viewed nicely in the terminal by running the blkid command:
root #
blkid
While not always true for partition labels, using a UUID to identify a partition in fstab provides a guarantee that the bootloader will not be confused when looking for a certain volume, even if the filesystem would be changed in the future. Using the older default block device files (/dev/sd*N) for defining the partitions in fstab is risky for systems that are restarted often and have SATA block devices added and removed regularly.
The naming for block device files depends on a number of factors, including how and in what order the disks are attached to the system. They also could show up in a different order depending on which of the devices are detected by the kernel first during the early boot process. With this being stated, unless one intends to constantly fiddle with the disk ordering, using default block device files is a simple and straightforward approach.
Let us take a look at how to write down the options for the /boot/ partition. This is just an example, and should be modified according to the partitioning decisions made earlier in the installation.
In our ppc partitioning example, /boot/ is usually the /dev/sda1 partition, with ext2 as filesystem. It needs to be checked during boot, so we would write down:
/etc/fstab
An example /boot line for /etc/fstab/dev/sda1 /boot ext2 defaults 0 2
Some users don't want their /boot/ partition to be mounted automatically to improve their system's security. Those people should substitute defaults with noauto. This does mean that those users will need to manually mount this partition every time they want to use it.
Add the rules that match the previously decided partitioning scheme and append rules for devices such as CD-ROM drive(s), and of course, if other partitions or drives are used, for those too.
Below is a more elaborate example of an /etc/fstab file:
/etc/fstab
A full /etc/fstab example/dev/sda1 /boot ext2 defaults,noatime 0 2 /dev/sda2 none swap sw 0 0 /dev/sda3 / ext4 noatime 0 1 /dev/cdrom /mnt/cdrom auto noauto,user 0 0
When auto
is used in the third field, it makes the mount command guess what the filesystem would be. This is recommended for removable media as they can be created with one of many filesystems. The user
option in the fourth field makes it possible for non-root users to mount the CD.
To improve performance, most users would want to add the noatime
mount option, which results in a faster system since access times aren't registered (those are not needed generally anyway). This is also recommended for solid state drive (SSD) users, who should also enable the discard
mount option (ext4 and btrfs only for now) which makes the TRIM
command work.
Double-check the /etc/fstab file, save and quit to continue.
Netzwerkinformationen
Host- und Domäneninformationen
Eine der Entscheidungen, die Benutzer treffen müssen, ist der Name des PC. Auf den ersten Blick scheint dies einfach zu sein, aber viele Benutzer haben Schwierigkeiten einen passenden Namen für ihren Linux-PC zu finden. Um diesen Prozess zu beschleunigen, sei darauf hingewiesen dass der Name später wieder geändert werden kann. In den folgenden Beispielen wird der Hostname "tux" in der Domäne "homenetwork" verwendet.
root #
nano -w /etc/conf.d/hostname
# Die Variable "hostname" auf den gewählten Hostnamen setzen hostname="tux"
Anschließend, wenn ein Domänenname benötigt wird, setzen Sie diesen in /etc/conf.d/net. Dies ist nur nötig, wenn Ihr Provider oder Netzwerkadministrator dies verlangen, oder wenn das Netzwerk einen DNS-Server besitzt, aber keinen DHCP-Server. Sie können DNS oder Domänennamen ignorieren, wenn das System DHCP für die Zuweisung dynamischer IP-Adressen und Netzwerkkonfiguration verwendet wird.
Die Datei /etc/conf.d/net wird nicht mitgeliefert, Sie müssen sie daher erstellen.
root #
nano -w /etc/conf.d/net
# Setzen Sie die dns_domain-Variable auf Ihren Domainnamen dns_domain_lo="homenetwork"
Wenn Sie sich dafür entscheiden, keinen Domainnamen zu setzen, können Sie die "This is hostname.(none)" Nachrichten am Anmeldebildschirm loswerden, indem Sie /etc/issue editieren. Entfernen Sie einfach den String
.\O
aus dieser Datei. If a NIS domain is needed (users that do not know this will not need one), define that one too:
root #
nano -w /etc/conf.d/net
# Set the nis_domain_lo variable to the selected NIS domain name nis_domain_lo="my-nisdomain"
For more information on configuring DNS and NIS, please read the examples provided in /usr/share/doc/netifrc-*/net.example.bz2 which can be read using bzless. Also, it might be interesting to install net-dns/openresolv to help manage the DNS/NIS setup.
Configuring the network
During the Gentoo Linux installation, networking was already configured. However, that was for the installation CD itself and not for the installed environment. Right now, the network configuration is made for the installed Gentoo Linux system.
More detailed information about networking, including advanced topics like bonding, bridging, 802.1Q VLANs or wireless networking is covered in the Gentoo Network Configuration section.
All networking information is gathered in /etc/conf.d/net. It uses a straightforward yet perhaps not intuitive syntax. But don't fear, everything is explained below. A fully commented example that covers many different configurations is available in /usr/share/doc/netifrc-*/net.example.bz2.
First install net-misc/netifrc:
root #
emerge --ask --noreplace net-misc/netifrc
DHCP is used by default. For DHCP to work, a DHCP client needs to be installed. This is described later in Installing Necessary System Tools.
If the network connection needs to be configured because of specific DHCP options or because DHCP is not used at all, then open /etc/conf.d/net:
root #
nano -w /etc/conf.d/net
Set both config_eth0 and routes_eth0 to enter IP address information and routing information:
This assumes that the network interface will be called eth0. This is, however, very system dependent. It is recommended to assume that the interface is named the same as the interface name when booted from the installation media if the installation media is sufficiently recent. More information can be found in Network Interface Naming.
/etc/conf.d/net
Static IP definitionconfig_eth0="192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" routes_eth0="default via 192.168.0.1"
To use DHCP, define config_eth0:
/etc/conf.d/net
DHCP definitionconfig_eth0="dhcp"
Please read /usr/share/doc/netifrc-*/net.example.bz2 for a list of all available options. Be sure to also read up on the DHCP client man page if specific DHCP options need to be set.
If the system has several network interfaces, then repeat the above steps for config_eth1, config_eth2, etc.
Now save the configuration and exit to continue.
Automatically start networking at boot
To have the network interfaces activated at boot, they need to be added to the default runlevel.
root #
cd /etc/init.d
root #
ln -s net.lo net.eth0
root #
rc-update add net.eth0 default
If the system has several network interfaces, then the appropriate net.* files need to be created just like we did with net.eth0.
If after booting the system we find out that the assumption about the network interface name (which is currently documented as eth0
) was wrong, then execute the following steps to rectify this:
- Update the /etc/conf.d/net file with the correct interface name (like
enp3s0
instead ofeth0
). - Create new symbolic link (like /etc/init.d/net.enp3s0).
- Remove the old symbolic link (rm /etc/init.d/net.eth0).
- Add the new one to the default runlevel.
- Remove the old one using rc-update del net.eth0 default.
The hosts file
Next inform Linux about the network environment. This is defined in /etc/hosts and helps in resolving host names to IP addresses for hosts that aren't resolved by the nameserver.
root #
nano -w /etc/hosts
/etc/hosts
Filling in the networking information# This defines the current system and must be set 127.0.0.1 tux.homenetwork tux localhost # Optional definition of extra systems on the network 192.168.0.5 jenny.homenetwork jenny 192.168.0.6 benny.homenetwork benny
Save and exit the editor to continue.
Optional: Get PCMCIA working
PCMCIA users should now install the sys-apps/pcmciautils package.
root #
emerge --ask sys-apps/pcmciautils
System information
Root password
Set the root password using the passwd command.
root #
passwd
The root Linux account is an all-powerful account, so pick a strong password. Later an additional regular user account will be created for daily operations.
Init and boot configuration
Gentoo (at least when using OpenRC) uses /etc/rc.conf to configure the services, startup, and shutdown of a system. Open up /etc/rc.conf and enjoy all the comments in the file. Review the settings and change where needed.
root #
nano -w /etc/rc.conf
Next, open /etc/conf.d/keymaps to handle keyboard configuration. Edit it to configure and select the right keyboard.
root #
nano -w /etc/conf.d/keymaps
Take special care with the keymap variable. If the wrong keymap is selected, then weird results will come up when typing on the keyboard.
Finally, edit /etc/conf.d/hwclock to set the clock options. Edit it according to personal preference.
root #
nano -w /etc/conf.d/hwclock
If the hardware clock is not using UTC, then it is necessary to set clock="local"
in the file. Otherwise the system might show clock skew behavior.