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

Gigabyte P27G v2

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
Resources

This page describes how to install Gentoo Linux with Gnome 3 on a Gigabyte P27G v2 laptop.


Warning
As it is somewhat difficult to remember what you have exactly done and in which order during install, this page may include some mistakes. Please, if you are sure, feel free to correct or complete it based on your own experience.



Preliminary assumptions

  • In this page, we assume we are using rEFInd as a bootmanager. rEFInd is able to detect kernels with EFI stub support. Please refer to the Managing EFI Boot Loaders for Linux:Using rEFInd page, to learn more about how to install rEFInd on your laptop,
  • The installation is done from a terminal into the OpenSuse distribution (easy to install with EFI) or from a live CD of any distribution EFI bootable(e.g. Ubuntu),
  • The necessary partitions have already been created with a tool like gparted (in our case /dev/sda8 for /, /dev/sda9 for /home, /dev/sda12 for swap),
  • The ESP partition is already existing on the disk (/dev/sda2 ) and is FAT32.

Disable Secure Boot

Press F2 to enter the BIOS. Go to the Security tab. It is not possible to act upon the SecureBoot line [ENABLED]. Go to the Boot Control line instead and disable it. Then go to the Exit tab → Saves Changes and reset

Base System - First boot

Hardware

Here is the output of lspci:

root #lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller (rev 06)
	Subsystem: CLEVO/KAPOK Computer Device 3501
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
	Kernel driver in use: pcieport
00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: i915
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: xhci_hcd
	Kernel modules: xhci_pci
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
	Subsystem: CLEVO/KAPOK Computer Device 3501
00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: ehci-pci
	Kernel modules: ehci_pci
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_hda_intel
00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)
	Kernel driver in use: pcieport
00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 (rev d5)
	Kernel driver in use: pcieport
00:1c.3 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 (rev d5)
	Kernel driver in use: pcieport
00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: ehci-pci
	Kernel modules: ehci_pci
00:1f.0 ISA bridge: Intel Corporation HM87 Express LPC Controller (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: ahci
	Kernel modules: ahci
00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel modules: i2c_i801
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 860M] (rev a2)
	Subsystem: CLEVO/KAPOK Computer Device 3501
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter
	Subsystem: Realtek Semiconductor Co., Ltd. Device b729
	Kernel driver in use: rtl8723be
	Kernel modules: rtl8723be
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5287 (rev 01)
	Subsystem: CLEVO/KAPOK Computer Device 3501
04:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12)
	Subsystem: CLEVO/KAPOK Computer Device 3501
	Kernel driver in use: r8169
	Kernel modules: r8169

First of all open a terminal and switch user to root with the 'su' command.

Installation files

root #swapon /dev/sda12
root #mount /dev/sda8 /mnt/gentoo
root #mkdir /mnt/gentoo/home
root #mount /dev/sda9 /mnt/gentoo/home
root #mkdir /mnt/gentoo/boot
root #mount /dev/sda2 /mnt/gentoo/boot
root # cd /mnt/gentoo

Follow the Installing the Gentoo Installation files page and at the point on defining the MAKEOPTS variable enter:

CODE MAKEOPTS declaration in make.conf
MAKEOPTS="-j9"

Installing the Gentoo Base System

Follow the Installing the Gentoo base system page. The only exception is to not run mirrorselect as it is specific to Gentoo.

At the time of choosing the profile, please choose the default/linux/amd64/13.0/desktop/gnome/systemd profile, then update the system

root #emerge --ask --update --deep --newuse @world

Kernel and initramfs

Preparation

Do not emerge genkernel here but genkernel-next instead.

root #emerge --ask genkernel-next

Then emerge lvm

root #emerge --ask lvm2

Don't forget to set the MAKEOPTS variable in /etc/genkernel.conf as genkernel ignore the value in /etc/portage/make.conf

CODE Example MAKEOPTS declaration in /etc/genkernel.conf
MAKEOPTS="-j9"

Next, edit the /etc/fstab file so that the line containing /boot/ as second field has the first field pointing to the right device. . This would make the entry in the file look like so:

root #nano -w /etc/fstab
FILE /etc/fstabConfiguring the /boot mountpoint
/dev/sda2	/boot	fat	defaults	0 2

Creating an initramfs

We create an initramfs with genkernel to be embedded into the EFI stub. To do so run

root #genkernel --lvm --no-compress-initramfs --menuconfig initramfs
Note
The --no-compress-initramfs option may not be necessary but as we want an uncompressed initramfs it doesn't harm.

In order to boot directly from UEFI, the kernel needs to have CONFIG_EFI_STUB support enabled.

KERNEL Enable EFI stub support
Processor type and features  --->
    [*] EFI runtime service support 
    [*]   EFI stub support

UEFI does not pass kernel parameters to the kernel during normal boot, so you need to hardcode them via CONFIG_CMDLINE. Example for the root partition on /dev/sda2:

KERNEL Enable built-in kernel parameters
Processor type and features  --->
    [*] Built-in kernel command line
    (rootroot=/dev/sda8 rootfstype=ext4 real_init=/usr/lib/systemd/systemd dolvm)
KERNEL Enable EFI sysfs controls
Firmware Drivers  --->
    <*> EFI Variable Support via sysfs

Renaming the initramfs file

root # mv /boot/initramfs-genkernel-x86-64-3.18.7-gentoo /boot/initramfs-genkernel-x86-64-3.18.7-gentoo.cpio

Compiling the kernel

root #genkernel --lvm --menuconfig kernel

To embed the initramfs in the kernel stub set it up in the General setup menu:

KERNEL Build in the initramfs CPIO archive
General setup  --->
    [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
    (/boot/initramfs-genkernel-x86-64-3.18.7-gentoo.cpio) Initramfs source file(s)
Note
In the commands above, change the name of the initramfs and kernel according to your actual version.

Installing the EFI stub into the ESP

root # mkdir /boot/EFI/gentoo
root # cp /boot/kernel-genkernel-x86-64-3.18.7-gentoo /boot/EFI/gentoo/bootX64-GK-A.efi
Note
You can choose the name you prefer for the .efi stub. Only the .efi extension is required. Change the letter A into B for the next compilation of the kernel and so on but don't forget to remove old kernels to prevent the ESP partition from overflowing.

Completing the fstab File

Now complete the /etc/fstab file

FILE /etc/fstabMy fstab
/dev/sda2   /boot        fat   defaults,noatime     0 2

/dev/sda12 none swap sw 0 0 /dev/sda8 / ext4 noatime 0 1 /dev/sda9 /home ext4 defaults 0 2

/dev/cdrom /mnt/cdrom auto noauto,user 0 0

}}

Continue with the Configuring the System page. Then the Installing System Tools page contains optional tools to be installed.

Note
As access to the ESP fat partition is required, don't forget to install the necessary tools for this filesystem type:
root #emerge --ask sys-fs/dosfstools

You can skip the Configuring the bootloader page as there is no need of it.

Rebooting the system

Exit the chrooted environment and unmount all mounted partitions. Then type in that one magical command that initiates the final, true test: reboot.

root #exit
any ~#cd
any ~#umount -l /mnt/gentoo/dev{/shm,/pts,}
any ~#umount /mnt/gentoo{/boot,/sys,/proc,}
any ~#reboot

Finalizing

Continue with the Finalizing page.

Installing the X server

At first we install Gentoo using only the Integrated GPU.

Kernel configuration

KERNEL Enabling evdev in the kernel
'"`UNIQ--pre-0000000F-QINU`"'
KERNEL Configuring framebuffers
'"`UNIQ--pre-00000012-QINU`"'
KERNEL Intel settings
'"`UNIQ--pre-00000015-QINU`"'


CODE to add in make.conf
## (For mouse, keyboard, and Synaptics touchpad support)
INPUT_DEVICES="evdev synaptics"
VIDEO_CARDS="intel"
root #emerge --ask xorg-drivers
root #emerge --ask xorg-server
root # env-update source /etc/profile

{{Note|Please refer to the Xorg/Guide page for more details.

Installing Gnome

root #emerge --ask gnome
Note
It may be necessary to add the -bindist Use flag to openssh and openssl and to re-emerge openssh

To launch gdm at startup enter this command:

root # systemctl enable gdm.service

Other Devices

Wifi adapter

Kernel

The laptop is provided with a Realteck RTL8732BE PCIe Wireless Network Adapter.

KERNEL
'"`UNIQ--pre-0000001A-QINU`"'
KERNEL
'"`UNIQ--pre-0000001D-QINU`"'

Don't forget to emerge the firmware.

root #emerge --ask linux-firmware

Detection and Connection

In order to detect wireless networks and connect to them you can use wpa_supplicant:

root #emerge --ask wpa_supplicant

Add this in the /etc/conf.d/net file:

FILE /etc/conf.d/netSet up for net scripts
modules_wlan0="wpa_supplicant"
wpa_supplicant_wlan0="-Dnl80211"
config_wlan0="dhcp"

and this in the /etc/wpa_supplicant/wpa_supplicant.conf file:

FILE /etc/wpa_supplicant/wpa_supplicant.confConfiguring wpa_supplicant
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
#ap_scan=0
#update_config=1
 
network={
        ssid="YourSSID"
        psk="your-secret-key"
        scan_ssid=1
}

Alternative for Detection and Connection

If, like me, you experience some trouble using wpa_supplicant you can use wicd which offer a nice and efficient way to detect and to connect to wlan.

root #emerge --ask wicd

Here is my /etc/conf.d/net file:

FILE /etc/conf.d/netSet up for net scripts
config_enp4s0f1=dhcp
routes_enp4s0f1="default via 192.168.1.1"
config_wlan0="dhcp"

Be sure to disable the "dhcpcd" service at startup

root # systemctl disable dhcpcd.service

and to enable the "wicd" service

root # systemctl enable wicd.service

You should be able to connect via both wired and wireless interface launching the Wicd Network Manager from the Gnome menu.

Note
It seems that the wpa_supplicant program is still necessary in this case.

Using the Nvidia Optimus Technology

Warning
I could not manage to start this. If you managed to do it, please add your experience here.