diff --git a/docs/Debian/find-fastest-apt-mirror.md b/docs/Debian/find-fastest-apt-mirror.md new file mode 100644 index 0000000..c2ae22b --- /dev/null +++ b/docs/Debian/find-fastest-apt-mirror.md @@ -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. +``` diff --git a/docs/Debian/port-53-in-use.md b/docs/Debian/port-53-in-use.md new file mode 100644 index 0000000..9451354 --- /dev/null +++ b/docs/Debian/port-53-in-use.md @@ -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 +``` diff --git a/docs/Debian/privilged-ports.md b/docs/Debian/privilged-ports.md new file mode 100644 index 0000000..fc7cbc0 --- /dev/null +++ b/docs/Debian/privilged-ports.md @@ -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. diff --git a/docs/Docker/fix-apipa-veth.md b/docs/Docker/fix-apipa-veth.md new file mode 100644 index 0000000..7737401 --- /dev/null +++ b/docs/Docker/fix-apipa-veth.md @@ -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) diff --git a/docs/Docker/move-volume.md b/docs/Docker/move-volume.md new file mode 100644 index 0000000..b4c39f3 --- /dev/null +++ b/docs/Docker/move-volume.md @@ -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 +``` diff --git a/docs/Docker/resource.limits.md b/docs/Docker/resource.limits.md new file mode 100644 index 0000000..197f6da --- /dev/null +++ b/docs/Docker/resource.limits.md @@ -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) diff --git a/docs/Docker/restart-policies.md b/docs/Docker/restart-policies.md new file mode 100644 index 0000000..5e0bc3e --- /dev/null +++ b/docs/Docker/restart-policies.md @@ -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 +``` diff --git a/docs/Miscellaneous/470-datacenter-drivers.md b/docs/Miscellaneous/470-datacenter-drivers.md new file mode 100644 index 0000000..cfca34e --- /dev/null +++ b/docs/Miscellaneous/470-datacenter-drivers.md @@ -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)) diff --git a/docs/Miscellaneous/b450m-ds3h-wifi-firmware.md b/docs/Miscellaneous/b450m-ds3h-wifi-firmware.md new file mode 100644 index 0000000..6b8ac53 --- /dev/null +++ b/docs/Miscellaneous/b450m-ds3h-wifi-firmware.md @@ -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 +``` \ No newline at end of file diff --git a/docs/mergerfs-snapraid-setup.md b/docs/Miscellaneous/mergerfs-snapraid-setup.md similarity index 100% rename from docs/mergerfs-snapraid-setup.md rename to docs/Miscellaneous/mergerfs-snapraid-setup.md diff --git a/docs/Miscellaneous/mount-drive-on-boot.md b/docs/Miscellaneous/mount-drive-on-boot.md new file mode 100644 index 0000000..410b303 --- /dev/null +++ b/docs/Miscellaneous/mount-drive-on-boot.md @@ -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= /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 +``` diff --git a/docs/Miscellaneous/spice-guest-tools.md b/docs/Miscellaneous/spice-guest-tools.md new file mode 100644 index 0000000..ad1d2d3 --- /dev/null +++ b/docs/Miscellaneous/spice-guest-tools.md @@ -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/). diff --git a/docs/blog/index.md b/docs/blog/index.md deleted file mode 100644 index c58f16c..0000000 --- a/docs/blog/index.md +++ /dev/null @@ -1,2 +0,0 @@ -# Blog - diff --git a/docs/index.md b/docs/index.md index 37e8e29..aaa0be2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,3 @@ # Wiki -Wiki and stuff. \ No newline at end of file +wow it's a wiki \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 9bc9b10..c4180c8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 diff --git a/requirements.txt b/requirements.txt index d81a2cc..21f876b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ mkdocs -mkdocs-material -mkdocs-material-extensions \ No newline at end of file +mkdocs-material \ No newline at end of file diff --git a/images/askiiart.gif b/static/askiiart.gif similarity index 100% rename from images/askiiart.gif rename to static/askiiart.gif diff --git a/static/iwlwifi-3168-29.ucode b/static/iwlwifi-3168-29.ucode new file mode 100644 index 0000000..1759561 Binary files /dev/null and b/static/iwlwifi-3168-29.ucode differ