Sys clock is off by 7 hours and cannot be set.

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
dmongeon

Sys clock is off by 7 hours and cannot be set.

Post by dmongeon »

I a total newbie. I had all kinds of trouble installing mint 17 cinnamon but finally got it by removing one of the 4 primary partitions. Even though it shows the correct location on the map the time is 7 hours earlier than actual time. When I try to change it it resets itself every second. I tried setting network time to off and on (reboot in between) neither helped. I tried changing "UTC=" in the file /etc/default/rcS to "yes" and "no" (with reboots in between) - still didn't help. Short of saying that I live in Africa I don't know what else to try.

Anyone have any ideas?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18211
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Sys clock is off by 7 hours and cannot be set.

Post by karlchen »

Hello, dmongeon.

The parameter UTC=yes (default) or UTC=no is somewhat unrelated to the time which Linux Mint will display.
UTC=yes means: Set the hardware clock to UTC (Greenwich meantime), but display local time.
UTC=no means: Set the hardware clock to local time and display local time.
The second setting is often used on machines where you dual boot Linux and Windows, because Windows assumes the hardware clock has been set to local time.

About network time:

I always select my timezone Germany/Berlin including dailight saving time - yours will of course be different. I always activate time synchronization with the internet time server. And it works perfectly here.
As soon as network-manager has established a connection to the internet, actually to my router and the router is connected to my internet provider, it will launch ntpdate-debian and fetch the correct time and synchronize it with my local system time.

So switching this mechanism off is more likely to make your system time be different from the correct time.
Unless ... unless ntpdate-debian cannot connect any time server or unless it has been configured to ask for an incorrect timezone.

This is my config file for ntpdate

Code: Select all

$ cat /etc/default/ntpdate
# The settings in this file are used by the program ntpdate-debian, but not
# by the upstream program ntpdate.

# Set to "yes" to take the server list from /etc/ntp.conf, from package ntp,
# so you only have to keep it in one place.
NTPDATE_USE_NTP_CONF=yes

# List of NTP servers to use  (Separate multiple servers with spaces.)
# Not used if NTPDATE_USE_NTP_CONF is yes.
NTPSERVERS="ntp.pool.org ntp.ubuntu.com"

# Additional options to pass to ntpdate
NTPOPTIONS=""
Basically it should work anywhere in the world.

You might open a terminal window and execute this commandline

Code: Select all

sudo ntpdate-debian
It will prompt for your password.
The output should look similar to this:

Code: Select all

$ sudo ntpdate-debian 
[sudo] password for karl: 
 1 Oct 00:05:06 ntpdate[5616]: adjust time server 91.189.94.4 offset 0.007246 sec
karl@unimatrix0 ~ $
ntpdate has contacted the time server 91.189.94.4 and corrected my system time by the fraction of a second.

Note:

On a Linux workstation depending on ntpdate to keep the system time in sync is totally sufficient. Lots of users start to fiddle around with the ntp daemon programme ntpd instead. Configuring ntpd correctly can be tricky. ntpd usually only makes sense on server machines.
The symptoms which you describe make me wonder whether you have tried configuring ntpd and misconfigured it perhaps.
Unless you have a really good reason to fiddle around with it, get rid of it and use ntpdate instead. It should come-pre-installed on LM17.

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
dmongeon

Re: Sys clock is off by 7 hours and cannot be set.

Post by dmongeon »

karlchen wrote: Note:
On a Linux workstation depending on ntpdate to keep the system time in sync is totally sufficient. Lots of users start to fiddle around with the ntp daemon programme ntpd instead. Configuring ntpd correctly can be tricky. ntpd usually only makes sense on server machines.
The symptoms which you describe make me wonder whether you have tried configuring ntpd and misconfigured it perhaps.
Unless you have a really good reason to fiddle around with it, get rid of it and use ntpdate instead. It should come-pre-installed on LM17.
Hi and thanks for the quick response!
First I would like to give a little more info about my system (read an entry saying I should have). I have an HP laptop with an intel Core i7-2670QM CPU @ 2.2GHz x 4, 8GB Ram, with windows 7 home along side of Linux Mint 17 Cinnamon 64-bit Version 2.2.13. The partition I created for Linux in 300 GB.

I got the info on the rcS file from the following link:
http://community.linuxmint.com/tutorial/view/275
I know I don't have the Debian version but figured I would give it a try. Took me a while to figure out that I have the "Nemo" file manager and that is why I didn't get anything when typed the lines verbatum. I put the file back exactly as I had found it and figured it was time to ask for help. I did not mess with ntpd.

I just tried to run ntpdate as you suggested and this was the system response:

dmongeon@dmongeon-HP-Pavilion-dv7-Notebook-PC ~ $ sudo ntpdate-debian
[sudo] password for dmongeon:
Error resolving ntp.ubuntu.com: Name or service not known (-2)
30 Sep 23:48:19 ntpdate[3116]: Can't find host ntp.ubuntu.com: Name or service not known (-2)
30 Sep 23:48:19 ntpdate[3116]: no servers can be used, exiting

Any clue as to why I can't run this?

By the way, /etc/ntp.conf is not there...
Is that the file you were refering to when you said "my config file"?
Last edited by dmongeon on Wed Oct 01, 2014 11:28 am, edited 1 time in total.
User avatar
karlchen
Level 23
Level 23
Posts: 18211
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Sys clock is off by 7 hours and cannot be set.

Post by karlchen »

Hello, dmongeon.

As you are dual-booting with Windows, changing UTC=yes to UTC=no in the file /etc/default/rcS will be the right thing to do. This way Linux Mint and Windows will agree that the hardware clock is set to local time and act accordingly both. - The file /etc/default/rcS will only be read on reboot. So you have to reboot Linux Mint to see the effect.

About the error messages returned by the comand ntpdate:

Code: Select all

 Can't find host ntp.ubuntu.com: Name or service not known
This strongly suggests you have got a problem with your network setup.
Either when you ran the command you did not have a network connection at all.
Or if you were connected to the internet at that point in time, then you have got a problem with your DNS configuration.

Can you ping google.com e.g. successfully?

Code: Select all

ping -c 5 google.com
Should return no error, because google.com is hardly ever offline.
What does the command

Code: Select all

ifconfig
display?

Are you connected to the internet all the time at all? I ask, because I know that what seems normal here in Europe is not necessarily possible in all places in Africa: being online all the time.

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
dmongeon

Re: Sys clock is off by 7 hours and cannot be set.

Post by dmongeon »

From my rcS file:

# assume that the BIOS clock is set to UTC time (recommended)
UTC=no

This is the way it was originally. I have not changed it. I have also tried it with UTC=yes (with a reboot after the change) and both show the tray clock 7 hours earlier.

Forgive me if I made it sound like I was in Africa. I am in Arizona, USA (I had said that I would have to set the clock to Africa for the clock to display the correct time).

I am at work where they have a fire wall and proxy server. I have set up firefox to the correct proxy server and I am able to surf. However I cannot ping google. Here is what I get.

dmongeon@dmongeon-HP-Pavilion-dv7-Notebook-PC ~ $ ping -c 5 google.com
ping: unknown host google.com
Is there a way to use the proxy server when in terminal? Otherwise I guess I'll have to wait until I get home (pity - 80% of my job is down time - perfect time for learning Linux).

I just realized something... My time zone is UTC-7 so somehow linux is treating my system time as UTC time and subtracting 7 hours from it.

I tried to run ifconfig but when I type it (Alt-f2 then typing ifconfig) and hit enter nothing happens. I ran into this when I tried to run "gksu nautilus" because my file manager was nemo and not nautilus. Is there something special I need to do? it's acting like the command doesn't exist.
User avatar
karlchen
Level 23
Level 23
Posts: 18211
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Sys clock is off by 7 hours and cannot be set.

Post by karlchen »

Hello, dmongeon.

I see. Misunderstandings about almost any relevant details in this case.

One thing is for sure and correct (UTC=no):

Windows and Linux Mint should agree on how to handle the hardware clock. Else you will see differences in the displayed system time which will be the difference between UTC (Greenwich meantime) and your local time (UTC - 7).
As it is unlikely that a company will configure their Windows machines to follow Linux rules, the Mint installer was correct to conclude it should put UTC=no in the file /etc/default/rcS.


About DNS, NTP and the proxy:

So most of the time you are behind a company proxy. - Good. The same is true for my company notebook.
You have configured your Firefox accordingly and can surf the web. - Great. This means you should be able to tell how to connect to the internet through this company proxy. You will need these details.

Neither ping packets, nor ntp queries will be forwarded through a proxy to the internet by default.
As a consequence, you cannot ping google.com through a proxy. - Neither can I when I am in the office.

You cannot query ntp.ubuntu.com for the correct time when you are behind the proxy. - Neither can my machine when it is behind the company proxy.
As a consequence I had to put 2 entries in the file /etc/default/ntpdate. Parameter NTPSERVERS.
In fact I put the local IP address of a Windows domain server there plus ntp.ubuntu.com.

Code: Select all

NTPSERVERS="11.12.13.14 ntp.ubuntu.com"
The IP 11.12.13.14 points to our Windows domain server which serves as a local time server as well. => You will have to find out the IP of the local time server in your company network. This may be a Windows domain server. This might be a Linux server. Ask your friendly IT guys. They will know.

The local server IP will be used by ntpdate when you are inside the company network successfully and the system time will be synchronized.
At home ntpdate will log a warning about the local IP because it is not reachable, proceed to ntp.ubuntu.com and get the right time from ntp.ubuntu.com.


About the proxy server itself:

You have configured Firefox to use your company proxy. Fine. Downside: only Firefox knows and uses this information.
In addition you will have to use Network Settings and configure the same proxy settings systemwide so that all programmes that access the local network and the internet will use the correct proxy settings.
So far so good. Now there is some good news and some bad ones.

Good news first:
Configuring systemwide proxy settings works fine on genuine Ubuntu 14.0.4.1 through its (Gnome) Network Settings dialogues.

Bad news next:
Linux Mint 17 Network Settings dialogues are a bit different form the genuine Ubuntu dialogues. And I am not using LM17 on the company notebook.
So what I see will not be exactly the same that you see.

Not all is lost:
In the end the configuration files for proxy settings are the same on Linux Mint 17 and Ubuntu 14.04.1. So in the worst case I can explain which files are affected and what they have to look like. In this case you will have to enter the details using your favourite text editor with root privileges. But this works.
Another programme that can be used to achieve the goal is dconf-editor. I think you have to install it from the official Ubuntu repositories first, because it will not be present on LM 17 by default.

I assume all this reads a bit confusing and not to encouraging. Yet, nonetheless no voodoo magic will be needed. It is just not really convenient. - The network configuration leaves some room for improvement, provided the target is making it as convenient as the network configuration on Windows 7 e.g.

Oh, yes, and of course, at home, you will have to disable the proxy settings. (Disable, not delete)

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
dmongeon

Re: Sys clock is off by 7 hours and cannot be set.

Post by dmongeon »

Your answers are not confusing and not discouraging. I am a pretty quick study as I work with computers (although the linux machines have always baffled me - fairly new to this field. This is why I am learning linux).

It'll take some work on my part to find the address of our local domain server because IT isn't on site and it is a nightmare to get ahold of them.

I posted a part of me question on the networking page since I thought that's where it should go (sorry if I should have kept it all here). http://forums.linuxmint.com/viewtopic.p ... 7&t=175239

What is the name of the configuration file/s for proxy settings and where is it located? What do I add to the file to let the system know where to find the proxy automatic configure script?

Again, Thanks for your help - I'm learning alot.
User avatar
karlchen
Level 23
Level 23
Posts: 18211
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Sys clock is off by 7 hours and cannot be set.

Post by karlchen »

Hello, dmongeon.

OK, so here I am back, on my office notebook, running Ubuntu 14.04.1 x64, which corresponds to Linux Mint 17 x64.

(1) Basic Proxy Configuration:

System Settings => Network => Network Proxy.

There will be 3 proxy methods: Manual, Automatic, None.
None means "Do not use any proxy". - The good thing about "None" is, it will not throw away a proxy configuration, but merely not use it.

Manual proxy configuration

Image
(Manual proxy configuration - Click the image to enlarge. Press <alt><cursor left> to return here)
The values which have been entered are only examples, no real username, no real password, no real servername, the port numbers may be different, too.
So in case you choose to configure your proxy manually, you will have to replace everything by the appropriate values.

As you mentioned as proxy configuration file which you used in Firefox, you may prefer the automatic proxy configuration below.

Automatic proxy configuration

Image
(Automatic proxy configuration - Click the image to enlarge. Press <alt><cursor left> to return here)
The address to be entered in the field "Configuration URL" will be the same that you used in Firefox and it should point to the proxy server configuration file.
Again displayed values are examples only and you will have to replace them by the appropriate real values.


Proxy configuration in dconf-editor

Image
(Proxy configuration in dconf-editor - Click the image to enlarge. Press <alt><cursor left> to return here)
Everything which you configure in the Network dialogues can be viewed, modified, enhanced, deleted with the help of dconf-editor.
Inside dconf-editor navigate to system => proxy.
Using dconf-editor to fine-tune the proxy settings can be handy or simply necessary because dconf-editor will grant you access to details which cannot be accessed in the Network dialogue.
E.g. if you entered the proxy autoconfig URL, you will not be able to add logon credentials for your proxy in the Network dialogue.
In case your proxy requires username and password, then you will be able to enter them in dconf-editor.


(2.) Adding manual proxy details to user root's profile (for software management):

I may be doing something incorrectly or I may be missing an important step, yet: Having performed the proxy configuration as explained works fine. Yet, the Software Management will do quite a few steps with root privileges. But no proxy settings will be present in root's profile after the "(1) Basic proxy configuration".

Here is how to work around it. Though you may suspect so, let me confirm: the next steps all must be run under the root account. So it is "sudo" time. :wink:

File /etc/apt/apt.conf

Will be used by all apt-related commands, no matter whether you run them interactively or a GUI programme executes them.
If the file does not exist, create it

Code: Select all

sudo gedit /etc/apt/apt.conf
Content:

Code: Select all

Acquire::http::proxy "http://karl:password@proxyservername:3128/";
Acquire::https::proxy "https://karl:password@proxyservername:3128/";
Acquire::ftp::proxy "ftp://karl:password@proxyservername:3128/";
Reminds a bit of the manual proxy settings. - Sorry no idea whether it will be possible to refer to the proxy autoconfig URL here in some way instead.

Note:
Create a backup copy of this file. Reason: At least here , resetting the proxy to none in the Network dialogue will erase the content of this file. (It is the only collateral damage of switching proxy usage off.) So when I need it I can restore the backup copy instead of typing everything again from the scratch.


File /root/.synaptic/synaptic.conf

mintupdate internally calls synaptic. and synaptic uses its own configuration file. And therefore needs to learn about the proxy, too. . Moreover I frequently use Synaptic interactively to install software.
If the file does not exist, create it

Code: Select all

sudo gedit /root/.synaptic/synaptic.conf
You may also create it by launching Synaptic with root privileges once.
Content:
Do not bother to check or modify the other lines manually, the relevant entries with respect to proxy usage are the ones after the [...omitted ...] line:

Code: Select all

Synaptic "" {
  ViewMode "1";
  showWelcomeDialog "0";
  ShowAllPkgInfoInMain "false";
  AskRelated "true";
  OneClickOnStatusActions "false";
  delAction "3";
  upgradeType "1";
  update "" {
    type "0";
    last "1412236646";
  };
  [... omitted a lot of lines which are of no concern here ...]
  useProxy "1";
  httpProxy "proxyservername";
  httpProxyPort "3128";
  ftpProxy "proxyservername";
  ftpProxyPort "3128";
  noProxy "localhost,127.0.0.1";
  httpProxyUser "karl";
  httpProxyPass "password";
};
I am not quite sure whether the problem exists on Mint 17 as well, but here on Ubuntu 14.04, you can enter the proxy details in the Synaptic GUI. What you cannot do is entering the needed proxy credentials. So I had to use gedit for this purpose.

Once everything has been setup, I would recommend rebooting, though in fact it should not be necessary.
HTH. And do not hesitate to ask back in case anything has been explained in an unclear way or not correctly.

Cheers,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
dmongeon

Re: Sys clock is off by 7 hours and cannot be set.

Post by dmongeon »

Well, I have some good news and some bad news...

I had installed LM17 when I was at work and had not started the OS at home. Last night I brought it home and messed around a bit. When I looked down at the clock I was suprised by an accurate clock. I am writing this from work again and the clock is still correct. I guess all it needed was to get sync'd once.

While I was at home I loaded all the updates and loaded Calibre so I could read my linux book while I tried things out in the OS.

I just tried to install another program (through the proxy) and I get the following error:
----------------------------------------------------------
W: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
Could not resolve 'archive.ubuntu.com'


W: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/u ... _amd64.deb
Could not resolve 'archive.ubuntu.com'
--------------------------------------------------------
I tried to set up the automatic proxy setting through menu-system settings-networking-selecting network proxy from the left window- and entering the configuration URL. With the above error it looks like this didn't work.

If I open a terminal and type "ifconfig" I get the following (don't know if this will help or not):
---------------------------------------------------------
eth0 Link encap:Ethernet HWaddr 08:2e:5f:85:6b:ed
inet addr:192.27.104.141 Bcast:192.27.104.191 Mask:255.255.255.192
inet6 addr: fe80::a2e:5fff:fe85:6bed/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18708 errors:0 dropped:0 overruns:0 frame:0
TX packets:12114 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11129398 (11.1 MB) TX bytes:1634307 (1.6 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:3293 errors:0 dropped:0 overruns:0 frame:0
TX packets:3293 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:327666 (327.6 KB) TX bytes:327666 (327.6 KB)

wlan0 Link encap:Ethernet HWaddr 4c:80:93:97:f4:7d
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
-----------------------------------------------------------

I couldn,t find dconf-editor on my machine so I'll have to wait until I get home to try it.

I can't use the manual proxy setting method because there is no way for me to get the actual proxy settings.
User avatar
karlchen
Level 23
Level 23
Posts: 18211
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Sys clock is off by 7 hours and cannot be set.

Post by karlchen »

Hello, dmongeon.

The error message

Code: Select all

Could not resolve 'archive.ubuntu.com'
might also suggest that there is problem with your DNS setup when you are in the company network behind the company proxy.
(This hypothesis is inconflict with the fact the you can surf the web using Firefox, because this will only work, too, provided name resolution works correctly.)

What happens if you execute this command in a terminal window, when you are inside your company network:

Code: Select all

nslookup archive.ubuntu.com
(Do not add any http or www or any other additonal stuff to the commandline. The commandline is correct as it is.)

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
Locked

Return to “Cinnamon”