2

I have a XEN domU running CentOS 5.

I'm having trouble setting the correct timezone.

I want it to run on Mountain Standard Time, but it shows Pacific Standard time. I've tried everything, but I can't get this right. This VM doesn't have Internet access, so I can't use ntpd or anything. I sync it up with another Xen domU running XP, which has the correct timezone and time. But even if I don't sync up, it should show me the correct timezone, since I'm pointing /etc/localtime at the correct timezone.

Here's all the commands (and output for some) I've used so far.

# mv /etc/localtime  /etc/localtime-old

# ln -sf /usr/share/zoneinfo/US/Mountain /etc/localtime

# vi /etc/sysconfig/clock

ZONE="America/Denver"
UTC=true
ARC=false

# /usr/sbin/tzdata-update

# /sbin/hwclock --systohc --utc

# uname -a
Linux MyServer 2.6.18-164.6.1.el5 #1 SMP Tue Nov 3 16:18:27 EST 2009 i686 athlon i386 GNU/Linux

Now when I type date it shows PST # date Thu Apr 7 16:29:34 PDT 2011

ntpd is not running

What's missing?

Kvisle
  • 4,113
  • 23
  • 25
FatherFigure
  • 285
  • 1
  • 2
  • 14

4 Answers4

4

Do you use a PV Xen DomU? If so, your time is coupled with the Dom0. If you want to change that, do a sysctl -e xen.independent_wallclock = 1

After that timezone, ntpdate and ntp will function as expected.

Nils
  • 7,657
  • 3
  • 31
  • 71
  • Oh - that was easy. ;-) So for these points just an additional comment: To make it reboot-safe add `xen.independent_wallclock = 1` to /etc/sysctl.conf – Nils Oct 17 '11 at 19:00
1

You do realize that uname -a is displaying the date and timezone information from when the kernel was actually built? That changing the timezone settings will not affect the results of uname -a timezone display unless you recompile your kernel.

For a domU to run ntpd you will need to set the xen.independent_wallclock sysctl value to 1 as Nils mentions but that won't affect the timezone displayed via uname -a. Otherwise all the other steps you show as having taken should affect the timezone on your machine and if the results of simply running date returns the timezone you're expecting then it is complete and your test of using uname -a to verify is all that is invalid.

Jeremy Bouse
  • 11,241
  • 2
  • 27
  • 40
0

Is it possible the TZ environment variable is set for your user? TZ will override /etc/localtime with a different timezone. Run "echo $TZ"

mfarver
  • 2,576
  • 13
  • 16
-2

I ended up synching the troubled machine with another machine every minute, just using simple ntpdate command run from a script invoked via crontab every minute.

FatherFigure
  • 285
  • 1
  • 2
  • 14