There has been a similar question - but IMHO there has to be a simpler solution. If num-lock is on in the BIOS - why is it turned off during linux boot and/or KDE/Gnome/whatever startup?
Linux initializes most peripherals so that they'll be in a known state. This includes the keyboard: Linux's internal data about the keyboard had better match the LEDs, so what Linux does is to turn off the LEDs (as far as I recall, the CPU can't read the state of the LEDs on a PC keyboard) and declare all *Lock to be off.
I like to have NumLock on by default. For Linux text consoles, what I used to do¹ is to run
for t in /dev/tty[0-9]*; do setleds -D +num <$t; done
from a boot script (
/etc/init.d/50_local_setleds or wherever the distribution likes to put those).
Nowadays, at least on some distributions such as Debian, you can add
/etc/kbd/config depending on which one you have).
The X window system has its own keyboard handling, so you need to deal with it separately. What I do is to switch caps lock permanently off (I don't have a Caps Lock key in my layout) and switch num lock permanently on (I don't have a Num Lock key in my layout, and the keypad keys send
KP_1 and so on). If you want to retain the modifiers but make Num Lock default on, you can write a small program to call
XKbLockModifiers to set the modifier inside X and
XChangeKeyboardControl to set the physical LED.
¹ Used to, because I haven't bothered with text consoles in a while.