Skip to content

Latest commit

 

History

History
639 lines (431 loc) · 25.6 KB

arch.md

File metadata and controls

639 lines (431 loc) · 25.6 KB

Arch Linux

There are plenty of help-pages, so this md-page just collects some useful snippets or links, but IS NOT A COMPLETE GUIDE.

Good pages to start

Table of Contents

  1. Notes when installing Arch
    1. Partitioning
    2. Add a user
    3. systemd and systemctl
    4. wifi on reboot
    5. Bootloader rEFInd
  2. Notes when setting up Arch
    1. GNOME
    2. Display-Server (xorg, wayland)
    3. KDE-Plasma5
      1. Desktop-Environment itself
      2. Login-Manager
      3. Wayland
      4. Applications
    4. Install printer
    5. Install Visual-Studio-Code
  3. General snippets and interesting stuff
    1. vpn with openconnect
    2. Monitoring system-resources with htop
    3. Printing system-info
    4. Check colors in terminal
    5. Activate colors for pacman (and yay)
    6. Event-Listening with evtest
    7. LaTeX or TeX Live
    8. Mouse-polling-rate
    9. Python
    10. Random-number-generator
    11. Check kernel-default-settings
    12. Check existing groups
    13. Linux Container with lxc/lxd
  4. Cool themes and icons
  5. Fonts
  6. Troubleshooting
    1. Booting into black screen with blinking cursor
    2. Login doesn't work after updating pam
    3. System-maintenance and logging
    4. Could not find tools on server when updating/installing tools
    5. Unrecognized tools or external HDD or whatever
    6. Screen flicker after resume from suspend (Radeon GPU)
    7. CPU random generator seems to be failing (0xffffffff)
    8. vscode's cmd 'Open Containing Folder' opens vscode instead of Files
    9. Can't read from NTFS-format (windows-partition)
    10. Unrecognized mount option windows_names
    11. sp5100-tco: Watchdog hardware is disabled

Notes when installing Arch

In addition to the installation-guide on archwiki, the following notes could be helpful and save google-time. :)

Partitioning

Use fdisk -l to find the respective partition- and disk-names. Note, that the Device-names for Disks, like /dev/sdb or /dev/sda, can change between reboots. Hence don't use these names without lookup via fdisk -l. Then, partition the disk-name (not a partition-name) via fdisk, e.g. fdisk /dev/sdb. Made changes in the resulting mode will change the actual disk-partitions only if you save them. So don't hesitate in executing the fdisk-command.

You will need following types, which can be added inside the fdisk-mode:

  • EFI System
  • Linux filesystem
  • Linux swap

The swap-partition can have a size of ~4 GB. With hibernation (meaning saving RAM to HDD when turning off to restore RAM after reboot), you should take the whole RAM-size plus some extra space, but I don't use hibernation.

Add a user

useradd -m -G wheel -s /usr/bin/zsh USERNAME
passwd USERNAME
visudo # for wheel-user-group

systemd and systemctl

Basic systemctl-stuff can be found here Note that enable means the service to start automatically on reboot, while start means starting it right now for once.

wifi on reboot

Install networkmanager (including nmcli) for wifi and enable it on reboot via systemctl enable NetworkManager.service (should be explained in the Archwiki).

Helpful commands:

# Show little overview
nmcli

# Show network-devices (e.g. wifi-sticks)
ip link # or
nmcli device show

# List nearby wifi networks
nmcli device wifi list

# connect to a wifi network with password being asked interactively
nmcli --ask device wifi connect "${ssid}"

# OR

# connect to a wifi network without password being stored in history
vim tmp_pw.txt
ssid='my-wlan'
nmcli device wifi connect "${ssid}" password "$(cat tmp_pw.txt)"
rm tmp_pw.txt

Bootloader rEFInd

Configure Kernel

Take a look at this super link for documentation of the options. Note that you could have another version as used in the URL.

To check your kernel-version, execute uname -r.

Notes when setting up Arch

GNOME

Just install as mentioned in the Archwiki. When logging in, the default is wayland, but currently (end 2019), wayland doesn't support app-switching, e.g. when Enpass wants to authenticate via browser, going back to the app afterwards.

Display-Server (xorg, wayland)

sudo pacman -S xorg-server xorg-xinit
sudo pacman -S xf86-video-amdgpu

KDE-Plasma5

deprecated

Repeadingly removes my home-directory when trying to uninstall a color-theme. Hence goodbye KDE-Plasma, hello GNOME.

Desktop-Environment itself

sudo pacman -S plasma-meta

sudo pacman -S kdebase-meta
sudo pacman -S kdegraphics-meta
sudo pacman -S kdeutils-meta
sudo pacman -S kdeadmin-meta
sudo pacman -S kdegames-meta
sudo pacman -S kde-gtk-config

Login-Manager

KDE uses sddm (sudo pacman -S sddm sddm-kcm according to ). Based on Google Images, the theme breeze is the same as Manjaro is using.

Changing keyboard-layout for login with SDDM (a display-manager for KDE) can be done in the file /usr/share/sddm/scripts/Xsetup. Add the line

setxkbmap de,us

to enable a selection. More information from askubuntu - Wrong language displayed by SDDM on login Kubuntu 18.04 or US keyboard layout always used or ArchLinux Forum SDDM Keyboard Selection.

Wayland

Applications

If discover shows No application back-ends found, please report to your distribution., then install package-qt5 according to this doc.

Install printer

yay -S cups cups-pdf
yay -S hplip
sudo systemctl start cups
# for automatically starting after reboot
sudo systemctl enable cups

Then enter http://localhost:631/admin and add a new printer. In my case, the printer is HP_Color_LaserJet_MFP_M277dw, so I have added the respective PDD-file from hplib at /usr/share/ppd/HP/hp-color_laserjet_pro_mfp_m277-ps.ppd.gz

Whether your printer needs a plugin, you will find at hp. Executing hp-plugin --interactive after installing hplip should install the plugin. HOWEVER, on my machine at 6th October 2020, this doesn't work. The error-message is something related to the checksum, but in fact, no file is downloaded at all. Here is a workaround:

TLDR

  • When executing hp-plugin --help, your version is printed. In my case, it is 3.20.6.
  • Download the hplip-VERSION-plugin.run and hplip-VERSION-plugin.run.asc of your version (hp-plugin --help) from here.
  • Execute hp-plugin --interactive and use the relative path to the directory, where you've just downloaded your plugin-files to.
# get version
hp-plugin --help

# Download key
curl 'https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-VERSION-plugin.run.asc' -o "${HOME}/Downloads/hplip-VERSION-plugin.run.asc"

# Download plugin-files
curl 'https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-VERSION-plugin.run' -o "${HOME}/Downloads/hplip-VERSION-plugin.run"

# Install and use relative path to download-directory
hp-plugin --interactive --path="${HOME}/Downloads"

# Cleanup
rm "${HOME}/Downloads/hplip-VERSION-plugin.run"
rm "${HOME}/Downloads/hplip-VERSION-plugin.run.asc"

More details about finding the right files/urls

  • Execute which hp-plugin to find the executable, which is a symlink.
  • Follow the symlink to find the underlying py-script.
  • When digging through this py-script (and imported modules in neighbouring py-scripts), you may find the download-url. In my case, the download-function is in /usr/share/hplip/installer/pluginhandler.py.
  • In case the plugin-path (pointing to a local file) is empty, the download-function gathers info from this config.
  • Search for your version in the config-file and find the url to the respective file plugin.run. The key-file plugin.run.asc is needed as well. Probably add .asc to the url, or simply remove the url's suffix to find all relevant files listed. In the list, look for your version (in my case, hplip-3.20.6-plugin.run and hplip-3.20.6-plugin.run.asc).

Install Visual-Studio-Code

I'm using the Open-Source-Build of vscode, installed via yay -S code, and it runs very nice. Note that the vscode-home-directory changes. For more information, see the archwiki.

General snippets and interesting stuff

vpn with openconnect

See archwiki about OpenConnect. Don't forget the integration-section ;)

Monitoring system-resources with htop

This blog explains some basics, for example the colors of the bars, which are:

For CPU-usage

  • Blue: Low priority processes (nice > 0)
  • Green: Normal (user-) processes
  • Red: Kernel processes
  • Yellow: IRQ time
  • Magenta: Soft IRQ time
  • Grey: IO wait-time

For memory-usage

  • Green: Used memory-pages
  • Blue: Buffer-pages
  • Yellow: Cache-pages

Printing system-info

You can use uname -a for quick-info. For a more fancy output, do yay -S archey4 followed by archey printing something like

[dominic:~]$ archey

               +                 User: dominic
               #                 Hostname: aqua
              ###                Model: motherboard
             #####               Distro: Arch Linux [x86_64]
             ######              Kernel: 5.4.11-arch1-1
            ; #####;             Uptime: 26 minutes
           +##.#####             WindowManager: Not detected
          +##########            DesktopEnvironment: GNOME
         #############;          Shell: /usr/bin/zsh
        ###############+         Terminal: xterm-256color ## ## ## ## ## ## ##
       #######   #######         Packages: 1147
     .######;     ;###;`".       Temperature: 16.8 C (Max. 16.8 C)
    .#######;     ;#####.        CPU: ...
    #########.   .########`      GPU: ...
   ######'           '######     RAM: 1934 MB / 16024 MB
  ;####                 ####;    Disk: 167 GB / 522 GB
  ##'                     '##    LAN_IP: ...
 #'                         `#   WAN_IP: ...

Check colors in terminal

From stackoverflow

msgcat --color=test

Activate colors for pacman (and yay)

Uncomment #Color in /etc/pacman.conf.

Event-Listening with evtest

Execute sudo evtest and follow instructions.

LaTeX or TeX Live

Install the packages mentioned in the ArchWiki-page.

Mouse-polling-rate

Check with sudo evhz

Python

Just install python and pip-modules with your package-manager (e.g. yay). No need to use pip (yesss).

Random-number-generator

yay -S haveged

Check kernel-default-settings

Snippet: zcat /proc/config.gz | grep CONFIG_RANDOM_TRUST_CPU

Check existing groups

getent group
cat /etc/group

# Syntax
man group

Linux Container with lxc/lxd

Info can be found here.

While lxc stands for client, the lxd represents the daemon. The daemon provides a socket and has root-rights. The client can send commands to this socket, e.g. to create containers.

Installing lxc and lxd:

yay -S lxc lxd

You can launch privileged and unprivileged containers. The former maps the container-root to the host-root, whereas the latter maps the container-root to some nobody-user. For unprivileged containers, create a uid- and gid-mapping by creating /etc/subuid and /etc/subgid:

root:100000:65536

Look at this super youtube-tutorial as soon as lxc/lxd are running. The man in the video uses lxc without sudo. ATTENTION: You can do this by adding your user to the lxd-group via usermod -a -G lxd <user>. This makes privilege escalation possible, basically meaning that this added user is able to create privileged containers, which can mount the host-system in and change everything with host-root-rights. By the way, same holds for docker.

Cool themes and icons

Install them using yay, like yay nordic-theme-git.

  • aur/nordic-theme-git (dark version)

  • aur/nordic-polar-theme-git (light version)

  • ant-dracula-gtk-theme

  • community/materia-gtk-theme

  • community/arc-gtk-theme

  • community/arc-icon-theme

  • community/papirus-icon-theme

  • aur/zafiro-icon-theme

Fonts

Some cool monospace-fonts

More useful fonts/fonts-pkgs can be found in the Archwiki, e.g.

  • ttf-liberation, which is used in libreoffice-templates
  • ttf-ms-win10, which is a wrapper for local ms-fonts. Microsoft-Fonts can be added from an Windows-ISO as described in the Archwiki.

Troubleshooting

CTRL, ALT and e.g. F2 selects another tty. This can be used to check logs or access the system if something is not running accordingly.

Booting into black screen with blinking cursor

Solution: Switch TTY with ALT, F2 and back with ALT, F1.

Login doesn't work after updating pam

Once, after updating the system, login didn't work. Reason for this was an update in a config of the login-service pam. When pacman updated pam, the config /etc/pam.d/system-login had merge-conflicts with the new version. To keep both versions, pacman adds the new version as /etc/pam.d/system-login.pacnew. Problem has been, that the updated pam needs the new config to work, hence crashed (or something) and login didn't work (even for root).

To solve this: boot from an Bootalbe USB-stick, chroot into the system (see installation-guide on archwiki) and resolve the merge-conflict.

In general, to find pacnew-files, you might play around with

sudo find . -type f -exec grep -i "pacnew" --color=auto {} +

for finding .pacnew-files.

System-maintenance and logging

Via journalctl and systemctl, e.g.

  • systemctl --failed
  • journalctl -p 3 -xb
  • journalctl --unit=sddm.service

See the archwiki for very detailed info about system-maintenance.

Could not find tools on server when updating/installing tools

Arch is strict in versioning, meaning if your system is too old (could mean days), you won't find tools in the mirror-servers. Just update the system (e.g. via yay) and reboot.

Unrecognized tools or external HDD or whatever

If you have updated your system, e.g. via yay, do a restart.

Kernel-updates lead to missing support. In my case the external HDD hasn't been detected anymore (exFAT). I imagine, that old versions should be loaded that are already removed due to the system-update. A restart fixed my problem with the unrecognized external HDD.

Screen flicker after resume from suspend (Radeon GPU)

See in the archlinux-wiki

CPU random generator seems to be failing (0xffffffff)

TLDR Solution is updating BIOS (source: Manjaro-Forum). If you have a mainboard from msi, check this 3-min-video. For the x570 Aorus Elite, check this video.

My AMD-CPU seems to have a bug or something, throwing the message

WARNING: CPU random generator seem to be failing, disable hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff

resulting in bad random numbers (only fff...ff) when using QT (e.g. in matplotlib).

You can check the random-number-generator of your cpu via the following c-script, using an inline-assembler-snippet to access the hardware-random-generator directly, not through your OS.

If the code is saved as script named rdrand-test.c, just execute gcc rdrand-test.c && ./a.out to print the random number.

/*
   The code has been derived from systemd:
   https://github.com/systemd/systemd/blob/master/src/basic/random-util.c

   SPDX-License-Identifier: LGPL-2.1+
*/

#include <stdio.h>

int main() {
  unsigned char success;
  unsigned long v;
  asm volatile("rdrand %0;"
               "setc %1"
               : "=r"(v), "=qm"(success));

  printf("success: %i  value: %lx\n", success, v);
}

Though, you can check the output of head -c 8 /dev/urandom | xxd. If it is random stuff, your OS probably has detected the issue by its own.

Source: archlinux-forum

vscode's cmd 'Open Containing Folder' opens vscode instead of Files

The default-application for opening folders has changed somehow, but your gnome-settings doesn't show it in its section Default Applications. To solve this,

  1. open Files,
  2. right-click on a folder,
  3. select Open With Other Application (or similar)
  4. and select Files since this is probably your preferred application to open folders.
  5. Maybe (cannot tell since I just have done it): Restart all open vscode-windows.

Now, vscode should open containing folders in Files again.

Can't read from NTFS-format (windows-partition)

See see troubleshooting for unrecognized mount option windows_names

Unrecognized mount option windows_names

Install ntfs-3g.

Source: the ubuntu-forum

sp5100-tco: Watchdog hardware is disabled

Add blacklist sp5100_tco to /etc/modprobe.d/sp5100_tco.conf.

Source: archlinux-forum See also: archlinux-wiki for blacklisting kernel-modules