Proxmox容器中Chrony无法启动且容器时间同步异常求助
Proxmox容器中Chrony无法启动且容器时间同步异常求助
我在Proxmox 7.0.8上基于Debian 11模板创建了一个容器,系统时间同步对我来说非常重要,所以安装了chrony服务,但它始终无法正常启动。
相关日志信息
journalctl -xe 输出:
root@pamiweb:~# journalctl -xe -- Support: https://www.debian.org/support -- -- A start job for unit chrony.service has begun execution. -- -- The job identifier is 1038110. Jan 31 15:45:55 pamiweb systemd[77723]: chrony.service: Failed to set up mount namespacing: /run/systemd/unit-root/proc: Permission denied Jan 31 15:45:55 pamiweb systemd[77723]: chrony.service: Failed at step NAMESPACE spawning /usr/sbin/chronyd: Permission denied -- Subject: Process /usr/sbin/chronyd could not be executed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- The process /usr/sbin/chronyd could not be executed and failed. -- -- The error number returned by this process is ERRNO. Jan 31 15:45:55 pamiweb systemd[1]: chrony.service: Control process exited, code=exited, status=226/NAMESPACE -- Subject: Unit process exited -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- An ExecStart= process belonging to unit chrony.service has exited. -- -- The process' exit code is 'exited' and its exit status is 226. Jan 31 15:45:55 pamiweb systemd[1]: chrony.service: Failed with result 'exit-code'. -- Subject: Unit failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- The unit chrony.service has entered the 'failed' state with result 'exit-code'. Jan 31 15:45:55 pamiweb systemd[1]: Failed to start chrony, an NTP client/server. -- Subject: A start job for unit chrony.service has failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- A start job for unit chrony.service has finished with a failure. -- -- The job identifier is 1038110 and the job result is failed. lines 6027-6062/6062 (END)
systemctl status chrony 输出:
chrony.service - chrony, an NTP client/server Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2023-01-30 18:50:13 UTC; 20h ago Docs: man:chronyd(8) man:chronyc(1) man:chrony.conf(5) Process: 15390 ExecStart=/usr/sbin/chronyd $DAEMON_OPTS (code=exited, status=226/NAMESPACE) CPU: 7ms Jan 30 18:50:13 pamiweb systemd[1]: Starting chrony, an NTP client/server... Jan 30 18:50:13 pamiweb systemd[15390]: chrony.service: Failed to set up mount namespacing: /run/systemd/unit-root/proc: Permission denied Jan 30 18:50:13 pamiweb systemd[15390]: chrony.service: Failed at step NAMESPACE spawning /usr/sbin/chronyd: Permission denied Jan 30 18:50:13 pamiweb systemd[1]: chrony.service: Control process exited, code=exited, status=226/NAMESPACE Jan 30 18:50:13 pamiweb systemd[1]: chrony.service: Failed with result 'exit-code'. Jan 30 18:50:13 pamiweb systemd[1]: Failed to start chrony, an NTP client/server.
后续尝试与新问题
按照@NikitaKipriyanov的建议,我已经在Proxmox主机上配置了chrony直接从外部服务器同步时间,主机的时间现在是正常的,但容器的时间还是没有同步过来。我确认了主机和容器的/etc/timezone时区设置是一致的。
手动在容器里执行dpkg-reconfigure tzdata时,时间会立刻更新到正确值,但过一会儿又会滞后。
查看容器内systemd-timesyncd.service状态,输出如下:
systemd-timesyncd.service - Network Time Synchronization Loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Active: inactive (dead) Condition: start condition failed at Wed 2023-03-08 15:34:55 CST; 7s ago ConditionVirtualization=!container was not met Docs: man:systemd-timesyncd.service(8) Mar 08 14:12:46 vmproxy-5 systemd[1]: Condition check resulted in Network Time Synchronization being skipped. Mar 08 15:34:55 vmproxy-5 systemd[1]: Condition check resulted in Network Time Synchronization being skipped.
现在不知道该怎么解决容器的时间同步问题了,希望能得到大家的帮助!
备注:内容来源于stack exchange,提问作者Francisco
相关产品推荐
相关产品推荐

