Gentoo auf einem Thinkpad T410 mit Dualboot

Es wird mal wieder Zeit für eine neue Installation da die alte beim Update-Versuch nun endgültig zerschossen ist traurig .
Da es eine ganz neue aktuelle (2017/2018) Gentoo Installation sein wird kann ich auch gleich ein How-To daraus machen... Der erste Schritt beginnt damit eine Gentoo Live-CD / Live-DVD oder von USB zu booten. Die Images zum brennen findet man unter https://www.gentoo.org/downloads/ . Ich habe noch eine alte Live-DVD von 2012 gefunden und diese gebootet. Hier eine lspci Ausgabe:
Code


console ~ $ lspci
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)
00:01.0 PCI bridge: Intel Corporation Core Processor PCI Express x16 Root Port (rev 02)
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)
00:1a.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06)
00:1c.3 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 06)
00:1c.4 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 (rev 06)
00:1d.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
00:1f.0 ISA bridge: Intel Corporation QM57 Chipset LPC Interface Controller (rev 06)
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller (rev 06)
00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller (rev 06)
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GT218M [NVS 3100M] (rev a2)
01:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 35)
0d:00.0 SD Host controller: Ricoh Co Ltd MMC/SD Host Controller (rev 01)
0d:00.1 System peripheral: Ricoh Co Ltd R5U2xx (R5U230 / R5U231 / R5U241) [Memory Stick Host Controller] (rev 01)
0d:00.3 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 PCIe IEEE 1394 Controller (rev 01)
ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
ff:02.1 Host bridge: Intel Corporation 1st Generation Core i3/5/7 Processor QPI Physical 0 (rev 02)
ff:02.2 Host bridge: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved (rev 02)
ff:02.3 Host bridge: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved (rev 02)


Nach dem ich die alte Installation über rsync auf meinem Backup-System gesichert habe formatiere ich die bestehenden Partitionen einfach wieder mit ext4. Mein Partitionaslayout ist etwas ungewöhnlich da noch ein anderes Betriebssystem installiert ist... Bei euch kann das Partitonslayout anders sein, daher müsst ihr hier besonders aufpassen und nicht blind meine Einstellungen übernehmen. Diese Einstellungen ziehen sich über das ganze How-To.
Code


Gerät Boot Anfang Ende Sektoren Größe Kn Typ
/dev/sda1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT
/dev/sda2 206848 230893567 230686720 110G 7 HPFS/NTFS/exFAT
/dev/sda3 230893568 256059391 25165824 12G 7 HPFS/NTFS/exFAT
/dev/sda4 256059392 976773119 720713728 343,7G 5 Erweiterte
/dev/sda5 256061440 258158591 2097152 1G 83 Linux
/dev/sda6 258160640 264452095 6291456 3G 82 Linux Swap / Solaris
/dev/sda7 264454144 976773119 712318976 339,7G 83 Linux

Ich habe für Gentoo ein klassisches Layout mit einer Hauptpartition (ext4), einer Boot-Partition (ext2) und einer Swap-Partition. Das wird nun neu erstellt und gemountet:
Code


console ~ $ mkfs.ext2 -T small /dev/sda5
console ~ $ mkfs.ext4 /dev/sda7
console ~ $ mkswap /dev/sda6
console ~ $ swapon /dev/sda6
console ~ $ mount /dev/sda7 /mnt/gentoo

Im nächsten Schritt muss die Systemzeit richtig eingestellt werden... "date" gibt die aktuelle Systemzeit aus und kann sie auch mit dem Format MMDDhhmmYYYY neu einstellen:
Code

console ~ $ date 122120002017

Nun wird in ein aktuelles Stage3 Basissystem in das neue Wurzelverzeichnis heruntergeladen und entpackt:
Code


console ~ $ cd /mnt/gentoo
console ~ $ wget http://distfiles.gentoo.org/releases/amd64/autobuilds/20171215T184104Z/stage3-amd64-20171215T184104Z.tar.bz2
console ~ $ tar xvjpf stage3-*.tar.bz2 --xattrs --numeric-owner

Als nächstes wird die zentrale und wichtige Konfigurationsdatei /mnt/gentoo/etc/portage/make.conf angepasst. Ich will nicht detailiert auf die Optionen eingehen... Die Einstellungen stammen noch zum größten Teil von meiner alten Installation und sind gut auf das Thinkpad abgestimmt. So sieht meine neue make.conf aus:
Code


# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"

# With MAKEOPTS you define how many parallel compilations should occur when you install a package. A good choice is the number of CPUs (or CPU cores) in your system plus one, but this guideline isn't always perfect.
MAKEOPTS="-j4"

# These are the USE flags that were used in addition to what is provided by the
# profile used for building.

# general
USE="pcre16 upcall encode cups rdesktop minizip script nss policykit icu consolekit bindist python X ipp mkl ssl xml xml2 win32codecs unicode lame mp3 mpeg a52 aac pulseaudio offensive ogg openrc-force vorbis xpm wmf mad sql sqlite -systemd mysql declarative vhost-net -libproxy"
# hardware
USE="$USE xkb gudev udev opengl hddtemp hwdb upower wifi cdr 64bit laptop usb dvd alsa dvdr dbus hal dvdread nvidia fbcondecor hdaps kernel_linux scanner threads"
# gui/wm
USE="$USE qt3support qt4 qt5 kde kdepim truetype webkit semantic-desktop xosd"
# graphic
USE="$USE apng jpeg png gif tiff svg exif vnc xmp"


# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

INPUT_DEVICES="evdev synaptics"

#VIDEO_CARDS="nvidia vesa"
VIDEO_CARDS="nouveau"

ALSA_CARDS="hda-intel usb-audio"

SANE_BACKENDS="hp4200"

ACCEPT_LICENSE="*"

#ACCEPT_KEYWORDS="~amd64"

LINGUAS="de en"

ABI_X86="64 32"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

Nun richten wir das zentrale Paketverwaltungssystem ein, setzen Umgebungsvariablen für die neue Installation und wechseln über "chroot" direkt in die neue Umgebung.
Code


console ~ $ mkdir --parents /mnt/gentoo/etc/portage/repos.conf
console ~ $ cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
console ~ $ cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
console ~ $ mount --types proc /proc /mnt/gentoo/proc
console ~ $ mount --rbind /sys /mnt/gentoo/sys
console ~ $ mount --make-rslave /mnt/gentoo/sys
console ~ $ mount --rbind /dev /mnt/gentoo/dev
console ~ $ mount --make-rslave /mnt/gentoo/dev
console ~ $ chroot /mnt/gentoo /bin/bash
console ~ $ source /etc/profile
console ~ $ export PS1="(chroot) ${PS1}"

Jetzt sind wir in der neuen Umgebung, also dem Zielsystem, dass wir gerade installiert haben, angemeldet und können mit der Einrichtung weitermachen. Es fehlt nur noch die Boot-Parition:
Code


console ~ $ mkdir /boot
console ~ $ mount /dev/sda5 /boot

Das Paketverwaltungssystem wird nun das erste mal eingerichtet
Code


console ~ $ emerge-webrsync
console ~ $ emerge --sync
console ~ $ eselect news read

Wir müssen das Profil bestimmen. Das Profil enthält wichtige Einstellungen und wirkt sich auf alle zu installierenden Pakete aus, da es bestimmte USE-Flags setzt.
Code


console ~ $ eselect profile list
console ~ $ eselect profile set default/linux/amd64/17.0/desktop

Nun sollten wir ein Systemupdate machen. Durch die zahlreichen USE-Flags meiner älteren make.conf werden schon einige Zusatzpakete installiert die das System für Stunden auslasten wird...
Code


console ~ $ emerge --ask --update --deep --newuse @world


Es muss die Zeitzone eingestellt werden.
Code


console ~ $ echo "Europe/Berlin" > /etc/timezone
console ~ $ emerge --config sys-libs/timezone-data

Und nun wird die Systemsprache und der Zeichensatz eingestellt. Dazu muss die Datei /etc/locale.gen angepasst werden. Ich habe Deutsch und Englisch mit zwei Zeichensätzen aktiviert:
Code


# /etc/locale.gen: list all of the locales you want to have on your system.
# See the locale.gen(5) man page for more details.
en_US ISO-8859-1
en_US.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE@euro ISO-8859-15
de_DE.UTF-8 UTF-8

Als nächstes muss dieser Einstellung entsprechend die Lokalisierung generiert werden.
Code


console ~ $ locale-gen

Und wir setzen die Standardlokalisierung.
Code


console ~ $ eselect locale list
console ~ $ eselect locale set de_DE.utf8
console ~ $ env-update && source /etc/profile && export PS1="(chroot) $PS1"


Jetzt kommt der wirlich schwierige Teil... Es muss der Kernel konfiguriert und gebaut werden. Ich nehme hier immer schon den Standardkernel von gentoo "gentoo-sources" und habe ihn über viele Jahre optimiert und genau eingestellt. Am Anfang lief das nicht immer ganz rund aber mitlerweile kann ich den Kernel ganz gut einstellen... Ich verfolge stehts die Strategie, nur die benötigten Treiber im Kernel zu aktivieren und alles was man garantiert nicht brauch zu deaktivieren. Die meisten benötigten Treiber aktiviere ich mit der Option "Y" damit sie fest im Kernel integriert sind und nicht als Module geladen werden müssen. Bei einigen Treibern gibt es jedoch Probleme und sie müssen als Modul "M" gebaut werden.
Der Kernel muss zunächst installiert und verlinkt werden.
Code


console ~ $ emerge --ask sys-kernel/gentoo-sources
console ~ $ ln -s /usr/src/linux-4.14.8-gentoo-r1 /usr/src/linux


Ihr könnt meine fertige Kernelkonfiguration für den Thinkpad T410 hier herunterladen: 4.14.8-gentoo-r1

Die Konfiguration muss als Datei ".config" im Verzeichnis /usr/src/linux-4.14.8-gentoo-r1/ hinterlegt werden. Anschließend wird der Kernel kompiliert und im System integriert.
Code


console ~ $ cd /usr/src/linux
console ~ $ make && make modules_install && make install

Nun müssen wir noch ein paar Extra-Pakete installieren weil nicht alle Treiber im Kernel enthalten sind.
Code


console ~ $ emerge --ask app-laptop/tp_smapi app-laptop/tpb sys-kernel/linux-firmware

Und es muss die Datei /etc/conf.d/modules angepasst werden damit einige Module beim Boot geladen werden.
Code


# You should consult your kernel documentation and configuration
# for a list of modules and their options.

modules="nouveau"
modules="iwlwifi"
modules="tp_smapi"

# qemu
modules="kvm kvm-intel vhost_net"

Es folgen nun weitere Systemeinstellungen... Es müssen die Dateisystem Einhängepunkte in der Datei /etc/fstab eingestellt werden... Meine sieht wegen des Dualboot so aus:
Code


# /etc/fstab: static file system information.
#
# <fs> <mountpoint> <type> <opts> <dump/pass>

/dev/sda5 /boot ext2 noauto,noatime 1 2
/dev/sda7 / ext4 noatime 0 1
/dev/sda6 none swap sw 0 0

#/dev/sda1 /mnt/WINBOOT ntfs-3g noatime 0 0
#/dev/sda2 /mnt/WINMAIN ntfs-3g noatime 0 0
#/dev/sda3 /mnt/WINRESQ ntfs-3g noatime 0 0

/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
#/dev/fd0 /mnt/floppy auto noauto 0 0

Es wird der Hostname in der Datei /etc/conf.d/hostname festgelegt:
Code


# Set to the hostname of this machine
hostname="alex_mobil"

Und die Netzwerkeinstellungen in /etc/conf.d/net. Wegen udev heißen die Netzwerkschnittstellen etwas anders. Man kann nach dem Reboot unter /sys/class/net/ nachgucken wie sie benannt wurden.
Code


# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /usr/share/doc/openrc*/net.example* and save your configuration
# in /etc/conf.d/net (this file :]!).

# Home
config_enp0s25="192.168.0.123 netmask 255.255.255.0 brd 192.168.0.255"
routes_enp0s25="default via 192.168.0.1"
dns_servers_enp0s25="192.168.0.1"

Mit passwd sollte man jetzt außerdem sein root-Passwort festlegen:
Code


console ~ $ passwd

Es wird die Datei /etc/rc.conf angepasst. Da sie zu 99% aus Kommentare besteht sind naxhfolgend nur die aktivierten Optionen aufgeschrieben:
Code


# Linux users could specify /sbin/sulogin
rc_shell=/sbin/sulogin
# rc_logger launches a logging daemon to log the entire rc process to
# /var/log/rc.log
# NOTE: Linux systems require the devfs service to be started before
# logging can take place and as such cannot log the sysinit runlevel.
rc_logger="yes"
# Set unicode to YES to turn on unicode support for keyboards and screens.
unicode="YES"
# on Linux and Hurd, this is the number of ttys allocated for logins
# It is used in the consolefont, keymaps, numlock and termencoding
# service scripts.
rc_tty_number=12

In der Datei /etc/conf.d/keymaps wird das Tastaturlayout festgelegt
Code


# Use keymap to specify the default console keymap. There is a complete tree
# of keymaps in /usr/share/keymaps to choose from.
keymap="de"

# Should we first load the 'windowkeys' console keymap? Most x86 users will
# say "yes" here. Note that non-x86 users should leave it as "no".
# Loading this keymap will enable VT switching (like ALT+Left/Right)
# using the special windows keys on the linux console.
windowkeys="YES"

# The maps to load for extended keyboards. Most users will leave this as is.
extended_keymaps=""
#extended_keymaps="backspace keypad euro2"

# Tell dumpkeys(1) to interpret character action codes to be
# from the specified character set.
# This only matters if you set unicode="yes" in /etc/rc.conf.
# For a list of valid sets, run `dumpkeys --help`
dumpkeys_charset=""

# Some fonts map AltGr-E to the currency symbol instead of the Euro.
# To fix this, set to "yes"
fix_euro="NO"

Außerdem muss in der Datei /etc/conf.d/hwclock die Uhrzeiteinstellung festgelegt werden. Für ein Dualboot sollte man hier "local" einstellen.
Code


# Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
# Greenwich Mean Time). If that clock is set to the local time, then
# set CLOCK to "local". Note that if you dual boot with Windows, then
# you should set it to "local".
clock="local"

Jetzt werden noch ein paar wichtige Standardtools installiert und eingerichtet bevor wir fertig sind. Mit "rc-update" können INIT-Scripte aus /etc/init.d/ in diversen runleveln gestartet werden. Hier ein Beispiel:
Den SSHD Dämon aus dem paket net-misc/openssh sollte man beim Systemstart für den runlevel "default" starten. "default" steht für den Normalbetrieb mit Netzwerkanbindung direkt nach dem Bootvorgang.
Code


console ~ $ rc-update add sshd default

Als nächstes richtet man den Systemlogger ein. Ich nutze hier syslog-ng. Die Konfigurationsdatei liegt dann in /etc/syslog-ng/syslog-ng.conf.
Code


console ~ $ emerge --ask app-admin/syslog-ng
console ~ $ rc-update add syslog-ng default

Beim CRON-Dämon nutze ich vixie-cron. Er ist simpel und legt folgende Verzeichnisse an: /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly ... Auführbare Scripte müssen später nur noch in diese Verzeichnisse verlinkt werden. Einige Systemtools tun das schon automatisch.
Code


console ~ $ emerge --ask sys-process/vixie-cron
console ~ $ rc-update add vixie-cron default

Außerdem sehr nützlich für die Suche nach Dateinamen ist mlocate. Nach der Installation führt man "updatedb" aus (erstellt den Index) und kann mit dem Befehl "locate XYZ" blitzschnell die gewünschte Datei findensmile
Code


console ~ $ emerge --ask sys-apps/mlocate

Nun eine Anpassung in der Datei /etc/inittab. Hier habe ich bei # TERMINALS die Option --noclear hinzugefügt damit nach dem Bootvorgang die Bootnachrichten nicht mehr ausgeblendet werden. Hier ist der relevante Inhalt:
Code


# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux

Jetzt installieren wir noch ein paar Dateisystemtools. Damit kann man EXT2, EXT3, EXT4, VFAT, FAT32 und NTFS Verwalten.
Code


console ~ $ emerge --ask sys-fs/e2fsprogs sys-fs/dosfstools sys-fs/ntfs3g

Als letztes installieren wir den Bootloader und richten ihn für den Dualboot ein...
Ich nutze hier GRUB2 da er über eine eigene Konsole verfügt. Diese Konsole kann im Notfall ganz nützlich sein um Bootparameter einzustellen.
Code


console ~ $ emerge --ask sys-boot/grub:2
console ~ $ grub-install /dev/sda

Hier muss noch die Konfigurationsdatei /etc/default/grub angepasst werden. Ich habe die Komentare aus der Datei weggelassen und ein Hintergrundbild eingestellt. Falls Ihr kein Hintergrundbild parat habt solltet ihr die letzte Zeile auskommentieren.
Code


GRUB_DISTRIBUTOR="Gentoo"

GRUB_TIMEOUT=30

GRUB_CMDLINE_LINUX="acpi_backlight=vendor"

GRUB_GFXMODE=1440x900

#GRUB_BACKGROUND="/boot/grub/mybackground.png"

Nun muss ich noch ein Extra für die Windows-Partiton einbauen... Die Bootpartiton von Windows liegt auf /dev/sda1 und hat eine spezielle UUID die beim Booten übergeben werden muss. Die UUID bekommt man folgenden Befehl:
Code


console ~ $ grub-probe -t fs_uuid -d /dev/sda1

Mit der UUID die man nun bekommt legen wir die Konfigurationsdatei /etc/grub.d/39_win7 mit folgenden Inhalt an:
Code


#!/bin/sh

echo "Eigener Menüeintrag für Windows 7 hinzugefügt" >&2
#BEFEHL FUER --set-root: grub-probe -t fs_uuid -d /dev/sda1
cat << EOF
menuentry "Microsoft Windows im BIOS-Modus starten" {
insmod part_msdos
insmod ntfs
search --no-floppy --fs-uuid --set=root 62127CC3127C9E2B
parttool \${root} hidden-
drivemap -s (hd0) \${root}
chainloader +1
}
EOF

Jetzt generieren wir endgültig die Bootkonfiguration:
Code


console ~ $ grub-mkconfig -o /boot/grub/grub.cfg

Außerdem noch ein Tipp für ein schönes Gentoo Logo nach dem Boot:
Code


console ~ $ cp /etc/issue.logo /etc/issue


Wenn alles gekappt hat ist das System in der Basis fertig und kann neugestartet werden, ich hoffe es hat sich kein grober Fehler eingeschlichen Cool





CMS & Forum coded by Alexander 'EisWiesel' Rothenberg
:: Seitenaufbau: 0.047 Sekunden :: SQL Selects: 30, InUpDel: 1 ::



Portions of the materials used are ®, (tm),(mr), and/or (mc) Epic Games, Inc., and/or copyrighted works of Epic Games, Inc., in the United States of America and elsewhere. All rights reserved, Epic Games, Inc. This material is not official and is not endorsed by Epic Games, Inc.
Diese Webseite verwendet Cookies / This website uses cookies