Passing Kernel Parameters to Xen DomU Guests
Kernel parameters often need to be passed to Xen DomUs during boot or for troubleshooting. Common scenarios include booting into single-user mode for recovery, enabling kernel debugging, or adjusting memory/CPU settings at runtime.
Using the extra parameter
The simplest method is passing kernel parameters via the extra= option when creating or starting a DomU. For example, to boot a DomU into single-user mode:
xl create domu-vm.cfg extra="single"
Note: Modern Xen deployments use xl (the newer toolstack) rather than the deprecated xm command. If you’re still on xm, consider upgrading to xl as xm is no longer maintained.
Making parameters permanent
To apply kernel parameters persistently across reboots, add the extra= line directly to the DomU’s configuration file:
cat >> domu-vm.cfg << EOF
extra="single"
EOF
Or edit the file directly with your preferred editor. The parameters will then apply every time the DomU boots.
Common kernel parameters
Here are frequently used parameters for DomU kernels:
single— boot to single-user mode (useful for recovery)ro— mount root filesystem read-only initiallyrw— mount root filesystem read-writeconsole=hvc0— use Xen hypervisor console as primary consolequiet— suppress verbose kernel outputloglevel=7— set kernel log verbosity (0-7)init=/bin/bash— use bash as init (recovery scenario)systemd.unit=rescue.target— boot into systemd rescue mode
Multiple parameters
When passing multiple parameters, separate them with spaces:
xl create domu-vm.cfg extra="single console=hvc0 loglevel=7"
Or in the configuration file:
extra="single console=hvc0 loglevel=7"
Configuration file example
A typical DomU configuration with kernel parameters looks like this:
name = "web-server"
memory = 2048
vcpus = 2
vif = [ 'bridge=xenbr0' ]
disk = [ 'phy:/dev/vg0/web-server-root,xvda,w' ]
kernel = "/boot/vmlinuz-5.10.0-xen"
ramdisk = "/boot/initrd.img-5.10.0-xen"
extra = "console=hvc0 quiet"
Boot loader parameters with PV guests
If your DomU uses PV (paravirtualized) boot with a bootloader like pygrub, the kernel parameters may be embedded in the guest’s bootloader configuration instead. In such cases, modify the guest’s grub configuration file and recreate the DomU:
# Inside the DomU or via mount
vi /boot/grub/grub.cfg
# or for legacy GRUB
vi /boot/grub/menu.lst
Then either reboot the DomU or recreate it with xl create.
HVM guests with UEFI/BIOS
For HVM (hardware virtual machine) guests, kernel parameters may be passed differently depending on whether the guest is using Xen’s built-in boot, UEFI, or traditional BIOS. HVM guests typically boot an OS bootloader within the guest, so kernel parameters are usually configured via that bootloader (GRUB, systemd-boot, etc.) rather than via extra=.
Checking active parameters
To verify which parameters are currently active in a running DomU, check /proc/cmdline from within the guest:
xl console domu-vm
# Inside the DomU:
cat /proc/cmdline
This confirms that your extra parameters were correctly applied.
Temporary parameter changes for troubleshooting
If you need to test a parameter without making it permanent, use the extra= flag with xl create or xl console to attach to the running DomU. After testing, update the configuration file if the change proves necessary.