[SOLVED] NTP server on LXC

nywst

Member
Jul 6, 2022
23
0
6
Which Linux LXC can be configured to be NTP server?
I tried Fedora 39 LXC, seems it doesn't have NTP package.

Thanks.

Code:
[root@DNS-test ~]# cat /etc/redhat-release
Fedora release 39 (Thirty Nine)
[root@DNS-test ~]# dnf install ntp
Last metadata expiration check: 1:10:32 ago on Sat Jul  6 03:52:33 2024.
No match for argument: ntp
Error: Unable to find a match: ntp
 
You could just use the PVE host for that. I know you should really use an LXC or a VM for any services you wish to add - but this one requires NO installation as basically it already exists inside the Debian-based PVE host.

To do that (my tried setup - from notes) just do the following:

NTP Time Server:

Code:
nano /etc/chrony/chrony.conf


# Added by ME for NTP Server
local stratum 8
manual
allow 192.168.1.0/24   # The network you wish to allow to access the NTP time server - change accordingly

# Save & Exit

systemctl restart chronyd
 
Did not work
Code:
apt install chrony
nano /etc/chrony/chrony.conf
# put in as appropriate for my network

# systemctl enable --now chronyd
Failed to enable unit: Refusing to operate on alias name or linked unit file: chronyd.service
root@tyrtest:~# systemctl status chrony.service
x chrony.service - chrony, an NTP client/server
     Loaded: loaded (/lib/systemd/system/chrony.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-07-07 20:27:40 UTC; 7min ago
       Docs: man:chronyd(8)
             man:chronyc(1)
             man:chrony.conf(5)
    Process: 1550 ExecStart=/usr/sbin/chronyd $DAEMON_OPTS (code=exited, status=226/NAMESPACE)
        CPU: 4ms

Jul 07 20:27:40 tyrtest systemd[1]: Starting chrony.service - chrony, an NTP client/server...
Jul 07 20:27:40 tyrtest (chronyd)[1550]: chrony.service: Failed to set up mount namespacing: /run/systemd/unit-root/proc: Permission deni>
Jul 07 20:27:40 tyrtest (chronyd)[1550]: chrony.service: Failed at step NAMESPACE spawning /usr/sbin/chronyd: Permission denied
Jul 07 20:27:40 tyrtest systemd[1]: chrony.service: Control process exited, code=exited, status=226/NAMESPACE
Jul 07 20:27:40 tyrtest systemd[1]: chrony.service: Failed with result 'exit-code'.
Jul 07 20:27:40 tyrtest systemd[1]: Failed to start chrony.service - chrony, an NTP client/server.
 
Even this did not work

Code:
apt install systemd-timesyncd -y
systemctl start systemd-timesyncd
systemctl status systemd-timesyncd

* systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
     Active: inactive (dead)
  Condition: start condition failed at Sun 2024-07-07 20:56:34 UTC; 33s ago
             `- ConditionVirtualization=!container was not met
       Docs: man:systemd-timesyncd.service(8)

Jul 07 18:35:31 tyrtest systemd[1]: systemd-timesyncd.service - Network Time Synchronization was skipped because of an unmet condition ch>
Jul 07 20:56:22 tyrtest systemd[1]: systemd-timesyncd.service - Network Time Synchronization was skipped because of an unmet condition ch>
Jul 07 20:56:34 tyrtest systemd[1]: systemd-timesyncd.service - Network Time Synchronization was skipped because of an unmet condition ch>
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!