Skip to main content

A gentoo installation story - continued!

The birth of a Gentoo Linux KDE Desktop

I have previously journaled (Part-I) my attempt to create an encrypted Gentoo Linux desktop. Please follow that first. It was a little more involved than I expected. I had to revisit some of the steps one or two times. Some of the steps in that post might better fit in this post. But hindsight is a wonderful thing. Now we come to building out what the general public think of as a computer (the Desktop).

Install some useful utilities

localost / $ eselect profile list # to get a list of desktop profiles 
localost / $ eselect profile set <KDE-openrc>  # I will also setup i3 tiling window manager
localost / $ echo "Europe/London" > /etc/timezone
localost / $ emerge --sync 
localost / $ emerge --quiet-build --ask --config sys-libs/timezone-data 
localost / $ emerge --quiet-build --ask app-misc/screen sys-process/htop
Setup WiFi (Optional)

In (Part-I), I already had ethernet and used that for installation. However, if WiFi is something that is required, then the following instructions should set up WiFi. Bear in mind that WiFi drivers could be missing from your kernel configuration. Searching the Gentoo forums for a similar issue would be helpful.

I will be installing network-manager later on and will have to disable both dhcpcd and wpa-supplicant. If we forget, then we will have two instances of DHCP and WiFi daemons duelling each other.

localost / $ emerge --quiet-build --ask net-misc/dhcpcd
localost / $ emerge --ask --verbose net-wireless/wpa_supplicant
localost / $ cp /usr/share/dhcpcd/hooks/10-wpa_supplicant /lib/dhcpcd/dhcpcd-hooks/
localost / $ bzcat  /usr/share/doc/wpa_supplicant-<ver-no>/wpa-supplicant.conf.bz2 > /etc/wpa_supplicant/wpa_supplicant.conf

Almost all variations of a wpa-supplicant configuration can be obtained from "/usr/share/doc/wpa_supplicant-/wpa_supplicant.conf.bz2". Uncomment the following in /etc/wpa_supplicant/wpa_supplicant.conf.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
eapol_version=1
ap_scan=1
fast_reauth=1

Also generate the network connection parameters and insert into wpa_supplicant.conf using wpa_passphrase and remove every other configuration in that file. In case you have a more complicated set-up, then you will have to configure this according to your setup.

localost / $ wpa_passphrase ${ssid} ${passphrase}  >> /etc/wpa_supplicant/wpa_supplicant.conf

Change the value of wpa_supplicant_args in /etc/conf.d/wpa_supplicant.conf to:

wpa_supplicant_args="-B -M -c/etc/wpa_supplicant/wpa_supplicant.conf"

Now add the dhcpcd and wpa_supplicant services to default runlevel and start the services.

localost / $ rc-update add dhcpcd default
localost / $ rc-update add wpa_supplicant default
localost / $ rc-service dhcpcd start
localost / $ rc-service wpa_supplicant start
Setting up NTP

Networking and "time" dependent programs require accurate date and time information. This is achieved by installing NTPD.

localost / $ emerge --ask net-misc/ntp
localost / $ rc-update add ntpd default
localost / $ rc-service ntpd start

Gentoo KDE desktop

Install the KDE desktop

While Wayland seems to be the future, I am still quite comfortable with the X server. It also helps that the i3wm window manager also is dependent on X-sever. The KDE meta-package is comprehensive and installs all the KDE applications and dependencies.

localhost / $ emerge --ask kde-plasma/plasma-meta

Ensure that the KDE display manager sddm is installed; then ensure that the "DISPLAYMANAGER" variable is set to sddm.

DISPLAYMANAGER="sddm"

Add the requisite services to openrc to start at boot,

localost / $ rc-update add dbus default
localost / $ rc-update add display-manager default
localost / $ rc-update add elogind boot

IT crowd In my case, at this point, I found that just starting up the boot displaymanager from openrc did not get sddm to start. Rebooting the machine sorted the crashing display manager out.

Debugging: Install X-server

If there are any problems with bringing up KDE, using X-server to debug the issue is very useful. In case it was not already installed when KDE-meta was installed, start with installing X-server and driver packages.

localost / $ emerge --ask --verbose x11-base/xorg-drivers x11-base/xorg-server

To test out that the X-server is working correctly install a few X applications

localost / $ emerge -a x11-terms/xterm x11-apps/xclock x11-wm/twm
localost / $ startx   # to test if display server is working
Sidenote: Uninstall dhcp and wpa-supplicant

Keeping dhcpcd and wpa-supplicant running in the background led me to some incredibly annoying and hard to debug problems with networking. The KDE deskptop already installs NetworkManager and this will in turn call an instance of dhcp and wpa_supplicant. You do NOT need your own version fighting with it. So...

localost / $ rc-service stop dhcpcd
localost / $ rc-update del dhcpcd
localost / $ rc-service stop wpa_supplicant
localost / $ rc-update del wpa_supplicant

Congratulations!

If you have persevered with the process this far, congratulations! You should have a desktop machine that you have compiled from source. Obviously, I have cleverly hidden all the frustrating debug work that went into steps going wrong. Along with this, there are issues with drivers or kernel features required by some software component not being turned ON. However, that is what the incredible gentoo forums and wiki are for. Happy compiling and debugging.