LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-17-2015, 07:00 AM   #1
vjlxmi
Member
 
Registered: Aug 2014
Posts: 38

Rep: Reputation: Disabled
Question how to set the time of the virtual machine same as the host machine


is it possible to set the time of the virtual machine according to the host system on which it is installed????
i tried to do it by enabling the "hardware clock in UTC time" in the Motherboard tab.. but it is giving me the time in UTC format.. but i want it in IST format.. can anyone help me in this.



Thanks in Advance
 
Old 01-17-2015, 07:25 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You should set TZ environmental variabe in /etc/profile.

Try running this command:

Code:
TZ="Asia/Kolkata" date
in command line. See if it shows correct time. If so then set:

export TZ="Asia/Kolkata"

in your /etc/profile file.
 
Old 01-18-2015, 07:48 AM   #3
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,019

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
If the host is a Linux system and runs an ntp service (most distros do by default) you can configure the host as ntp server for the guest.

Assuming that you are using virtual box and a NAT type network adapter for the virtual system the guest will see the host under 10.0.2.2.

In /etc/ntp.conf on the guest system you'll find the section with the servers. I.e. on my machine that looks like below
Code:
# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
Make a backup copy of the file:
Code:
cp /etc.ntp.conf /etc/ntp.conf.bck
and then change it into
Code:
# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
server 10.0.2.2 iburst
The restart ntp (how to do that depends on your init system, worst case just restart the guest system).
Now the two machines should automatically synchronize, provided that the timezone is set correctly as described by veerain.

Last edited by joe_2000; 01-18-2015 at 07:50 AM.
 
Old 01-18-2015, 08:06 AM   #4
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,019

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
You can probably disregard my previous post. In fact I think virtualbox will synchronise guest and host for you by default...
 
Old 01-20-2015, 07:37 AM   #5
vjlxmi
Member
 
Registered: Aug 2014
Posts: 38

Original Poster
Rep: Reputation: Disabled
virtualbox is not syncing the time automatically.Is there any way to sync the time forcefully????
 
Old 01-20-2015, 12:47 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,636

Rep: Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652Reputation: 2652
well if you are running on MICROSOFT
the MS windows OS's can NOT use utc
they set the clock on the Motherboard to YOUR LOCAL TIME ZONE!!!
you must DISABLE UTC time on linux

and use the MICROSOFT way of doing things

PS
note
using the microsoft way might cause some "odd" things on the net
dealing with time
such as
a replay to one of your posts might be posted BEFORE YOUR POST

Last edited by John VV; 01-20-2015 at 12:49 PM.
 
Old 01-20-2015, 02:45 PM   #7
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,019

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by vjlxmi View Post
virtualbox is not syncing the time automatically.Is there any way to sync the time forcefully????
Not sure if we are talking about the same thing here. When I said syncing I meant "making sure that the minutes and seconds fit together". The hours obviously depend on the timezone.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Iptables: route web traffic of virtual machine through local proxy of host machine lola.hipf Linux - Networking 1 10-26-2014 07:09 PM
file sharing between a virtual machine and the host machine okok Linux - Networking 3 06-21-2013 12:42 AM
Accessing files available within a virtual machine from the host machine ed.kumar Linux - Virtualization and Cloud 5 08-03-2011 03:25 PM
host machine virtual machine question kaplan71 Linux - General 2 03-31-2011 05:14 PM
How to configure the serial port of my virtual machine with host machine. akram Linux - Newbie 4 07-31-2009 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:22 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