Hide Forgot
Description of problem: Starting RHEL7/CentOS7 in a systemd-nspawn container results in chronyd failing to start, because adjtimex() can't be called from an unprivileged container. The systemd service unit for chrony needs to have the following line in the [Unit] section to prevent it from being started in container environments: ConditionVirtualization=!container
What if someone wants to run chronyd in a privileged container? It's probably not very common, or even an advisable thing to do, but I'm not sure if the default unit file should be preventing it. The chronyd service is disabled by default, so I'm wondering what has enabled in the container.
(In reply to Miroslav Lichvar from comment #2) > What if someone wants to run chronyd in a privileged container? It's > probably not very common, or even an advisable thing to do, but I'm not sure > if the default unit file should be preventing it. I think the default units should always be built under the assumption of a most common scenario. Special scenarios like running chronyd from within a privileged container can be easily achieved through a drop-in 2-line configuration like: /etc/systemd/system/chronyd.service.d/privileged-container.conf: [Unit] ConditionVirtualization=!container > The chronyd service is disabled by default, so I'm wondering what has > enabled in the container. To me it looks like it is enabled by default (at least on CentOS 7.2), but I can't find a corresponding .preset file. This is possibly a side-effect of chronyd being registered as ntp-unit in /usr/lib/systemd/ntp-units.d/50-chronyd.list
I noticed that the chrony unit file in Debian is now using ConditionCapability=CAP_SYS_TIME. If I understand it correctly, this prevents starting of chronyd when it doesn't have privileges to call adjtimex(), i.e. the issue that was reported in this bug. To me it looks like a cleaner solution than the ConditionalVirtualization directive.
(In reply to Miroslav Lichvar from comment #5) > I noticed that the chrony unit file in Debian is now using > ConditionCapability=CAP_SYS_TIME. If I understand it correctly, this > prevents starting of chronyd when it doesn't have privileges to call > adjtimex(), i.e. the issue that was reported in this bug. To me it looks > like a cleaner solution than the ConditionalVirtualization directive. I agree - this is a better solution of which I didn't think when writing the initial report.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:1908