openntpd no longer installs -/etc/openntpd/ntpd.conf: Permission denied

Bug #458061 reported by Lars Noodén on 2009-10-22
164
This bug affects 32 people
Affects Status Importance Assigned to Milestone
openntpd (Ubuntu)
Undecided
Unassigned

Bug Description

OpenNTPd does not install from the package repository. ntp and ntpdate install / uninstall just fine.
The error message for openntpd:

   Setting up openntpd (3.9p1+debian-2) ...
   Starting openntpd: /etc/openntpd/ntpd.conf: Permission denied
   invoke-rc.d: initscript openntpd, action "start" failed.
   dpkg: error processing openntpd (--install):
    subprocess installed post-installation script returned error exit status 1

This happens even after purging:
$ apt-get purge openntpd

I would expect the package manager to be able to install openntpd without errors or else suggest a way to clear the problem out of the way.

$ sudo apt-get install openntpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
openntpd is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up openntpd (3.9p1+debian-2) ...
Starting openntpd: /etc/openntpd/ntpd.conf: Permission denied
invoke-rc.d: initscript openntpd, action "start" failed.
dpkg: error processing openntpd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 openntpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ dpkg -i /var/cache/apt/archives/openntpd_3.9p1+debian-2_i386.deb
(Reading database ... 136520 files and directories currently installed.)
Preparing to replace openntpd 3.9p1+debian-2 (using .../openntpd_3.9p1+debian-2_i386.deb) ...
Stopping openntpd: ntpd.
Unpacking replacement openntpd ...
Setting up openntpd (3.9p1+debian-2) ...
Starting openntpd: /etc/openntpd/ntpd.conf: Permission denied
invoke-rc.d: initscript openntpd, action "start" failed.
dpkg: error processing openntpd (--install):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db ...
Processing triggers for sreadahead ...
Errors were encountered while processing:
 openntpd

$ apt-cache policy openntpd
openntpd:
  Installed: 3.9p1+debian-2
  Candidate: 3.9p1+debian-2
  Version table:
 *** 3.9p1+debian-2 0
        500 http://fi.archive.ubuntu.com karmic/universe Packages
        100 /var/lib/dpkg/status

$ lsb_release -rd
Description: Ubuntu 9.10
Release: 9.10

:: DESCRIPTION ::
openntpd doesn't install due to remaining ntp apparmor profile after ntp removal (not purged)

:: HOW TO REPRODUCE ::
$ apt-get install ntp
$ invoke-rc.d apparmor restart
$ apt-get install openntpd

install fails with the error above

:: WORKAROUND ::
$ dpkg --purge ntp
$ invoke-rc.d apparmor restart
$ apt-get install openntpd

Kamus (kamus) wrote :

I try to reproduce this issue in Karmic up to date and works fine for me. Could you update your sources (or select another mirror) and try to reinstall openntpd package?

Regards

affects: ubuntu → openntpd (Ubuntu)
Brian Murray (brian-murray) wrote :

Using package version 3.9p1+debian-2 on Karmic I noticed the following:

(karmic)root@flash:~# /var/lib/dpkg/info/openntpd.postinst configure
Starting openntpd: invoke-rc.d: initscript openntpd, action "start" failed.

Kamus (kamus) wrote :

@Brian, you are right, but when while was installing this package via apt that do not show any error message so I assumed that works fine.

Lars Noodén (larsnooden) wrote :

@Kamus, the above report is in Karmic and is after updating the sources and after uninstalling / reinstalling. I tried to make that clear in the description..

Artis Caune (artis.caune) wrote :

[ 1029.725409] type=1503 audit(1256475570.487:32): operation="open" pid=3120 parent=3117 profile="/usr/sbin/ntpd" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/etc/openntpd/ntpd.conf"

Artis Caune (artis.caune) wrote :

I think this happens when you:
- install ntp
- install openntpd (which uninstall ntp)

apparmo profiles are not updated, and /usr/sbin/ntpd is still there.

/etc/init.d/apparmor restart will fix this.

Jean-Baptiste Lallement (jibel) wrote :

Confirmed in karmic and lucid

As Artis said this is an issue with ntp apparmor profile left after implicit uninstall of ntp.
The workaround is to purge the remaining configuration file and restart apparmor before installing openntpd.

Changed in openntpd (Ubuntu):
status: New → Confirmed
description: updated

Just running apparmor restart doesn't fix the problem.
To get openntpd installed on ubuntu 9.10, I did:
aa-complain /usr/sbin/ntpd
apt-get install -f

One more issue... when you install openntpd (replacing ntpd) it leaves behind a /etc/init.d/ntpd file. That file is still run and it starts the openntpd server but doesn't do so correctly.

sOLARiZ (mg-solariz) wrote :

Same error here. Installed ntpd, removed it, tried to install openntpd. Failed.

 /etc/init.d/openntpd restart
Restarting openntpd: /etc/openntpd/ntpd.conf: No such file or directory

the installer didn`t created a config file.

Richte openntpd ein (3.9p1+debian-2) ...
Starting openntpd: /etc/openntpd/ntpd.conf: No such file or directory
invoke-rc.d: initscript openntpd, action "start" failed.
dpkg: Fehler beim Bearbeiten von openntpd (--configure):
 Unterprozess installiertes post-installation-Skript gab den Fehlerwert 1 zurück
Fehler traten auf beim Bearbeiten von:
 openntpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

@solariz: you're not affected by the same bug. The original report is about a 'Permission denied' and yours is a 'No such file or directory'

Please file a new report. Thanks.

Same problem (Permission denied) on 10.04 amd64.
Restarting apparmor fixed the issue.

Andrew Cowie (afcowie) wrote :

Still present in lucid{,-proposed}.

AfC

Ryan Smith-Roberts (rmsr) wrote :

I experienced this in maverick when moving to openntpd from ntp.

I had to purge ntp and then use aptitude to reinstall the openntpd package to resolve it.

Faldegast (faldegast) wrote :

Still having this problem in 10.10, none of the tricks provided above works for me.

Andreas Moog (ampelbein) wrote :

This should be fixed by the version in natty.

Changed in openntpd (Ubuntu):
status: Confirmed → Fix Released
Christian Kujau (christiank) wrote :

Still there on 10.04.2. Disabling apparmor (boot with security="") helped. Rebooting with apparmor enabled again (security=apparmor) still allows openntpd to run. So, this looks like an apparmor related problem - openntpd can't do much about it (but its install scripts can).

Julien (julien-t43) wrote :

bug still happening on 11.04 if you switch between ntp & openntp packages.

Ryan Daly (daly-ctcnet) wrote :

I can confirm this happens when switching from ntp to openntp package on 10.04.3.

Thomas Krennwallner (tkren) wrote :

Still present on 11.10 oneiric. I had to "service apparmor restart" before I could "service openntpd restart".

Peter Hoeg (peterhoeg) wrote :

Still present on 13.04 raring. The apparmor restart workaround does the trick.

ndsipa pomu (ndsipa-pomu) wrote :

This is still present on Utopic (14.10) and restarting apparmor doesn't help at all.

ndsipa pomu (ndsipa-pomu) wrote :

I've managed to get it installed by running "apt-get purge openntpd apparmor", performing a reboot and then installing openntp.

tim (acmeinc) wrote :

To work around this, I had to manually "purge" ntp, and restart apparmor to allow openntpd to start.

apt-get install openntpd -y
apt-get purge ntp -y
service apparmor restart
service openntpd restart

Success!

Ker Ruben Ramos (xdiscent) wrote :

Still happens on Ubuntu 14.04.3.

I know that the workaround works. But the problem is still there.

Nick Groenen (zoni) wrote :

Despite this supposedly having been fixed, I still run into this on Ubuntu 16.04.1 LTS (xenial).

This is caused by the ntp package (which comes installed by default) placing an apparmor profile in `/etc/apparmor.d/usr.sbin.ntpd`. When removing ntp and installing openntpd instead, the apparmor profile is not removed so apparmor enforces restrictions meant for ntp onto openntpd.

The solution is to (1) remove /etc/apparmor.d/usr.sbin.ntpd and (2) reload apparmor (`systemctl reload apparmor.service`). At this point openntpd will install and run without issue.

i was able to run into this "permission denied" problem with Ubuntu 14.04
i tried this:
  apt-get purge openntpd apparmor
  apt-get install openntpd apparmor
and i even tried to set "rw" file rights for everybody...

let's do a wild guess some service has opened and locked (exclusive access) the file in question.
and this service is not neccessarily having the char sequence "ntp" in its body.
  "ps fax | grep ntp" did not return anything that might be a server to me.
trying:
  sudo lsof /etc/openntpd/ntpd.conf
this line returned only a fuse-warning of probable incompletness to me - nothing else.
even no report at all when using fuser instead of lsof.

running "openntpd" with sudo from the command line creates the very well known permission error.

checking this:
  sudo ls -l `which openntpd`
return this:
  lrwxrwxrwx 1 root root 4 Dez 24 2013 /usr/sbin/openntpd -> ntpd

deleting the symlink and retrying the partial installation suddenly seems to succeed.

is the uninstall/install having a problem with a leftover symlink pointing to ntpd?
doing a re-install from that state... failed again! and the symlink got recreated.

stopping here - feeling puzzled... but it looks like the openntpd package itself is the problem.

please re-open this bug!
(or tell me how to otherwise make this issue manageable again.)

Martijn Brinkers (m-brinkers) wrote :

I have a similar problem on Ubuntu 14.04. The only workaround that works was the one provided by "Alexander Stohr", i.e., install openntpd (which failes), then remove the symlink /usr/sbin/openntpd -> ntpd and then reinstall openntpd.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers