The methods mentioned earlier can be either too extreme, like i8042.nokbd, or limited to Xserver. However, there's another approach that achieves a similar result to the i8042.nokbd parameter while still being easy to revert, just like the X server methods.
To unbind the device from the relevant driver in an elevated terminal, execute:
echo -n 'serio0' > '/sys/bus/serio/drivers/atkbd/unbind'
To rebind or enable the keyboard again, use:
echo -n 'serio0' > '/sys/bus/serio/drivers/atkbd/bind'
Note: On some devices, the keyboard will automatically bind itself. To prevent this, you need to change the bind mode of the device from auto to manual by executing:
echo -n 'manual' | tee /sys/devices/platform/i8042/serio0/bind_mode
Also, note that the keyboard is not guaranteed to correspond to serio0, though this is usually the case.
source
Another interesting way to achieve similar results to xinput methods at a layer just below xserver or any modern display-input server is to force libinput to ignore inputs from the device by using the udev attribute LIBINPUT_IGNORE_DEVICE.
For further instructions.
Yet another udev method is to not identify the keyboard as an input device by setting ENV{ID_INPUT}="",source.
Note:The first method is valid for a session only,you can create a udev rule or systemd service to have a persistent effect.