Debian buster show wrong date format

Kernels & Hardware, configuring network, installing services

Debian buster show wrong date format

Postby kdillen » 2019-07-30 09:03

Hello All,

I have done a few upgrades from Stretch to Buster and also a clean install of Buster and I run into an annoying issue with the date command:

When executed on Buster I have the following output:

Code: Select all
 root  /  etc  default  date
Tue 30 Jul 2019 11:29:54 AM CEST
 root  /  etc  default 


Expected output:

Code: Select all
 root  ~  date
Tue Jul 30 11:30:36 CEST 2019
 root  ~ 


This happen for both the upgrades and the clean install. And yes my timezone should be configured correctly.

Code: Select all
 root  ~  timedatectl status
               Local time: Tue 2019-07-30 11:49:09 CEST
           Universal time: Tue 2019-07-30 09:49:09 UTC
                 RTC time: Tue 2019-07-30 09:49:10
                Time zone: Europe/Brussels (CEST, +0200)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no
 root  ~ 


Any idea how to get the same output from the date command in buster like in stretch ?

NOTE: dmesg / rsyslog etc.. all show the good output. Only on command line the `date` command give's the bad layout.

Thanks in advance.
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby L_V » 2019-07-30 10:01

For investigation only:
Code: Select all
apt policy coreutils

+ what are those strange characters in your prompt ?
Code: Select all
 root  ~ 
(I see two squares) +
Code: Select all
echo $PS1
L_V
 
Posts: 1035
Joined: 2007-03-19 09:04

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 11:08

Result:

Code: Select all
root  ~  apt policy coreutils
coreutils:
  Installed: 8.30-3
  Candidate: 8.30-3
  Version table:
 *** 8.30-3 500
        500 http://ftp.be.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status
 root  ~ 


Note the special characters come from powerline. Which I also use on stretch and other linux distro's
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby L_V » 2019-07-30 11:23

For investigation
Code: Select all
# dpkg-reconfigure tzdata
Last edited by L_V on 2019-07-30 11:32, edited 1 time in total.
L_V
 
Posts: 1035
Joined: 2007-03-19 09:04

Re: Debian buster show wrong date format

Postby Soul Singin' » 2019-07-30 11:31

Code: Select all
# apt-get install locales
# dpkg-reconfigure locales

The second of those commands will help you select your preference.

Here are the selected locales on my machine:
Code: Select all
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


Here's the list of available locales:
Code: Select all
$ locale -a
C
C.UTF-8
en_US.utf8
POSIX


And here are the date formats:
Code: Select all
$ date
Tue 30 Jul 2019 08:11:40 AM EDT
$
$ export LC_TIME="C.UTF-8"
$ date
Tue Jul 30 08:11:49 EDT 2019
$
$ export LC_TIME="en_US.utf8"
$ date
Tue 30 Jul 2019 08:11:56 AM EDT
User avatar
Soul Singin'
 
Posts: 1542
Joined: 2008-12-21 07:02

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 12:35

L_V wrote:For investigation
Code: Select all
# dpkg-reconfigure tzdata


Result:

Code: Select all
root  ~  dpkg-reconfigure tzdata

Current default time zone: 'Europe/Brussels'
Local time is now:      Tue Jul 30 15:21:44 CEST 2019.
Universal Time is now:  Tue Jul 30 13:21:44 UTC 2019.

root  ~  date
Tue 30 Jul 2019 03:22:21 PM CEST
root  ~ 


stays the same.

Note the strange thing it is happened on the updated systems from stretch to buster and on a clean install.
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 12:36

Soul Singin' wrote:
Code: Select all
# apt-get install locales
# dpkg-reconfigure locales

The second of those commands will help you select your preference.

Here are the selected locales on my machine:
Code: Select all
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


Here's the list of available locales:
Code: Select all
$ locale -a
C
C.UTF-8
en_US.utf8
POSIX


And here are the date formats:
Code: Select all
$ date
Tue 30 Jul 2019 08:11:40 AM EDT
$
$ export LC_TIME="C.UTF-8"
$ date
Tue Jul 30 08:11:49 EDT 2019
$
$ export LC_TIME="en_US.utf8"
$ date
Tue 30 Jul 2019 08:11:56 AM EDT


Tried all these steps the result stays the same for me

I also tried to change to another timezone file from Europe/Brussels to Europe/Amsterdam it stay the same.

And the output from locale is the same on Stretch as on Buster. But in Stretch it works perfectly.
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby L_V » 2019-07-30 12:43

No reason that locales could disappear during an update.
and this ?
Code: Select all
printenv | grep LANG
L_V
 
Posts: 1035
Joined: 2007-03-19 09:04

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 12:46

L_V wrote:No reason that locales could disappear during an update.
and this ?
Code: Select all
printenv | grep LANG


Results from Buster:

Code: Select all
root  ~  cat /etc/debian_version
10.0
root  ~  printenv | grep LANG
LANG=en_US.UTF-8
root  ~  date
Tue 30 Jul 2019 03:33:52 PM CEST
root  ~ 


Results from stretch:

Code: Select all
root  ~  cat /etc/debian_version
9.9
root  ~  printenv | grep LANG
LANG=en_US.UTF-8
LANGUAGE=en_US:en
root  ~  date
Tue Jul 30 15:35:03 CEST 2019
root  ~ 
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby L_V » 2019-07-30 12:49

Then your environement is not correct, and this
Code: Select all
ls -l /etc/localtime

If not OK, try this
Code: Select all
rm /etc/localtime
ln -s /etc/localtime /usr/share/zoneinfo/Europe/Brussels
L_V
 
Posts: 1035
Joined: 2007-03-19 09:04

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 12:58

L_V wrote:Then your environement is not correct, and this
Code: Select all
ls -l /etc/localtime

If not OK, try this
Code: Select all
rm /etc/localtime
ln -s /etc/localtime /usr/share/zoneinfo/Europe/Brussels


Code: Select all
root  ~  ls -l /etc/localtime
lrwxrwxrwx 1 root root 35 Jul 30 15:27 /etc/localtime -> /usr/share/zoneinfo/Europe/Brussels
root  ~ 


As you notice there is no reason why it would not be correct. Everything is as it should be configured and the same as on stretch but in Buster is has strange results. Also as far as I can see in the log files is everything ok only the `date` command gives problems. But yeah some of my scripts depend on the correct date output format.


Example of logfile output:

Code: Select all
root  ~  cd /var/log
root  /  var  log  tail syslog
Jul 30 15:39:01 hostname systemd[1]: Starting Clean php session files...
Jul 30 15:39:01 hostname systemd[1]: phpsessionclean.service: Succeeded.
Jul 30 15:39:01 hostname systemd[1]: Started Clean php session files.
Jul 30 15:41:42 hostname systemd[1]: Starting Collect apt metrics for prometheus-node-exporter...
Jul 30 15:41:42 hostname systemd[1]: Starting Collect SMART metrics for prometheus-node-exporter...
Jul 30 15:41:42 hostname systemd[1]: prometheus-node-exporter-apt.service: Succeeded.
Jul 30 15:41:42 hostname systemd[1]: Started Collect apt metrics for prometheus-node-exporter.
Jul 30 15:41:43 hostname systemd[1]: prometheus-node-exporter-smartmon.service: Succeeded.
Jul 30 15:41:43 hostname systemd[1]: Started Collect SMART metrics for prometheus-node-exporter.
Jul 30 15:45:01 hostname CRON[8751]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
 root  /  var  log 
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 13:02

It does not seems to be an issue with coreutils neither

Code: Select all
 root  /  var  log  /upgrade/date
Tue 30 Jul 2019 03:49:35 PM CEST
root  /  var  log  /upgrade/date  --version
date (GNU coreutils) 8.26
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

root  /  var  log  date --version
date (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
root  /  var  log 


I copied the date command from stretch on an shared NFS and then used this on buster. With the same result.
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Re: Debian buster show wrong date format

Postby L_V » 2019-07-30 13:03

Try to add this in /etc/environment (or create if not exist).
Code: Select all
LC_TIME="fr_FR.UTF-8"

(and reboot for test / I think)
L_V
 
Posts: 1035
Joined: 2007-03-19 09:04

Re: Debian buster show wrong date format

Postby trinidad » 2019-07-30 13:08

You can't believe your eyes if your imagination is out of focus.
trinidad
 
Posts: 49
Joined: 2016-08-04 14:58

Re: Debian buster show wrong date format

Postby kdillen » 2019-07-30 13:11

L_V wrote:Try to add this in /etc/environment (or create if not exist).
Code: Select all
LC_TIME="fr_FR.UTF-8"

(and reboot for test / I think)


Reboot is not needed.

Some test results:

Code: Select all
 root  /  var  log  export LC_TIME="en_US.UTF-8"
root  /  var  log  date
Tue 30 Jul 2019 03:58:20 PM CEST
root  /  var  log  export LC_TIME="fr_FR.UTF-8"
-bash: warning: setlocale: LC_TIME: cannot change locale (fr_FR.UTF-8)
root  /  var  log  date
mardi 30 juillet 2019, 15:58:35 (UTC+0200)
root  /  var  log 


So it seems related to the locale settings. But then the big problem is to find one that works for Belgium and is in English

And why it used to work before with stretch and now suddenly not anymore.
kdillen
 
Posts: 11
Joined: 2019-07-30 08:33

Next

Return to System configuration

Who is online

Users browsing this forum: fender0107401 and 19 guests

fashionable