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 performance 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 performance 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 performance testing:
+/-
Sequential read: "sudo hdparm -t /dev/nvme0n1p2"
KDiskMark
bonnie++
Codrut's "How to benchmark the speed of your SSD" (fio)



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"

"nvtop" (for NVIDIA)
"intel_gpu_top" (for Intel)
"radeontop" (for AMD Radeon)

"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).

To fix screen-tearing, maybe: use X11 compositor "picom --vsync", or configure X11 variable "TearFree".

Vivek Gite's "Linux Find Out Graphics Card Installed In My System"
Vivek Gite's "GPU Monitoring and Diagnostic Commands Line Tools"
Gentoo Wiki's "AMDGPU"

"my BIOS settings had set my graphics cards to a 'hybrid' format where sometimes my distro would use my integrated and other times the dedicated. To make my computer use only the dedicated card, I booted into BIOS, Advanced, scrolled down to SwitchableGraphics, and then selected dGPU."

To see if you're using hardware video acceleration:
"glxinfo | grep 'direct rendering'"
From someone on reddit:
To check on Chrome: about:gpu
To check on Firefox about:support
To check on VLC, launch it via CLI and it will tell you.

Chrome (and chromium-based browsers) don't come with video decode enabled by default, you need to manually enable it by adding --enable-features=VaapiVideoDecoder and --use-gl=desktop in front of the command that launches your browser, e.g editing its .desktop file.

Firefox, https://wiki.archlinux.org/title/firefox#Hardware_video_acceleration .

If you want video decode hardware accelerated on VLC and others AFAIK they're enabled by default, so no need to worry.

BTW YouTube uses a CODEC that is not accelerated by older versions of CPUs, so you'll need an extension such as "enhanced-h264ify" to force YouTube to use H264.



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 ?

If "pw-cli list-objects Device" and "pw-record --list-targets" show no audio devices, "That means PulseAudio is managing the audio devices and not PipeWire. There is nothing wrong with this in and of itself."

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"
Mike Royal's "PipeWire Guide" (about many tools)


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"

"inxi -A" to see most of the stack.
"fuser -v /dev/snd/*" to see what process is running sound system.

"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"

How to software-prevent any use of microphone ?

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"
Lan Tian's "Disabling Webcam"

"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*"
Software-prevent anything from using webcam: "sudo modprobe -r uvcvideo"

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"

How to type non-English keys on an English keyboard:
Fsymbols' "Linux keyboard shortcuts for text symbols"
€ == compose C =
¿ == compose ? ?
ñ == compose ˜ n



Battery / Power Management

+/-
"acpi -V"
"battop"
"upower -e"
"upower -i /org/freedesktop/UPower/devices/battery_BAT0"

Maybe install TLP or power-profiles-daemon ? 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" ?
Overheating: Switch from NVIDIA graphics to integrated graphics ?



Display

+/-
See what resolution and refresh you are using: "xrandr".
"xrandr --current"

"xdpyinfo | less"

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, xf86-input-synaptics ?

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`

# see what speed has been negotiated with each of your USB devices:
lsusb -tv

usb-devices

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

# Set a USB port to send out power or charge from external supply:
ls /sys/class/typec
echo 'source' >/sys/class/typec/port0/power_role
echo 'sink' >/sys/class/typec/port0/power_role
# Not in my openSUSE Tumbleweed system; need sysfs-class-typec driver ?
# https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-typec
# https://www.kernel.org/doc/html/latest/driver-api/usb/typec.html
grep -i typec /boot/config-$(uname -r)

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.

See "Connect Android phone via USB cable to Linux" section



PCI






Miscellaneous



Don't clean the inside of your computer, with compressed-air or whatever. There are many stories from people who did some kind of cleaning and then their machine won't boot or their GPU is dead or something.



Firmware:

+/-
"ls /lib/firmware"
"xz -l FILENAME.xz" to see some file size info.
"xz -k -d FILENAME.xz" to extract compressed file FILENAME (but you'll just get some binary file).

"zypper search firmware"

There is a firmware service that some vendors use: Linux Vendor Firmware Service.
Arch Wiki's "fwupd"
fwupd / fwupd
gnome-firmware
"man fwupdmgr" and "fwupdmgr --show-all-devices get-devices" and "fwupdmgr refresh" and "fwupdmgr get-updates"
"fwupdtool --help"
"sudo fwupdtool get-history"

Do "fwupdate --help" or "/usr/lib/fwupd/fwupdate --help". But it seems to be EFI-only, and mostly a test-tool. fwupdate.1 man page


Firmware update that comes only in a Windows/DOS EXE format:

+/-
"zypper info FirmwareUpdateKit" (creates a bootable mini-DOS system)

BIOS updates from manufacturers may come only as EXE files. To use one, maybe install FreeDOS on a flash drive and boot from that. Or your BIOS may have a command for updating itself. Or see:
Dell's "Update the Dell BIOS in a Linux or Ubuntu environment"
nixCraft's "How to install/update Intel microcode firmware on Linux"
And from discussions on reddit:
"With Dell, you can even put the .exe file directly onto an USB stick (I think it has to be FAT32 though), and the flash it from the BIOS." and "Plug in flash drive, F12 to bring up a BIOS boot menu and there should be an option for a BIOS upgrade there. I know this works on Dell's business machines, not so sure about their consumer models." and "Try renaming the .EXE to .ZIP and unzipping it." and: use MediCat, a bootable Windows troubleshooting environment on USB or DVD.

If you have some emergency need to run Windows, one possibility is to boot from a USB stick with Windows To Go. But you can't make such an image from the Home edition of Windows. article

Also Linux Uprising's "How To Make A Bootable Windows 10 USB On Linux Using The New WoeUSB"
Jahid Onik's "How To Create a Windows Bootable USB on Linux"


Or put Ventoy on a (8 GB minimum) USB stick, then in a chrom* browser go to Download Windows 10 Disc Image (ISO File).

Very technical:
Ristovski's "Inside the InsydeH2O BIOS"


BIOS:

+/-
To see the current BIOS version, do "sudo dmidecode -s bios-version".

"sudo dmidecode -t bios"
"sudo biosdecode"
"sudo vpddecode"

EndeavourOS's "ACPI Kernel Parameters and how to choose them"
The kernel's command-line parameters

Aaron Klotz's "New Linux Build Allows BIOS Updates Without a Reboot" (PFRUT)

UEFI open-source implementation: TianoCore

Coreboot:
+/-
coreboot source
coreboot
Wikipedia's "coreboot"

From someone on reddit 5/2022:
Drawbacks are security and [lack of] official support. coreboot doesn't sign any of their firmware updates and, instead, uses a tool on your Linux installation to update firmware and its settings. Their security FAQ.

... a corporate-backed product will tend to last longer than community projects as they have a profit motive to continue. ... coreboot tends to be faster for almost everyone.


Enabling virtualization features in BIOS setup:
May have to switch from Easy Mode to Advanced Mode, maybe via Setup Mode item or F7 or some other key.
Look for "Virtualization" tab or setting.
Maybe look under CPU options.
Names for virtualization support: VT-x, AMD-V, SVM, Vanderpool, Intel VT-d, VTD, AMD IOMMU.
Check in Linux: "egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no"


Idea for verifying firmware integrity:
+/-
Is the firmware (say, BIOS firmware) readable ? Can an OS or user process read it and compare to the last-installed version, and flag "hey, firmware has changed since the last time you booted !" ? Do any current OS's do that ? It could even be a user-level feature.

Shouldn't all devices (routers, security cams, disk drives, etc) come with a "read out the current firmware contents" feature ? Maybe a very clever malicious firmware could mimic a legit firmware, but it might not be easy if firmware memory is full (excess space padded with random static stuff when legit firmware is generated).

In Linux, do "sudo grep ROM /proc/iomem". If it returns "000f0000-000fffff : System ROM", you can read BIOS via "sudo dd if=/dev/mem of=pcbios.bin bs=64k skip=15 count=1 # 15*64k + 64k" or "sudo dd if=/dev/mem of=pcbios.bin bs=1k skip=960 count=64". Also relevant "sudo dmidecode". Maybe someone could make a little daemon or cron job that uses them to report any changes.

How about Linux's /dev/microcode ? Also would be nice to know if the router/gateway MAC address has changed ("arp" command).

Maybe enhance the "fwupdmgr" command to be able to read/verify existing firmware contents.
Does "fwupdmgr verify DEVICEID" do that ?
"fwupdmgr --show-all-devices get-devices", "fwupdmgr refresh", "fwupdmgr verify DEVICEID", "fwupdmgr get-updates", "fwupdmgr update".
There may be a timer running; see it in "sudo systemctl list-timers".
Maybe do "sudo systemctl disable fwupd-refresh.timer" and "sudo systemctl disable fwupd-refresh.service" ?




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 | less"
"sudo fwupdtool security --force" (security state of system)
"sudo fwupdtool esp-list"
Look for GRUB: "sudo find /boot -name 'grub*' -print"
Test for systemd-boot installed: "sudo bootctl is-installed"
Fedora:
Use grubby, it's the default ?
GoLinuxCloud's "How to update GRUB2 using grub2-editenv and grubby in RHEL 8 Linux"
Fedora User Docs' "Working with the GRUB 2 Boot Loader"
"cat /etc/default/grub" "grubby --info=ALL"
"grubby --default-kernel"
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:
+/-
Look for GRUB: "sudo find /boot -name 'grub*' -print"

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.)

pgrz's "Launching system from GRUB2 console"
GNU GRUB Manual 2.04
Dedoimedo's "GRUB 2 bootloader - Full tutorial"
A downstream source repo

grub-btrfs includes ability to boot from Btrfs snapshots.

GRUB themes: Run "grub-customizer", click "Appearance settings" tab, click a choice in "Theme" pull-down, click :"Save". Available themes are stored in /boot/grub/themes. Get more from: package manager search "grub2-theme*"; article1; GitHub search; KDE Store; GNOME-Look.

Using systemd-boot:
+/-
"[Compared to systemd-boot,] GRUB has more features and it also works with legacy boot."

Test for systemd-boot installed: "sudo bootctl is-installed"
"sudo bootctl list"
"sudo find /boot -name '*.conf' -print"

If your boot-menu is hidden, hold Shift when booting.

Kowalski7cc's "Systemd-boot install on Fedora"
ArchWiki's "systemd-boot"

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 ?)

Proposal, I think: systemd's "The Boot Loader Specification"



Sleep / Suspend:

+/-
Power states:
    G0 / S0 == powered on == running.
    G1 / S1 == standby == CPU clock stopped.
    G1 / S2 == freeze == suspend-to-idle == CPU powered off, caches lost, RAM preserved.
    G1 / S3 == suspend-to-RAM == more chips powered off, RAM still preserved.
    G1 / S4 == suspend-to-disk == hibernation == must have enough swap.
    G1 / S3 + S4 == hybrid suspend.
    G2 / S5 == soft powered off.
    G3 / S5 == mechanical powered off.

Check kernel parameters:
"sudo sysctl -a | egrep 'suspend|hibernation|resume'"

"cat /sys/power/state" (states supported by the kernel):
    standby == standby / S1.
    freeze == suspend-to-idle / S2Idle.
    disk == hibernation / STD / S4.
    mem == do as specified in /sys/power/mem_sleep

"cat /sys/power/mem_sleep" (string in square brackets is current value):
    shallow == standby / S1.
    s2idle == suspend-to-idle / S2Idle.
    deep == Suspend-to-RAM / S2RAM.

"sudo dmesg -HT | grep -i acpi"

As far as I can tell, the kernel has no support for state S3.

How to tell what sleep states your BIOS / ACPI supports ?
"sudo journalctl --since today | grep 'ACPI: (supports'"
"fwupdmgr security --force"
"sudo fwupdtool security --force" (security state of system)

Connection between key/lid events and resulting state:
"cat /etc/systemd/logind.conf"

Flags:
"cat /etc/systemd/sleep.conf"

Microsoft's "System Sleeping States"
The Linux Kernel's "System Sleep States"
Tookmund's "Linux Hibernation Documentation"
Aleksandar's "Difference between S1 (POS) and S3 (STR) standby mode in BIOS?"
Homo Ludditus article

Tell the system to go into various states:
"sudo systemctl suspend" # save to RAM
"sudo systemctl hibernate" # save to disk
"sudo systemctl hybrid-sleep" # save to both RAM and disk
"sudo systemctl suspend-then-hibernate"

Summarized from someone on reddit 11/2021:
Fedora by default deliberately doesn't support hibernate (save to disk) because:

- A copy of RAM left on disk is a security leak.
- Secure Boot does not support Hibernation due to "Linux kernel lockdown policy", according to Fedora.
- Hibernation is unreliable/unstable on lots of hardware/BIOS's.
- You need to have a swap area, larger than RAM. Fedora by default has no swap area on disk.
- Swap to disk is slow for the system, while running normally.
- There are devices/drivers that can't cleanly power off completely, and then suddenly be asked to power back up into the "same state".
- Hibernation can fail if the battery suddenly is exhausted while writing to disk.
[- Hibernation can cause a lot of writes to SSD.]

One person with AMD hardware says:
I have seen that hibernation fails to resume about 20% of the time on openSUSE Tumbleweed. ... And whenever it did "successfully" resume, I often experienced issues due to things like sockets that had died/timed out while the computer was hibernated. Background processes sometimes hung because they had been suddenly frozen/turned off without an internet connection for too long in an unexpected state that the program's code was never written to handle, etc. ... It's not just a Linux problem. Not even Windows or my MacBook Pro does it reliably. ...