Skip to content

improvements to script #3

Description

@djanice1980

I don't know if this is helpful or not but I will leave it here for you.

Key changes from your v1.5:

Single rpm-ostree transaction.
Combined the install + all five kargs into one rpm-ostree install call with --append-if-missing= flags, with a fallback to two transactions if your rpm-ostree version doesn't support that.

Old script staged 6 deployments; new one stages 1 (or 2 on fallback). This is the runtime fix.

Fixed the Unicode hyphen in oberon‑governor → oberon-governor. The old line silently never matched the unit.

Added --idempotent to rpm-ostree install so re-runs don't error out if the package is already layered.

Self-elevates with sudo at the top instead of sprinkling sudo everywhere (and removed the pointless sudo echo … | sudo tee pattern).

set -uo pipefail plus a logger so you can actually see which step is running.

Loud warning before the initramfs step that it takes 5–10 minutes and isn't a loop — so no one panics.

Fixed the fstab sed to use | as the delimiter so the / in the path doesn't need escaping, and writes the fstab line with plain >> since we're already root.

#!/usr/bin/env bash

────────────────────────────────────────────────────────────────

Setup-32GB (Bazzite) – NexGen3D v1.6

Created By: NexGen3D for the BC-250

Revised: Consolidated rpm-ostree transactions for speed,

fixed Unicode hyphen in oberon-governor unit name,

cleaned up redundant sudo on echo redirects,

added strict error handling and progress output.

What this script does:

1 Stop & disable oberon-governor, cyan-skillfish-governor,

and cyan-skillfish-governor-tt

2 Enable the filippor/bazzite COPR repo

3 Refresh rpm-ostree metadata

4 Install cyan-skillfish-governor-smu and apply all kernel

args (mitigations=off, zswap, systemd.zram=0) in a SINGLE

rpm-ostree transaction (much faster than the old script)

5 Recreate /var/swap btrfs subvolume and 32 GiB swapfile

6 Restore SELinux contexts

7 Update /etc/fstab cleanly (no duplicates)

8 Set vm.swappiness = 180

9 Enable rpm-ostree initramfs regeneration with lz4 driver

Run with: ./Setup-32GB.sh

Reboot afterwards: systemctl reboot

────────────────────────────────────────────────────────────────

set -uo pipefail

Require root for the privileged operations. Re-exec under sudo if needed.

if [[ $EUID -ne 0 ]]; then
echo "[*] Re-executing under sudo..."
exec sudo --preserve-env=HOME bash "$0" "$@"
fi

log() { printf '\n[\e[1;32m+\e[0m] %s\n' "$"; }
warn() { printf '\n[\e[1;33m!\e[0m] %s\n' "$
"; }

────────────────────────────────────────────────────────────────

1. Stop & disable conflicting governors

────────────────────────────────────────────────────────────────

log "Disabling existing governors (if present)..."
for unit in cyan-skillfish-governor cyan-skillfish-governor-tt oberon-governor; do
systemctl disable --now "$unit" 2>/dev/null || true
done

────────────────────────────────────────────────────────────────

2. Enable filippor/bazzite COPR

────────────────────────────────────────────────────────────────

log "Enabling filippor/bazzite COPR repo..."
copr enable filippor/bazzite <<< y 2>/dev/null || true

────────────────────────────────────────────────────────────────

3. Refresh rpm-ostree metadata

────────────────────────────────────────────────────────────────

log "Refreshing rpm-ostree metadata..."
rpm-ostree cleanup -m || true
rpm-ostree refresh-md || true

────────────────────────────────────────────────────────────────

4. Install package + apply ALL kargs in one transaction

This is the big win vs. the old script: one deployment instead

of six. Each rpm-ostree call stages a full deployment, so

consolidating them cuts runtime dramatically.

────────────────────────────────────────────────────────────────

log "Installing cyan-skillfish-governor-smu and applying kernel args (single transaction)..."
rpm-ostree install --idempotent
--append-if-missing=mitigations=off
--append-if-missing=zswap.enabled=1
--append-if-missing=zswap.max_pool_percent=25
--append-if-missing=zswap.compressor=lz4
--append-if-missing=systemd.zram=0
cyan-skillfish-governor-smu 2>/dev/null || {
# Older rpm-ostree versions don't support combining install + kargs.
# Fall back to two transactions (still faster than six).
warn "Combined install+kargs not supported on this rpm-ostree; falling back."
rpm-ostree install --idempotent cyan-skillfish-governor-smu || true
rpm-ostree kargs
--append-if-missing=mitigations=off
--append-if-missing=zswap.enabled=1
--append-if-missing=zswap.max_pool_percent=25
--append-if-missing=zswap.compressor=lz4
--append-if-missing=systemd.zram=0 || true
}

────────────────────────────────────────────────────────────────

5. Recreate /var/swap subvolume and 32 GiB swapfile

────────────────────────────────────────────────────────────────

log "Recreating /var/swap btrfs subvolume and 32 GiB swapfile..."
swapoff /var/swap/swapfile 2>/dev/null || true
rm -f /var/swap/swapfile 2>/dev/null || true
btrfs subvolume delete /var/swap 2>/dev/null || true
btrfs subvolume create /var/swap

semanage fcontext -a -t var_t /var/swap 2>/dev/null || true
restorecon /var/swap

btrfs filesystem mkswapfile --size 32G /var/swap/swapfile

semanage fcontext -a -t swapfile_t /var/swap/swapfile 2>/dev/null || true
restorecon /var/swap/swapfile

────────────────────────────────────────────────────────────────

6. Update /etc/fstab cleanly

────────────────────────────────────────────────────────────────

log "Updating /etc/fstab..."
sed -i '|/var/swap/swapfile|d' /etc/fstab
echo '/var/swap/swapfile none swap defaults,nofail 0 0' >> /etc/fstab

────────────────────────────────────────────────────────────────

7. Swappiness

────────────────────────────────────────────────────────────────

log "Setting vm.swappiness = 180..."
echo 'vm.swappiness = 180' > /etc/sysctl.d/99-swappiness.conf
sysctl --system >/dev/null 2>&1 || true

────────────────────────────────────────────────────────────────

8. Initramfs regeneration with lz4 driver

NOTE: this step is slow (5-10 min on the BC-250). It is NOT

looping — dracut is rebuilding the initramfs. Be patient.

────────────────────────────────────────────────────────────────

log "Enabling rpm-ostree initramfs regeneration with lz4 driver..."
log "This step takes several minutes. Do NOT interrupt it."
rpm-ostree initramfs --enable --arg=--add-drivers --arg=lz4 || true

────────────────────────────────────────────────────────────────

Done

────────────────────────────────────────────────────────────────

cat <<'EOF'

──────────────────────────────────────────────────────────────
Setup Complete
──────────────────────────────────────────────────────────────
Reboot now with: systemctl reboot

After reboot, to test GPU overclocking:
systemctl start cyan-skillfish-governor-smu

CAUTION: Overclocking the GPU can cause increased system
heat and instability.
──────────────────────────────────────────────────────────────
EOF

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions