LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 09-09-2008, 02:16 AM   #1
soliax
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Rep: Reputation: 0
Question Way to force a specific value for system uptime?


Hi all,

I'm trying to find out if there's a way to force the value of a Linux system's uptime to a specific value?

I tried the couple of basics like changing the system clock, writing to /proc/uptime etc but no luck.

I read over the man pages for sysinfo and tried looking around the forums but it seems to be an unusual request.

The reason is I'd like to be able to confirm whether a patch we will apply to Oracle 10g will indeed be fixed. The bug occurs after the system has been running for more than 249 days (and I don't want to have to wait that long!).

Thanks in advance.

Soliax.
 
Old 09-09-2008, 02:28 AM   #2
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
in all honesty i doubt the bug actually has to do with the value 'uptime' returnes! that would be very very unlikely.
your best bet would anyway be to let oracle know of the issue and when you have noticed it to show up.
 
Old 09-09-2008, 02:38 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,153

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Better to use the clock approach. Stop NTP (and make sure it doesn't start on reboot), then change the time and reboot. Shutdown should write the time back into the BIOS - if not, do it manually.
Let it come up as normal with a fudged date and do your testing. Simply starting NTPD should set everything back to normal I would expect.
 
Old 09-09-2008, 02:54 AM   #4
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
oracle is the most stable database i know of. i connot understand why you guys think it could have anything to do with the clock or the update of the system. i seriously cannot imagine that being the case, unless you mean by 'bug' that your update license has expired, which is not how oracle works iirc!
rather if oracle has run for that long, not the system itself (neither if the system claims to have run for that long).
think of full /var/log or other stuff (which should not cause oracle to crash)
there are countless things that could be the cause of a bug after a system ran for a longer amount of time, though it could also be that if under heavier load the bug appears way earlier(?).
again - i cannot repeat this often enough - i highly doubt it has to do with the system time or uptime!
 
Old 09-09-2008, 03:46 AM   #5
soliax
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Nathanael View Post
oracle is the most stable database i know of. i connot understand why you guys think it could have anything to do with the clock or the update of the system. i seriously cannot imagine that being the case, unless you mean by 'bug' that your update license has expired, which is not how oracle works iirc!
rather if oracle has run for that long, not the system itself (neither if the system claims to have run for that long).
think of full /var/log or other stuff (which should not cause oracle to crash)
there are countless things that could be the cause of a bug after a system ran for a longer amount of time, though it could also be that if under heavier load the bug appears way earlier(?).
again - i cannot repeat this often enough - i highly doubt it has to do with the system time or uptime!
It's an official bug with Oracle 10g. Google for "patch 4612267". The last message on the following thread:

http://forums.oracle.com/forums/thre...sageID=2333424

Indicates Oracle uses a signed integer instead of an unsigned one for the return from times(). For 2.4 kernels (which I'm using, Oracle's component gets into an infinite loop after 248 days, so it technically doesn't crash but rather just stop responding). I haven't looked into the specifics of the bug, but was wondering also out of curiousity what would be involved in forcing a specific uptime, wether by modifying the sysinfo()'s returned value of uptime or playing with the jifffies / HZ values.
 
Old 09-09-2008, 03:51 AM   #6
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
wow - this is sad! my opinioin on oracle as just sunk drastically! :-(
 
Old 09-09-2008, 11:49 AM   #7
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by soliax View Post
I tried the couple of basics like changing the system clock, writing to /proc/uptime etc but no luck.
What happened when you tried to write to /proc/uptime? Did you get an error message?

In my very limited way of looking at things, I thought that should 'work' in changing the uptime, although it might do something nasty - like crash - the system in doing so.

Quote:
I read over the man pages for sysinfo and tried looking around the forums but it seems to be an unusual request.
...you can say that again...the only reason that I read this thread was because I coudn't think of any reason that anyone would want to do that, so now I am, at least, better informed.
 
Old 09-09-2008, 06:20 PM   #8
soliax
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by salasi View Post
What happened when you tried to write to /proc/uptime? Did you get an error message?
Nothing. I didn't get any errors (I just went echo X X > /proc/uptime) nor did anything get written to /proc/uptime (the original values stayed there).

Quote:
Originally Posted by salasi View Post
In my very limited way of looking at things, I thought that should 'work' in changing the uptime, although it might do something nasty - like crash - the system in doing so.
The approach I'm doing now is recompiling the kernel after having modified it's sysinfo() implementation to return sysinfo struct type with the member uptime with it's real value added to a base of 249 days (in seconds).

I'm having other issues with getting the kernel to compile with the driver for our RAID adaptor so need to get that fixed first...
 
Old 09-10-2008, 12:18 AM   #9
soliax
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Solved the issue...

I was able to figure it out by myself eventually.

I am running RHEL 3 with kernel 2.4.21-50.EL. I modified the kernel source (kernel/sys.c) so that that the times() function would return a value big enough to cause the Oracle bug. Note, this doesn't change the actual output of uptime if you run the uptime command.

asmlinkage long sys_times(struct tms * tbuf)
{
struct tms times;
/*
* In the SMP world we might just be unlucky and have one of
* the times increment as we use it. Since the value is an
* atomically safe type this is just fine. Conceptually its
* as if the syscall took an instant longer to occur.
*/
if (tbuf) {
times.tms_utime = kernel_timeval_to_clock_t(&current->utime);
times.tms_stime = kernel_timeval_to_clock_t(&current->stime);
times.tms_cutime = kernel_timeval_to_clock_t(&current->cutime);
times.tms_cstime = kernel_timeval_to_clock_t(&current->cstime);
if (copy_to_user(tbuf, &times, sizeof(struct tms)))
return -EFAULT;
}
//return jiffies;
return jiffies + (21513600 * 100); /* plus 249 days */
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force compile for a specific architecture ie Athlon ? hadding Programming 6 02-15-2016 04:00 PM
Need to force specific X driver in Hardy Psience Ubuntu 2 05-19-2008 02:35 PM
Force packets to a specific interface glowe Linux - Networking 1 06-13-2007 03:43 PM
how to force sendmail to use a specific interface Finlay Linux - Networking 5 05-14-2006 03:13 PM
force apt to install specific version cheech66 Linux - Newbie 5 05-29-2004 11:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration