RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1306046 - chrony systemd service unit is missing "ConditionCapability=CAP_SYS_TIME"
Summary: chrony systemd service unit is missing "ConditionCapability=CAP_SYS_TIME"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: chrony
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Miroslav Lichvar
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-09 23:20 UTC by Elias Probst
Modified: 2017-08-01 16:20 UTC (History)
2 users (show)

Fixed In Version: chrony-3.1-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 16:20:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1908 0 normal SHIPPED_LIVE chrony bug fix and enhancement update 2017-08-01 17:54:45 UTC

Description Elias Probst 2016-02-09 23:20:12 UTC
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

Comment 2 Miroslav Lichvar 2016-02-12 13:39:48 UTC
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.

Comment 3 Elias Probst 2016-02-12 16:39:45 UTC
(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

Comment 5 Miroslav Lichvar 2017-01-17 08:38:52 UTC
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.

Comment 6 Elias Probst 2017-01-17 10:16:49 UTC
(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.

Comment 9 errata-xmlrpc 2017-08-01 16:20:39 UTC
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


Note You need to log in before you can comment on or make changes to this bug.