Precautions








Problems and troubleshooting



In general:
What did you change before the problem happened ?
What can you remove to simplify the situation ?

Not Unix's job to stop you from shooting yourself in the foot
Easy Linux tips project's "Solutions for 27 bugs in Linux Mint 19.1"
Easy Linux tips project's "System hacks for advanced Linux Mint users"
Neil Bothwick's "How to fix any Linux problem"

Star Trek Picard: have you tried reversing the polarity of something ?




Magic key-sequences




Eric Simard's "Frozen Linux System? Here are 3 Ways to Deal With It"
superuser's "Does Linux have a Ctrl+Alt+Del equivalent?"







Clean up space on disk



To see used/free space:

df -khT
df -khT -x squashfs -x tmpfs		# don't show snap devices

sudo du -h --summarize --exclude=/home --exclude=/sys --exclude=/proc --exclude=/run /
sudo du -h --summarize -c --exclude=/home --exclude=/sys --exclude=/proc --exclude=/run /*

sudo du -h --summarize -c /home/*
du -sh $HOME/* | sort -h
du -sh $HOME/.[0-9a-z]* | sort -h

sudo df -i



Easy Linux tips project's "How to clean Linux Mint 19 safely"






Performance



If your performance is bad, or you want to make it better:




Run Performance Tests



Phoronix test suite to check performance.
+/-

# Download and extract the test package.
# Then:

sudo ./install-sh
sudo apt install php-cli php-xml pkg-config

phoronix-test-suite --help
# have to accept some license terms etc

# can run via cli or GUI
# GUI will give a CLI-type interface; type 'quit' to get out

# https://www.phoronix-test-suite.com/documentation/phoronix-test-suite.html

phoronix-test-suite list-available-suites
phoronix-test-suite list-available-tests | less

# I want: simple, few dependencies, run in a few minutes, test CPU RAM disk.

# Best to run tests after a fresh boot, no other apps running.
# Run each test 3 times and average them.

phoronix-test-suite benchmark pts/sysbench
# My 2011 Dell Inspiron N5010 with Kubuntu 20.10:
# (Intel Core i3 370M @ 2.39GHz, 8 GB RAM, 320 GB WD3200BEVT-7 with ext4/LUKS)
# gave CPU 2100, RAM 9.8 M
# My 2021 KDE Slimbook 15 with KDE Neon 5.20.5:
# (AMD Ryzen 7 4800H @ 2.9GHz, 16 GB RAM, 256 GB NVMe SSD with ext4)
# gave CPU 17600, RAM 13.6 M

phoronix-test-suite benchmark pts/leveldb
# My 2011 Dell Inspiron N5010 with Kubuntu 20.10:
# (Intel Core i3 370M @ 2.39GHz, 8 GB RAM, 320 GB WD3200BEVT-7 with ext4/LUKS)
# gave seq fill 12 MB/S, hot read 1.76 usec/op, random read 1.71 usec/op.
# My 2021 KDE Slimbook 15 with KDE Neon 5.20.5:
# (AMD Ryzen 7 4800H @ 2.9GHz, 16 GB RAM, 256 GB NVMe SSD with ext4)
# gave seq fill 23 MB/S, hot read 7 usec/op, random read 7 usec/op.

phoronix-test-suite benchmark pts/fio
# Choose sub-test 3 (sequential read), option 4 (Linux AIO), Buffered, Not Direct,
# 4 KB block size.
# My 2011 Dell Inspiron N5010 with Kubuntu 20.10:
# (Intel Core i3 370M @ 2.39GHz, 8 GB RAM, 320 GB WD3200BEVT-7 with ext4/LUKS)
# gave 48 MB/S.
# My 2021 KDE Slimbook 15 with KDE Neon 5.20.5:
# (AMD Ryzen 7 4800H @ 2.9GHz, 16 GB RAM, 256 GB NVMe SSD with ext4)
# gave 1132 MB/S.




Network testing:
+/-
Speedcheck

My 2011 Dell Inspiron N5010 and 100 mbps chip with Kubuntu 20.10:
Without VPN on 600 mbps service: ping 75 down 95 up 100.
With Windscribe VPN (OpenVPN) on 600 mbps service: ping 80-90 down 55-75 up 45-80.
Without VPN on 100 mbps service: ping 70-80 down 95 up 100.
With Windscribe VPN (OpenVPN) on 100 mbps service: ping 85-125 down 85-90 up 75-80.
My 2021 KDE Slimbook 15 and 1000 Mbps chip with KDE Neon 5.20.5:
Without VPN on 600 mbps service: ping 45-55 down 365-445 up 105-130.
With Windscribe VPN (OpenVPN) on 600 mbps service: ping 65 down 15-20 up 50 [fast.com = 65/120].

Apparently "iperf3" is a better way to test (requires 2nd machine on LAN) ?
Also "speedtest-cli" ?



GPU testing:
+/-
Apparently some games, and Steam, will display a "frames per second" as you play the game. You can use this to compare performance before and after changes.
Also, at CLI, run "glxgears" to see frame-rate.
Test suites: Novabench, Heaven UNIGINE.
Is direct rendering enabled ? "glxinfo | grep "direct rendering"



Disk testing:
+/-
Sequential read: "sudo hdparm -t /dev/nvme0n1p2"
KDiskMark
bonnie++



Linux Shell Tips' "How to Create 100% CPU Load on Linux System"





Tweaking/fixing video



Definitely back up the config files before you start messing with stuff, it's easy to go wrong.

Check which GPU and which video driver you're using.
"lspci -nnk | grep -iA2 vga"
"hwinfo --gfxcard"
"lsmod | grep nouveau"
"sudo dmesg | grep gpu"

"nvidia-smi"

Maybe switch between X and Wayland to see which works better.
Maybe try a different compositor (picom ?) on X.

[NOT SURE] Video configurations, and drivers for them:
+/-
  • Intel CPU with integrated graphics: drivers built into kernel.
  • Intel CPU with Intel GPU (HD, Iris, UHD).
  • AMD CPU with integrated graphics: driver built into kernel.
  • AMD CPU with AMD GPU (Radeon): closed-source AMDPRO driver, or open-source AMDGPU / AMDVLK driver, or open-source Mesa RADV Vulkan driver built into Mesa stack.
  • Any CPU with NVIDIA GPU (GeForce, Quadro, NVS): closed-source NVIDIA driver, or open-source Nouveau driver.

Some people report better results (more stability, especially in games) if they disable the "dashboard" that comes with manufacturer's drivers (GeForce Experience and the NVIDIA control panel for NVIDIA; Radeon Software for AMD). Maybe this applies to Windows only ?

Some applications use CUDA, which is a parallel programming framework by NVIDIA.

Refresh rate can be limited by many factors, including connection to monitor (HDMI, DisplayPort).

Vivek Gite's "Linux Find Out Graphics Card Installed In My System"



Tweaking/fixing mouse/trackpad/scrolling/video latency/tearing:

+/-
Definitely back up the config files before you start messing with stuff, it's easy to go wrong.
Check what drivers you are using.
Check what resolution and refresh you are using: "xrandr".
Compare behavior in various apps; maybe change a "smooth scrolling" setting in an app.
For KDE, maybe try kwin-lowlatency package.
Maybe try a different DE, distro, or GPU hardware.


"The addition of input lag is always going to be the trade-off for most solutions that fix screen tearing."

"... tearing happens when the screen has to draw the next frame before its done drawing the current one. If you stay below [maximum rated Hz] your monitor will always have the time to draw frames to the screen. So, just capping the game's fps to, say, [maximum minus 4] fps, should do the trick."







Tweaking/fixing audio



There are various compatibility options. For example, running "apulse" on top of ALSA emulates the API of PulseAudio to the app above apulse. And PipeWire can be run along with PulseAudio, or without PulseAudio ?

The Well-Tempered Computer's "Linux Audio Architecture"
Venam's "Making Sense of The Audio Stack On Unix"
Ahmed S. Darwish's "PipeWire: The Linux audio/video bus"


Definitely back up the config files before you start messing with stuff, it's easy to go wrong.

ArchWiki's "Advanced Linux Sound Architecture / Troubleshooting" ArchWiki's "PulseAudio/Troubleshooting" Dedoimedo's "Linux audio"
EasyEffects (formerly PulseEffects)
Gamunu Balagalla's "Enable High Quality Audio on Linux"
Jahid Onik's "How To Fix Sound Issues On Ubuntu"

"less /etc/pipewire/pipewire.conf" (example == /usr/share/pipewire/pipewire.conf)
"sudo apt install pulseaudio-equalizer"

If speaker device disappears: do "pulseaudio -k"
If no sound, maybe "sudo alsa force-reload"
Also: "systemctl --user restart pipewire"

"ps -ax | egrep -e pulseaudio -e pipewire | grep -v grep"
"pactl info"
"apt list | grep alsa | grep installed"
"less /etc/modprobe.d/alsa-base.conf"

If you decide to give up on PipeWire and switch back to PulseAudio: "sudo dnf swap --allowerasing pipewire-pulseaudio pulseaudio"

From someone on reddit 4/2021, about non-PipeWire system:
The default values in /etc/pulse/daemon.conf use very little CPU but make audio sound like complete garbage on decent headphones.

Edit /etc/pulse/daemon.conf and audio will sound great:

default-sample-format = float32ne  
default-sample-rate = 44100  
alternate-sample-rate = 48000  
default-sample-channels = 2    
default-fragments = 2  
default-fragment-size-msec = 125  
resample-method = soxr-vhq      
nice-level = -11    
realtime-priority = 9  
rlimit-rtprio = 9







Reporting Bugs



On Mint, run System Reports application to see any crash reports.

Run "apt show PKGNAME" or "dnf info PKGNAME" etc to get info about a package, including URLs for bug-reporting and source code.

For some apps, it's hard to even figure out what you're running. For example, in Ubuntu 20.04, the default app that plays mp4 video files has no app-name or About menu item anywhere in the UI of the app. From the file-association in file explorer, I found out it's called "Videos". But that name doesn't appear anywhere on disk or in packages or in running processes, that I can find. From the application store, I was able to find out its home web site: https://wiki.gnome.org/Apps/Videos From there, I was able to find that another name for it is "Totem". Then "apt show totem" gives useful info.

For a given problem, check the version number of the software you are running, and what the latest released version number is. Is it possible for you to upgrade and re-test ?



Rocket2DMn's "Improving Ubuntu: A Beginners Guide to Filing Bug Reports"
Brendan Hesse's "How to Submit a Bug Report to Apple, Google, Facebook, Twitter, Microsoft, and More"

My impression of what usually happens:
+/-
  • If you're reporting a clear crash or failure: expect friendly reaction.

  • If you're reporting something not useful or done wrong: expect acceptance and put on a list.

  • If you're asking for a new preference or feature: maybe acceptance, maybe "why don't you implement it yourself", maybe "go away".

  • If you're asking for a change to the way things work now: expect "go away" or something less polite.




A lot of bug-tracking and mailing lists, plus packages and PPAs, are hosted on Launchpad.




Devices



Webcam

+/-
Are you using "HD Webcam" or "HD IR Webcam" ?
IR camera is for Windows-Hello-style facial recognition.

ArchWiki's "Webcam setup"

"The current state of video capture, usually webcams, handling on Linux is basically the v4l2 kernel API."

"sudo apt install v4l-utils qv4l2" and launch "qv4l2" (note: that's 4 L 2).
"sudo apt install guvcview" and do "guvcview --control_panel" ?
How many processes using webcam ? "lsmod | grep '^uvcvideo' | awk '{print $3}'"
See what's using webcam: "sudo fuser -v /dev/video*"

Christian F.K. Schaller's "PipeWire and fixing the Linux Video Capture stack"



Keyboard

+/-
X and Wayland do keyboard layout differently, but overlap ?
setxkbmap, localectl ?
"sudo localectl set-keymap MAPNAME"
"sudo localectl set-x11-keymap MAPNAME"

If you suspect a stuck/disabled key or bad touchpad or similar:
Do "xev -event keyboard" (works in both Wayland and X; little GUI window must be in foreground to get events).

"xbindkeys_show" ?

The Super key stopped working on my system. It turned out I had pressed Fn+F2, which has a "padlock" symbol on it. Pressing that again made Super key work again.

Online test: Key-Test

"man sxhkd"



Battery / Power Management

+/-
Maybe install TLP ? I don't.

See System Hardware Monitoring And Control section of my "Linux Controls" page.


Ctrl blog's "Fix Linux not suspending on low battery levels, and prolong your battery life"
thermald
auto-cpufreq
powertop
GNOME extension "CPU Power Manager"
On KDE, the system tray widget to show temperatures seems to be called "Pie Chart" ?



Display

+/-
See what resolution and refresh you are using: "xrandr".
Dead pixel test
JScreenFix - Pixel Repair (didn't seem to work for me)

If you have a high-resolution display, things (icons, text, etc) may be displayed too small. There are various ways to fix this: scale the whole desktop, or scale just the fonts ?



Mouse

+/-
Special software for advanced features of the mouse:
logiops
piper
Solaar



Touchpad

+/-
Turn off "tap to click": usually under something like Settings / Mouse / Touchpad.

For me on Mint: install Synaptics touchpad support via "sudo apt install xserver-xorg-input-synaptics" and then log out and back in. But later I removed it with "apt remove xserver-xorg-input-synaptics" and log out/in; I suspect it was causing UI freezes.

To see what driver you're using:
"grep -i 'Using input driver' /var/log/Xorg.0.log"
"sudo journalctl --since=today | grep 'Using input driver'"

There is another driver: "xserver-xorg-input-evdev". Maybe others: libinput-gestures, Fusuma, Touchegg ?

On X, stop middle-click from doing paste:

# May have to install package xorg-xinput

xinput --list
xinput --list DEVICEID
# Output shows 7 buttons, 2nd is middle button.
xinput set-button-map DEVICEID 1 0
# Test it, then add it as a startup application.

# If ID of device keeps changing, do:
xinput set-button-map $(xinput list --id-only 'DEVICENAME') 1 0

# If full name and ID of device keep changing, do:
xinput set-button-map $(xinput list --id-only "$(xinput list --name-only | grep Touchpad)") 1 0
If you want to run automatically at startup, put in a shell script file and run the script, instead of running the command directly. Needed for proper expansion of expressions, I think.
There was an AMD interrupt problem that made the touchpad not work at all; workaround is "sudo rmmod i2c_hid && sudo modprobe i2c_hid".

Kris Wouk's "How to Fix a Touchpad Not Working in Linux"



USB

+/-

lsusb
lsusb -D /dev/bus/usb/BUSNUMBER/DEVICENUMBER
udevadm info /dev/bus/usb/BUSNUMBER/DEVICENUMBER
udevadm info --query=path /dev/bus/usb/BUSNUMBER/DEVICENUMBER
ls -l /sys/`udevadm info --query=path /dev/bus/usb/BUSNUMBER/DEVICENUMBER`

usb-devices

dmesg | grep 'New USB device found'
dmesg | grep 'usb '
sudo usbview

jmtpfs --listDevices	# list MTP devices

USB ID Database
Device Hunt

Note: an Android smartphone's device number in "lsusb" changes when you click on a button in the "Use USB for ..." dialog on the phone screen.





Miscellaneous



Bootloader:

+/-
See current state:
+/-
To see bootable partitions other than the current one: "sudo os-prober"
To see kernels bootable from a partition: "sudo linux-boot-prober /dev/sdaN"

In Windows, to see/edit bootloader list, run "bcdedit" as administrator. article1, article2

In Linux, UEFI (if you can boot):
"efibootmgr -v"
"sudo bootctl status"
Fedora:
https://docs.fedoraproject.org/en-US/fedora/rawhide/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader/
"cat /etc/default/grub" "grubby --info=ALL"
Fedora UEFI:
"cat /boot/efi/EFI/fedora/grub.cfg"
"grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg"

Xiao Guoan's "Use Linux efibootmgr Command to Manage UEFI Boot Menu"

Using GRUB menu:
+/-
If your GRUB-menu is hidden, hold Shift when booting, or run "sudo grub2-editenv - unset menu_auto_hide", or edit /etc/default/grub to comment out "GRUB_TIMEOUT_STYLE=hidden" line.

At EFI menu, press Esc or "c" for GRUB.
Get "grub> " prompt.

"help" to get help.
"help testspeed" to get help about that command.
Has ZFS commands.
But output of "help" zooms past and 80% of it can't be seen.
(To add paging: "set pager=1")
Type "exit" to get out and go to BIOS.
Type "normal" to get out and boot current kernel.
(Edit /etc/default/grub, add pager=1, run update-grub But doesn't work.)

GNU GRUB Manual 2.04
Dedoimedo's "GRUB 2 bootloader - Full tutorial"

Kowalski7cc's "Systemd-boot install on Fedora"

Repair:
Add memtest:
+/-
[Legacy BIOS:] Should see memtest in GRUB menu.
[UEFI:]
Bootable USB image: Memtest86, or
Add to GRUB menu: Matias's "Installing memtest86 on UEFI Grub2 Ubuntu"
(my /boot/efi is nvme0n1p1, so I used "set root='hd0,gpt1'".
"sudo update-grub2" is for Debian and SUSE;
"sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg" for Fedora;
"sudo grub-mkconfig -o /boot/grub/grub.cfg" for Arch family ?)