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.



Going around NTP service and still get corrent time EXPLAINED!

We have one server running on RH 5.9 that have issues with ntp service.
Issue is, well, it is not working. We reinstall ntp package, restart service numerous times, change ntp servers but nothing worked. After sometime it just stops to work. It is pretty embarrassing when user is calling you and say "Can you please fix time because it is 4 hours late?!?!"
So how to fix this strange issue?

Ntpdate command is doing her thing so we simple put it in crontab!

Depending of how often you would like to have synchronisation with your ntp server, your crontab will be different from my crontab. I think that synchronisation interval should not be smaller that one hour.
Crontab looks like this

00 * * * * ntpdate ntp_server > /dev/null 2>&1

This done the tricks for me! I hope this helps you!