Skip to content

fix: Implement fallback for 'update-initramfs' in ignore_msrs_always function#1931

Open
Silver-Crystal wants to merge 4 commits into
quickemu-project:masterfrom
Silver-Crystal:patch-1
Open

fix: Implement fallback for 'update-initramfs' in ignore_msrs_always function#1931
Silver-Crystal wants to merge 4 commits into
quickemu-project:masterfrom
Silver-Crystal:patch-1

Conversation

@Silver-Crystal

@Silver-Crystal Silver-Crystal commented Jul 3, 2026

Copy link
Copy Markdown

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have performed a self-review of my code
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Review in cubic

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 )
Copilot AI review requested due to automatic review settings July 3, 2026 21:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mkinitcpio when update-initramfs is 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.

Comment thread quickemu Outdated
Comment thread quickemu
Comment on lines +37 to +50
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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 1 file

Confidence score: 2/5

  • In quickemu, the &>2 redirection is a concrete shell bug: it writes output to a file named 2 instead 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 uses mkinitcpio -p linux, which can fail on systems using non-default kernels like linux-lts or linux-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 via man pages 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 example command -v) before merging.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread quickemu Outdated
Comment thread quickemu Outdated
Comment thread quickemu Outdated
…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>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants