And it won't be long now before Netcraft is showing my supposed "Solaris 8" machine with around 350 days of uptime:
nmap:
I can now change my uptime to anything I want (below 497 days because of the 2.4 kernel uptime limitation). And I can do it on the fly without having to reboot. Here's the uptime command:
It was easy as adding two lines of code to one of the kernel source files which creates a proc file "/proc/sys/kernel/jiffies". "jiffies" is the counter variable that the kernel uses to keep track of how long the kernel has been running and all other applications indirectly key off of that variable (even the TCP/IP timestamps). So basically you can set the variable to anything you want on the fly by doing something like:
# echo "3000000000" > /proc/sys/kernel/jiffies
which will set your uptime to about 347 days. Obviously there are some ramifications of mucking with this somewhere along the line. The only thing I have noticed so far is if you set it to a high value like above the system stops responding for a period of time and then seems to get its wits back after about a minute. So if you try something similar I just want to warn you that something disasterous could happen.
If you feel adventerous and want to try it on an old machine then I have created a patch for the 2.4.20 kernel source. Put the following code in a file called "/usr/src/jiffies.patch":
Then assuming your 2.4.20 kernel source is in "/usr/src/linux" type:
# cd /usr/src/linux
# patch -p1 < ../jiffies.patch
Now make and install your new kernel and you should find a /proc/sys/kernel/jiffies variable that you can modify by my earlier instructions.
I didn't completely figure this out on my own. I happen to run across this:
http://www.zevv.nl/jiffies/However, the patch on that page is obviously not for the 2.4.20 kernel, I figured out what they did in the patch and made the same modification to the 2.4.20 kernel source and created my own patch.
[edit]
NOTE: I just found out a few important commands appear to not work if you set this too high. It seems I can set it to 3000000000 (347 days) without any problems but I'm not quite sure why when I had it set to 3500000000 400+ days it made a couple of commands hang.
It seems that under certain conditions commands like "top" and "sleep" will just hang. Any script that contains the "sleep" command will more or less just hang until you kill it. But going back and setting it to 3000000000 seemed to wake things up and everythign starts running fine from that point on. Maybe at this point I should just say the behavior is erratic and your mileage may vary. Let me know if you come up with the secret answer...
[/edit]
[ December 07, 2002: Message edited by: void main ]