# Fedora

- [Fedora](#fedora)
  - [Framework 16 Fixes](#framework-16-fixes)
    - [Wake from Sleep](#wake-from-sleep)
    - [Wrong keys pressed in the browser](#wrong-keys-pressed-in-the-browser)
  - [Podman](#podman)
    - [Autostarting services with quadlets](#autostarting-services-with-quadlets)
  - [Network](#network)
    - [VLAN Setup with nmcli](#vlan-setup-with-nmcli)
  - [ZRAM](#zram)

## Framework 16 Fixes

### Wake from Sleep

The keyboard/mouse can be pressed through the lid while in a backpack. Disable them to
prevent wake from sleep.

`/etc/udev/rules.d/69-suspend.rules`

```conf
ACTION=="add", SUBSYSTEM=="acpi", DRIVERS=="button", ATTRS{hid}=="PNP0C0D", ATTR{power/wakeup}="disabled"
ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled"
ACTION=="add", SUBSYSTEM=="i2c", DRIVERS=="i2c_hid_acpi", ATTRS{name}=="PIXA3854:00", ATTR{power/wakeup}="disabled"

# https://askubuntu.com/questions/848698/wake-up-from-suspend-using-usb-device
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0012", RUN+="/bin/sh -c 'echo disabled > /sys$env{DEVPATH}/power/wakeup'"
```

Reload

```bash
sudo udevadm control --reload-rules && sudo udevadm trigger
```

### Wrong keys pressed in the browser

Sometimes keys will stop working when using search bars or do strange things like move the page around. This seems to be caused by some "alt" keypress combination. Pressing "alt" twice fixes it.

## Podman

Since you'll be using podman for most container-based services, you'll want to set the
the podman auth file to somewhere persistent, otherwise it'll get deleted every time you
reboot.

Add this to your `.bashrc`:

```bash
# Podman auth file
export REGISTRY_AUTH_FILE=$HOME/.podman-auth.json
```

Source that and then run `podman login` to create the file.

### Autostarting services with quadlets

If you want to run something as your user at boot (like a systemd process, think ollama) you can
create a user quadlets like so:

```bash
# Generate the .container file
podman run --rm ghcr.io/containers/podlet --install --description "Local AI" \
  podman run \
  -d \
  -v ollama:/root/.ollama \
  -p 11434:11434 \
  --name ollama \
  --restart always \
  docker.io/ollama/ollama > ~/.config/containers/systemd/ollama.container

# Verify the service (Note the filename:service, this is required! You will get "Failed to prepare filename" without it)
systemd-analyze verify ~/.config/containers/systemd/ollama.container:ollama.service

# Start the service
systemctl --user daemon-reload
systemctl --user start ollama
```

## Network

### VLAN Setup with nmcli

```bash
# VLAN 2
nmcli conn
export NMCLI_DEVICE=enp195s0f4u1u3
nmcli connection add type VLAN con-name $NMCLI_DEVICE.2 dev $NMCLI_DEVICE id 2
```

## ZRAM

Increasing zram size

```bash
# Show existing configuration
zramctl
# 
swapoff /dev/zram0
# Reset swap
zramctl -r /dev/zram0

# Set a new size
zramctl --size 4G /dev/zram0
```
