我无法设置基于arm的Debian日期和时间!

我无法设置基于arm的Debian日期和时间!

我有一个基于 ARM 的板(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

答案1

正确设置 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评论)

相关内容