Hardware

Hardware introspection

Printing keystrokes

This is conventionally handled by the window manager, such as X or recently Wayland.

In both cases xev or showkey can be used to monitor input events and print them to the terminal, along with the key name and scan or key codes respectively.

CPU temperature

CPU temperature:

/sys/class/thermal/thermal_zone0/temp

Listing hardware devices

Listing all of the PCI devices can be achieved with

lspci

You may need to update the PCI database

update-pciids

On HowToGeek is a Ubuntu overview for listing hardware.

Graphics cards

The official Debian wiki has a great overview of graphic driver installations depending on the hardware you are using.

PCI wattage

The power ratings of graphics cards is discussed in detail on the graphics card hub. In brief

  • PCI provides 75 watts

  • 8-pin connector 150 watts

  • 6-pin connector 75 watts

nVidia

List of compatible hardware is here. The nVidia installation follows the following process:

Identify hardware:

lspci -nn | egrep -i "3d|display|vga"

Fetch the Kernel headers (amd64):

sudo apt install linux-headers-amd64

The process varies depending on which Debian version you are using. Since I am using Debian 10.5 Buster, I will first add the buster-backports to my apt sources:

In /etc/apt/sources.list we add

# buster-backports
deb http://deb.debian.org/debian buster-backports main contrib non-free

we then install the packages with

sudo apt update && sudo apt install -t buster-backports nvidia-driver

This performs upstream device detection to fetch the correct driver for your card. Finally, reboot your systemto complete the installation.

CUDA and cuDNN

Installing CUDA is directed in the wiki. In short, we can install CUDA 10 with backports

sudo apt -t buster-backports install nvidia-cuda-dev nvidia-cuda-toolkit

which will install nvcc for gcc >5.3.1.

For cuDNN, we need to create a development account on the nVidia website

The full installation process is documented on the nVidia site.

Troubleshooting

When installing the nvidia-driver, I encountered this issue

sudo apt install -t buster-backports nvidia-driver

which outputted

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nvidia-driver : Depends: nvidia-kernel-dkms (= 440.100-1~bpo10+1) but it is not going to be installed or
                          nvidia-kernel-440.100
                 Recommends: nvidia-persistenced but it is not installable
E: Unable to correct problems, you have held broken packages.

My fix was to ensure consistency in the /etc/apt/sources.list; e.g.

deb http://ftp.ch.debian.org/debian/ buster main contrib non-free
deb http://ftp.ch.debian.org/debian/ buster-backports main contrib non-free

I have buster and buster-backports both configured as main and non-free.

Sound Configuration

Especially on headless installations of *nix, some sound device configuration is required.

NB: In most cases, the user wont succeed in configuring the sound unless they are also part of the audio group.

ALSA

Advanced Linux Sound Architecture replaces the original Open Sound System (OSS) on *nix.

There are conflicting methods for the installation on different *nix systems, but I had personal success on Debian with

sudo apt-get install libasound2 alsa-utils alsa-oss

The seemingly magic configuration step that is missed out in a lot of guides is to create the file

/etc/modprobe.d/default.conf

with contents

options snd_hda_intel index=1

There is some information as to how this works in this wiki entry.

You’ll probably also need to add

pcm.!default {
type hw
card 1
}

ctl.!default {
type hw
card 1
}

to ~/.asoundrc, at least I did on Buster.

ALSA auto-configuration

If the above did not work, or if you altered your sound hardware, a quick-fix for a lot of ALSA related issues is to run the init command:

sudo alsactl init

From the manual:

init tries to initialize all devices to a default state. If device is not known, error code 99 is returned.

CMUS with ALSA

To get CMUS to use ALSA, we edit the ~/.cmus/autosave file and change the configuration to

set dsp.alsa.device=default
set mixer.alsa.device=default
set mixer.alsa.channel=PCM
set output_plugin=alsa

If it fails to start, add the line

set output_plugin=alsa

in (a file which you’ll probably have to create) .cmus/rc.

Hardware specifications

As stated in the Debian wiki, the assigned indexes to sound cards can be found with

cat /proc/asound/cards

To see the hardware device names, you can also use

lspci -nn | grep -i audio

Also useful is

lsmod | grep snd

to see the kernel sound modules.

With ALSA installed, you can also identify the sound devices using

aplay -l