I'm trying to debug Linux kernel using qemu and gdb. The problem is that gdb won't stop at the breakpoint. I've searched about it and found that turning kASLR off may help because kASLR confuses gdb.

-- Install that kernel on the guest.

+- Install that kernel on the guest, turn off KASLR by adding "nokaslr" to the kernel command line .

Unfortunately, I don't know what it means to add nokaslr to the command line and the way to do that. Any ideas would be appreciated.

  • I added "nokaslr" as it says in the link and the kernel boots normally. Therefore, it must be the right way. Thanks.
    – Winston
    Oct 13, 2017 at 15:38

2 Answers 2


qemu-system-x86_64 -append nokaslr

This is the way to go if you are using QEMU itself to load the kernel with -kernel, as opposed to having a bootloader inside the disk image, as you would do e.g. with an Ubuntu ISO installer.

The nokasrl Linux command line parameter disables KASRL.

This has been needed since v4.12, when KASLR was turned on by default.

Here is a highly automated Buildroot example that uses it.


Kernel boot parameters can be set temporarily per boot or always via some configuration file; how this is done depends on the bootloader which for current versions of Ubuntu is grub2;

$ grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub
$ sudo perl -i -pe 'm/quiet/ and s//quiet nokaslr/' /etc/default/grub
$ grep quiet /etc/default/grub
$ sudo update-grub

and then reboot; confirm at the grub menu that the parameters appear as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .