28da46a764
gates / gates (push) Successful in 2m54s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
57 lines
2.6 KiB
Bash
57 lines
2.6 KiB
Bash
#!/bin/bash
|
|
# Kernel-lane spike (R-836, `09` §3 decision 164) — set up on a Proxmox host WITHOUT rebooting. Reversible: spike-undo.sh.
|
|
# Usage: spike-setup.sh <old-kver> <new-kver> e.g. spike-setup.sh 7.0.2-6-pve 7.0.14-20-pve
|
|
set -euo pipefail
|
|
OLD=$1 NEW=$2
|
|
ROOTUUID=$(findmnt -n -o UUID /)
|
|
ESPUUID=$(findmnt -n -o UUID /boot/efi)
|
|
ROOTDEV=$(findmnt -n -o SOURCE /)
|
|
ADV="gnulinux-advanced-$ROOTUUID"
|
|
[ -f /etc/default/grub.felhom-spike-orig ] || cp -p /etc/default/grub /etc/default/grub.felhom-spike-orig
|
|
# 1. the OLD kernel is the default (an install of a new kernel made the NEW one default — R-836)
|
|
sed -i "s|^GRUB_DEFAULT=.*|GRUB_DEFAULT=\"$ADV>gnulinux-$OLD-advanced-$ROOTUUID\"|" /etc/default/grub
|
|
# 2. candidate 2: a one-shot flag in a GRUB environment block on the ESP (vfat — GRUB can rewrite it in place)
|
|
grub-editenv /boot/efi/EFI/proxmox/felhom-oneshot.env create
|
|
cat > /etc/grub.d/01_felhom_oneshot <<SNIP
|
|
#!/bin/sh
|
|
cat <<'G'
|
|
# felhom kernel-lane spike: a one-shot default read from (and cleared in) an env block on the ESP
|
|
insmod part_gpt
|
|
insmod fat
|
|
search --no-floppy --fs-uuid --set=felhom_esp $ESPUUID
|
|
if [ -f (\$felhom_esp)/EFI/proxmox/felhom-oneshot.env ]; then
|
|
load_env -f (\$felhom_esp)/EFI/proxmox/felhom-oneshot.env felhom_next
|
|
if [ "\${felhom_next}" ]; then
|
|
set default="\${felhom_next}"
|
|
set felhom_next=
|
|
save_env -f (\$felhom_esp)/EFI/proxmox/felhom-oneshot.env felhom_next
|
|
fi
|
|
fi
|
|
G
|
|
SNIP
|
|
chmod 0755 /etc/grub.d/01_felhom_oneshot
|
|
# 3. the test entries: the NEW kernel healthy, and two simulated hangs before userspace (no init → kernel panic)
|
|
entry() { # id title extra-cmdline
|
|
cat <<G
|
|
menuentry '$2' --id $1 {
|
|
insmod gzio
|
|
insmod part_gpt
|
|
insmod lvm
|
|
insmod ext2
|
|
search --no-floppy --fs-uuid --set=root $ROOTUUID
|
|
linux /boot/vmlinuz-$NEW root=$ROOTDEV ro quiet $3
|
|
initrd /boot/initrd.img-$NEW
|
|
}
|
|
G
|
|
}
|
|
{ echo '#!/bin/sh'; echo "cat <<'G'"
|
|
entry felhom-spike-good "felhom spike: $NEW healthy" "panic=10"
|
|
entry felhom-spike-panic "felhom spike: $NEW, panic, restart 10s" "rdinit=/felhom-spike-no-rdinit init=/felhom-spike-no-init panic=10"
|
|
entry felhom-spike-freeze "felhom spike: $NEW, panic, NO restart" "rdinit=/felhom-spike-no-rdinit init=/felhom-spike-no-init panic=0"
|
|
echo G; } > /etc/grub.d/41_felhom_spike
|
|
chmod 0755 /etc/grub.d/41_felhom_spike
|
|
update-grub 2>&1 | tail -2
|
|
grub-script-check /boot/grub/grub.cfg && echo "grub.cfg syntax OK"
|
|
grep -n 'felhom_next\|felhom-spike-\|^set default' /boot/grub/grub.cfg | head -20
|
|
grub-editenv /boot/efi/EFI/proxmox/felhom-oneshot.env list; echo "(env listed above; empty = no one-shot)"
|