9 minute read

My Arch Linux Setup with Plasma 5

Arch Linux is a general purpose GNU/Linux distribution that provides most up-to-date software by following the rolling-release model. Arch Linux allows you to use updated cutting-edge software and packages as soon as the developers released them.

Plasma 5 is the current generation of the desktop environment created by KDE primarily for Linux systems.

In this post, we will do a complete installation of Arch Linux with Plasma 5 as the desktop environment. Our setup will also involve encryption of the root partition that will be formatted in btrfs. This post is an updated and a more complete version of my previous posts on Arch Linux and Plasma 5 Installation.

System Details

For reference, my installation system is a slightly upgraded form of my original desktop:

  • i7 4790 3.6 GHz (Haswell)
  • ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA USB 3.0
  • ADATA XPG V1.0 DDR3 1866 4x4 GB RAM
  • OCZ Vertex 460A Series 2.5" 240 GB
  • WD Blue 1TB 3.5" 7200 RPM, 64MB Cache
  • WD Blue 3TB 3.5" 7200 RPM, 64MB Cache
  • Ultra LSP V2 650 Watt PSU
  • Cooler Master - MasterCase Pro 5
  • Asus BW-12B1ST/BLK/G/AS Blue Ray Burner
  • Samsung U28E590D 28-Inch UHD LED-Lit 4K Monitor
  • Nvidia GeForce GTX 750 Ti GPU

Base Installation

Before beginning this guide, I would assume that you have a bootable USB of the latest Arch Linux Installer. If not, please follow the Arch wiki guide to create one for you.

Once you login in the installer disk, You will be logged in on the first virtual console as the root user, and presented with a zsh shell prompt. I will assume you have an Ethernet connection and hence will be connected to Internet by default. If you have to rely on wifi, please refer to the Wireless Network Configuration wiki page for the detailed setup. You must have Internet connection at this stage before proceeding any further.

You should boot into UEFI mode if you have a UEFI motherboard and UEFI mode enabled.

To verify you have booted in UEFI mode, run:

This should give you a list of set UEFI variables. Please look at the Arch Installation Guide in case you do not get any list of UEFI variables.

The very first thing that annoys me in the virtual console is how tiny all the fonts are. We will fix that by running the following commands:

We are all set to get started with the actual installation process.

HDDs Partitioning

First find the hard drive that you will be using as the main/root disk.

Say, we will be using /dev/sda as the main disk and /dev/sdb as /data and /dev/sdc as /media .

Because we are creating an encrypted file system it’s a good idea to overwrite it with random data.

We’ll use badblocks for this. Another method is to use dd if=/dev/urandom of=/dev/xxx, the dd method is probably the best method, but is a lot slower. The following step should take about 20 minutes on a 240 GB SSD.

Next, we will create GPT partitions on all disks using gdisk command.

Then press 2 to create a blank GPT and start fresh

It might now kick us out of gdisk, so get back into it:

Repeat the above procedure for /dev/sdb and /dev/sdc, but create just one partition with all values as default. At the end we will have three partitions: /dev/sda1, /dev/sda2, /dev/sdb1 and /dev/sdc1.

Setup Disk Encryption

Our /boot partition will be on /dev/sda1, while the main installation will be on /dev/sda2. In this setup, we will be enabling full encryption on /dev/sda2 only.

In order to enable disk encryption, we will first create a root luks volume, open it and then format it.

Automatic Key Login from an USB/SD Card

If you want to automatically login the encrypted disk password from an externally attached USB or SD card, you will first need to create a key file.

Then, add this key to the luks container, so that it can be later used to open the encrypted drive.

Note that the KEYFILE here should be kept on a separate USB drive or SD card.

The recommended way of using such a disk would be as follows:

We will be later using this KEYFILE in boot loader setup.

Format HDDs

At this point, we have following drives ready for format: /dev/sda1, /dev/mapper/root, /dev/sdb1 and /dev/sdc1.

These can be format as follows:

Now, we will create btrfs subvolumes and mount them properly for installation and final setup.

Now, once the sub-volumes have been created, we will mount them in appropriate locations with optimal flags.

Save the current /etc/resolv.conf file for future use!

Base System Installation

Now, we will do the actually installation of base packages.

Initial System Setup

Edit the /mnt/ect/fstab file to add following /tmp mounts.

Finally bind root for installation.

We will also add hostname to our /etc/hosts file:

We also need to fix the mkinitcpio.conf to contain what we actually need.

Boot Manager Setup

systemd-boot, previously called gummiboot, is a simple UEFI boot manager which executes configured EFI images. The default entry is selected by a configured pattern (glob) or an on-screen menu. It is included with the systemd, which is installed on an Arch systems by default.

Assuming /boot is your boot drive, first run the following command to get started:

It will copy the systemd-boot binary to your EFI System Partition ( /boot/EFI/systemd/systemd-bootx64.efi and /boot/EFI/Boot/BOOTX64.EFI - both of which are identical - on x64 systems ) and add systemd-boot itself as the default EFI application (default boot entry) loaded by the EFI Boot Manager.

Finally to configure out boot loader, we will need the UUID of some of our hard drives. These can be easily done using the blkid command.

Now, make sure that the following two files look as follows, where UUIDs is the value obtained from above commands.

Do not forget to modify UUIDs and KEYFIL entries!

Network Setup

At first we will need to figure out the Ethernet controller on which cable is connected.

In my case, the name of the device is enp0s25.

Using this name of the device, we need to configure, and enable the systemd-networkd.service service.

Note that we will using the resolv.conf that we saved from this session.

Network configurations are stored as *.network in /etc/systemd/network. We need to create ours as follows.:

Now enable the networkd services:

Your network should be ready for the first use!

Sync time automatically using the systemd service:

Now run the following:

Avahi is a tool that allows programs to publish and discover services and hosts running on a local network with no specific configuration. For example you can plug into a network and instantly find printers to print to, files to look at and people to talk to.

We can easily set it up it as follows:

We will also install terminus-font on our system to work with proper fonts on first boot.

First Boot Installations

Now we are ready for the first boot! Run the following command:

After your new system boots, Network should be setup at the start. Check the status of network using:

If you do not get this output, please follow the troubleshooting links at Arch Wiki on setting up network.

Adding New User

Choose $USERNAME per your liking. I chose ssingh, so in future commands whenever you see ssingh please replace it with your $USERNAME.

GUI Installation with nvidia

I will be assuming you have an NVIDIA card for graphics installation.

To setup a graphical desktop, first we need to install some basic X related packages, and some essential packages (including fonts):

To avoid the possibility of forgetting to update your initramfs after an nvidia upgrade, you have to use a pacman hook like this:

Nvidia has a daemon that is to be run at boot. To start the persistence daemon at boot, enable the nvidia-persistenced.service.

How to Avoid Screen Tearing

Tearing can be avoided by forcing a full composition pipeline, regardless of the compositor you are using.

In order to make this change permanent, We will need to edit nvidia configuration file. Since, by default there aren't any, we will first need to create one.

Specific for Plasma 5, we will also create the following file to avoid any tearing in Plasma.

How to Enable Better Resolution During Boot

The kernel compiled in efifb module supports high-resolution nvidia console on EFI systems. This can enabled by enabling the DRM kernel mode setting.

First, we will need to add following to MODULES section of the mkinitcpio.conf file:

  • nvidia
  • nvidia_modeset
  • nvidia_uvm
  • nvidia_drm

We will also need to pass the nvidia-drm.modeset=1 kernel parameter during the boot.

Finally run:

Plasma 5 Installation and Setup

We can now proceed with the installation of Plasma 5. In the process, we will also install some useful fonts.

We will also need to select proper themes for the Plasma 5 display manager sddm and then enable its systemd service.

Now run:

Once, we boot into the new system, we should have a basic Plasma 5 desktop waiting for you. In the following section, we will be do installation and modifications to the system that I prefer.

Post Installation Setup

Plasma 5 provides a handy network manager applet. However, in order to use it properly we will need the NetworkManager service to be enabled. This applet allows user specific enabling of wifi, ethernet or even VPN connections.

We can also automate the hostname setup using the following systemd command:

Selecting pacman Mirrors

The pacman package provides a "bash" script, /usr/bin/rankmirrors, which can be used to rank the mirrors according to their connection and opening speeds to take advantage of using the fastest local mirror.

We will do this only on the US based mirrors. First make a copy of the mirrors list file and then delete all non-US mirrors. We will then rankmirrors script on the modified list to get the top 6 mirrors for our regular use.

Setup AUR

AUR is a community-driven repository for Arch users. This allows you to install many popular packages that are otherwise not available through core repositories.

In order to make all types of installations uniform, I use pacaur as the preferred tool for installing all packages. One the biggest advantages of pacaur is that is uses exactly the same options that regular pacman uses.

In order to install pacuar, first install dependencies.

Create a temp directory for building packages:

Install cower first and then pacaur:

Audio Setup

This is pretty simple. Install following packages and you should be done:

Now start the pulseaudio service.

Web Browsers

My preferred choice of browsers is google chrome. However, it is also good to have the KDE native qupzilla.

Profile-sync-daemon (psd) is a tiny pseudo-daemon designed to manage browser profile(s) in tmpfs and to periodically sync back to the physical disc (HDD/SSD). This is accomplished by an innovative use of rsync to maintain synchronization between a tmpfs copy and media-bound backup of the browser profile(s). These features of psd leads to following benefits:

  • Transparent user experience
  • Reduced wear to physical drives, and
  • Speed

To setup. first install the profile-sync-daemon package.

Run psd the first time which will create a configuration file at $XDG_CONFIG_HOME/psd/psd.conf which contains all settings.

In the config file change the BROWSERS variables to google-chrome qupzilla. Also, enable the use of overlayfs to improve sync speed and to use a smaller memory footprint. Do this in the USE_OVERLAYFS="yes" variable.

Note: USE_OVERLAYFS feature requires a Linux kernel version of 3.18.0 or greater to work.

In order to use the OVERLAYFS feature, you will also need to give sudo permissions to psd-helper as follows (replace $USERNAME accordingly):

Verify the working of configuration using the preview mode of psd:

Google Chrome by default uses kdewallet to manage passwords, where as Qupzilla does not. You can change that in its settings.

git Setup

Install git and setup some global options as below:

and setup gitconfig as:

ssh Setup

To get started first install the openssh package.

The ssh server can be started using the systemd service. Before starting the service, however, we want to generate ssh keys and setup the server for login based only on keys.

Now create ssh config as:

Furthermore, before enabling the sshd service, please also ensure to copy your keys to all your relevant other servers and places like github.

We can now use systemd to start the ssh service.

zsh Setup

During the user creation, we already installed the zsh shell. We have also activated a basic setup at first login by the user.

In this section, we will be installing my variation of zprezto package to manage zsh configurations.

First install the main zprezto package:

Now, We will add my version of prezto to the same git repo.

And we are all setup for using zsh!

gpg Setup

We have already installed the gnupg package during the pacaur installation. We will first either import our already existing private keys(s) or create one.

Once We have our keys setup, edit keys to change trust level.

Once all keys are setup, we need to gpg-agent configuration file:

Also, add following to your .zshrc or ."bash"rc file. If you are using my zprezto setup, you already have this!

Now, simply start the following systemd sockets as user:

Finally add your ssh key to ssh agent.

User Wallpapers

You can store your own wallpapers at the following location. A good place to get some good wallpapers are KaOS Wallpapers.

conky Setup

First installed the conky package with lua and nvidia support:

Then, copy your conky configuration at $HOME/.config/conky/conky.conf.

Here, I have also put my simple configuration file:

Software Installations

Here is a running list of other common softwares that I install.

I also add the following repository to install the Sublime Text editor. Refer to my previous post on sublimetext for details on setting up Sublime Text.

Now we can install sublime-text as:

This brings us to the conclusion of this installation guide. Hope many of you find it useful. Please drop your comments below if you have any suggestions for improvements etc.


RELATED POSTS |Linux, Guides

Get in touch 👋

Feel free to email me about anything. Want some advice? Give some feedback?

You can also reach me around the web: GitHub, Twitter, LinkedIn