Fix broken desktop after gaming profile: skip risky dracut regen.
Carveout-only changes no longer run dracut --regenerate-all (known to leave wallpaper with no Plasma shell on Nobara). Add z13-recover-desktop for emergency reset from TTY. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Executable
+54
@@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Emergency recovery when desktop shows wallpaper but no panels/UI after a profile change.
|
||||||
|
# Run from TTY: Ctrl+Alt+F3, log in, then:
|
||||||
|
# sudo /path/to/z13Profiler/bin/z13-recover-desktop
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
INSTALL_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
|
export INSTALL_ROOT CONFIG_FILE="${INSTALL_ROOT}/config/profiles.conf"
|
||||||
|
|
||||||
|
# shellcheck source=../lib/memory-profiles.sh
|
||||||
|
source "${INSTALL_ROOT}/lib/memory-profiles.sh"
|
||||||
|
|
||||||
|
if [[ "${EUID}" -ne 0 ]]; then
|
||||||
|
echo "Run with sudo." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "=== z13Profiler desktop recovery ==="
|
||||||
|
echo ""
|
||||||
|
echo "Memory now:"
|
||||||
|
free -h | sed 's/^/ /'
|
||||||
|
echo ""
|
||||||
|
if uma_base="$(find_uma_base 2>/dev/null)"; then
|
||||||
|
echo "UMA carveout index: $(cat "${uma_base}/carveout")"
|
||||||
|
sed 's/^/ /' "${uma_base}/carveout_options"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "Step 1: Reset memory profile to safe defaults (4 GB carveout, no custom TTM)..."
|
||||||
|
apply_profile reset
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Step 2: Try restarting Plasma for logged-in user(s)..."
|
||||||
|
for udir in /run/user/*; do
|
||||||
|
[[ -d "${udir}" ]] || continue
|
||||||
|
uid="${udir##*/}"
|
||||||
|
user="$(id -nu "${uid}" 2>/dev/null)" || continue
|
||||||
|
[[ "${user}" == "root" ]] && continue
|
||||||
|
echo " Restarting plasmashell for ${user} (uid ${uid})..."
|
||||||
|
sudo -u "${user}" DBUS_SESSION_BUS_ADDRESS="unix:path=${udir}/bus" \
|
||||||
|
systemctl --user restart plasma-plasmashell 2>/dev/null \
|
||||||
|
|| sudo -u "${user}" kstart plasmashell 2>/dev/null \
|
||||||
|
|| true
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "If the panel still missing, reboot once more:"
|
||||||
|
echo " sudo reboot"
|
||||||
|
echo ""
|
||||||
|
echo "After reboot, verify:"
|
||||||
|
echo " z13-memory-profiles --status"
|
||||||
|
echo " free -h"
|
||||||
@@ -38,6 +38,7 @@ rsync -a --delete \
|
|||||||
"${SRC_DIR}/" "${INSTALL_DIR}/"
|
"${SRC_DIR}/" "${INSTALL_DIR}/"
|
||||||
|
|
||||||
chmod +x "${INSTALL_DIR}/bin/z13-memory-profiles"
|
chmod +x "${INSTALL_DIR}/bin/z13-memory-profiles"
|
||||||
|
chmod +x "${INSTALL_DIR}/bin/z13-recover-desktop" 2>/dev/null || true
|
||||||
chmod +x "${INSTALL_DIR}/install.sh" 2>/dev/null || true
|
chmod +x "${INSTALL_DIR}/install.sh" 2>/dev/null || true
|
||||||
|
|
||||||
ln -sf "${INSTALL_DIR}/bin/z13-memory-profiles" "${BIN_DIR}/z13-memory-profiles"
|
ln -sf "${INSTALL_DIR}/bin/z13-memory-profiles" "${BIN_DIR}/z13-memory-profiles"
|
||||||
|
|||||||
+24
-7
@@ -191,20 +191,33 @@ clear_ttm_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
regenerate_initramfs() {
|
regenerate_initramfs() {
|
||||||
|
# Only needed when /etc/modprobe.d/ttm.conf changes. Carveout (UMA) is firmware
|
||||||
|
# staged via sysfs and must NOT trigger a full initramfs rebuild — that has caused
|
||||||
|
# broken sessions on Nobara (wallpaper only, no plasmashell).
|
||||||
|
if [[ "${REGEN_INITRAMFS:-0}" != "1" ]]; then
|
||||||
|
log "Skipping initramfs regen (not required for this change)."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local running_kernel
|
||||||
|
running_kernel="$(uname -r)"
|
||||||
|
|
||||||
if command -v dracut >/dev/null 2>&1; then
|
if command -v dracut >/dev/null 2>&1; then
|
||||||
log "Regenerating initramfs (dracut)..."
|
log "Regenerating initramfs for ${running_kernel} only..."
|
||||||
dracut --force --regenerate-all 2>/dev/null || dracut --force
|
dracut --force -k "${running_kernel}" || {
|
||||||
|
log "WARN: dracut failed; try: sudo dracut --force -k ${running_kernel}"
|
||||||
|
}
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if command -v update-initramfs >/dev/null 2>&1; then
|
if command -v update-initramfs >/dev/null 2>&1; then
|
||||||
update-initramfs -u -k all
|
update-initramfs -u -k "${running_kernel}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if command -v mkinitcpio >/dev/null 2>&1; then
|
if command -v mkinitcpio >/dev/null 2>&1; then
|
||||||
mkinitcpio -P
|
mkinitcpio -P
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
log "No initramfs tool found; reboot may still apply modprobe.d on next boot."
|
log "No initramfs tool found; modprobe.d applies on next boot without regen."
|
||||||
}
|
}
|
||||||
|
|
||||||
set_carveout_index() {
|
set_carveout_index() {
|
||||||
@@ -245,13 +258,17 @@ apply_profile() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ttm_action}" == "clear" ]]; then
|
if [[ "${ttm_action}" == "clear" ]]; then
|
||||||
clear_ttm_config
|
if [[ -f "${TTM_CONF}" ]]; then
|
||||||
|
clear_ttm_config
|
||||||
|
REGEN_INITRAMFS=1 regenerate_initramfs
|
||||||
|
else
|
||||||
|
clear_ttm_config
|
||||||
|
fi
|
||||||
elif [[ -n "${ttm_gb}" ]]; then
|
elif [[ -n "${ttm_gb}" ]]; then
|
||||||
write_ttm_config "${ttm_gb}"
|
write_ttm_config "${ttm_gb}"
|
||||||
|
REGEN_INITRAMFS=1 regenerate_initramfs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
regenerate_initramfs
|
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Profile "${label}" staged successfully.
|
Profile "${label}" staged successfully.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user