fix: Implement fallback for 'update-initramfs' in ignore_msrs_always function#1931
fix: Implement fallback for 'update-initramfs' in ignore_msrs_always function#1931Silver-Crystal wants to merge 4 commits into
Conversation
Implements fallback in the absence of 'update-initramfs' utility(the command fails on arch). The counterpart on arch would be 'mkinitcpio' (possibly mkinitcpio -p linux )
There was a problem hiding this comment.
Pull request overview
This PR updates quickemu’s ignore_msrs_always helper to rebuild the host initramfs even on distros where update-initramfs is not available (e.g., Arch), so the kvm ignore_msrs=Y modprobe setting reliably takes effect.
Changes:
- Adds a fallback path to rebuild initramfs using
mkinitcpiowhenupdate-initramfsis unavailable. - Introduces command-availability detection logic to choose the correct initramfs rebuild tool.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case "$flag" in | ||
| 1) | ||
| sudo update-initramfs -k all -u | ||
| ;; | ||
| 2) | ||
| sudo mkinitcpio -p linux | ||
| echo "Ran mkinitcpio -p linux" | ||
| ;; | ||
| 3) | ||
| echo "ERROR! User does not have update-initramfs or mkinitcpio installed, please find out respective utility to update/regenrate intiramfs." | ||
| echo "Run respective command for 'sudo update-initramfs -k all -u'(debian) or 'sudo mkinitcpio -p linux'(arch)" | ||
| exit 1 | ||
| ;; | ||
| esac |
There was a problem hiding this comment.
3 issues found across 1 file
Confidence score: 2/5
- In
quickemu, the&>2redirection is a concrete shell bug: it writes output to a file named2instead of suppressing logs, which can leave artifacts and cause follow-on command behavior to diverge from expectations. This is the highest merge risk because it can directly break runtime flow—fix the redirection to the intended target (likely stderr or/dev/null) before merging. - In
quickemu, the Arch fallback usesmkinitcpio -p linux, which can fail on systems using non-default kernels likelinux-ltsorlinux-zen. Merging as-is risks broken initramfs generation for a meaningful set of Arch users—detect the installed kernel preset dynamically before merging. - In
quickemu, checking command availability viamanpages can produce false negatives when binaries exist but manpages are not installed. That can trigger unnecessary fallback/error paths and user-facing failures—switch detection to executable checks (for examplecommand -v) before merging.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…uickemu Removes (dumb human written) redundandant check in favour of other (intelligent, still human written but noticed by ai) checks instead. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
use ```mkinitcpio -P``` instead of hardcoded ```mkintcpio -p linux```
(fix suggested by cube and validated by copilot)
(manpage for mkinitcpio says
```-P, --allpresets
Process all presets contained in /etc/mkinitcpio.d. See the -p option for more detail about presets.
-p, --preset preset
Build initramfs image(s) according to specified preset. This may be a file in /etc/mkinitcpio.d
(without the .preset extension) or a full, absolute path to a file. This option may be specified mul‐
tiple times to process multiple presets.```
This does seem to remove hard coded path
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Auto-approved: Adds mkinitcpio fallback for Arch Linux; extends initramfs rebuilding logic with error handling. Low risk, well-contained.
Re-trigger cubic
Description
Implements fallback in the absence of 'update-initramfs' utility(the command fails on arch). The counterpart on arch would be 'mkinitcpio' (possibly mkinitcpio -p linux ).
Type of change
Checklist: