Passing boot args to kernel in QEMU without append

Abstract: Configure GRUB in the guest OS to pass persistent kernel boot arguments without modifying QEMU command-line flags.

Created: 2026-09-04 by
Pass boot arguments to a QEMU-launched Linux kernel by configuring the virtual machine’s firmware interface, such as GRUB or UEFI, rather than using command-line append flags. This approach allows persistent configuration changes within the guest environment that survive reboots and do not require modifying the host-side QEMU invocation script every time settings change.

Understanding the Limitation of -append

The standard method for passing kernel parameters involves adding -append "console=ttyS0" to the QEMU command line. While effective for quick debugging, this method is ephemeral; any change requires editing the host command string. For users seeking a more integrated solution where the guest operating system manages its own boot parameters, relying on the bootloader inside the virtual machine is the correct architectural choice. This separation ensures that the guest kernel behaves identically whether it is booted via QEMU, KVM, or physical hardware.

Configuring GRUB for Persistent Arguments

Most standard Linux distributions use GRUB (Grand Unified Bootloader) as their primary bootloader. To pass arguments without touching QEMU, you must edit the GRUB configuration file on the guest system. This method is particularly useful when you are performing incremental Linux kernel upgrades or managing specific kernel headers, as described in related guides on kernel management. First, access the guest operating system via SSH or a serial console provided by QEMU. Once logged in, open the GRUB configuration file using a text editor with root privileges. The file is typically located at /etc/default/grub. Look for the variable named GRUB_CMDLINE_LINUX_DEFAULT. This variable contains the default set of arguments passed to the kernel during normal boot operations. For example, if you need to enable verbose boot logging or specify a different console device, modify this line. Change: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" To: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash console=ttyS0" After saving the file, you must update the GRUB configuration to apply these changes. Run the following command depending on your distribution:
  • For Debian-based systems like Ubuntu or Kali: sudo update-grub
  • For Red Hat-based systems like Fedora or CentOS: sudo grub2-mkconfig -o /boot/grub2/grub.cfg
This process ensures that every time the guest boots, the kernel receives the specified arguments directly from the bootloader, eliminating the need for host-side injection.

Handling Kernel Headers and Upgrades

When modifying boot parameters, ensure that the necessary kernel modules are available. If you are working with custom kernels or specific driver requirements, you may need to install corresponding kernel headers. Properly configured boot arguments can help isolate cores or manage system resources, which is critical when dealing with complex kernel tasks or isolated core assignments. Always verify that your current kernel version supports the arguments you are passing.

Using Serial Console for Debugging Without Append

A common reason developers want to pass boot args is to enable a serial console for debugging purposes. Instead of using -append, you can configure the guest to output its console messages to a virtual serial port that QEMU exposes. This is often more stable than trying to force video console output during early boot stages. In the guest's GRUB configuration, add console=ttyS0 to the command line as shown above. Then, ensure that the kernel has support for serial ports compiled in. On the QEMU side, you do not need to pass arguments via -append. Instead, define the serial device in your QEMU startup script or XML definition (if using libvirt). For example:
-serial stdio
Or in an XML configuration:
<serial type='pty'>
  <target port='0'/>
</serial>
This setup allows the guest kernel to write its boot logs to the standard input/output of the QEMU process, providing visibility into the boot sequence without cluttering the graphical display or requiring host-side parameter injection.

UEFI and OVMF Considerations

If you are using UEFI instead of legacy BIOS, the process differs slightly. Modern QEMU installations often use OVMF (Open Virtual Machine Firmware). In this case, you cannot edit a simple text file like /etc/default/grub because the bootloader might be loaded differently or managed by systemd-boot. For UEFI systems, you typically need to modify the NVRAM variables or edit the EFI boot entries directly. Use tools like efibootmgr inside the guest to view and modify boot options. Add your desired kernel parameters to the specific boot entry. For instance:
efibootmgr --create --gpt --disk /dev/sda --part 1 --label "Linux" --unicode "\vmlinuz root=/dev/sda1 console=ttyS0 quiet"
This method persists across reboots and does not rely on the host QEMU command line. It is essential for environments where security policies prevent modification of host-side scripts, ensuring that all boot-time configurations are contained within the guest's secure boot chain.

Netconsole as an Alternative

Another robust alternative to local serial consoles is netconsole. This allows the kernel to send log messages over the network to a remote server. Configure this in the guest's GRUB parameters by adding netconsole=@IP_OF_SERVER/eth0,@PORT/DEST_MAC/IFACE_IP. This is particularly useful for headless servers where direct console access is difficult. Ensure that the network interfaces are correctly configured in the guest before rebooting, as misconfiguration can lead to boot failures.

Frequently Asked Questions

Why should I avoid using -append for permanent changes?

Using -append ties your kernel configuration to the specific QEMU launch script, making it hard to maintain across different host machines or automation scripts. Configuring the guest bootloader ensures consistency regardless of how the VM is started.

Can I mix GRUB and UEFI boot methods?

No, you must choose one firmware interface per installation. Switching between BIOS/GRUB and UEFI/OVMF after installation can break the boot process. It is best to decide on the firmware type during the initial OS installation.

What happens if I make a typo in the GRUB config?

If the kernel parameters are invalid, the system may fail to boot. You can usually recover by selecting the previous kernel version from the GRUB menu or by using a live USB to edit the /etc/default/grub file again.

Does netconsole work with encrypted disks?

Yes, netconsole operates at the kernel level before the root filesystem is mounted. However, you must ensure that the network drivers required for netconsole are built into the kernel image itself, not loaded as external modules, to guarantee availability during early boot.

How do I verify that boot args were applied?

After the system boots, check the contents of /proc/cmdline using the command cat /proc/cmdline. This file displays the exact arguments the running kernel received during startup, allowing you to confirm your changes took effect.
Tags: Linux QEMU Kernel

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More