Some tuning and troubleshooting needs kernel boot parameters: a serial console, IOMMU for passthrough, disabling a driver, or setting a cgroup mode. This guide shows how to safely change kernel boot parameters in GRUB on a KVM VPS or VM.
Before you start
- Root access and a working console (VNC or serial) in case the system fails to boot; see serial console.
- A snapshot or backup.
- Containers (OpenVZ/LXC) share the host kernel, so these steps do not apply there.
See current parameters
cat /proc/cmdlineTest a change temporarily
- Reboot and, at the GRUB menu (hold Shift or press Esc on many systems), select the entry and press e.
- Append the parameter to the line starting with
linux. - Press Ctrl+X or F10 to boot. The change lasts only for this boot.
Make it permanent on Debian/Ubuntu
Edit /etc/default/grub and add to GRUB_CMDLINE_LINUX_DEFAULT or GRUB_CMDLINE_LINUX:
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"Apply:
sudo update-grubSome cloud images also have files in /etc/default/grub.d/ that override settings; check them.
Make it permanent on AlmaLinux/Rocky
Use grubby, which updates all kernel entries:
sudo grubby --update-kernel=ALL --args="console=ttyS0,115200n8"Remove a parameter with --remove-args. Check with sudo grubby --info=DEFAULT.
Common parameters
| Parameter | Purpose |
|---|---|
console=ttyS0,115200n8 | Serial console output |
intel_iommu=on iommu=pt | IOMMU for passthrough on hosts; see PCI passthrough |
systemd.unit=rescue.target | Boot into rescue mode (temporary use) |
net.ifnames=0 | Use classic eth0 interface names |
mitigations=auto | CPU vulnerability mitigations (default); avoid disabling on shared hosts |
Reboot and verify
sudo rebootAfter boot, check cat /proc/cmdline again.
Troubleshooting
- Change not applied: config not regenerated, or the system boots via a different bootloader or EFI path.
- System will not boot: edit the entry at the GRUB menu to remove the parameter, boot, then fix the file. Or use rescue mode.
- Interfaces renamed after net.ifnames change: update network configuration before rebooting.
Frequently asked questions
Can I change kernel parameters on any VPS?
On KVM VPSs yes; on container-based VPSs no.
Should I disable CPU mitigations for speed?
Not on shared or internet-facing servers; the security risk outweighs the small gain.
What about sysctl?
Runtime kernel tunables go in /etc/sysctl.d/; boot parameters are for settings needed at startup.
