Debian

我無法設置基於 arm 的 Debian 日期和時間!

  • November 29, 2016

我有一個基於手臂的板(nanopi m1,類似覆盆子),我試圖更新日期和時間!我使用了我在網上看到的所有方法,但沒有成功!(實際上我的預設日期是 1970 年,但我更改了 timesyncd.confntp.conf並將伺服器設置為0-4.ir.pool.ntp.org iburst,我的日期更改為 2014 年!)

我該如何解決這個問題?

這是我的“ntp.conf”文件的內容:

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example

# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst
server 1.ir.pool.ntp.org
server 1.asia.pool.ntp.org
server 0.asia.pool.ntp.org

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

執行此命令後,我也收到此警告:

systemctl enable fake-hwclock.service

Synchronizing state for fake-hwclock.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d fake-hwclock defaults
insserv: warning: script 'K01tightvncserver' missing LSB tags and overrides
insserv: warning: script 'tightvncserver' missing LSB tags and overrides
Executing /usr/sbin/update-rc.d fake-hwclock enable

insserv: warning: script 'K01tightvncserver' missing LSB tags and overrides
insserv: warning: script 'tightvncserver' missing LSB tags and overrides

正確設置 ntp 伺服器並執行hwclock --systohc命令。

然後安裝fake-hwclock包,啟用並啟動fake-hwclock.service

systemctl enable fake-hwclock.service
systemctl start fake-hwclock.service
systemctl restart fake-hwclock.service

有些機器沒有工作的實時時鐘 (RTC) 單元,或者沒有適用於確實存在的硬體的驅動程序。fake-hwclock是一組簡單的腳本,用於定期保存核心的目前時鐘(包括在關機時)並在啟動時恢復它,以便系統時鐘至少保持接近實時。這將阻止一些可能由系統認為它已經及時回到 1970 年引起的問題,例如需要在每次啟動時執行文件系統檢查。

最重要的是,仍然建議使用 NTP 來處理硬體停止或重新啟動時的假時鐘“漂移”。

編輯

runnig解決了這個問題dpkg-reconfigure tzdata(來自@user3486308 的評論)

引用自:https://unix.stackexchange.com/questions/325337