设为首页 收藏本站
查看: 1093|回复: 0

[经验分享] SUSE 12 cannot restart the ntp daemon 故障处理

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-5-20 09:52:02 | 显示全部楼层 |阅读模式
故障现象:

SUSE 12 在启动NTP客户端时,报“cannot restart the ntp daemon”错误,此错误应该是SUSE 12.0的一个BUG

解决办法:

root 用户执行  

#logprof 命令,根据提示 按  A    A    W

然后再执行

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


参考官网说明:https://www.suse.com/support/kb/doc.php?id=7015867

NTP Service Fails to Start or Hangs on SLES12

               
Environment

SUSE Linux Enterprise Server 12
Network Time Protocol (NTP)

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 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.

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.

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.

Status

Reported to Engineering

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-68766-1-1.html 上篇帖子: postgresql+slony-i安装配置主从 下篇帖子: DRBD安装与运维演练 cannot
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表