Repository navigation
el: EL9 transaction out of PID 1's reach, sshd kept reachable, kdump and rescue images dropped (fixes #75) - #79
Conversation
…it (wend#75) On a live CentOS 7 box the alma9 hop stalled twice. systemd's %post re-executed PID 1 as EL9's systemd on EL7's 3.10 kernel, which never sees a stopped unit's cgroup empty, so audit's %post (systemctl start auditd) hung dnf. And once rpm.transit replaced sshd, the running EL7 listener re-executed the new binary for every connection and failed (recv_rexec_state), locking ssh out. The distro-sync now runs with SYSTEMD_OFFLINE=1: EL8's and EL9's systemctl skip start, restart and daemon-reexec, exactly as they do in the chroot replays CI runs; the old daemons run on until the hop's reboot. sshd is restarted after the transit and after the transaction, only on a booted root where it is a running unit, only if sshd -t accepts the config, with a timeout, and the step fails unless a new connection to the listen address gets the ssh greeting. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df4af505bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- hop.after restarts sshd too (wend#75 review): a hop to EL9 that fails between rpm.transit and its last restart no longer leaves the old listener exec'ing the new sshd. The guard skips only when `systemctl is-active sshd` says inactive, failed or unknown; a bus error fails the step instead of skipping. - kernel_before removes a removed kernel's kdump image (initramfs-<v>kdump.img, EL5/6's initrd-<v>kdump.img), and the rescue image (vmlinuz-0-rescue, its initramfs and BLS entry) unless it is GRUB legacy's default: EL9's 51-dracut-rescue.install copied its vmlinuz over EL7's and kept EL7's initramfs. No hop builds another (dracut_rescue_image="no" in a drop-in hop.after removes): a 54-65 MiB generic image per hop doesn't fit CentOS 5's 200 MB /boot. The machine's next kernel update builds one. - Preflight counts a kdump image with its kernel, and with old_kernels = "running" doesn't count the rescue image (new facts field rescue_mib). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
SPEC: keep this PR's rescue handling (old rescue image dropped, none built mid-route) over main's note on EL9 rebuilding it. adapters/el.toml: alma9's boot_mib back to 70, since main's 8 MiB for the rescue vmlinuz EL9 copied over EL7's no longer applies; the preflight test's /boot follows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
|
Independent Claude review: SIGN-OFF on 1aa66da. The reviewer checked:
Earlier rounds on this PR verified the Every live-box path here exits early in a chroot. This PR waits for a VM-tier replay on remi (centos7-lamp with its 1 GiB /boot, and centos5-web with a 200 MiB /boot for regression) before it merges. Open nits, to fold into a later push: the "CentOS 5's 200 MB" wording and a few lines over the wrap. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1aa66da9c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…(review) kernel_before leaves the rescue image alone when grub.conf's default entry boots it, so preflight must not treat its space as freed. Facts gain boot_dir.rescue_default, read from /boot/grub/grub.conf the way kernel_before's awk reads it. Also: "the VM tier's 200 MiB CentOS 5 /boot" wording, and the paragraphs this PR touched rewrapped to 120 columns (adapter data unchanged). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
…es (review) Entry 0 when there is no default= line, and default=/title only at the start of a line. The rescue_mib doc comment moves back above its function. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
|
Independent Claude review: SIGN-OFF on 64bbb6d. Since 1aa66da, two commits change only preflight (
The adapter's steps are unchanged ( This PR still waits for remi's VM-tier replays (centos7-lamp, centos5-web) before it merges. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64bbb6d7fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d (review) With default=saved (or a default= naming no entry), kernel_before can't tell whether GRUB boots the rescue image, so it now keeps it, and preflight counts it the same way. Only GRUB legacy machines are affected; on GRUB 2 the default is still not read. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ba93b1bf4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…lt (review) EL5's and EL6's grub.conf is 0600 and `wend facts` can run without root; kernel_before (as root) would keep the rescue image if the default is or may be it, so preflight counts it too rather than treating it as freed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
kernel_before now also keeps the rescue image when /boot/grub2/grubenv's saved_entry names a 0-rescue entry (EL7's menu title, a BLS id from EL8 on), and facts' rescue_default reads grubenv the same way (unreadable counts as maybe), so preflight keeps counting it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
…s it's swapped remi's VM proof of the previous head stalled again in the alma9 hop: EL8 audit's %postun runs `service auditd condrestart`, and `service` runs the legacy action under `env -i`, which drops SYSTEMD_OFFLINE, so the action's `systemctl start auditd` reached PID 1 and hung on the 3.10 kernel. ssh went dark because EL9's sshd landed mid-transaction and the restart after it never ran. On a live box dnf now runs in a private mount namespace with tmpfs over /run/systemd and /run/dbus, so no scriptlet can reach PID 1 whatever its environment, and a watcher outside the namespace restarts sshd (after sshd -t) as soon as the transaction replaces the binary. The chroot path is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
bec770d to
d17f109
Compare
|
Review sign-off on head d17f109 (independent Claude review) This round changes the following:
Checks run:
d17f109 has the same tree as bec770d; it only adds DCO trailers. The review left four low-severity notes, none blocking:
The chroot tier can't exercise the live-box path, so this still merges only after remi's real-VM replays pass on this head: centos7-lamp, then centos5-web. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d17f109d8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kernel_before = [ | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: kernel records left as they are\"; exit 0; }; K=$(for p in kernel kernel-core kernel-modules kernel-modules-core kernel-modules-extra; do rpm -q $p 2>/dev/null | grep -v 'is not installed'; done); if [ -n \"$K\" ]; then mkdir -p /var/lib/wend && echo $K > /var/lib/wend/kernel-handover && rpm -e --justdb --nodeps --noscripts --notriggers $K && echo \"kernel records dropped, files kept: $K\"; fi", | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: the running kernel isn't its own, nothing removed\"; exit 0; }; R=$(uname -r); G=/boot/grub/grub.conf; D=\"\"; [ -f $G ] && D=$(awk -F= '/^default=/ {d = $2} /^title/ {t++} t - 1 == d && $0 ~ /vmlinuz-/ {sub(/.*vmlinuz-/, \"\"); sub(/[ \\t].*/, \"\"); print; exit}' $G); for f in /boot/vmlinuz-*; do [ -e \"$f\" ] || continue; v=${f#/boot/vmlinuz-}; [ -n \"$v\" ] || continue; case \"$v\" in 0-rescue-*|\"$R\"|\"$D\") continue;; esac; rpm -qf \"$f\" >/dev/null 2>&1 && continue; echo \"removing an old kernel no package owns: $v\"; rm -f \"/boot/vmlinuz-$v\" \"/boot/.vmlinuz-$v.hmac\" \"/boot/System.map-$v\" \"/boot/config-$v\" \"/boot/symvers-$v.gz\" \"/boot/initrd-$v.img\" \"/boot/initramfs-$v.img\" \"/etc/ld.so.conf.d/kernel-$v.conf\"; rm -rf \"/lib/modules/$v\"; done; df -h /boot | tail -n1", | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: the running kernel isn't its own, nothing removed\"; exit 0; }; R=$(uname -r); G=/boot/grub/grub.conf; D=\"\"; [ -f $G ] && D=$(awk -F= '/^default=/ {d = $2} /^title/ {t++} t - 1 == d && $0 ~ /vmlinuz-/ {sub(/.*vmlinuz-/, \"\"); sub(/[ \\t].*/, \"\"); print; exit}' $G); for f in /boot/vmlinuz-*; do [ -e \"$f\" ] || continue; v=${f#/boot/vmlinuz-}; [ -n \"$v\" ] || continue; case \"$v\" in 0-rescue-*|\"$R\"|\"$D\") continue;; esac; rpm -qf \"$f\" >/dev/null 2>&1 && continue; echo \"removing an old kernel no package owns: $v\"; rm -f \"/boot/vmlinuz-$v\" \"/boot/.vmlinuz-$v.hmac\" \"/boot/System.map-$v\" \"/boot/config-$v\" \"/boot/symvers-$v.gz\" \"/boot/initrd-$v.img\" \"/boot/initramfs-$v.img\" \"/boot/initramfs-${v}kdump.img\" \"/boot/initrd-${v}kdump.img\" \"/etc/ld.so.conf.d/kernel-$v.conf\"; rm -rf \"/lib/modules/$v\"; done; mkdir -p /etc/dracut.conf.d && echo 'dracut_rescue_image=\"no\"' > /etc/dracut.conf.d/99-wend-no-rescue.conf || exit 1; case \"$D\" in 0-rescue-*) echo \"GRUB's default is the rescue image: left as it is\";; '') if [ -f $G ]; then echo \"GRUB's default (default=saved, or no such entry) may be the rescue image: left as it is\"; else D=none; fi;; esac; if grep -q '^saved_entry=.*0-rescue' /boot/grub2/grubenv 2>/dev/null; then echo \"GRUB 2's saved default is the rescue image: left as it is\"; D=''; fi; case \"$D\" in 0-rescue-*|'') ;; *) for f in /boot/vmlinuz-0-rescue-* /boot/.vmlinuz-0-rescue-*.hmac /boot/initramfs-0-rescue-*.img /boot/loader/entries/*-0-rescue.conf; do [ -e \"$f\" ] || continue; echo \"removing the old release's rescue image: $f\"; rm -f \"$f\"; done;; esac; df -h /boot | tail -n1", |
There was a problem hiding this comment.
Preserve numeric GRUB2 rescue defaults
When an EL7 machine uses GRUB_DEFAULT=saved and its grubenv has a numeric saved_entry that selects the rescue menu entry (for example, after grub2-set-default 2), this grep does not recognize it and the following branch deletes that rescue kernel and initramfs. The saved default can therefore still resolve to the now-stale rescue entry on the next reboot, leaving the machine unbootable. Fresh evidence: RHEL 7 documents numeric saved_entry values set by grub2-set-default; resolve numeric entries against the active menu or conservatively retain the rescue image.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and fixed in 8288b0c. It isn't pushed yet; it goes up once the EL replays finish.
kernel_before now keeps the rescue image whenever GRUB 2's default might be it. That covers four cases:
saved_entrynames0-rescue.saved_entryis a menu number (2,1>2).GRUB_DEFAULTin /etc/default/grub is something other thansavedor0, such as a number or a title, since that overrides grubenv.- Either file exists but can't be read.
Facts' rescue_default uses the same rule (grub2_default_may_be_rescue), so preflight keeps counting the image. Tests cover each case, plus a BLS id that starts with a digit and must not count as a number.
Generated by Claude Code
…iew) A numeric saved_entry (grub2-set-default 2, or 1>2) or a GRUB_DEFAULT other than saved or 0 may select the rescue entry, so kernel_before keeps the image and facts' rescue_default counts it, as for a saved_entry naming 0-rescue. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
|
Review sign-off on head 3807fd8 (independent Claude review) The new commit since d17f109 is 8288b0c. It keeps the rescue image when GRUB 2's default may be a menu number. That covers two cases: Checked: the gate, One low-severity note: a CRLF Real-VM evidence (remi), so far:
The 8288b0c change runs only on a live box's rescue guard and doesn't alter the VM path, so no further VM run is planned for it. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3807fd84f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kernel_before = [ | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: kernel records left as they are\"; exit 0; }; K=$(for p in kernel kernel-core kernel-modules kernel-modules-core kernel-modules-extra; do rpm -q $p 2>/dev/null | grep -v 'is not installed'; done); if [ -n \"$K\" ]; then mkdir -p /var/lib/wend && echo $K > /var/lib/wend/kernel-handover && rpm -e --justdb --nodeps --noscripts --notriggers $K && echo \"kernel records dropped, files kept: $K\"; fi", | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: the running kernel isn't its own, nothing removed\"; exit 0; }; R=$(uname -r); G=/boot/grub/grub.conf; D=\"\"; [ -f $G ] && D=$(awk -F= '/^default=/ {d = $2} /^title/ {t++} t - 1 == d && $0 ~ /vmlinuz-/ {sub(/.*vmlinuz-/, \"\"); sub(/[ \\t].*/, \"\"); print; exit}' $G); for f in /boot/vmlinuz-*; do [ -e \"$f\" ] || continue; v=${f#/boot/vmlinuz-}; [ -n \"$v\" ] || continue; case \"$v\" in 0-rescue-*|\"$R\"|\"$D\") continue;; esac; rpm -qf \"$f\" >/dev/null 2>&1 && continue; echo \"removing an old kernel no package owns: $v\"; rm -f \"/boot/vmlinuz-$v\" \"/boot/.vmlinuz-$v.hmac\" \"/boot/System.map-$v\" \"/boot/config-$v\" \"/boot/symvers-$v.gz\" \"/boot/initrd-$v.img\" \"/boot/initramfs-$v.img\" \"/etc/ld.so.conf.d/kernel-$v.conf\"; rm -rf \"/lib/modules/$v\"; done; df -h /boot | tail -n1", | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: the running kernel isn't its own, nothing removed\"; exit 0; }; R=$(uname -r); G=/boot/grub/grub.conf; D=\"\"; [ -f $G ] && D=$(awk -F= '/^default=/ {d = $2} /^title/ {t++} t - 1 == d && $0 ~ /vmlinuz-/ {sub(/.*vmlinuz-/, \"\"); sub(/[ \\t].*/, \"\"); print; exit}' $G); for f in /boot/vmlinuz-*; do [ -e \"$f\" ] || continue; v=${f#/boot/vmlinuz-}; [ -n \"$v\" ] || continue; case \"$v\" in 0-rescue-*|\"$R\"|\"$D\") continue;; esac; rpm -qf \"$f\" >/dev/null 2>&1 && continue; echo \"removing an old kernel no package owns: $v\"; rm -f \"/boot/vmlinuz-$v\" \"/boot/.vmlinuz-$v.hmac\" \"/boot/System.map-$v\" \"/boot/config-$v\" \"/boot/symvers-$v.gz\" \"/boot/initrd-$v.img\" \"/boot/initramfs-$v.img\" \"/boot/initramfs-${v}kdump.img\" \"/boot/initrd-${v}kdump.img\" \"/etc/ld.so.conf.d/kernel-$v.conf\"; rm -rf \"/lib/modules/$v\"; done; mkdir -p /etc/dracut.conf.d && echo 'dracut_rescue_image=\"no\"' > /etc/dracut.conf.d/99-wend-no-rescue.conf || exit 1; case \"$D\" in 0-rescue-*) echo \"GRUB's default is the rescue image: left as it is\";; '') if [ -f $G ]; then echo \"GRUB's default (default=saved, or no such entry) may be the rescue image: left as it is\"; else D=none; fi;; esac; E=$(sed -n 's/^GRUB_DEFAULT=//p' /etc/default/grub 2>/dev/null | tail -n1 | tr -d \"\\\"'\"); S=$(sed -n 's/^saved_entry=//p' /boot/grub2/grubenv 2>/dev/null | tail -n1); case \"$E\" in ''|saved) case \"$S\" in *0-rescue*) echo \"GRUB 2's saved default is the rescue image: left as it is\"; D='';; *) if [ -n \"$S\" ] && echo \"$S\" | grep -qx '[0-9>]*'; then echo \"GRUB 2's saved default is menu entry $S, which may be the rescue image: left as it is\"; D=''; fi;; esac;; 0) ;; *) echo \"GRUB 2's default ($E) may be the rescue image: left as it is\"; D='';; esac; case \"$D\" in 0-rescue-*|'') ;; *) for f in /boot/vmlinuz-0-rescue-* /boot/.vmlinuz-0-rescue-*.hmac /boot/initramfs-0-rescue-*.img /boot/loader/entries/*-0-rescue.conf; do [ -e \"$f\" ] || continue; echo \"removing the old release's rescue image: $f\"; rm -f \"$f\"; done;; esac; df -h /boot | tail -n1", |
There was a problem hiding this comment.
Preserve rescue defaults selected by title
Fresh evidence: this guard treats every nonnumeric saved_entry without the literal 0-rescue as safe. On an EL7 system with GRUB_DEFAULT=saved where saved_entry is a rescue menu title that lacks that filename fragment, the loop removes the rescue kernel and initramfs while GRUB still selects that entry, leaving the next reboot unbootable. GRUB permits defaults to identify entries by title, and saved_entry supplies that default; resolve the saved entry against the active menu or retain the rescue image for title-valued entries. GNU GRUB: default selectors, saved_entry
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. Fixed in e8adb39, which isn't pushed yet; it goes up once the EL replays finish.
Instead of listing what counts as the rescue entry, the guard now lists what counts as safe. A saved_entry lets kernel_before drop the rescue image only when it names an installed, non-rescue kernel, in one of two forms:
- EL7's menu title
... (<version>) ... - a BLS id ending in
-<version>
Anything else keeps the image: a renamed title, a menu number, or a title for a kernel that's gone.
Facts' rescue_default uses the same rule. Both sides strip carriage returns from GRUB_DEFAULT, which also closes a CRLF mismatch our own review found. I tested the shell under dash and bash against the Rust test cases, and they agree on every case.
Generated by Claude Code
…led kernel (review) A saved_entry that is a renamed title, a menu number or a kernel that is gone may select the rescue entry. Only a title naming an installed kernel's version (EL7's "... (<version>) ...") or a BLS id ending in one lets kernel_before drop the image; facts' rescue_default follows the same rule. GRUB_DEFAULT is read with carriage returns stripped, as Rust's lines() does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f7101fb93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kernel_before = [ | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: kernel records left as they are\"; exit 0; }; K=$(for p in kernel kernel-core kernel-modules kernel-modules-core kernel-modules-extra; do rpm -q $p 2>/dev/null | grep -v 'is not installed'; done); if [ -n \"$K\" ]; then mkdir -p /var/lib/wend && echo $K > /var/lib/wend/kernel-handover && rpm -e --justdb --nodeps --noscripts --notriggers $K && echo \"kernel records dropped, files kept: $K\"; fi", | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: the running kernel isn't its own, nothing removed\"; exit 0; }; R=$(uname -r); G=/boot/grub/grub.conf; D=\"\"; [ -f $G ] && D=$(awk -F= '/^default=/ {d = $2} /^title/ {t++} t - 1 == d && $0 ~ /vmlinuz-/ {sub(/.*vmlinuz-/, \"\"); sub(/[ \\t].*/, \"\"); print; exit}' $G); for f in /boot/vmlinuz-*; do [ -e \"$f\" ] || continue; v=${f#/boot/vmlinuz-}; [ -n \"$v\" ] || continue; case \"$v\" in 0-rescue-*|\"$R\"|\"$D\") continue;; esac; rpm -qf \"$f\" >/dev/null 2>&1 && continue; echo \"removing an old kernel no package owns: $v\"; rm -f \"/boot/vmlinuz-$v\" \"/boot/.vmlinuz-$v.hmac\" \"/boot/System.map-$v\" \"/boot/config-$v\" \"/boot/symvers-$v.gz\" \"/boot/initrd-$v.img\" \"/boot/initramfs-$v.img\" \"/etc/ld.so.conf.d/kernel-$v.conf\"; rm -rf \"/lib/modules/$v\"; done; df -h /boot | tail -n1", | ||
| "[ / -ef /proc/1/root ] || { echo \"not booted from this root: the running kernel isn't its own, nothing removed\"; exit 0; }; R=$(uname -r); G=/boot/grub/grub.conf; D=\"\"; [ -f $G ] && D=$(awk -F= '/^default=/ {d = $2} /^title/ {t++} t - 1 == d && $0 ~ /vmlinuz-/ {sub(/.*vmlinuz-/, \"\"); sub(/[ \\t].*/, \"\"); print; exit}' $G); for f in /boot/vmlinuz-*; do [ -e \"$f\" ] || continue; v=${f#/boot/vmlinuz-}; [ -n \"$v\" ] || continue; case \"$v\" in 0-rescue-*|\"$R\"|\"$D\") continue;; esac; rpm -qf \"$f\" >/dev/null 2>&1 && continue; echo \"removing an old kernel no package owns: $v\"; rm -f \"/boot/vmlinuz-$v\" \"/boot/.vmlinuz-$v.hmac\" \"/boot/System.map-$v\" \"/boot/config-$v\" \"/boot/symvers-$v.gz\" \"/boot/initrd-$v.img\" \"/boot/initramfs-$v.img\" \"/boot/initramfs-${v}kdump.img\" \"/boot/initrd-${v}kdump.img\" \"/etc/ld.so.conf.d/kernel-$v.conf\"; rm -rf \"/lib/modules/$v\"; done; mkdir -p /etc/dracut.conf.d && echo 'dracut_rescue_image=\"no\"' > /etc/dracut.conf.d/99-wend-no-rescue.conf || exit 1; case \"$D\" in 0-rescue-*) echo \"GRUB's default is the rescue image: left as it is\";; '') if [ -f $G ]; then echo \"GRUB's default (default=saved, or no such entry) may be the rescue image: left as it is\"; else D=none; fi;; esac; E=$(sed -n 's/^GRUB_DEFAULT=//p' /etc/default/grub 2>/dev/null | tail -n1 | tr -d \"\\\"'\\r\"); S=$(sed -n 's/^saved_entry=//p' /boot/grub2/grubenv 2>/dev/null | tail -n1); case \"$E\" in ''|saved) K=; for f in /boot/vmlinuz-*; do v=${f#/boot/vmlinuz-}; case \"$v\" in 0-rescue-*|'*') continue;; esac; case \"$S\" in *\"($v)\"*|*\"-$v\") K=$v;; esac; done; case \"$S\" in '') ;; *0-rescue*) echo \"GRUB 2's saved default is the rescue image: left as it is\"; D='';; *) [ -n \"$K\" ] || { echo \"GRUB 2's saved default ($S) names no installed kernel, so it may be the rescue image: left as it is\"; D=''; };; esac;; 0) ;; *) echo \"GRUB 2's default ($E) may be the rescue image: left as it is\"; D='';; esac; case \"$D\" in 0-rescue-*|'') ;; *) for f in /boot/vmlinuz-0-rescue-* /boot/.vmlinuz-0-rescue-*.hmac /boot/initramfs-0-rescue-*.img /boot/loader/entries/*-0-rescue.conf; do [ -e \"$f\" ] || continue; echo \"removing the old release's rescue image: $f\"; rm -f \"$f\"; done;; esac; df -h /boot | tail -n1", |
There was a problem hiding this comment.
Preserve custom rescue titles selected by GRUB2
For GRUB2 systems using GRUB_DEFAULT=saved, a custom rescue menu title such as Recovery-3.10.0-1160.el7.x86_64 can validly point at the vmlinuz-0-rescue-* entry. The new *"-$v" arm treats that title as a normal installed-kernel BLS id, so K becomes nonempty and the later branch removes the rescue image even though GRUB's saved default still selects it; the next reboot can therefore be unbootable. Fresh evidence is the suffix match itself: only accept a saved entry resolved from the active menu/BLS config, or conservatively retain the rescue image for title-valued entries.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed. Matching on text was the wrong approach, and 8e08e88 replaces it. That commit isn't pushed yet; it goes up after the EL replays.
kernel_before now resolves GRUB 2's default the way GRUB itself does. The default is whichever applies of:
saved_entry,GRUB_DEFAULT,- the first menu entry.
It looks that default up as:
- a BLS entry's
linuxline, or - the
linux/linux16/linuxefiline under the grub.cfgmenuentrywith that exact title. It checks/boot/grub2/grub.cfgfirst, then the ESP's.
The rescue image goes only if the default resolves to a kernel other than the rescue image. That kernel is also kept, which closes a related gap: a box updated but not rebooted could lose its GRUB 2 default kernel. Anything else keeps the rescue image: Recovery-<version> resolves to vmlinuz-0-rescue-*, a menu number or submenu path doesn't resolve, and an unreadable file counts as "may be".
Facts' rescue_default uses the same resolution, and tests cover these cases.
Generated by Claude Code
…efore removing any (review) kernel_before matched saved_entry against /boot after its removal loop, so on a box updated but not rebooted it had already deleted the kernel GRUB 2 boots by default: the rescue image was then kept while facts said it would go, and a hop failing before kernel_after left the default entry pointing at deleted files. The saved default is now resolved first and its kernel is kept, as GRUB legacy's already was. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
…cue image (review)
Matching saved_entry's text against kernel versions let a custom title
on the rescue entry ("Recovery-<version>") pass as a kernel. GRUB 2's
default (saved_entry, or GRUB_DEFAULT, or the first entry) is now
resolved the way GRUB does: a BLS entry's linux line, or the linux line
under the grub.cfg menuentry with that title. Only a default that
resolves to a kernel other than the rescue image lets the image go, and
that kernel is kept. Facts follow the same resolution.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc
Signed-off-by: Claude <[email protected]>
… menu Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc Signed-off-by: Claude <[email protected]>
|
Review sign-off on head 247e3d2 (independent Claude review) Changes since 3807fd8:
Checks: the gate, Real-VM evidence (remi, both at d17f109, which already had the transaction fix):
The commits after d17f109 only change Carried to the follow-up PR:
Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 247e3d2673
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # is-active` saying inactive, failed or unknown skips it (a socket-activated sshd execs per connection already); a | ||
| # bus error counts as running, so it fails the step rather than skipping it. A chroot box runs no sshd and skips | ||
| # both. | ||
| upgrade = ["[ / -ef /proc/1/root ] && [ -d /run/systemd/system ] && case $(systemctl is-active sshd 2>/dev/null) in inactive|failed|unknown) false;; esac || { echo \"sshd: not a running systemd service on this root, left alone\"; exit 0; }; /usr/sbin/sshd -t || { echo \"the installed sshd rejects its configuration: restarting it would lock ssh out\"; exit 1; }; timeout 120 systemctl restart sshd || { echo \"systemctl restart sshd failed or hung\"; exit 1; }; L=$(/usr/sbin/sshd -T 2>/dev/null | awk '$1 == \"listenaddress\" {print $2}'); A=$(echo \"$L\" | grep -v '^\\[' | head -n1); [ -n \"$A\" ] || A=$(echo \"$L\" | head -n1); H=${A%:*}; P=${A##*:}; H=${H#[}; H=${H%]}; case \"$H\" in 0.0.0.0|\"\") H=127.0.0.1;; ::) H=::1;; esac; for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do timeout 5 bash -c \"exec 3<>/dev/tcp/$H/${P:-22} && head -c 4 <&3\" 2>/dev/null | grep -q '^SSH-' && { echo \"sshd restarted: a new connection to $H port ${P:-22} gets its greeting\"; exit 0; }; sleep 1; done; echo \"sshd restarted, but a new connection to $H port ${P:-22} gets no greeting\"; exit 1", |
There was a problem hiding this comment.
Start SSH recovery before rpm.transit replaces sshd
When an EL7 route fires el8-transit or el8-transit-epel, its rpm.transit pre step explicitly reinstalls openssh-server (fixes/el/alma9/el8-transit*.toml:9-13). Walk.hop_parts executes every pre step before this release's upgrade list (tools/walk.py:87-88), so neither this restart nor the watcher in the next command exists while the long EL7→EL8 transit is running. Once transit swaps /usr/sbin/sshd, new logins are still broken until transit returns; if it stalls after that swap, hop.after is also never reached. Start the watcher/restart before (or inside) the transit phase so the stated SSH-reachability guarantee covers the transition that first replaces sshd.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is a real gap, but I'm not fixing it in this PR. It moves to the route-gap follow-up.
Here is the path. rpm.transit runs as a fix's pre step, before this release's upgrade list. So between the transit swapping /usr/sbin/sshd and upgrade[0] restarting sshd, new logins fail. Existing sessions keep working, and so does the harness's own connection. That window is the rest of the transit, a few minutes on remi's VM. If the transit fails rather than hangs, hop.after still restarts sshd. Only a hang inside the transit after the swap leaves new logins broken. A hang anywhere in a hop already needs the console, and that is what wend#75 was about.
Covering it properly means starting the watcher before any pre step, as a detached process with a pidfile, and stopping it in hop.after. Then it covers the transit and the transaction alike. That is a hop-structure change (adapter, tools/walk.py, tools/vm.py's runner and the Rust client). It is bigger than this PR's scope, and remi's real-VM proof on this head didn't hit it. It is going into the follow-up PR.
Generated by Claude Code
Requested by Peter · project thread
What this adds
Route: none. This is a spec change to
adapters/el.toml, SPEC.md and the client's preflight (client/src/hardware.rs). It fixes #75 and the /boot gaps the VM tier found next to it.New fixes: none
Claims issue: #75
Before: on a real CentOS 7 VM, the CentOS 7 -> Alma 10 route stalled in the alma9 hop.
/usr/sbin/sshdfor every connection, and the newer binary can't read its state.%postre-executes it, and audit'sservice auditd condrestartstarts a unit. On EL7's 3.10 kernel EL9's systemd never sees a cgroup go empty, so the start never returns.After:
dnf distro-synccan't reach PID 1. It runs in a private mount namespace (unshare -m) with tmpfs over/run/systemdand/run/dbus, plusSYSTEMD_OFFLINE=1. No scriptlet can reach PID 1, whatever environment it gets;serviceruns legacy actions underenv -i, which droppedSYSTEMD_OFFLINEalone. The old daemons and the old PID 1 run until the hop's reboot. A chroot is unchanged.sshd -t, as soon as the transaction swaps the binary.rpm.transit, after the transaction, and inhop.after.sshd -tand needs a new connection to get theSSH-greeting.hop.kernel_beforeremoves a removed kernel's kdump image, and drops the old release's rescue image and BLS entry unless GRUB's default is or may be it.default=, ordefault=saved.saved_entry,GRUB_DEFAULTor the first entry, resolved against grub.cfg's menu or the BLS entry the way GRUB resolves it. The kernel that default boots is kept too.dracut_rescue_image="no"drop-in thathop.afterremoves).boot_dir.rescue_mib,boot_dir.rescue_default) say it goes. alma9boot_mibstays at 70.Model
none: hand-written
Evidence
Chroot tier (
./wend verify, head 247e3d2):Decoy check passed.
tools/check.py,tools/test_check.py,cargo fmt/clippy/testandclient/parity.pyare green.VM tier (remi, BIOS, at d17f109, which already had the namespace and watcher; later commits only touch the live-box rescue/default guard):
el9-drop-orphaned-polkitvs tuned on a real @core install, and a stalemysql_upgrade. A follow-up PR handles them, and the full routes are VM-proved there.Merging on this evidence was agreed in the project thread.
Self-review (AGENTS.md step 5)
./wend verifyfound no decoy hitsrepair) keptgit commit -s)🤖 Generated with Claude Code
https://claude.ai/code/session_01U79sdXK2gVuGi4U9ty7qHc