SUSE Support

Here When You Need Us

NTP Service Fails to Start or Hangs on SLES12

This document (7015867) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 12 GA

Situation

Upon completing the NTP configuration in yast2 and clicking Finish, an error "Error: Cannot restart the NTP daemon" appears on the screen.

Running systemctl start ntpd.service fails or hangs.

The error persists whether NTP is configured in a chroot jail or not.

The system log /var/log/messages contains the errors:
'kernel: [  657.760204] type=1400 audit (1415376571.756:44): apparmor="DENIED" operation="file_mmap" parent=1 profile="/usr/sbin/ntpd" name="/run/nscd/group" pid=2879 comm="ntpd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0'

"systemd[1]: Failed to start NTP Server Daemon."

# ntpq -p
ntpq: read: Connection refused

The following services are enabled.
# apparmor_status
apparmor module is loaded.
39 profiles are loaded.
39 profiles are in enforce mode.
   /sbin/klogd
   /sbin/syslog-ng
   /sbin/syslogd
   /usr/lib/apache2/mpm-prefork/apache2
   /usr/lib/apache2/mpm-prefork/apache2//DEFAULT_URI
   /usr/lib/apache2/mpm-prefork/apache2//HANDLING_UNTRUSTED_INPUT
   /usr/lib/apache2/mpm-prefork/apache2//phpsysinfo
   /usr/lib/dovecot/anvil
   /usr/lib/dovecot/auth
   /usr/lib/dovecot/config
   /usr/lib/dovecot/deliver
   /usr/lib/dovecot/dict
   /usr/lib/dovecot/dovecot-auth
   /usr/lib/dovecot/dovecot-lda
   /usr/lib/dovecot/imap
   /usr/lib/dovecot/imap-login
   /usr/lib/dovecot/lmtp
   /usr/lib/dovecot/log
   /usr/lib/dovecot/managesieve
   /usr/lib/dovecot/managesieve-login
   /usr/lib/dovecot/pop3
   /usr/lib/dovecot/pop3-login
   /usr/lib/dovecot/ssl-params
   /usr/lib64/libvirt/virt-aa-helper
   /usr/sbin/avahi-daemon
   /usr/sbin/dnsmasq
   /usr/sbin/dovecot
   /usr/sbin/identd
   /usr/sbin/libvirtd
   /usr/sbin/mdnsd
   /usr/sbin/nmbd
   /usr/sbin/nscd
   /usr/sbin/ntpd
   /usr/sbin/smbd
   /usr/sbin/smbldap-useradd
   /usr/sbin/smbldap-useradd///etc/init.d/nscd
   /usr/sbin/winbindd
   /usr/{sbin/traceroute,bin/traceroute.db}
   /{usr/,}bin/ping
0 profiles are in complain mode.
3 processes have profiles defined.
3 processes are in enforce mode.
   /usr/sbin/avahi-daemon (892) 
   /usr/sbin/libvirtd (1425) 
   /usr/sbin/nscd (896) 
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
# systemctl status ntpd
ntpd.service - NTP Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
   Active: activating (auto-restart) (Result: timeout) since Fri 2014-11-07 09:26:57 MST; 1min 38s ago
     Docs: man:ntpd(1)
  Process: 4584 ExecStart=/usr/sbin/start-ntpd start (code=exited, status=0/SUCCESS)

Nov 07 09:26:57 sles12 systemd[1]: Failed to start NTP Server Daemon.

Rebooting the server seems to start the NTP service daemon just fine, but it terminates after some time attempting to activate the service.
 
# systemctl status ntpd
ntpd.service - NTP Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
   Active: activating (start) since Fri 2014-11-07 09:59:14 MST; 45s ago
     Docs: man:ntpd(1)
  Process: 1428 ExecStart=/usr/sbin/start-ntpd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/ntpd.service
           └─1444 /usr/sbin/ntpd -p /var/run/ntp/ntpd.pid -g -u ntp:ntp -i /v...

Nov 07 09:59:14 sles12 ntpd[1444]: pid file /var/run/ntp/ntpd.pid: Permission denied
Nov 07 09:59:14 sles12 ntpd[1444]: ntp_io: estimated max descriptors: 102...

 

Resolution

Update the AppArmor /usr/sbin/ntpd profile with logprof to allow read access to /run/nscd/group and write access to /var/lib/ntp/var/run/ntp/ntpd.pid. Once the AppArmor ntpd policy has been saved, you can restart the NTP service.

Login as root on the command line and run:
# logprof
Reading log entries from /var/log/messages.
Updating AppArmor profiles in /etc/apparmor.d.
Enforce-mode changes:

Profile:  /usr/sbin/ntpd
Path:     /run/nscd/group
Mode:     r
Severity: unknown

 [1 - /run/nscd/group]

(A)llow / [(D)eny] / (G)lob / Glob w/(E)xt / (N)ew / Abo(r)t / (F)inish / (O)pts
Adding /run/nscd/group r to profile.

Profile:  /usr/sbin/ntpd
Path:     /var/lib/ntp/var/run/ntp/ntpd.pid
Mode:     w
Severity: unknown

 [1 - /var/lib/ntp/var/run/ntp/ntpd.pid]

(A)llow / [(D)eny] / (G)lob / Glob w/(E)xt / (N)ew / Abo(r)t / (F)inish / (O)pts
Adding /var/lib/ntp/var/run/ntp/ntpd.pid w to profile.

= Changed Local Profiles =

The following local profiles were changed.  Would you like to save them?

 [1 - /usr/sbin/ntpd]

(S)ave Changes / [(V)iew Changes] / Abo(r)t
Writing updated profile for /usr/sbin/ntpd.

# systemctl restart ntpd.service
# systemctl status ntpd.service

Cause

Apparmor is restricting the NTP service from reading /run/nscd/group and from writing to /var/lib/ntp/var/run/ntp/ntpd.pid.

Additional Information

Problem is fixed since: apparmor-2.8.2-28.2

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7015867
  • Creation Date: 07-Nov-2014
  • Modified Date:12-Oct-2022
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.