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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
09-23-2017, 06:29 PM
|
#1
|
Senior Member
Registered: May 2007
Posts: 1,395
Rep:
|
What is wrong with this computer time + Debian 9?
This computer has Debian 9 running. For window manager, it has Mate installed, among others.
Why does it always shows date and time in a different timezone?
Why does it also does *not* accept that I change the clock? I changed the clocked with the root account, click "ok" to close the window with the changes, and it is ignored!
I have tried to change the settings with several usual methods, none of them worked:
- reboot and change in BIOS.
- change with a normal user that can do sudo
- change with root account
Even at the moment that I change the clock settings, it is ignored as if I did not even try.
More details will be given as you ask. I do not know much details about this computer.
|
|
|
09-23-2017, 08:12 PM
|
#2
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
try a logout and login again.
Depending on how things go - each user is allowed to have their own timezone determined when they log in.
Changing the systems desigation for time zone doesn't change the users designation - and that would occur when the user logs in. Thus a logout/login should get the new default.
|
|
|
09-23-2017, 08:18 PM
|
#3
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
I have done what you said more than one time, jpollard. And with root user too. Makes no difference.
I don't know what it is, but I imagine something installed forcing things. It discards everything I have used in computers my whole life.
/-:
|
|
|
09-23-2017, 08:32 PM
|
#4
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
The problem is that I do not know what to look for, nor where to look.
I have tried something that I did not do before: rebooted the computer, changed the clock in BIOS (which where a few hours ahead), removed the network cable, logged in as a normal user. The clock is correct! Logged out and in again with the network cable there, it did not change anymore. Maybe just after another reboot. But remember: it also will prevent changes after any user log in.
Is this situation a bit easier easy to help? (:
Last edited by dedec0; 09-23-2017 at 08:37 PM.
|
|
|
09-23-2017, 08:45 PM
|
#5
|
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 20,014
|
Quote:
Why does it always shows date and time in a different timezone?
|
Could you clarify what exactly you mean by this? Does it show different timezones for different users or does the timezone for an individual user change randomly?
What are the outputs of these two commands (depending on the distro, you may have to run one or more of them as root):
Be sure to surround any command output with "code" tags, which become available when you click the "Go Advanced" button at the bottom of the "compose post" window.
|
|
|
09-23-2017, 09:33 PM
|
#6
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
Quote:
Why does it always shows date and time in a different timezone?
|
When I log in with a graphical interface, the window manager (Mate) show the clock a few hours wrong. I can see it the right time, just a few hours wrong. This happened everytime I used it. The first time it happened differently was a few minutes ago, when I did a complete boot with no network access (literally, removed cable).
hwclock... I did not know that one. I will show you a bit more. Right now, I am accessing this machine with ssh. In my PS1, I have the time with seconds, user@machine and current folder shown, and the command on a separate line. Look what it showed:
Code:
22:19:19 [ 255] me@anotherComputer: ~ # this was the current time ~one hour ago,
# in my timezone and computer
$ ssh user@192.168.local.net
Debian GNU/Linux 9
user@192.168....'s password:
Linux debian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64
Debian 9 = Stretch
No mail.
Last login: Sat Sep 23 17:48:30 2017
19:00:59 [ 0] user@debian: ~ # should have been 23:00
$ date
Sat Sep 23 19:01:13 PDT 2017
19:01:13 [ 0] user@debian: ~
$ hwclock
-bash: hwclock: command not found
19:01:58 [ 1] user@debian: ~
$ su
Password:
19:02:18 [ 0] root@debian: /home/user
# hwclock
2017-09-23 19:06:14.697298-0700
19:03:15 [ 0] root@debian: /home/user
# exit
19:06:35 [ 0] user@debian: ~
$ date
Sat Sep 23 19:06:42 PDT 2017
19:06:42 [ 0] user@debian: ~
$
Is that 0700 a timezone? Due this fact, I have checked: the same user, logged in graphically, have the 19:2x clock shown. And when I click on the Mate clock, it shows the BR time (which is the one and only location I have for this user's settings) correct: 23:2x.
(just loose thought writing: What changed the hwclock again? I want it different. Or did I adjust it wrong? ...)
Last edited by dedec0; 09-23-2017 at 09:40 PM.
|
|
|
09-23-2017, 09:38 PM
|
#7
|
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 20,014
|
It's late here in EDT and I have to pack it in, but the -0700 would normally indicate the difference from Universal Mean Time (what used to be called Greenwich Mean time) represented by the PDT timezone.
-0400 is EDT. (-0500 is EST.)
There's a neat little command line program called tzselect that you can use to check your timezone setting. It needs to be run as root. It is likely already installed.
What does it tell you?
Last edited by frankbell; 09-23-2017 at 09:41 PM.
|
|
|
09-23-2017, 09:47 PM
|
#8
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
Quote:
Originally Posted by frankbell
The -0700 would normally indicate the difference from Universal Mean Time (what used to be called Greenwich Mean time) represented by the PDT timezone.
-0400 is EDT.
|
-0400 is my timezone now, BRT (I think these are the letters I would choose). I am in Bra sil. I did not know date showed timezone with letters... should have been easy to learn - if I suspected it was there, I just passed my eyes through it without paying attention.
But why the computer seems locked to this strange (to me) timezone? Changing the hardware clock is useless while it has a network connection to correct it (probably using NFS?). I do not even know what to search for, without finding only results for things not my problem.
(imagining: services, daemons, ... ?)
Last edited by dedec0; 09-23-2017 at 09:54 PM.
|
|
|
09-23-2017, 10:30 PM
|
#9
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
A few findings...
'man hwclock':
- talks about /etc/adjtime, which has the 3rd line written UTC
- talks about tzset(3), which is a function (programming), but I found tzselect program!
'man tzselect' says:
"Note that tzselect will not actually change the timezone for you. Use 'dpkg-reconfigure tzdata' to achieve this."
Should I do that dpkg-r... command?
'man hwclock' also mentioned "ISA hardware clock". How can I find if my hardware has this kind of feature, or anything similar? A couple of days ago, I have read everything I could understand in the BIOS options of this computer. Nothing seemed to fit my problem of "OS with a different timezone", and I changed the clock there again, assuming it should be "my clock, in my timezone", as it was with all computers I used before (at least, or I could not tell).
|
|
|
09-24-2017, 12:23 AM
|
#10
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
Quote:
Originally Posted by dedec0
...
'man tzselect' says:
"Note that tzselect will not actually change the timezone for you. Use 'dpkg-reconfigure tzdata' to achieve this."
Should I do that dpkg-r... command?
...
|
I searched for dpkg-reconfigure tzdata and it brings a few good results. I only looked one: debian wiki /TimeZoneChanges. Great sentence in this part:
Quote:
Check Configured Timezone
To see or change what timezone your Debian system is configured for,
# dpkg-reconfigure tzdata
What does this do? It changes /etc/localtime. Background information follows.
|
So, can I say that /etc/localtime was the file I should have known before? With the command, I saw that the timezone for this computer was Los Angeles'. Now it is correct, and probably will not be wacky anymore.
Right? If there are no more comments or things I should know, the thread will be marked as solved.
|
|
|
09-24-2017, 09:07 AM
|
#11
|
Moderator
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
|
Quote:
Originally Posted by dedec0
So, can I say that /etc/localtime was the file I should have known before?
|
Yes, but in most cases /etc/localtime is not a file, but a symlink to one of the files in /usr/share/zoneinfo.
Depending on where you are in Brazil, it should be a link to either of the files Porto_Acre, Noronha, Sao_Paulo or Manaus in /usr/share/zoneinfo/America.
|
|
|
09-24-2017, 09:38 AM
|
#12
|
Senior Member
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
|
Hi Dedec0,
Although I am not a Debian user, your issue sounds like a typical case of a computer being incorrectly configured with respect to local time or UMT.
Basically, in linux, unless configured specifically otherwise, the linux system expects the computer's hardware clock to be interpreted as UMT. It then knows which time to display to the user depending on the time zone the user has configured.
So in a nutshell:
- Make sure your linux is configured properly to interpret your hardware clock. As mentioned above, it normally expects this to be UMT. It can be configured to interpret it as local time, but the appropriate command is required to do this (since this is not typical, I'll leave you to let us know if you need help with this function).
- Make sure your computer is properly configured with respect to its time zone. This is usually initially done at system install, but obviously can be changed if you travel. In Arch (the system I use), this is done on the command line, but Debian probably has a GUI tool to manage this.
Hope this helps - let us know if more assistance is needed.
Cheers !
Last edited by Rickkkk; 09-24-2017 at 09:40 AM.
|
|
|
09-24-2017, 09:59 AM
|
#13
|
LQ Veteran
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,866
|
Last edited by colorpurple21859; 09-24-2017 at 10:01 AM.
|
|
1 members found this post helpful.
|
09-24-2017, 10:52 AM
|
#14
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
I see you got better info.
As others have said, /etc/localtime should either contain the proper default local time, or be a symbolic link to the right one. I like the use of the symbolic link as the info in /usr/share/zoneinfo/... documents what timezone you have without having to decode the contents (it is a binary file).
|
|
|
09-24-2017, 11:03 AM
|
#15
|
Senior Member
Registered: May 2007
Posts: 1,395
Original Poster
Rep:
|
Exactly, TobiSGD. I have checked /usr/share/zoneinfo files yesterday and found symlinks to the files you mention. After doing that, I decided to change my timezone and ran:
Code:
# dpkg-reconfigure tzdata # see/change what TZ system is configured for
Current default time zone: 'America/Sao_Paulo'
Local time is now: Sun Sep 24 02:13:53 -03 2017.
Universal Time is now: Sun Sep 24 05:13:53 UTC 2017.
Right now I checked /etc/localtime, and it is also simply a symlink to the correct zoneinfo file, based on what dpkg-reconfigure did.
Note that I made a mistake in the posts above: my timezone is -3, not -4.
Rickkkk, thank you for all your comments. I have some doubts with them. First, I searched around a bit, but could not find a page with enough comments to what I want: configure this computer to use its hardware clock as localtime (for it is better); from the pages I have read (skimmed, some were too long), it can be a Debian configuration, a specific kernel configuration. May you help me doing that?
First good looking page I found was stack ov. /.../set-hwclock-to-utc-on-linux. The opposite wish, but that should be easy to change. It made me read 'man hwclock' more carefully for a few options. '/etc/sysconfig/clock' file does not exist here.
So, in the end I still have doubts. I want to: use computer's clock as localtime in all installed OSes, if it is not yet doing so; configure this Debian install to know that, and work according to that. Debian may change the hardware clock with NTP if it gets a bit wrong. All of this may involve global system settings, kernel settings or anything else I did not mention. I want to be sure that every possible detail is corret. May you help me here?
Right now, I ran the same commands frankbell asked above, and one more that I think can be useful to helpers now, with all I already did:
Code:
12:52:21 [ 0] root@debian: ~
# hwclock
2017-09-24 12:52:26.748578-0300
12:52:27 [ 0] root@debian: ~
# date
Sun Sep 24 12:52:32 -03 2017
12:52:32 [ 0] root@debian: ~
# ls -l /etc/localtime
0 lrwxrwxrwx 1 root root 37 Sep 24 02:13 /etc/localtime -> /usr/share/zoneinfo/America/Sao_Paulo
Did you note the PS1 time here is correct localtime now?? :D
|
|
|
All times are GMT -5. The time now is 03:50 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|