故障现象

  1. 系统日志时间晚了整整8个小时,比如现在是中午12点,日志时间为凌晨4点
  2. date命令报错(Local time zone must be set--see zic manual page)

解决方案(失败)

  1. 修改/etc/profile

    export TZ='Asia/Shanghai'

    无效,date命令显示正常,但是放在脚本中的date命令依然报错,并且日志时间依然延后8小时

  2. tzselect配置
    #tzselect
    Please identify a location so that time zone rules can be set correctly.
    Please select a continent or ocean.
    ) Africa
    ) Americas
    ) Antarctica
    ) Arctic Ocean
    ) Asia
    ) Atlantic Ocean
    ) Australia
    ) Europe
    ) Indian Ocean
    ) Pacific Ocean
    ) none - I want to specify the time zone using the Posix TZ format.
    #?
    Please select a country.
    ) Afghanistan ) Israel ) Palestine
    ) Armenia ) Japan ) Philippines
    ) Azerbaijan ) Jordan ) Qatar
    ) Bahrain ) Kazakhstan ) Russia
    ) Bangladesh ) Korea (North) ) Saudi Arabia
    ) Bhutan ) Korea (South) ) Singapore
    ) Brunei ) Kuwait ) Sri Lanka
    ) Cambodia ) Kyrgyzstan ) Syria
    ) China ) Laos ) Taiwan
    ) Cyprus ) Lebanon ) Tajikistan
    ) East Timor ) Macau ) Thailand
    ) Georgia ) Malaysia ) Turkmenistan
    ) Hong Kong ) Mongolia ) United Arab Emirates
    ) India ) Myanmar (Burma) ) Uzbekistan
    ) Indonesia ) Nepal ) Vietnam
    ) Iran ) Oman ) Yemen
    ) Iraq ) Pakistan
    #?
    Please select one of the following time zone regions.
    ) Beijing Time
    ) Xinjiang Time
    #? The following information has been given: China
    Beijing Time Therefore TZ='Asia/Shanghai' will be used.
    Local time is now: Wed Nov :: CST .
    Universal Time is now: Wed Nov :: UTC .
    Is the above information OK?
    ) Yes
    ) No
    #? You can make this change permanent for yourself by appending the line
    TZ='Asia/Shanghai'; export TZ
    to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you
    can use the /usr/bin/tzselect command in shell scripts:
    Asia/Shanghai
    [root@compute--: 2019年 11月 27日 星期三 :: Local time zone must be set--see zic manual page /root ]
    #date
    2019年 11月 27日 星期三 :: Local time zone must be set--see zic manual page

    无效

  3. /etc/localtime
    rm -f /etc/localtime
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

    依然没有什么鸟用

最后网上看了一篇文章大概是说可能是升级libc.so.6导致,尝试以下方法总算成功了

解决方案(成功!)

#ll /usr/local/glibc-2.14/etc/
总用量
-rw-r--r-- root root 7月 : ld.so.cache
lrwxrwxrwx root root 7月 : localtime -> ../share/zoneinfo/Factory
-rw-r--r-- root root 7月 : rpc #cd /usr/local/glibc-2.14/etc/ #rm localtime
rm:是否删除符号链接 "localtime"?y #ln -s /usr/local/glibc-2.14/share/zoneinfo/Asia/Shanghai localtime
05-12 11:23