refactor(kb): give linux-specific articles their own section

This commit is contained in:
Michele Cereda
2024-05-15 18:58:01 +02:00
parent 0ac246f571
commit 59ee94ccac
16 changed files with 137 additions and 117 deletions

View File

@@ -0,0 +1,30 @@
# Alpine
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
## TL;DR
```sh
# Create users.
adduser 'somebody'
adduser -DHS -G 'docker' 'docker'
# Create groups.
addgroup 'new-group'
# Add users to groups.
addgroup 'nobody' 'docker'
```
## Further readings
- [APK]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[apk]: ../apk.md

View File

@@ -0,0 +1,28 @@
# Arch linux
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
## TL;DR
```sh
# Manually install packages from the AUR.
git clone https://aur.archlinux.org/jdupes.git \
&& cd jdupes \
&& makepkg -sirc
&& git clean -dfX
```
## Further readings
- [Suspend and hibernate]
- [Arch User Repository]
<!--
Reference
═╬═Time══
-->
<!-- Upstream -->
[arch user repository]: https://wiki.archlinux.org/title/Arch_User_Repository
[suspend and hibernate]: https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

View File

@@ -0,0 +1,63 @@
# Armbian
Ultralight Linux distribution optimized for custom ARM, RISC-V or Intel hardware.<br/>
Based on Debian.
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## TL;DR
[PI4b image]. Write with [BalenaEtcher].
`root` password and default user created on first boot by the init script.
```sh
# Connect to WiFi networks.
nmtui-connect
nmtui-connect 'SSID'
# Adjust hardware features.
sudo armbian-config
# Install Docker.
sudo mkdir -p '/etc/apt/keyrings'
curl -fsSL 'https://download.docker.com/linux/debian/gpg' | sudo gpg --dearmor -o '/etc/apt/keyrings/docker.gpg'
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bullseye stable" | sudo tee '/etc/apt/sources.list.d/docker.list' > /dev/null
sudo apt update
sudo apt install -y 'docker-ce' 'docker-compose-plugin'
sudo docker run --rm 'hello-world'
sudo usermod -aG 'docker' "$USER"
```
## Further readings
- [Website]
- [Documentation]
- [Github] account
- [Debian] GNU/Linux
- [Raspberry Pi OS]
### Sources
- [How to run Docker]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[debian]: debian.md
[raspberry pi os]: ../raspberry%20pi%20os.md
<!-- Upstream -->
[documentation]: https://docs.armbian.com/
[github]: https://github.com/armbian
[how to run docker]: https://docs.armbian.com/User-Guide_Advanced-Features/#how-to-run-docker
[pi4b image]: https://www.armbian.com/rpi4b/
[website]: https://www.armbian.com/
<!-- Others -->
[balenaetcher]: https://etcher.balena.io/

View File

@@ -0,0 +1,27 @@
# Debian GNU/Linux
1. [Further readings](#further-readings)
1. [Sources](#sources)
## Further readings
- The [APT] package manager
- [`dpkg`][dpkg]
- [Armbian]
### Sources
- [Advice for new users on not breaking their Debian system]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[armbian]: armbian.md
[apt]: ../apt.md
[dpkg]: ../dpkg.md
<!-- Upstream -->
[advice for new users on not breaking their debian system]: https://wiki.debian.org/DontBreakDebian

View File

@@ -0,0 +1,62 @@
# Fedora
1. [Enable the RPM Fusion repositories](#enable-the-rpm-fusion-repositories)
1. [Broadcom Wi-Fi drivers](#broadcom-wi-fi-drivers)
1. [Enable ZFS management](#enable-zfs-management)
1. [Use DNF from behind a proxy](#use-dnf-from-behind-a-proxy)
1. [Sources](#sources)
## Enable the RPM Fusion repositories
RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and current Red Hat Enterprise Linux or clones versions; you can use the RPM Fusion repositories with tools like yum and PackageKit.
These repositories are not available by default and need to be installed using a remote package:
```sh
# All flavours but Silverblue-based ones.
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Silverblue-base flavours.
sudo rpm-ostree install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
```
After enabling the repositories, you can add their _tainted_ versions for closed or restricted packages:
```sh
sudo dnf install rpmfusion-{free,nonfree}-release-tainted
sudo rpm-ostree install rpmfusion-{free,nonfree}-release-tainted
```
## Broadcom Wi-Fi drivers
After enabling the normal **and tainted** RPM fusion repositores, just install the `b43-firmware` package.
## Enable ZFS management
```sh
sudo dnf install http://download.zfsonlinux.org/fedora/zfs-release$(rpm -E %dist).noarch.rpm
sudo dnf install kernel-devel zfs
sudo systemctl start zfs-fuse.service
sudo zpool import -a
```
## Use DNF from behind a proxy
Either:
- add the line `sslverify=0` to `/etc/dnf/dnf.conf`; **not suggested**, but a quick fix
- add the proxie's certificate, in PEM format, to the `/etc/pki/ca-trust/source/anchors/` folder and then run `sudo update-ca-trust`.
## Sources
- [RPM fusion configuration]
- [DNF update from behind SSL inspection proxy]
<!--
Reference
═╬═Time══
-->
<!-- Others -->
[dnf update from behind ssl inspection proxy]: https://molo76.github.io/2017/07/04/dnf-update-behind-ssl-inspection-proxy.html
[rpm fusion configuration]: https://rpmfusion.org/Configuration

View File

@@ -0,0 +1,32 @@
# Funtoo GNU/Linux
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
## TL;DR
```sh
# Portage update.
sudo ego sync
sudo emerge --sync
```
## Further readings
- [Installation] guide
- [Gentoo Linux]
- [Portage]
- [Profiles]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[gentoo linux]: gentoo.md
[portage]: ../portage.md
<!-- Upstream -->
[installation]: https://www.funtoo.org/Install
[profiles]: https://www.funtoo.org/Funtoo_Profiles

View File

@@ -0,0 +1,15 @@
# Gentoo GNU/Linux
## Further readings
- [Portage]
- [Funtoo Linux]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[funtoo linux]: funtoo.md
[portage]: ../portage.md

View File

@@ -0,0 +1,69 @@
# Linux kernel modules
1. [TL;DR](#tldr)
1. [Permanent modules configuration](#permanent-modules-configuration)
1. [Further readings](#further-readings)
## TL;DR
```sh
# Show what kernel modules are currently loaded.
lsmod
# List all modules built into the currently running kernel.
cat "/lib/modules/$(uname -r)/modules.builtin"
# List all available modules.
find "/lib/modules/$(uname -r)" -type f -name '*.ko*'
# Show information about a module.
modinfo 'module_name'
# List the options set for loaded modules.
systool -v -m 'module_name'
# Show the comprehensive configuration of modules.
modprobe -c
modprobe -c | grep 'module_name'
# List the dependencies of modules or aliases.
# Includes the module itself.
modprobe --show-depends 'module_name'
# Load modules.
modprobe 'module_name'
modprobe 'module_name' 'parameter_1=value' 'parameter_n=value'
# Load modules by file name.
# For those not installed in "/usr/lib/modules/$(uname -r)/".
insmod 'file_name' 'arg_1' 'arg_n'
# Unload modules.
modprobe -r 'module_name'
rmmod 'module_name'
```
## Permanent modules configuration
Write the options in a `.conf` file in `/etc/modprobe.d/`:
```conf
# /etc/modprobe.d/raspi-wifi-workaround.conf
options brcmfmac roamoff=1 feature_disable=0x82000
```
## Further readings
- The [Kernel module][arch wiki kernel module] page in the [Arch wiki]
- The [Kernel modules][gentoo wiki kernel modules] page in the [Gentoo wiki]
<!--
Reference
═╬═Time══
-->
<!-- Others -->
[arch wiki]: https://wiki.archlinux.org
[arch wiki kernel module]: https://wiki.archlinux.org/title/Kernel_module
[gentoo wiki]: https://wiki.gentoo.org/wiki/Main_Page
[gentoo wiki kernel modules]: https://wiki.gentoo.org/wiki/Kernel_Modules

View File

@@ -0,0 +1,29 @@
# Lower the power consumption
1. [TL;DR](#tldr)
1. [Sources](#sources)
## TL;DR
```sh
echo '0' > '/proc/sys/kernel/nmi_watchdog'
echo 'med_power_with_dipm' > '/sys/class/scsi_host/host0/link_power_management_policy'
# Increase the virtual memory dirty writeback time to help aggregating disk I/O
# together. This reduces spanned disk writes.
# Value is in 1/100s of seconds. Default is 500 (5 seconds).
echo 6000 > '/proc/sys/vm/dirty_writeback_centisecs'
sudo sysctl vm.dirty_writeback_centisecs=6000
```
## Sources
- Arch Wiki's [power management][arch wiki power management] page
<!--
Reference
═╬═Time══
-->
<!-- Others -->
[arch wiki power management]: https://wiki.archlinux.org/title/Power_management

View File

@@ -0,0 +1,54 @@
# Manjaro
1. [Repositories](#repositories)
1. [Printing](#printing)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## Repositories
To ensure continued stability and reliability, Manjaro uses its own dedicated software branches rather than relying on those provided by Arch:
- **unstable**: synced several times a day with Arch's package releases; only a subset of them are modified to suit Manjaro; people using this branch need to have the skills to get themselves out of trouble; thanks to the feedback from these users, many issues are caught and fixed at this level; the very latest software is be located here, and using this branch is usually safe but - in rare cases - may cause issues with your system
- **testing**: this branch is the second line of defense; users living in this branch refine the work done by users in the _unstable_ branch by providing further feedback on the packages they receive as updates
- **stable**: packages which land here have gone through roughly a couple of weeks testing by users using the _unstable_ and _testing_ branches; these packages are usually free of any problems
One can use the [branch comparison] tool to check in what branch a package is available.
## Printing
```sh
pamac install manjaro-printer
sudo gpasswd -a ${USER} sys
sudo systemctl enable --now cups.service
# configure printers in ui
pamac install system-config-printer
```
## Further readings
- The knowledge base about [Arch Linux]
- [Branch comparison]
- [Switching branches]
- [Printing]
### Sources
- [Kde Plasma 5.23 not updating]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[arch linux]: arch.md
<!-- Upstream -->
[branch comparison]: https://manjaro.org/branch-compare
[printing]: https://wiki.manjaro.org/index.php/Printing
[switching branches]: https://wiki.manjaro.org/index.php/Switching_Branches
<!-- Others -->
[kde plasma 5.23 not updating]: https://forum.manjaro.org/t/kde-plasma-5-23-not-updating/88297/4

View File

@@ -0,0 +1,170 @@
# OpenSUSE
1. [Enable Bluetooth pairing on boot](#enable-bluetooth-pairing-on-boot)
1. [Enable SSH access from outside after installation](#enable-ssh-access-from-outside-after-installation)
1. [Raspberry Pi](#raspberry-pi)
1. [Firmware update from a running system](#firmware-update-from-a-running-system)
1. [Rollback from a bootable snapshot](#rollback-from-a-bootable-snapshot)
1. [Firefox MP4/H.264 video support](#firefox-mp4h264-video-support)
1. [Docker images](#docker-images)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## Enable Bluetooth pairing on boot
1. enable the `bluetooth` service on boot
1. install `bluez-auto-enable-devices`; this will create the configuration file `/etc/bluetooth/main.conf`
Also see specific settings in the [Bluetooth] KB.
## Enable SSH access from outside after installation
Open port 22 on the firewall:
- using Yast:
1. open _Yast2_ > _Firewall_
1. make sure your interfaces are appointed to the _External_ zone
1. check _ssh_ is in the _Allowed services_ column and add it to the list if not
1. save the configuration and exit (make sure the firewall is reloaded on exit)
- using [firewall-cmd][firewalld] on the command line:
```sh
sudo firewall-cmd --add-port=22/tcp --permanent
```
Start the SSH daemon:
- using Yast: open _Yast2_ > _System services_ and enable _SSHD_
- using [systemctl][systemd] on the command line:
```sh
sudo systemctl enable --now sshd.service
```
## Raspberry Pi
Install the OS from another computer capable of reading and writing SD cards.
Given `/dev/sdb` being a SD card, use the following:
```sh
curl -C - -L -o opensuse.raw.xz http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/openSUSE-Tumbleweed-ARM-JeOS-raspberrypi.aarch64.raw.xz
xzcat opensuse.raw.xz \
| sudo dd bs=4M of=/dev/sdb iflag=fullblock oflag=direct status=progress \
&& sync
```
Insert the SD card in the Raspberry Pi and power it on. The network is configured to get an IP address on `eth0` using
DHCP.
Connect using SSH and login using `root:linux`.
### Firmware update from a running system
```sh
# Check for an updated firmware.
sudo rpi-eeprom-update
# Install the new version and reboot.
sudo rpi-eeprom-update -a && sync && reboot
```
## Rollback from a bootable snapshot
Do as follows:
1. boot the system
1. in GRUB's boot menu, choose _Bootable snapshots_
1. select the snapshot you want to boot into; the list of snapshots is listed by date, the most recent snapshot being
listed first
1. log in to the system
1. carefully check whether everything works as expected
> You cannot write to any directory that is part of the snapshot. Data you write to other directories will not get
> lost, regardless of what you do next.
Depending on whether you want to perform the rollback or not, choose your next step:
- if the system is in a state where you do **not** want to do a rollback, reboot and boot again into a different
snapshot, or start the rescue system.
- to perform the rollback, run
```sh
sudo snapper rollback
```
and reboot
On the boot screen, choose the **default** boot entry to reboot into the reinstated system.
A snapshot of the file system status before the rollback is created, and the default subvolume for root will be replaced
with a fresh read-write snapshot.
## Firefox MP4/H.264 video support
To deal with [patent problems][information about the h.264 patent license], neither Firefox nor openSUSE provides the
H264 codec required by fresh new openSUSE installation to play some video formats on the web.<br/>
The Packman and VLC repositories provide the needed `libav` packages. Install those libraries to let Firefox use them to
decode MP4/H.264 video.
```sh
zypper install 'libavcodec60' 'libavdevice60' 'libavformat60'
```
openSUSE provides `ffmpeg` and `libav` packages like `libavcodec56`, but in them all patent related codecs were removed
making them unable to play MP4/H.264 video. That is why one needs to upgrade these packages with their version in the
Packman or VLC repositories.
Go to this [Simple WebRTC H264 check page] to check if Firefox can play H.264 videos after installation.
## Docker images
OpenSUSE's official container images are created and stored in
[SUSE's container registry][container images built by the open build service]:
```sh
docker run -ti --rm --name 'tw' 'registry.opensuse.org/opensuse/tumbleweed'
```
## Further readings
- [Zypper]
- [Bluetooth]
- [Firewalld]
- [Systemd]
- [System Recovery and Snapshot Management with Snapper]
- [Container Images built by the Open Build Service]
### Sources
- [OpenSSH basics]
- [Bluetooth on boot]
- [Raspberry Pi4]
- [Firefox MP4/H.264 video support]
- [Information about the H.264 patent license]
- [Simple WebRTC H264 check page]
<!--
Reference
═╬═Time══
-->
<!-- Knowledge base -->
[bluetooth]: ../bluetooth.md#bluetooth-devices-cannot-be-used-at-login
[firewalld]: ../firewalld.md
[systemd]: ../systemd.md
[zypper]: ../zypper.md
<!-- Upstream -->
[container images built by the open build service]: https://registry.opensuse.org/cgi-bin/cooverview
[firefox mp4/h.264 video support]: https://en.opensuse.org/SDB:Firefox_MP4/H.264_Video_Support
[openssh basics]: https://en.opensuse.org/SDB:OpenSSH_basics
[raspberry pi4]: https://en.opensuse.org/openSUSE:Raspberry_Pi
[system recovery and snapshot management with snapper]: https://documentation.suse.com/sles/12-SP4/html/SLES-all/cha-snapper.html
<!-- Others -->
[bluetooth on boot]: https://www.reddit.com/r/openSUSE/comments/eoozm2/comment/feetqpn/
[information about the h.264 patent license]: https://www.fsf.org/licensing/h264-patent-license
[simple webrtc h264 check page]: https://mozilla.github.io/webrtc-landing/pc_test_no_h264

View File

@@ -0,0 +1,71 @@
# Optimize battery
1. [TL;DR](#tldr)
1. [Disable unused services](#disable-unused-services)
1. [Improve battery performance](#improve-battery-performance)
1. [Further readings](#further-readings)
## TL;DR
```sh
# Summarize performance of the last boot.
sudo systemd-analyze
# Show last boot performance.
# Also shows the process tree.
sudo systemd-analyze critical-chain
# Check power stats.
sudo 'powertop'
```
## Disable unused services
```sh
$ sudo systemd-analyze
Startup finished in 13.129s (firmware) + 5.413s (loader) + 1.746s (kernel) + 7.903s (userspace) = 28.192s
graphical.target reached after 1.239s in userspace
$ sudo systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.
graphical.target @1.239s
└─multi-user.target @1.239s
└─ModemManager.service @1.154s +84ms
└─polkit.service @937ms +215ms
└─basic.target @928ms
└─sockets.target @928ms
└─dbus.socket @928ms
└─sysinit.target @924ms
└─systemd-backlight@backlight:acpi_video0.service @2.273s +8ms
└─system-systemd\x2dbacklight.slice @2.272s
└─system.slice @197ms
└─-.slice @197ms
```
## Improve battery performance
```sh
# Enable automatic power management.
# See `tlpui` on GitHub for UI.
sudo systemctl enable --now 'tlp.service'
sudo vim '/etc/tlp.conf'
# Check power stats.
sudo 'powertop'
```
## Further readings
- [laptop-mode-tools]
- [laptop-mode-tools in the Arch Wiki]
<!--
Reference
═╬═Time══
-->
<!-- Others -->
[laptop-mode-tools]: https://www.unixmen.com/laptop-mode-tools-extend-laptop-battery-life/
[laptop-mode-tools in the arch wiki]: https://wiki.archlinux.org/title/Laptop_Mode_Tools

View File

@@ -0,0 +1,64 @@
# Scan documents
1. [TL;DR](#tldr)
1. [Procedure](#procedure)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## TL;DR
```sh
# Manjaro.
sudo pamac install 'sane-airscan' 'skanlite'
```
## Procedure
Install:
- the `sane-airscan` package, if the scanner is known to work in driverless mode;
- the `sane` package to use old driver-based scanning.
If the scanner is using a USB connection, make sure to also install the `ipp-usb` package and start/enable the `ipp-usb`
service to allow using IPP protocol over USB connection.
Many modern scanners will immediately work over the network as long as you have `sane-airscan` installed.
SANE has lots of front ends, a non-exhaustive list of which can be found on the [sane project website][sane frontends]:
- [Simple Scan]: a simplified GUI intended to be easier to use and better integrated into the GNOME desktop than `XSane`
is;
- [Skanlite]: a simple image scanning application; it does nothing more than scan and save images, and is based on the
KSane backend;
- XSane: a full-featured GTK-based frontend; looks a bit old but provides extended functionalities.
Some OCR software are able to scan images using SANE, like gImageReader, [gscan2pdf], Linux-Intelligent-Ocr-Solution, [OCRFeeder] and [Paperwork].
## Further readings
- [SANE]
- [gscan2pdf]
- [ocrfeeder]
- [paperwork]
- [simple scan]
- [skanlite]
### Sources
- [SANE frontends]
<!--
Reference
═╬═Time══
-->
<!-- Upstream -->
[sane frontends]: http://www.sane-project.org/sane-frontends.html
[sane]: https://wiki.archlinux.org/title/SANE
<!-- Others -->
[gscan2pdf]: https://en.wikipedia.org/wiki/Scanner_Access_Now_Easy#gscan2pdf
[ocrfeeder]: https://en.wikipedia.org/wiki/OCRFeeder
[paperwork]: https://openpaper.work/
[simple scan]: https://gitlab.gnome.org/GNOME/simple-scan
[skanlite]: https://www.kde.org/applications/graphics/skanlite