Вы находитесь на странице: 1из 4

https://www.youtube.com/watch?

v=oMnkXRdswO4

https://help.ubuntu.com/community/UbuntuTime#Multiple_Boot_Systems_Time_Conflicts

Multiple Boot Systems Time Conflicts

Operating systems store and retrieve the time in the hardware clock located on your
motherboard so that it can keep
track of the time even when the system does not have power.
Most operating systems (Linux/Unix/Mac) store the time on the hardware clock as
UTC by default,
though some systems (notably Microsoft Windows) store the time on the hardware
clock as the 'local' time.
This causes problems in a dual boot system if both systems view the hardware clock
differently.

The advantage of having the hardware clock as UTC is that you don't need to change
the hardware clock when moving
between timezones or when Daylight Savings Time (DST) begins or ends as UTC does
not have DST or timezone offsets.

Changing Linux to use local time is easier and more reliable than changing Windows
to use UTC, so dual-boot
Linux/Windows systems tend to use local time.

Since Intrepid (8.10), UTC=yes is default.

Make Windows use UTC

Note: This method was not initially supported on Windows Vista and Server 2008, but
came back with Vista SP2,
Windows 7, Server 2008 R2 and Windows 8/8.1.

To make MS Windows calculate the time from the hardware clock as UTC.

Create a file named WindowsTimeFixUTC.reg with the following contents and then
double click on it to merge
the contents with the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001

Note: Windows Time service will still write local time to the RTC regardless of the
registry setting above on shutdown,
so it is handy to disable Windows Time service with this command (if time sync is
still required while in Windows
use any third-party time sync solution):

sc config w32time start= disabled

Reversing the change

You can create a file with the following contents and then double-click it to merge
in the original changes, as above:

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=-

If Windows Time service was disabled, enable it again with the command:

sc config w32time start= demand

Make Linux use 'Local' time

To tell your Ubuntu system that the hardware clock is set to 'local' time:

Pre-Ubuntu 15.04 systems (e.g. Ubuntu 14.04 LTS):

edit /etc/default/rcS
add or change the following section

# Set UTC=yes if your hardware clock is set to UTC (GMT)


UTC=no

Ubuntu 15.04 systems and above (e.g. Ubuntu 16.04 LTS):

open a terminal and execute the following command

timedatectl set-local-rtc 1

Troubleshooting

Is NTP installed?

Run dpkg-query --list ntp\* and look for ntp-simple (pre 7.04) or ntp. The ntpdate
and ntp-doc packages may also be useful.

Which configuration file is it using?

By default NTP uses /etc/ntp.conf. If /etc/ntp.conf.dhcp exists then the NTP daemon
assumes you're using DHCP
to redefine the NTP settings and it uses that file instead.

How do I configure NTP to use DHCP

Your DHCP server must be configured to supply NTP servers (man dhcpd.conf may be
helpful).

Your client must be configured to use the supplied NTP servers. To do this, add
ntp-servers to the request
(or even require) line in /etc/dhcp3/dhclient.conf. You may wish to use the
default and prepend features as well
to provide default/additional NTP servers. Please see man dhclient.conf and man
dhcp-options for details.

Is NTP running?

NTP most commonly 'fails' if it cannot resolve the servers in its configuration
file at startup (this can happen
if DNS isn't available during boot). Also, if NTP is unable to keep the local clock
reasonably accurate it gives up
and terminates (see below).
Try sudo /etc/init.d/ntp status to check if NTP is running, and sudo
/etc/init.d/ntp restart to restart it if necessary.

I have various systems on unreliable networks so I use a simple script to bounce


NTP if needed:

$ cat /etc/cron.hourly/BOUNCE-NTP
#!/bin/sh

/usr/bin/ntpq -np | /bin/grep '^\*' > /dev/null || ( /usr/bin/ntpq -np ;


/etc/init.d/ntp restart )

Which servers are you using?

Run grep ^server /etc/ntp.conf or grep ^server /etc/ntp.conf.dhcp to figure out


which servers you're trying to use

If your network or ISP have an NTP server they should be listed here. Failing that,
try ntp.ubuntu.com and/or the
NTP pool servers (http://www.pool.ntp.org/). 3 or 4 servers is plenty, and don't
use a server without permission
(see http://en.wikipedia.org/wiki/NTP_vandalism).

Can these servers be resolved?

If host $servername fails then you may have DNS issues that need to be fixed
($servername is the name of a server listed
in your configuration file, see above).

Can these servers be reached?

If ntptrace $servername fails then you may have routing/firewall issues that need
to be fixed ($servername is the name of
a server listed in your configuration file, see above). NTP uses UDP port 123,
make sure these packets can are properly
NAT-ed through your gateway if necessary.

What's NTP up to?

ntpq --numeric --peers

--numeric removes the DNS lookups. You can leave it off, but don't be surprised if
the resolved names don't match names
in the ntp.conf file.

Ideally you want a * and a few +'s in the fist column and a reach of 377
(see http://www.ntp.org/ntpfaq/NTP-s-trouble.htm#Q-MON-REACH)

delay is in milliseconds. It should be < 1 for local network servers, < 10 for ISP
servers over DSL and
ideally < 100 for wireless. offset is in milliseconds and is the current best guess
of the time difference
between your system and the server. The smaller the better! jitter is an estimate
the the local clock frequency error.
The smaller the better. If it's consistently high then your system may be drifting
(see below)

Why does NTP keep resetting/failing?


NTP attempts to fix your local clock to keep accurate time. If your local clock
drifts too fast (usually HW problems
or IRQ lockups or somesuch) then NTP either keeps resetting your clock or gives up
and terminates.
Fix the drift problem and NTP will behave.

Вам также может понравиться