Add stuff from askiiart/pc-configs

This commit is contained in:
askiiart 2023-10-20 11:27:00 -05:00
parent 5d03b0a1ec
commit c7c9080553
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67
18 changed files with 405 additions and 10 deletions

View file

@ -0,0 +1,39 @@
# Find Fastest Mirror
You can find the fastest apt mirror using `netselect-apt`. Install it with:
```bash
sudo apt install netselect-apt
```
Then run it:
```bash
sudo netselect-apt -c US -a amd64 -n stable
```
You should get something like this:
```text
Running netselect to choose 10 out of 33 addresses.
..............................................................................................................................................................................................................................
The fastest 10 servers seem to be:
http://mirror.dal.nexril.net/debian/
http://mirror.us.oneandone.net/debian/
http://mirrors.gigenet.com/debian/
http://mirror.steadfast.net/debian/
http://mirrors.xtom.com/debian/
http://la.mirrors.clouvider.net/debian/
http://mirror.keystealth.org/debian/
http://mirror.clarkson.edu/debian/
http://ftp.us.debian.org/debian/
http://mirror.cogentco.com/debian/
Of the hosts tested we choose the fastest valid for http:
http://mirror.dal.nexril.net/debian/
Writing sources.list.
sources.list exists, moving to sources.list.1672257815
Done.
```

View file

@ -0,0 +1,39 @@
# Port in use (connman)
## Problem
When trying to run DNS thing, `connman` is already using port 53.
```bash
docker compose up --detach --build --remove-orphans
[+] Running 0/1
⠿ Container pihole Starting 0.2s
Error response from daemon: driver failed programming external connectivity on endpoint pihole (bc535387671f0d471f11f8ade5eedc4771126c057e2099931e8ef49461111149): Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use
```
## Solution
- Find the `connman.service` file:
```bash
grep -Ril "connman" /etc/systemd/
```
- Add `--nodnsproxy` to the `ExecStart` line:
```bash
ExecStart=/usr/sbin/connmand -n --nodnsproxy
```
- Reload and restart stuff:
```bash
systemctl daemon-reload
systemctl restart connman.service
```
- Try your thing again. For example:
```bash
docker compose up -d --remove-orphans
```

View file

@ -0,0 +1,15 @@
# Port is privileged, cannot be used
When running a container that uses a priviledged port, AKA anything less than 1024, you will get the following error:
```text
Error starting userland proxy: error while calling PortManager.AddPort(): cannot expose privileged port 80, you can add 'net.ipv4.ip_unprivileged_port_start=80' to /etc/sysctl.conf
```
To fix this, you need to add the following to your `/etc/sysctl.conf` file:
```conf
net.ipv4.ip_unprivileged_port_start=0
```
Then, you can just run the container again.

View file

@ -0,0 +1,26 @@
# Fix APIPA (veth)
## Problem
On Debian 11, when:
1. Using docker containers that use the `host` network mode.
2. `PreferredTechnologies` is set to `ethernet,[...]` in `/etc/connman/main.conf`.
- This may not be a problem when ethernet is plugged in, not just wifi.
The system **uses a veth interface** to connect to the internet, which uses an APIPA (169.254.*.*) IP address, so the system can only contact devices on the LAN.
## Solution
Edit `/etc/connman/main.conf` and uncomment the line `# NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-`
Result:
```conf
NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-
```
## References
- [A tale of Docker and Linux ConnMan](https://sitaram.substack.com/p/a-tale-of-docker-and-linux-connman)
- [Arch Linux Docs](https://wiki.archlinux.org/title/ConnMan#Blacklist_interfaces)

View file

@ -0,0 +1,24 @@
# Move Docker program data
Docker stores all its data in `/var/lib/docker` by default. This is usually fine, but this directory grows quickly, so we'll move it to `/mnt/big-stuff/docker-program-data/`
Edit `/lib/systemd/system/docker.service` and add the `--data-root` option to the ExecStart line:
```sh
ExecStart=/usr/bin/dockerd --data-root /mnt/big-stuff/docker-program-data/ -H fd:// $DOCKER_OPTS
```
If you've already done stuff with docker, you'll need to move the data:
```sh
sudo systemctl stop docker
sudo mv /var/lib/docker/ /mnt/big-stuff/docker-program-data/
sudo systemctl daemon-reload
sudo systemctl start docker
```
You may also need to set up some symlinks:
```bash
ln -s source_file link_file
```

View file

@ -0,0 +1,44 @@
# Resource limits
You can limit the amount of CPU and/or memory resources that a container can use.
## CPU
| Option | Description |
|--------|-------------|
| `--cpus` | Set number of CPUs thee container can use |
| `--cpu-period` | Limits the length of time it can schedule the CPU before being throttled (used alongside `--cpu-quota`) |
| `--cpu-quota` | The throttling setting activated when the CPU is scheduled longer than `--cpu-period` |
| `--cpuset-cpus` | Limit the container to specific CPUs or cores (e.g. 0-3, 0,1) |
| `--cpu-shares` | The number of relative shares of the CPU the container can use (default 1024) |
## Memory
A markdown table:
| Option | Description |
|--------|-------------|
| `-m` or `--memory` | Memory limit (minimum 6m (megabytes)) |
| `--memory-swap` | How much swap is available - [details](https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details) |
| `--memory-swappiness` | "By default, the host kernel can swap out a percentage of anonymous pages used by a container. You can set --memory-swappiness to a value between 0 and 100, to tune this percentage" - [details]() |
| `--memory-reservation` | Soft limit less than `--memory` (for when there is low memory on host), *soft* limit, so usage may exceed this. |
| `--oom-kill-disable` | Disable OOM Killer (stops from killing container processes when out-of-memory error occurs) - Make sure to use `-m`, or host processes could be killed |
## Example
Note: `--xxxx 4` in `docker run` would be replaced with `xxxx` in `docker-compose.yml`. See below:
```yml
service:
image: nginx
mem_limit: 512m
mem_reservation: 128M
cpus: 0.5
ports:
- "80:80"
```
## See also
- [Docker documentation](https://docs.docker.com/config/containers/resource_constraints/)
- [Baeldung docs](https://www.baeldung.com/ops/docker-memory-limit) (includes `docker compose` examples)

View file

@ -0,0 +1,27 @@
# Restart Policies
Restart policies control whether and how Docker attempts to restart a container.
| option | description |
| ------ | --- |
| no | does not restart automatically |
| on-failure[:max-retry] | restarts only when the container exits with a non-zero exit code, and when it has been restarted fewer than max-retry times. |
| always | always restarts the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. |
| unless-stopped - always restarts the container unless it is manually stopped. Does not restart when the docker daemon is restarted. |
If no restart policy is provided, the default is no.
## Example
```yaml
version: '3.3'
services:
simple-torrent:
ports:
- '3000:3000'
volumes:
- '/path/to/my/downloads:/downloads'
- '/path/to/my/torrents:/torrents'
image: boypt/cloud-torrent
restart: unless-stopped
```

View file

@ -0,0 +1,125 @@
# Nvidia 470 datacenter drivers
**Note:** Desktop drivers and datacenter drivers are different.
## Debian
This hasn't yet been tested. If you have tested it, please open a PR to update this section.
### Add apt repos
**You can skip this if you already have the repositories enabled**
To add the non-free and contrib repos, edit `/etc/apt/sources.list` and add `non-free contrib` to the end of each line, like this:
```txt
deb http://deb.debian.org/debian/ bullseye main non-free contrib
deb-src http://deb.debian.org/debian/ bullseye main non-free contrib
```
Then, run `apt update`
### Installation
To install the driver:
```sh
apt install nvidia-tesla-470-driver
```
And to install CUDA:
```bash
apt install nvidia-cuda-dev nvidia-cuda-toolkit
```
### Links
- [Driver Install Guide](https://wiki.debian.org/NvidiaGraphicsDrivers) ([Internet Archive Link](https://web.archive.org/web/20221123184836/https://wiki.debian.org/NvidiaGraphicsDrivers))
## Fedora
This guide uses the RPM Fusion repositories, and if you install CUDA, it uses Nvidia repositories as well. Note that this guide is only compatible with Fedora 35+, I'm not sure about RHEL versions.
### Add RPM Fusion repository
**You can skip this if you already have the repository installed.**
To add the RPM Fusion repository:
```bash
# Add gpg key
sudo dnf install distribution-gpg-keys
sudo rpmkeys --import /usr/share/distribution-gpg-keys/rpmfusion/RPM-GPG-KEY-rpmfusion-free-fedora-$(rpm -E %fedora)
# Add repo with gpg check
sudo dnf --setopt=localpkg_gpgcheck=1 install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
```
### Install Driver
First, update everything, and reboot if you're not on the latest kernel.
```bash
dnf update -y
```
Then, install the driver:
```bash
dnf install akmod-nvidia-470xx
```
_**Do not reboot yet.**_
Before rebooting, use `top` or `ps` to make sure there is no `akmods`, `cc*`, `kthreadd`, or `gcc*` process running (`*` is either nothing or a number)—or anything using tons of CPU that you don't expect.
*Note:* `nvidia-smi` and other tools are not included with the driver. For that, you need to install CUDA.
### Install CUDA
Install packages needed for CUDA with:
```bash
export FEDORA_VERSION=$(rpm -E %fedora) # Nvidia's repo doesn't support Fedora 38 yet, so change this to 37 if you're on Fedora 38
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora35/x86_64/cuda-fedora${FEDORA_VERSION}.repo
dnf clean all
dnf module disable nvidia-driver
dnf -y install cuda
```
*Note:* Don't re-enable `nvidia-driver`
### Problems
#### Suspend Issues
I had issues with my K80 not working after being suspended. For example, `torch.cuda.is_available()` would give an error and return False, rather than saying True.
To fix this, install `xorg-x11-drv-nvidia-470xx-power`
```bash
dnf install xorg-x11-drv-nvidia-470xx-power
```
---
#### CUDA is higher version than driver
Sometimes the driver in the CUDA repo, and therefore dependencies for CUDA are of a later version than the driver. To fix this, run:
```bash
dnf module enable nvidia-driver -y && dnf download cuda-drivers && dnf module disable nvidia-driver -y
rpm -Uvh cuda-drivers*.rpm --nodeps
dnf update
```
### More stuff
Why not install `xorg-x11-drv-nvidia-470xx`?
- That's the _display_ driver, not the data center driver. It is the same version number, but is not the same.
### Links
- [Repo Config](https://rpmfusion.org/Configuration) ([Internet Archive Link](https://web.archive.org/web/20221111180224/https://rpmfusion.org/Configuration))
- [Verify Repo Signing Keys](https://rpmfusion.org/keys) ([Internet Archive Link](https://web.archive.org/web/20221111180744/https://rpmfusion.org/keys))
- [NVIDIA Guide](https://rpmfusion.org/Howto/NVIDIA) ([Internet Archive Link](https://web.archive.org/web/20221111181211/https://rpmfusion.org/Howto/NVIDIA))
- [CUDA Guide](https://rpmfusion.org/Howto/CUDA) ([Internet Archive Link](https://web.archive.org/web/20221111181243/https://rpmfusion.org/Howto/CUDA))

View file

@ -0,0 +1,28 @@
# Install Firmware
## During Linux Installation
When installing Linux, you may get an error like this:
```
Some of your hardware needs non-free firmware files to operate. The firmware can be loaded from removable media, such as a USB stick or floppy.
The missing firmware files are: iwlwifi-3168-29.ucode iwlwifi-3168-28.ucode iwlwifi-3168-27.ucode iwlwifi-3168-26.ucode iwlwifi-3168-25.ucode iwlwifi-3168-24.ucode iwlwifi-3168-23.ucode iwlwifi-3168-22.ucode
If you have such media available now, insert it, and continue.
Load missing firmware from removable media?
[ ] No
[x] Yes
```
These are all actually just different versions of the one firmware file you need. Just get `iwlwifi-3168-29.ucode` from [here](iwlwifi-3168-29.ucode) or [here](/static/iwlwifi-3168-29.ucode), put it on another USB drive, then insert it and continue.
## Post-Installation
Get the firmware from [here](iwlwifi-3168-29.ucode), then move it to `/lib/firmware`, and restart.
```bash
sudo mv iwlwifi-3168-29.ucode /lib/firmware/
reboot
```

View file

@ -0,0 +1,20 @@
# Mount Drive On Boot
To mount a drive on boot, first find the UUID of the drive:
```bash
sudo blkid
```
Then add the following to `/etc/fstab`:
```conf
UUID=<UUID_OF_DRIVE> /mnt/big-stuff ext4 defaults
```
For example, for my big drive (4TB Toshiba X300 Performance):
```conf
# big-stuff
UUID=d68f1a75-af20-4627-8382-7198c3a34b5d /mnt/big-stuff ext4 defaults
```

View file

@ -0,0 +1,15 @@
# Spice Guest Tools
These are the software packages for the guest OS that provide stuff like copy-paste, shared folders, graphics drivers, etc. They're not required, but are quite useful (and tiny!)
## Windows
The download is [here](https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe), it's easy. Just install it and restart.
## Linux
Linux guests use the packages `spice-vdagent` (for copy-paste, shared folders, etc.) and `xf86-video-qxl` (for graphics drivers) (or `xf86-video-qxl-devel` if you're building from source, according to GitHub copilot, IDK). The `spice-vdagent` package is available in most distributions' repositories, but the `xf86-video-qxl` package is not. You can build it from source (download [here](https://www.spice-space.org/download.html)).
## macOS
No. Maybe the Linux ones would work, IDK. I don't feel like testing it. Check out [this](https://github.com/utmapp/UTM/discussions/3772) and [this](https://docs.getutm.app/).

View file

@ -1,2 +0,0 @@
# Blog

View file

@ -1,3 +1,3 @@
# Wiki
Wiki and stuff.
wow it's a wiki

View file

@ -7,7 +7,7 @@ theme:
name: material
custom_dir: overrides
language: en
favicon: images/askiiart.gif
favicon: static/askiiart.gif
icon:
repo: fontawesome/brands/git-alt
logo: fontawesome/regular/folder-open
@ -41,10 +41,6 @@ theme:
- navigation.path # breadcrumbs at the top of each page
- search.suggest
plugins:
- blog:
categories: false
archive: false
#- git-revision-date
- search
markdown_extensions:
- admonition # enables coloured blocks mid article

View file

@ -1,3 +1,2 @@
mkdocs
mkdocs-material
mkdocs-material-extensions
mkdocs-material

View file

Before

Width:  |  Height:  |  Size: 789 KiB

After

Width:  |  Height:  |  Size: 789 KiB

Binary file not shown.