![Chrony 无法在 Proxmox 容器中启动](https://linux22.com/image/783619/Chrony%20%E6%97%A0%E6%B3%95%E5%9C%A8%20Proxmox%20%E5%AE%B9%E5%99%A8%E4%B8%AD%E5%90%AF%E5%8A%A8.png)
我在 Proxmox 7.0.8 上使用 Debian(Debian 11 模板)创建了一个容器。操作系统必须保持时间同步,为此我安装了 chrony,但它无法启动。
journalct -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,以直接从外部服务器更新时间。到目前为止一切顺利,但我没有看到容器更新时间。proxmox 主机和容器在 /etc/timezone 中具有相同的时区。当我手动dpkg-reconfigure tzdata
打开容器时,它会立即更新时间,但再次滞后。执行 systemctl status 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.