I have a laptop (Dell XPS15) from 2011 and it came with Windows 7 built-in, however they keyboard has a stuck key, therefore I need to disable the keyboard. I partitioned some space and did a Kali Linux install — which is based on Debian Linux. I wanted to make this an only Linux laptop because, as you can tell, it’s quite old and should work perfectly. However, I decided to keep Windows 7 on there just because of the amount of data I have stored on it. Now it’s dual-booting Linux and Windows and gives me the option to select the OS I want to run when booting.
Since the laptop is old, it has some issues of its own. First, of all, the battery is dead so it has to stay plugged in. Second, one day I tried to use it and I noticed every time I pressed the space key, it would get stuck. Initially I was able to pop it back out and have the keyboard function as normal, however after some time, the laptop just decided that it would randomly start inserting spaces (multiple spaces) when I’m typing something. My initial thoughts were I could just open up my laptop and and try to fix the keyboard itself and if that didn’t work, just disconnect the keyboard. However after some thought, I realized I may still need the internal keyboard to run commands or troubleshoot before the laptop actually loads all the drivers and boots up into Linux.
I currently have a wireless keyboard/mouse combo connected to it, and chances are there will be times where I will need the on-board keyboard. For example, when the computer is booting up, it will ask me to press F1 to continue or F2 to enter setup. I would not be able to use the wireless keyboard, because the wireless keyboard drivers haven’t been loaded yet, and the built-in keyboard is disconnected. I wouldn’t even make it to the login page of Linux. Therefore, I decided I would try to disable the keyboard via software using the terminal.
Researching led me to looking into the Linux kernel and parameters. I googled and landed on this page: Kernel Parameters
This guide lists all the parameters available to modify how certain hardware works, including the keyboard. So I decided to run a search using the browser search (CTRL + F), to go through the page and find me anything that hits on “keyboard”. As you can see from the image below, I have 14 hits. So I cycled through them (F3), reading the descriptions, until I found one that interested me.

disable keyboard
i8042.nokbd [HW] Don't check/create keyboard port
This parameter seems like it will purposely not check or create the keyboard port — which is needed to type using the built-in laptop keyboard. Since we have found a test parameter, we will need to update the /etc/defualt/grub file. To do this, we will have to open the file in a terminal editor, update it and save it.
$ nano /etc/default/grub
This should open the file grub
in the terminal with the nano editor. Feel free to use any other editor you prefer such as vim, emacs, etc. Once the file opens, we need to find the line that says
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
This line can be seen highlighted in the below image:

disable keyboard
and update it to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet i8042.nokbd"
The updated line is shown in the image below:

Disable keyboard 2
Afterwards, we can save the updated grub file. For nano editor, you can just press CTRL + X, and it will ask you if you want to save the changes, and you just press “Y” for yes and hit ENTER. Now, if you go anywhere and attempt to use your built-in keyboard, you will notice that nothing has changed — it is still typing and having the same issues as before. This is because we have not run the update-grub
in the terminal to apply all the changes. Here is a definition of what the update-grub
command does:
The update-grub command is used in Linux to update the GRUB bootloader configuration file, which allows the system to recognize new kernels or operating systems installed on the machine. It typically generates a new grub.cfg file based on the settings in /etc/default/grub and scripts in /etc/grub.d/.
After running the update-grub
, you should get a similar output:

Disable Keyboard – Update-Grub
This is great, it means you’re on track, however the built-in keyboard will still be working. The reason it is still working is because you need to “reboot” your machine for the changes to grub are complete. Now you should have a non-functioning built-in/on-board keyboard on your laptop! That may sound bad, but it’s good news for us because we accomplished the task that we set out to accomplish.
Now, I’m still able to use the built-in keyboard before everything in the new grub file is applied every boot. This will allow me to use F1 and F2 keys before the built-in keyboard is disabled. No more random spaces due to broken/stuck space bar. This will only work on Linux, so if you do not have a Linux distro installed on your computer, check out my tutorial on how to install Kali Linux, or even run it off a USB drive.
0 Comments