Linux tips and tricks for faster and easier administration Linux servers and applications! Troubleshooting and solutions!

Wednesday, 2 April 2014

Phantom reboot on kernel prior to 2.4.2 Linux EXPLAINED!

In case that you have up and running Linux server with 32 bit kernel prior 2.4.2 and in case that your uptime is 497 days and in case that you have monitoring software that alerts you for status of system(up,down,restart) that strange thing is about to happen. Your uptime information is about to reset it self and instead of 497 point something uptime you will have 0 days 0 minutes uptime. Depending on your monitoring system(we are using zabbix), you will probably get message that your server has been restarted!

Explanation is simple!

NOTE: The Linux kernel (at least up to 2.4.2) has a flaw: It computes the result of the "uptime" based on the internal "jiffies" counter, which counts the time since boot, in units of 10 milliseconds.This is typecast as an "unsigned long" - on the Intel boxes, that's an unsigned 32-bit number.Well, it turns out that in a 32-bit number, you can store 497.1 days before the number wraps.