Skip to content

Instantly share code, notes, and snippets.

@majamin
Last active January 11, 2025 19:01
Show Gist options
  • Save majamin/608f1d979c7d3a443609232e292370f4 to your computer and use it in GitHub Desktop.
Save majamin/608f1d979c7d3a443609232e292370f4 to your computer and use it in GitHub Desktop.
Notes on installing KDE on Gentoo

KDE on Gentoo (December, 2024)

Preamble

NOTE

If you’re reading the plain text or Asciidoc version, see the generated PDF in this gist for a nice version of this guide.

Congrats on wanting to install KDE on Gentoo! In total, this guide may take you up to 12 hours to complete. Only 2 - 4 of those hours will be actively completing tasks. The other 8 - 10 could be waiting for the various packages to install, especially KDE itself, which will take the longest. Make a lunch, grab a coffee, and let’s begin!

TASKS

I put some effort into simplifying the guide into tasks. You’ll notice those in the green boxes. Those are meant to simplify the current step, so it is very clear as to what the goal is.

Assumptions

This guide was run on a Thinkpad X1 Carbon (Gen 9). Nothing truly fancy (intel based), so I believe that steps here can be adapted to most systems out there. There’s some hardware combinations that require further work from you, and, guess what? Yes, go read the Gentoo wiki when you need more information.

☑ Task 1: prerequisites

Ensure that:

  • Your machine has safe boot disabled (turn off in your BIOS)

  • You have a UEFI-capable machine (verify with a non-empty result of find /sys/firmware/efi/efivars)

  • You have at least 50G of storage (more is better), and more than 4G of RAM (less than this, and you’ll have a hard time running KDE, internet browsing, etc.)

This guide will give you:

  • An EFI-stub bootloader

  • dist-kernel

  • openrc as the default init system

  • doas (instead of sudo)

  • KDE with defaults (wayland session)

You will not get:

  • Dual boot (with Windows)

  • Encryption

Also, I’m assuming you know how to create your own USB drive with an image of the LiveCD or minimal Gentoo install system. You can use lots of methods for this. On Windows, that would be rufus and on Linux, Ventoy works really well.

Initial boot

You just booted in to the LiveCD or Minimal Gentoo install environment. You’ll need access to an internet connection to install Gentoo.

Some common ways to connect are:

  1. Ethernet. If you can plug an Ethernet cord into your computer for internet access, there’s no steps you need to take: you’ll have an internet connection immediately (barring some unique network situations - please see the networking part of the Handbook).

  2. Wifi systray. In the LiveCD (gui) connect to the internet via the Wifi system tray utility, or again, use your ethernet connection (if available)

  3. net-setup. Use net-setup to connect to wifi:

    1. Check your interfaces (cards) with ifconfig -a. You should see a device like wlan0 or wlp2s0. Note the name.

    2. Connect with: net-setup YOURDEVICENAME (from the step above). You can usually select automatic IP (with DHCP) in the dialogs that follow. You’ll need to know your network name, and passkey.

    3. Back in the terminal, wait up to 30 seconds, then check if you have an IP (you’ll see it in under your device with ifconfig -a).

  4. USB-tether / hotspot. You can even connect your phone to your PC, provided your phone allows for USB-tethering. In that case, plugging your phone in, and waiting a few moments should get you a connection as well (if your phone uses wifi, it will use that - be aware that the PC will use data on your phone if there’s no wifi available.)

☑ Task 2: internet

Once booted into the Live environment, connect to the internet using one of the methods above.

Next, we make sure that we have superuser privileges as we install the system.

☑ Task 3: elevate

In the terminal or konsole on the LiveCD,

  1. Change your password: sudo passwd

  2. (LiveCD only) Elevate your terminal to superuser with su -

Lastly,

☑ Task 4: time sync

Synchronize the time with your machine for safety and performance: chronyd -q

In the steps that follow, it is assumed that you are running the commands as a superuser. You shouldn’t have to put "sudo" or "doas" in front of any commands, as the above steps should have elevated your shell to superuser.

Partitions

Next, we partition the storage to prepare it for install. I’ll assume you have one single storage device, but you can easily use other drives to create partitions, if desired. Confirm the storage drive that Gentoo will be installed on with lsblk. This should show something like the following:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0 476.9G  0 disk
├─nvme0n1p1 259:1    0  1000M  0 part
├─nvme0n1p2 259:2    0   150G  0 part
└─nvme0n1p3 259:3    0   326G  0 part

Instead of nvme0n1 you may have sda or vda, etc. It is quite important to ensure that you know which storage device you will be installing Gentoo on.

Warning
If you’re not careful in the next step, it may cause you to permanently lose data.

If you understand this, and you’re happy to continue, let’s get to it!

  1. Create the GPT Partition Table
    1. Run gdisk /dev/nvme0n1 (replace nvme0n1 with your device name)

    2. Type o and follow the prompts to create a new GPT partition table.

    3. Type p to confirm the new partition layout. Confirm that the name of the storage device as displayed matches your intended target.

  2. Create the EFI Partition
    1. Type n to create a new partition.

    2. Partition number: Press Enter (defaults to 1).

    3. First sector: Press Enter to use the default.

    4. Last sector: Type +1000M to create a 1000 MiB EFI partition.

    5. Hex code or GUID: Type EF00 (EFI System Partition).

  3. Create the root partition
    1. Type n to create a new partition.

    2. Partition number: Press Enter (defaults to 2).

    3. First sector: Press Enter to use the default.

    4. Last sector: Type +150G to create a root partition (you can change this).

    5. Hex code or GUID: Press Enter to use the default (8300 for Linux Filesystem).

  4. Create the home partition
    1. Type n to create a new partition.

    2. Partition number: Press Enter (defaults to 3).

    3. First sector: Press Enter to use the default.

    4. Last sector: Press Enter to use the rest of the disk.

    5. Hex code or GUID: Press Enter to use the default (8300 for Linux Filesystem).

  5. Write the changes to the disk
    1. Type w to write the partition table.

☑ Task 5: partition table

Create a GPT partition table with an EFI, root, and home partitions. Use the steps above as a guide. Keep in mind that the sizes of each partition should reflect your storage capacity.

Note that this scheme is written to the partition table only. It does not reflect the actual on-disk truth. To that end, we format the partitions with:

☑ Task 6: format

Format the partitions with:

mkfs.vfat -F 32 /dev/nvme0n1p1
mkfs.xfs /dev/nvme0n1p2    (1)
mkfs.ext4 /dev/nvme0n1p3   (2)
  1. You could certainly use mkfs.ext4 here. We’re choosing xfs as it is the recommended filesystem for Gentoo.

  2. xfs doesn’t allow for shrinking (as of writing) so we chose ext4. In the future, if you decide that your root partition is too small, you can always increase its size. In that case, you can shrink your home partition as needed.

And finally, mount the partitions:

☑ Task 7: mount

Mount the partitions:

mkdir -p /mnt/gentoo/{,efi,home}
mount /dev/nvme0n1p2 /mnt/gentoo
mount /dev/nvme0n1p1 /mnt/gentoo/efi
mount /dev/nvme0n1p3 /mnt/gentoo/home

This will result in something like (again, run lsblk):

Storage scheme
...
├─nvme0n1p1 259:4    0  1000M  0 part /mnt/gentoo/efi    (1)
├─nvme0n1p2 259:5    0   150G  0 part /mnt/gentoo        (2)
└─nvme0n1p3 259:6    0   326G  0 part /mnt/gentoo/home
  1. Your ESP partition

  2. We’ll call /dev/nvme0n1p2 ROOTPART in the article (this may be different for you)

We will create the swap as /swapfile when we chroot into our system in the steps that follow.

Stage 3 Tarball

The Gentoo stage 3 tarball is a boilerplate bundle of a small Linux-based system. We will grab the desktop-openrc archive from the distfiles repo, and unpack it into our newly-mounted system.

☑ Task 8: fetch tarball

Get the tarball and related checksum files:

cd /mnt/gentoo
wget -r -np -nd --accept "stage*" \
    "https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-desktop-openrc/"    (1)
  1. Ensure that your downloaded archive is the desktop-openrc variety and that the URL is exactly as shown!

You could theoretically skip this small step, but I highly recommend that you take a few minutes to ensure that your copy of the tar.xz file is not compromised:

☑ Task 9: verify

Verify the tarball:

sha256sum --check stage3-amd64-*.tar.xz.sha256

If successful, you will see a message similar to:

stage3-amd64-desktop-openrc-20241220T192248Z.tar.xz: OK.

☑ Task 10: unpack

Unpack the tarball:

tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo

After this command, /mnt/gentoo will contain the skeleton of your new Linux system.

Chroot

chroot (Change root) is a Unix system utility used to change the apparent root directory to create a new environment logically separate from the main system’s root directory (source)

Ensure that networking works even after entering our new environment:

☑ Task 11: copy networking
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Mirror the mount state of the current system to the chroot system:

☑ Task 1: filesystems
mount --types proc /proc /mnt/gentoo/proc && \
mount --rbind /sys /mnt/gentoo/sys && \
mount --make-rslave /mnt/gentoo/sys && \
mount --rbind /dev /mnt/gentoo/dev && \
mount --make-rslave /mnt/gentoo/dev && \
mount --bind /run /mnt/gentoo/run && \
mount --make-slave /mnt/gentoo/run

And finally:

☑ Task 12: chroot
chroot /mnt/gentoo /bin/bash

We’re in!

Congratulations, you’re now in your new system! Let’s make sure our environment is properly loaded:

☑ Task 13: update environment
env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

Set the root password:

☑ Task 14: new root password
passwd

Compile options

At this point, we add common flags, rust flags, use flags, any video cards, license acceptance, and finally, binary packages to make.conf.

Editing files

Whenever this guide mentions adding or editing a file, you can use nano as the editor. It’s a simple text editor that will get the job done. To save and exit a file, simply press Ctrl+x and follow the prompts to save.

/etc/portage/make.conf

COMMON_FLAGS="-march=native -O2 -pipe"               (1)

RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"        (2)
USE="-gtk -gnome dist-kernel qt5 kde"                (3)
VIDEO_CARDS="intel"                                  (4)
ACCEPT_LICENSE="-* @FREE @BINARY-REDISTRIBUTABLE"    (5)

FEATURES="${FEATURES} getbinpkg"                     (6)
FEATURES="${FEATURES} binpkg-request-signature"
  1. add -march=native (as indicated)

  2. add necessary Rust flags

  3. add these starter global USE flags - we will discuss these later

  4. please read this to ensure that you select the correct video card.

  5. please read this to understand how this affects your system usage

  6. enable binhost packages (add both lines)

☑ Task 15: update make.conf

Change your /etc/portage/make.conf file to reflect the above changes.

Swap

NOTE

For more modern systems (>1GB), your swap space should be at a minimum be equal to your physical memory (RAM) size "if you use hibernation", otherwise you need a minimum of round(\$sqrt(RAM)\$) and a maximum of twice the amount of RAM. source

From the handbook, we learn:

RAM size Suspend support? Hibernation support?

2 GB or less

2 × RAM

3 × RAM

2 to 8 GB

RAM amount

2 × RAM

8 to 64 GB

8 GB minimum, 16 maximum

1.5 × RAM

64 GB or greater

8 GB minimum

Hibernation not recommended!

The lesson is, you really do have to take into account your needs. When selecting the size, doubling the size of your RAM is a very safe amount, especially if you think you will use very RAM-intensive applications and/or system hibernation.

For the purposes of simplicity, we can create a decently-sized swap file, the same size as the RAM:

☑ Task 16: make swap
cd /
mkswap -U clear --size 16G --file /swapfile    (1)
swapon /swapfile
  1. Assuming you have 16G of RAM

Because we created a swapfile that can be resized, feel free to monitor your system as you use it: you can always adjust the size in the future. Simply turn swap off with swapoff, delete the swapfile, and repeat the steps above.

Checkpoint

In order for EFI stub boot to work, and hence uefi-mkconfig, we verify that PARTTYPE, etc. are not blank:

lsblk -o NAME,PARTTYPE

PARTTYPE s should contain a UUID similar to:

lsblk example printout
NAME        PARTTYPE
nvme0n1
├─nvme0n1p1 c12a7328-f81f-11d2-ba4b-00a0c93ec93b
├─nvme0n1p2 0fc63daf-8483-4772-8e79-3d69d8477de4
└─nvme0n1p3 0fc63daf-8483-4772-8e79-3d69d8477de4
☑ Task 17

Verify that the lsblk printout shows non-empty PARTTYPES

Sync repos

☑ Task 18: webrsync

Ensure packages sync with fast mirrors:

emerge-webrsync

Optionally, you can also pick faster mirrors:

emerge --ask --verbose --oneshot app-portage/mirrorselect
mirrorselect -c USA -s3 -b10 -o >> /etc/portage/make.conf

fstab

The fstab (file system table) file (/etc/fstab) is a configuration file that defines how and where the main filesystems are to be mounted, especially at boot time source.

Simply, in the fstab file we tell the system how to mount devices at boot time. This can be done by pointing to the partitions we created at the beginning of this guide. However, systems that have multiple storage devices can rename their partitions unexpectedly. The safest way to refer to these partitions is by declaring their UUIDs, and that’s the method we use next.

We’ll use the handy-dandy genfstab that autogenerates the fstab entries for us.

☑ Task 19: install genfstab
emerge --ask --verbose --oneshot sys-fs/genfstab

To get a sneak-peak at what will generate, we run genfstab on the root filesystem /:

genfstab -U /    (1)
  1. -U tells genfstab to generate UUIDs

This will produce something like:

# /dev/nvme0n1p2
UUID=f8c5e2ea-2a11-4fd3-8d92-2e8839bad58a  /       xfs    [...]

# /dev/nvme0n1p3
UUID=be80f048-7b36-47d1-9a44-df535f052767  /home   ext4   [...]

# /dev/nvme0n1p1
UUID=B009-5181                             /efi    vfat   [...]

/swapfile                                  none    swap   [...]

If genfstab did not generate an output similar to this (i.e. your partitions are not visible), perhaps you did not mount the partitions properly before the chroot. Exit the chroot system with exit, mount the systems properly, and come back to this step to see if genfstab generates the required entries.

If this seems correct to you, we can apply the changes with:

☑ Task 20: write to fstab
genfstab -U / >> /etc/fstab

Profiles

To install KDE, we will select the desktop/plasma profile. Running eselect profile list should produce a list similar to:

List all profiles
...
[23]  default/linux/amd64/23.0/desktop (stable) *           (1)
[24]  default/linux/amd64/23.0/desktop/systemd (stable)
[25]  default/linux/amd64/23.0/desktop/gnome (stable)
[26]  default/linux/amd64/23.0/desktop/gnome/systemd (stable)
[27]  default/linux/amd64/23.0/desktop/plasma (stable)      (2)
[28]  default/linux/amd64/23.0/desktop/plasma/systemd (stable)
[29]  default/linux/amd64/23.0/no-multilib (stable)
[30]  default/linux/amd64/23.0/no-multilib/systemd (stable)
[31]  default/linux/amd64/23.0/no-multilib/hardened (stable)
...
  1. This is probably the profile that is currently selected

  2. This is our target

Change to this profile with:

☑ Task 21: select profile
eselect profile set 27    (1)
  1. Replace 27 with the correct number from the printout in your terminal

Localization

List the available locales with ls -l /usr/share/zoneinfo. Link your preferred region and locale to localtime.

☑ Task 22: set localtime
ln -sf /usr/share/zoneinfo/REGION/LOCALE /etc/localtime

Assuming your locale is en_US,

☑ Task 23: add locales to gen

Add these lines to /etc/locale.gen:

en_US ISO-8859-1
en_US.UTF-8 UTF-8
NOTE

Even if your locale is not en_US, add it in addition to your own. Some software relies on the en_US locale to be present in order to run correctly.

Now, generate the locales:

☑ Task 24: generate locales
locale-gen
Alternate keyboards

If you use a different keyboard (like de) layout you can edit /etc/conf.d/keymaps or with a command like:

echo keymap="de" >> /etc/conf.d/keymaps

See this wiki page for more info.

Finally, we tell our system which locale we want to use. List the options with:

eselect locale list

and make a note of your locale with the utf8 postfix (for me that would be en_US.utf8):

Available targets for the LANG variable:
  [1]   C
  [2]   C.utf8
  [3]   POSIX
  [4]   en_US
  [5]   en_US.iso88591
  [6]   en_US.utf8    (1)
  [7]   C.UTF8 *
  [ ]   (free form)
  1. This is our target

Set the number accordingly:

☑ Task 25: select locale

Select your locale from eselect locale list:

eselect locale set 6

and reload the environment:

☑ Task 26 reload the environment
env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

Prepare installkernel

There’s actually quite a few options for booting your system. Some common choices are GRUB and systemd-boot (which works on openrc init systems, despite its name). However, we’ll keep it simple , and elect to boot with EFI stub. It’s fast, gets out of the way nicely, and relatively easy to setup.

Let’s go ahead and prep the system to use the EFI stub bootloader. Add the following lines to the installkernel file:

☑ Task 27: set keywords

Add the following to /etc/portage/package.accept_keywords/installkernel:

sys-kernel/installkernel
sys-boot/uefi-mkconfig
app-emulation/virt-firmware

The above needs to exist because EFI stub is somewhat experimental, and there’s no guarantee that your motherboard will support it. But! If you’re installing on hardware that does not accept EFI stub as a bootloader, then you’re probably already prepared to do your own customized booting. In any case, GRUB handles many different situations, and I highly recommend it if something goes awry.

Let’s tell installkernel to be efistub-aware and make sure dracut creates the initramfs we need to load a functional system:

☑ Task 28: set use flags

Add the following to /etc/portage/package.use/installkernel:

sys-kernel/installkernel efistub dracut

and emerge installkernel:

☑ Task 29: install
emerge --ask sys-kernel/installkernel

Finally, create the necessary EFI location:

☑ Task 30: Gentoo EFI directory
mkdir -p /efi/EFI/Gentoo

The kernel

Customizing a kernel can be done on any Linux system, but Gentoo and its handbook is particularly attuned to what settings you need. There are many articles which include the necessary kernel settings required to enable a feature.

You can’t go wrong with the distribution kernel, gentoo-kernel-bin, and that’s the one we’ll install. In the future, once you have a working kernel installed, feel free to try and compile your own!

☑ Task 31: install the kernel

Install the kernel with:

emerge --ask sys-kernel/gentoo-kernel-bin    (1)
  1. You will see warnings about missing firmware - we will install these soon

Because it’s the only kernel on our system, the next step is optional, but helpful to see what kernel your system is aware of:

eselect kernel list

You should see only one option, and it’s already selected.

Configuring the bootloader

Add your [rootpart] to the uefi-mkconfig file.

KERNEL_CONFIG="... ; root=/dev/ROOTPART"    (1)
  1. Ensure that you replace ROOTPART with the partition that you created previously (for example /dev/sda2)

Alternatively, you can also choose to designate this with a UUID, similar to our method for ensuring our fstab correctly reflects our system. In that case you would instead add:

KERNEL_CONFIG="... ; root=UUID=YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"    (1)
  1. Replace the YYYY …​ with the UUID for your ROOTPART partition

☑ Task 32: setup uefi-mkconfig

Add your ROOTPART to /etc/default/uefi-mkconfig using either of the methods listed above.

Checkpoint

We should ensure that our UEFI sees our kernel image, and that it’s set as the default.

Run efibootmgr. You should get something like:

BootOrder: 01FF,0200,001A,001B,001C,001D,001E,001F,0020,...    (1)
...
...
<other entries>
...
...
Boot01FF* UMC 1 Gentoo Linux 6.6.62     HD(1,GPT,82421fb4-0630-4d66-bc7d-4f196c3ece9e,0x800,0x1f4000)/\EFI\Gentoo\vmlinuz-6.6.62-gentoo-dist.efi    (2)
  1. Note that 01FF will boot first, as confirmed by …​

  2. …​ the entry here

☑ Task 33: check efibootmgr

Using efibootmgr, check that your kernel is selected to boot, as described above.

Hardware

It’s time to configure your hardware.

☑ Task 34: CPU capabilities

Add your CPU capabilities:

emerge --ask --oneshot app-portage/cpuid2cpuflags
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

Install linux firmware and sound firmware:

☑ Task 35: firmware
emerge --ask \
    sys-kernel/linux-firmware \
    sys-firmware/sof-firmware    (1)
  1. Sound Open Firmware binaries - see this table to verify that your CPU supports it (with most modern-ish CPUs, it will).

Further, for intel architectures,

☑ Task 36: intel microcode
emerge --ask \
    sys-firmware/intel-microcode \
    x11-drivers/xf86-video-intel

Microcode updates for AMD processors are provided by the sys-kernel/linux-firmware package (installed above).

Please read the Gentoo NVIDIA article for more info on NVIDIA cards.

Now, regenerate the initramfs to ensure your system will boot properly:

☑ Task 37: regen initramfs
emerge --ask --config sys-kernel/gentoo-kernel-bin

USE flags

USE flags are a big topic and are one of the big reasons Gentoo is reputable for supporting fine-grained control over your Linux system. Simply put, USE flags tell software what kind of features should be enabled or disabled. Managing USE flags can be daunting at first, but at its simplest, it is adding or removing flags from a set of files in the /etc/portage/package.use directory.

Example

We added a set of flags for your CPU above. These should be in /etc/portage/package.use/00cpu-flags.

Let’s add some more USE flags to a file called general (note that any valid filename will work):

☑ Task 38: add use flags

Add the following to /etc/portage/package.use/general:

app-admin/doas persist
media-gfx/gimp heif jpeg2k webp

In a little while, we will install doas to enable a regular user to run programs as another user (read: usually as root). The persist USE flag just tells doas to compile with that feature enabled (it extends the time that subsequent doas invocations can be run without entering a password). On gimp, we enable support for different media types (there are more), such as heif and webp.

Gentoo is a system that respects you. It does not assume / assert on how you want to use your computer. You tell it how you want to use it.

How do I pick my USE flags?
  1. Run equery uses package/name for your target package and read through the list of options.

  2. Add each package name and USE flags to a file in your package.use directory (as we did above).

  3. Install the package with emerge --ask package/name.

equery is provided by the app-portage/gentoolkit package (you can install this now, or later).

There are some caveats to the note above. Namely, sometimes it is necessary to do a @world update, or perhaps add additional USE flags as reported by an unsuccessful emerge attempt. As always, the section in the wiki on emerge is your friend.

You should visit the Gentoo wiki page on USE flags as soon as you’re done with this guide. For instance, setting the desktop profile to plasma enabled some USE flags automatically, and these are the kinds of details you’ll miss out on if you don’t read the wiki (so go read it already!)

☑ Task 39: homework

Use the method above to discover what USE flags the gimp package has.

System Utilities

Run the following commands to get a variety of useful system services going:

Logger
emerge --ask app-admin/sysklogd && \
    rc-update add sysklogd default
Cron job management
emerge --ask sys-process/cronie && \
    rc-update add cronie default
enable SSH
rc-update add sshd default
Time sync
emerge --ask net-misc/chrony
rc-update add chronyd default
NVME and storage utilities
emerge --ask \
    sys-block/io-scheduler-udev-rules \
    sys-fs/xfsprogs \
    sys-fs/e2fsprogs \
    sys-fs/dosfstools
☑ Task 40: add system utilities

Add system utilities using instructions above.

Laptop things (Optional)

For CPU usage profiles, install power-profiles-daemon:

Performance profiles manager
emerge --ask sys-power/power-profiles-daemon && \
    rc-update add power-profiles-daemon default

and enable battery saving options with tlp:

No-fuss laptop power management
emerge --ask sys-power/tlp && \
    rc-update add tlp default
NOTE

If you have intel, you can monitor temperature with:

emerge --ask sys-power/thermald && \
    rc-config add thermald

Networking

Set your hostname and networking routes (replace majatux with whatever name you desire):

☑ Task 41: add hostname
echo majatux > /etc/hostname
echo hostname="majatux" > /etc/conf.d/hostname    (1)
  1. This step may be necessary with openrc: it explicitly sets the hostname during boot to override any runtime changes.

☑ Task 42: hosts

Add the following to /etc/hosts:

/etc/hosts
127.0.0.1       localhost
::1             localhost
127.0.1.1       majatux

and enable Network Manager:

☑ Task 43: network manager
rc-update add NetworkManager default

Install KDE

We’re ready to install KDE. Congratulations!

This will take a long time (2 - 18 hours, depending on your hardware). Go to sleep, go for a long walk, or just take a break while it runs:

☑ Task 44: install KDE
emerge -aq kde-plasma/plasma-meta kde-apps/kde-apps-meta

Use SDDM as the display manager

We need a display manager to manage our sessions. Ok, technically you don’t need a display manager to run KDE, but I think most people will appreciate having a login screen after their computer boots.

☑ Task 45: display manager
emerge --ask gui-libs/display-manager-init

Set SDDM as the display manager.

☑ Task 46: SDDM

Add the following content to ./etc/conf.d/display-manager:

CHECKVT=7
DISPLAYMANAGER="sddm"

Add dbus, activate elogind, and sddm to start-up services:

☑ Task 47: Enable SDDM
rc-update add dbus default
rc-update add elogind boot
rc-update add display-manager default

Enable configuring SDDM from KDE:

☑ Task 48: configure SDDM
emerge --ask kde-plasma/sddm-kcm
NOTE

The first time you boot into the SDDM display manager, you may be a bit underwhelmed by the look. Fear not! You can set the theme for SDDM through KDE settings after your first log in (in fact, you can set it to your current theme - Breeze, etc.)

Regular user

Add a regular user (here, marian) to the system:

☑ Task 49: add regular user
useradd -m -G wheel,video,plugdev marian
passwd marian

Let’s use the simpler doas for superuser elevation:

☑ Task 50: doas
emerge --ask app-admin/doas

To let anyone in the wheel group to run privileged commands:

☑ Task 51: configure doas

Add the following to /etc/doas.conf

permit persist :wheel

Exit chroot:

☑ Task 52: exit chroot
exit

unmount the system,

☑ Task 53: unmount system
umount -R /mnt/gentoo

and …​

☑ Task 54: reboot
reboot

With this, let’s take a look at a few tasks that you may need to do after the first reboot.

Tasks after first reboot

☑ Task 55: login

Login as your regular user that you created in the steps above.

Open konsole. Let’s make sure we have the current emerge packages and update @world:

☑ Task 56: update
doas emerge --sync
doas emerge --ask --changed-use --deep @world

TODOs (use at your own risk)

Here’s some follow up things I will add soon. Please note that any notes here are incomplete, wrong, and should not be followed ad verbatim. User beware!

TODO: get bin packages of all @world packages

emerge --ask --verbose --update --deep --newuse --getbinpkg @world

TODO: enabling fonts

emerge -av \
    media-fonts/liberation-fonts \
    media-fonts/libertine \
    media-fonts/noto \
    media-fonts/dejavu \
    media-fonts/droid \
    media-fonts/sil-gentium \
    media-fonts/ubuntu-font-family \
    media-fonts/urw-fonts \
    media-fonts/corefonts \
    media-fonts/unifont \
    media-fonts/inter

View all available (system) fonts:

eselect fontconfig list

Enable the ones you want en masse:

Example all-in-one
for i in {35,36,37,40,57,58,59,63,65}; do eselect fontconfig enable $i ; done

TODO: Console font

emerge -aquDU @world media-fonts/terminus-font
eselect fontconfig list
eselect fontconfig enable 63     (1)
nvim /etc/conf.d/consolefont
rc-update add consolefont boot
  1. change this number

TODO: gtk "breeze" niceness

GTK-based software can use Breeze (or Breeze-like):

emerge -av kde-plasma/breeze-gtk kde-gtk-config

Then, select Settings > Colors & Themes > Global Themes > Configure GNOME/GTK Application Styles

TODO: add graphics card drivers for intel/amd/nvidia

emerge -av x11-driver/xf86-video-intel

TODO: typical software to install and USEful flags

Probably don’t need this here. The user will know what they want.

An incomplete list
app-admin/doas
app-admin/pass
app-admin/stow
app-admin/sysklogd
app-editors/neovim
app-eselect/eselect-repository
app-misc/tmux
app-misc/wayland-utils
app-office/libreoffice
app-portage/gentoolkit
app-portage/pfl
app-shells/fzf
app-shells/gentoo-zsh-completions
app-shells/zsh
app-shells/zsh-completions
app-shells/zsh-syntax-highlighting
app-text/aha
app-text/poppler
app-text/tree
app-text/zathura
dev-lua/luarocks
dev-python/pynvim
dev-python/secretstorage
dev-ruby/bundler
dev-util/clinfo
dev-util/tree-sitter-cli
dev-util/vulkan-tools
dev-vcs/git
games-misc/cowsay
kde-apps/kde-apps-meta
kde-plasma/breeze-gtk
kde-plasma/kde-gtk-config
kde-plasma/plasma-meta
media-fonts/corefonts
media-fonts/dejavu
media-fonts/droid
media-fonts/liberation-fonts
media-fonts/libertine
media-fonts/noto
media-fonts/sil-gentium
media-fonts/terminus-font
media-fonts/ubuntu-font-family
media-fonts/unifont
media-fonts/urw-fonts
media-gfx/gimp
media-gfx/inkscape
media-gfx/pdf2svg
media-libs/libexif
media-libs/libva-intel-media-driver
media-libs/mesa
media-libs/mutagen
net-libs/nodejs
net-misc/chrony
net-misc/whois
net-misc/yt-dlp
net-p2p/syncthing
sys-apps/bat
sys-apps/dmidecode
sys-apps/fd
sys-apps/fwupd
sys-apps/hwinfo
sys-apps/lshw
sys-apps/merge-usr
sys-apps/pciutils
sys-apps/ripgrep
sys-apps/usbutils
sys-auth/rtkit
sys-block/io-scheduler-udev-rules
sys-firmware/intel-microcode
sys-firmware/sof-firmware
sys-fs/dosfstools
sys-fs/genfstab
sys-fs/ncdu
sys-fs/xfsprogs
sys-kernel/gentoo-kernel-bin
sys-kernel/installkernel
sys-kernel/linux-firmware
sys-power/power-profiles-daemon
sys-power/thermald
sys-power/tlp
sys-process/cronie
www-client/firefox
www-plugins/passff-host
x11-apps/mesa-progs
x11-apps/xdpyinfo
x11-drivers/xf86-video-intel
x11-terms/wezterm

If this is in something like packages.txt, then we can run something like:

Install from a list of packages (one per line)
xargs -a packages.txt emerge --ask

TODO: optional lto optimization

Just go read the Gentoo page.

TODO: System Monitor in KDE needs these

emerge -av sys-apps/dmidecode \
    app-misc/wayland-util \
    app-text/aha \
    dev-util/clinfo \
    dev-util/vulkan-tools \
    sys-apps/fwupd
    x11-apps/mesa-progs \
    x11-apps/xdpyinfo \

TODO: basic encryption

Partition drive according to instructions.

/efi -> boot (~ 1G)
/    -> root (the rest)
  • mkfs.vfat -F32 boot (don’t format root, yet!)

  • cryptsetup luksFormat /dev/nvme0n1p2

  • cryptsetup open /dev/nvme0n1p2 cryptroot

  • pvcreate /dev/mapper/cryptroot

  • vgcreate vg /dev/mapper/cryptroot

  • lvcreate -L 16G vg -n swap

  • lvcreate -l 100%FREE vg -n root

  • mkfs.xfs /dev/vg/root

  • mkswap /dev/vg/swap

  • swapon /dev/vg/swap

  • mount /dev/vg/root /mnt/gentoo

  • mkdir /mnt/gentoo/efi

  • mount /dev/nvme0n1p1 /mnt/gentoo/efi

NAME            FSTYPE      FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1
├─nvme0n1p1     vfat         854.9M    16% /efi
└─nvme0n1p2     crypto_LUKS
  └─luks-xx     LVM2_member
    ├─vg-swap   swap                       [SWAP]
    └─vg-root   xfs          186.8G    80% /var/lib/docker

In chroot:

/etc/dracut.conf.d/crypt.conf

hostonly="yes"
add_dracutmodules+=" crypt dm rootfs-block "

/etc/default/uefi-mkconfig

KERNEL_CONFIG="%entry_id %linux_name Linux %kernel_version ; root=UUID=b8eaad84-928f-456e-879b-dddef0e78e7a rd.luks.uuid=20ce96f6-adb6-46e1-94ca-85a5f6db0eb0"    (1)
  1. Note the addition of UUID and rd.luks

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment