This commit is contained in:
zleyyij 2022-10-23 14:32:43 -06:00
commit 0ca815eba5
12 changed files with 491 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.obsidian

View File

@ -0,0 +1,7 @@
****#linux
#laptop
[Documentation](https://github.com/knauth/goodix-521d-explanation)
From the usbreset directory run `gcc usbreset.c -o usbreset.out` to compile the reset bin, then `sudo ./usbreset.out /dev/bus/usb/<bus>/<device>` to reset it, for this device it's ``sudo ./usbreset.out /dev/bus/usb/003/002``
from goodix-fp-dump run `sudo python run_521d.py` to reflash the firmware

View File

@ -0,0 +1,141 @@
# Fixing a non-booting linux install
Because of the length and variety of troubleshooting methods, the following article will be segmented by each step of the boot process.
## UEFI/BIOS
When the system is first powered on, the UEFI/BIOS preforms basic integrity checks of your disk, then checks the MBR for a valid bootloader, and if it's a GPT system, it will check the ESP(EFI System Partition) for a valid bootloader. If it is not found, you may get an error stating boot failure, the system may load into the UEFI/BIOS, or it may reboot.
### Troubleshooting
Try a live environment.
##### If the live environment boots successfully:
It indicates the bootloader is not functioning correctly. You can attempt to fix the bootloader by `chroot`ing in:
**On non Arch based distributions:**
Mount the root filesystem, where `sdXY` is your root partition, or `/`. You can find it by running `lsblk`, and looking at the size, or using `sudo fdisk -l`, and looking at the partition size and type.
```
mount /dev/sdXY /mnt
```
Mount the API filesystems:
```
cd /mnt
```
```
mount -t proc /proc proc/
```
```
mount /t sysfs /sys sys/
```
```
mount --rbind /dev dev/
```
```
mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/
```
Mount the `efi` partition if the system is UEFI/GPT:
use `sudo fdisk -l` to list disks, look for a partition of ~200-500M, labeled `EFI System`, again, where `/dev/sdXY` is the EFI system partition
```
mount /dev/sdXY /mnt/boot/efi
```
If you require an internet connection:
```
cp /etc/resolv.conf etc/resolv.conf
```
Chroot into `/mnt` using a bash shell:
```
chroot /mnt /bin/bash
```
**On Arch based distributions:**
Chroot into the system using arch's `arch-chroot` script:
```
arch-chroot /dev/sdXY
```
Mount the `efi` partition if the system is UEFI/GPT:
Use `sudo fdisk -l` to list disks, look for a partition of ~200-500M, labeled `EFI System`, again, where `/dev/sdXY` is the EFI system partition
```
mount /dev/sdXY /boot/efi
```
To reinstall grub:
```
grub-mkconfig -o /boot/grub/grub.cfg
```
If the system is EFI, you do not need any arguments for `grub-install`:
```
grub-install
```
If the system is MBR:
```
grub-install --target=i386-pc /dev/sdXY
```
##### If the live environment does *not* boot successfully:
See if Secure Boot is enabled:
Check your UEFI/BIOS and ensure Secure Boot is disabled, or enabled if you are using a linux distro that supports secure boot.
Try Ventoy, if it boots to the Ventoy menu without issue, try redownloading/burning your Linux ISO. You can ensure the checksum matches:
From Linux(this utility is included in most distros):
```
sha256sum [file]
```
From Windows(from Powershell):
```
Get-FileHash
```
If the checksum doesn't match with the one provided by the original source, than something went wrong during the download process, and the ISO needs to be downloaded again.
If the checksum matches and the ISO *still* isn't booting:
- Try a different iso utility(Rufus, Ventoy, `dd`(unix only), BalenaEtcher)
- Try a different "base" of distro(RHEL, Debian/Ubuntu, Arch, and OpenSUSE are all common alternatives)
- Try a different USB drive
- See if the drive works on a different computer
*If the ISO is STILL not booting:*
- Pray to Tux for mercy
- Ensure it's not a PEBKAC
- Update your UEFI/BIOS
## GRUB/Bootloader
*Note: this section assumes you use GRUB*
At this point, your UEFI/BIOS has passed control over to GRUB, by default, it presents a menu similar to the one shown below, although the appearence may vary.
![[Pasted image 20220907095504.png]]
### Recovery shell
With the standard boot option selected in GRUB:
- Hit `e` to temporarily edit the boot config
- Find the line that says `linux`, and go to the end of the line and put `systemd.unit=rescue.target`
- Then hit ctrl + x or F10 to boot with the modified config.
- If the recovery shell doesn't work, you can try an emergency shell(a more minimalistic recovery interface) by replacing `systemd.unit=rescue.target` with `systemd.unit=emergency.target`
### Init shell
In Linux, the init process is the very first process launched by the system, identified with a PID of 1. This can be changed with a GRUB variable.
- Hit `e` over the correct entry to temporarily edit the boot config
- Append `init=/bin/bash` to the line that starts with `linux`. You can experiement with having it earlier in the line to see if it makes a difference.
### Troubleshooting from a shell
- Update everything
- Reinstall GPU drivers
- Reinstall the display manager and desktop environment
- Try manually starting display manager/desktop environment
## System Boot
Once GRUB passes booting over to Linux, it will start booting in VGA text mode under tty1. Troubles here can show symptoms including:
- Appears unresponsive during boot
- Screen goes black as it leaves VGA text mode, then crashes or hangs
- Begins shutting down after a partial boot
### Different TTY
During the boot process, you can try switching to a different TTY to bypass the TTY used at boot. You can use ctrl + alt + f2-f9 to drop to a different interface.
#### Troubleshooting from a recovery shell
If the shell loads successfully, than the system not booting might be prevented by a bad config loaded at startup, a nonfunctional display manager or desktop environment.
**If X11:**
Try starting your desktop environment using [xinit](https://wiki.archlinux.org/title/Xinit):
You can also try skipping xinit by specifying the start environment as a `startx` argument:
(example uses KDE plasma)
`startx startplasma-x11`
if that fails, you can check `dmesg` logs if stdout is inconclusive.
Try starting your display manager with `systemctl`:
(`sddm` used in example)
`sudo systemctl start sddm`
If you don't know what the systemd service is named, you can try to find it with `systemctl list-units | grep possiblename` where `possiblename` is the or part of it.

View File

@ -0,0 +1 @@
https://asus-linux.org/faq/#why-did-nvidia-mode-give-me-black-screen-with-xorg

156
Installing Arch.md Normal file
View File

@ -0,0 +1,156 @@
#linux
#documentation
See offical documentation [here](https://wiki.archlinux.org/title/installation_guide).
### Preperation
**Prerequisites**
Check if system is in UEFI mode with:
`ls /sys/firmware/efi/efivars`
If it lists the directory without issue then it's in EFI mode, if `no directory exists` is returned than EFI is disabled.
**Partitioning Disks**
List disks with:
`fdisk -l`
Select disk to modify with:
`fdisk /dev/sdx` (where x is the selected disk)
In the *fdisk* environment, use:
- `n` to create a new partition
- `p` or `e` to select primary or extended, primary is fine for all partitions on this install.
- `+[size][scale]` EG: `+512M` or `+1g` create a partition of that size.
- `w` to write changes to the disk.
Arch requires:
- 1 *EFi system partition* of at least **300MiB** mounted to **/mnt/boot** (Only for UEFI systems)
- 1 *root partition* using **all leftover space** mounted at **/mnt**
- Optionally a *swap partition* **more than 512MiB**, but ideally equal to the total ram.(Note: the swap partition is not mounted, but is instead initialized with `mkswap /dev/swap_partition`)
**Formatting Partitions**
- Format the root partition as ext4
```bash
mkfs.ext4 /dev/root_partition
```
- Format the EFI system partition as Fat32
```bash
mkfs.fat -F 32 /dev/efi_system_partition
```
- Initialize the swap partition
```bash
swapon /dev/_swap_partition_
```
**Mounting Partitions**
Mount these partitions with `mount /dev/sdxI /mounting_location`, for this purpose `/mnt`.
You will need to:
- Mount root partition(/)
```bash
mount /dev/[root_partition] /mnt
```
- Mount EFI System Partiton
(boot may need to be made with `mkdir`)
```bash
mount /dev/[efi_system_partition] /mnt/boot
```
- If a swap partition was made, initialize it with:
```bash
swapon /dev/[swap_partition]
```
**Update Mirrors**
Use `reflector` to update mirrors to the optimal servers.
### Installation
Use `pacstrap` to install necessary packages into `/mnt`
```bash
pacstrap /mnt base linux linux-firmware dhcpcd nano
```
Note: if you wish to configure a static IP you can remove `dhcpcd`from the package list and use `ip address add [IP]/[subnet] broadcast + dev [interface]`, where subnet is usually `/24` and the interface can be found with `ip link`. You will need to add a route, which can be done with `ip route add default via [gateway address]`.
**Configuring the system**
Generate an `fstab` file(shows how partitions should translate into disk space)
```bash
genfstab -U /mnt >> /mnt/etc/fstab
```
**Chroot into the new system** with `arch-chroot`
```bash
arch-chroot /mnt
```
Optionally set time zone(See installation wiki)
Edit `/etc/locale.gen` to set locales. For English uncomment `en_US.UTF-8 UTF-8`.
If needed, generate locales with `locale-gen`.
Start and enable internet
```bash
systemctl start dhcpcd
systemctl enable dhcpcd
```
**User Account Management**
Set a root password with `passwd`.
Install `sudo`
```bash
pacman -S sudo
```
Add a user
```bash
useradd -m [user]
```
Give the user a password:
```bash
passwd [user]
```
Add the user to the sudoers group(you will need to uncomment a line from /etc/sudoers)
```bash
usermod -aG wheel [user]
```
Reboot, unmount the .iso, and login to the user just created.
Install either `amd-ucode` or `intel-ucode` depending on the system processor
```bash
sudo pacman -S [needed package]
```
**Beyond the install**
Install `grub` and`efibootmgr` with pacman
```bash
pacman -S grub
pacman -S efibootmgr
```
Create the directory for grub
```bash
mkdir /boot/EFI/GRUB
```
Install `grub` to the efi partition.
```bash
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
```
Generate the grub config
```bash
grub-mkconfig -o /boot/grub/grub.cfg
```
Install `xorg-server`
```bash
sudo pacman -S xorg-server
```
Install `plasma`
```bash
sudo pacman -S plasma
```
Install `sddm`
```bash
sudo pacman -S plasma
```
Start sddm
```bash
sudo systemctl start sddm.service
```
If the desktop works as intended, enable sddm to launch at boot
```bash
sudo systemctl enable sddm.service
```

30
Ohm's Law.md Normal file
View File

@ -0,0 +1,30 @@
#notes
#school
#electricity
Summary:
- **Voltage** is the difference in charge between two points.
- **Current** is the rate at which charge is flowing.
- **Resistance** is a materials tendency to resist the flow of charge (current).
- Water = **Charge**(Coloumbs)
- Pressure = **Voltage**(Volts)
- Flow = **Current**(Amps)
- Hose Width = **Resistance**(Ohms
### Equations
- V = Voltage in volts
- I = Current in amps
- R = Resistance in ohms
Solving for Voltage:
`V = I * R`
Solving for Current:
`I = V / R`
Solving for Resistance:
`R = V/I`
### Applying Concepts
If a resistor has a 20 mAh current rating, and it's being powered with a 9 volt battery.
To find the appropriate resistor for the LED, you solve for resistance with `R = V/I`, where V=9 and R = a number less than 0.02, like `9/0.018 = 500`, so you would want a resistor with a voltage at or greator than about 500 Ohms.

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

57
Setting up SSH keys.md Normal file
View File

@ -0,0 +1,57 @@
#documentation
## Terms
The following terms should be standardized across the document.
#### Client
- The user side local computer that connects *to* a remote host, typically a server.
- This side has the **private key**, which you should keep secure
- The private key decrypts data
#### Server
- The remote computer that the client connects to.
- This side has the **public key**, which doesn't need to be secure
- The public key encrypts data
## SSH Keypairs
SSH keypair authentication relies on asymmetrical encryption, and is only used for authentication. Once they exchange the needed info, they use the Diffie-Hellman Key Exchange Algorithm to create a symmetrical key(can decrypt and encrypt). This is used to encrypt the rest of the session.
## Setup
1. Generate an SSH keypair from the *client* with:
```
ssh-keygen -t ed25519
```
- Note: while ed25519 encryption is much more secure than rsa4096, it's not universally supported. When using older versions of OpenSSH, generate a key with `ssh-keygen -t rsa -b 4096` to generate an rsa4096 keypair. This should be compatible with almost every implementation of SSH.
2. Follow the prompts onscreen:
- You will be asked where to save the key, the default location is typically correct(`~/.ssh/KEYNAME`) where `KEYNAME` is the name of your keypair.
- You will then be prompted for a password. This password is used alongside the keypair, and is optional(leave blank if you want passwordless login)
3. Copying the public key to the server
- There should now be two files in `~/.ssh` with the format `id_ENCRYPTIONMETHOD` and `id_ENCRYPTIONMETHOD.pub` (EG: `id_ed25519` and `id_ed25519.pub`)
```
ssh-copy-id USERNAME@SERVERADDRESS
```
- EG: `ssh-copy-id foo@192.168.0.10`
- Restart the SSH daemon, and test for functionality
## Further Configuration
### Disabling password based login
1. Edit `/etc/ssh/sshd_config` to have an uncommented line that says:
```
PasswordAuthenntication no
```
- This will prevent clients from logging on with a password entirely, unless the SSH key was configured with a passcode.
- Reload the SSH daemon.
### Storing keys on github
1. See https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account about adding keys, access public keys at `https://github.com/USERNAME.keys`
- You can then add public keys to your server with `curl https://github.com/USERNAME.keys | tee -a ~/.ssh/authorized_keys`
- A similar method should exist across most git clients.
---
## Further Reading
- https://www.hostinger.com/tutorials/ssh
- https://www.hostinger.com/tutorials/ssh-tutorial-how-does-ssh-work
- https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys

40
The basics of Git.md Normal file
View File

@ -0,0 +1,40 @@
#notes #documentation
### Create a git repository
`git init`
- This defines the folder as a git repository, and creates `.git`, a folder that contains metadata about the repo, like where the *remote* (repository hosted somewhere else) is, and other useful stuff like version control. You should not need to directly interact with this folder.
`git add .`
- This makes all files and folders in the current repository(can also be more precise by replacing `.` with specific files) tracked.
`git commit -am "The Epoch"
- Syntax breakdown:
- `-a` All, commit all changes
- `-m` Have a message, takes a string argument, in this example, "The Epoch"
#### If adding a remote repository, GitHub or otherwise.
`git remote add origin https://urltorepo.com/path/to/repo`
- Telling git that the files should come from and go to that remote repository, where `https://urltorepo.com/path/to/repo` is the destination repo.
- If the url is wrong, it can be removed with `git remote remove origin`
`git branch -M main`
- Syntax breakdown:
- `-M`, shortcut for `--move --force`, used to move/rename a branch.
- Telling git that we want the current branch to be `main`.
`git push -u origin main`
- Synatx breakdown:
- `-u` is a shortcut for `--set-upstream`
- Telling git that we want the main host of the repository(`origin`, or `https://urltorepo.com/path/to/repo`) to be the host. After this is run one time, git remembers, and you can shorten it to `git push`, to take commits(saved changes) from your local code, and send them to remote(GitHub or other Git server).
### Update code on github/remote
`git commit -am "changes"`
- Tell git to keep track of all the changes you made
`git push`
- Take code here and put it on the server
### Get code from github
`git clone https://remotehost.com/repo/to/clone`
- Download a folder containing all of the code and versions to a project, where `https://remotehost.com/repo/to/clone` is the url of the repo in question.

View File

@ -0,0 +1,48 @@
#laptop
#documentation
#issue
#closed
#linux
02/02/2022
Because wifi was broken by a pacman update, Im reverting to an older point in the repos(01/01/2022).
When updating via pacman -Syyuu, `error: failed to prepare transaction (could not satisfy dependencies)
:: installing expat (2.4.2-1) breaks dependency 'expat=2.4.4' required by lib32-expat
:: installing libcap (2.62-1) breaks dependency 'libcap=2.63' required by lib32-libcap` is returned.
`lib32-expat ` is an xml parser library [Arch WIki](https://archlinux.org/packages/multilib/x86_64/lib32-expat/), and lib32-libcap is some posix document `[arch wiki](https://archlinux.org/packages/multilib/x86_64/lib32-libcap/)`.
New solution: downgrade lib32-libcap(2.63-1 to 2.62-1) and lib32-expat(2.4.4-1 to 2.4.2-1)
Was going to use expat 2.4.3 but caused dependency issues with the 64 bit version. V2 successfully worked
sudo pacman -U /var/cache/pacman/pkg/[PACKAGE].pkg.tar.zst
After the above downgrade, `sudo pacman -Syyuu` with “y” on skip the lib32-expat and lib32-libcap worked, but returned
error: failed to commit transaction (conflicting files)
hwids: /usr/share/hwdata/pci.ids exists in filesystem (owned by hwdata)
hwids: /usr/share/hwdata/pnp.ids exists in filesystem (owned by hwdata)
hwids: /usr/share/hwdata/usb.ids exists in filesystem (owned by hwdata)
[referenced documentation for below as on garuda forums](https://forum.garudalinux.org/t/help-cant-upgrade/16237/2)
Couldnt figure out how to fix above issue, attempting a different date(15).
ISSUE CLOSED.
Solution, using the rollback repos to rollback to 2022/01/15

View File

@ -0,0 +1,4 @@
#laptop
#issue
#open
#linux

View File

@ -0,0 +1,6 @@
#laptop
#issue
#linux
#open
### Disabling the watchdog timer
currently disabled via grub config, trying to disable module loading, don't know module name. Used `lsmod` to list modules, was unable to spot it after a cursory glance. `cat /proc/sys/kernel/watchdog` will show if it's active, and it does return 0, but I want it fully disabled. [see for disabling watchdog timer](https://wiki.archlinux.org/title/improving_performance#Watchdogs), [see for blacklisting modules](https://wiki.archlinux.org/title/Kernel_module#Blacklisting)