Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 27426 - new ntp-4.1.2 ebuild doesn't set permissions correctly for new ntp.drift file location.
Summary: new ntp-4.1.2 ebuild doesn't set permissions correctly for new ntp.drift file...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-27 07:55 UTC by Decibels
Modified: 2003-09-02 18:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Decibels 2003-08-27 07:55:29 UTC
First thought it was an error do to no value written in /var/lib/misc/ntp.drift .
Because found this RedHat bug:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=58294
Then read on NTP site. It will take one hour approx for ntp to write to the
file, then will continue at one hour intervals.
I tried from example above and wrote 0.0 to the file. And with no value (default
file). Both produced the same results after an hour.

/var/log/ntpd.log:

26 Aug 23:30:48 ntpd[11595]: can't open /var/lib/misc/ntp.drift.TEMP: Permission
denied
27 Aug 00:30:48 ntpd[11595]: can't open /var/lib/misc/ntp.drift.TEMP: Permission
denied
27 Aug 01:30:48 ntpd[11595]: can't open /var/lib/misc/ntp.drift.TEMP: Permission
denied

This continues no matter whether value in drift file or not.

There is a new group with this ebuild. Group 123

Looking at permissions on /var/lib/misc and is root root

Changed permissions on folder to 'ntp' for group and made writeable for group.

Then ntpd.log file started acting correctly:

27 Aug 09:24:31 ntpd[2252]: ntpd exiting on signal 15
27 Aug 09:24:32 ntpd[24261]: frequency initialized 0.000 from
/var/lib/misc/ntp.drift
27 Aug 09:24:32 ntpd[24261]: running as uid(123)/gid(123) euid(123)/egid(123).
27 Aug 09:24:32 ntpd[24265]: signal_no_reset: signal 17 had flags 4000000
27 Aug 09:24:40 ntpd[24265]: signal_no_reset: signal 14 had flags 4000000
27 Aug 09:24:57 ntpd[2257]: parent died before we finished, exiting

Note: will take an hour with the default drift file before get the 'frequency
initialized 0.000 from /var/lib/misc/ntp.drift', until then will get
'Un-parsable frequency in /var/lib/misc/ntp.drift'. That is just until the first
hour.

Reproducible: Always
Steps to Reproduce:
1. Emerge ntp-4.1.2
2. Copy example ntp.conf to /etc. Setup servers,...
3. rc-update add ntpd default
4. View the /var/log/ntpd.log after an hour. Will get permission errors because
ntp cannot write to drift file.

Actual Results:  
can't open /var/lib/misc/ntp.drift.TEMP: Permission denied

in /var/log/ntpd.log

Expected Results:  
After an hour ntp should have been able to write calculated drift to
/var/lib/misc/ntp.drift file.
Comment 1 Decibels 2003-08-27 12:31:50 UTC
Not sure it would be a good idea to make /var/lib/misc as user:root & group:ntp
So changed it back to root:root.
Then changed the ntp.drift file itself to user:root & group:ntp instead of the default ntp:ntp is was set as. And added write permission for group. Seems to be working. Will have to check the logs after awhile.

After checking the logs from the previous user:group change on the folder. Didn't notice the hourly update checks. So still working on this.
Comment 2 SpanKY gentoo-dev 2003-08-28 10:26:39 UTC
so you're saying that when /var/lib/misc is ntp:ntp it works fine ...
and when /var/lib/misc/ntp.drift is ntp:ntp it works fine ?

the ebuild does this currently:
dodir /var/lib/misc   
touch ${D}/var/lib/misc/ntp.drift
fowners ntp:ntp /var/lib/misc/ntp.drift
Comment 3 Decibels 2003-08-28 18:49:35 UTC
Sorry, uncomment the line in ntp.conf 
# If you want to deny all machines from accessing
# your NTP server, uncomment:
#
restrict default ignore

And ntp wouldn't work. Have to start over. 
Got errors with 'ntpq -p':

127.0.0.1: timed out, nothing received
***Request timed out

So have to start over. But answer to your question. No, thought it was working at first. Didn't wait long enough. After letting ntp do it's thing. Got the
permission errors or not hourly activity.

Working on trying this right now. With default blank ntp.drift and with adding '0.000' to the file. 
https://www.redhat.com/archives/redhat-list/2002-November/msg03059.html

Had results, but didn't know the config file was stopping me. Will post results when get them.

Thanks.
Comment 4 Decibels 2003-08-28 18:56:26 UTC
PS. To not misunderstand. The config file was changed this morning. It wasn't change earlier, so wasn't causing the problems that posted for.:) FYI
Comment 5 Decibels 2003-08-28 19:41:40 UTC
quote SpanKY:
so you're saying that when /var/lib/misc is ntp:ntp it works fine ...
and when /var/lib/misc/ntp.drift is ntp:ntp it works fine ?

SpanKY, I was thinking something else when answered your question. I think
it was working that way. But didn't know if it was a good idea to change the permissions on /var/lib/misc to group ntp [123]. That folder could be used for other things so thought better to try something else.

Now if you want to read the url I am working on about adding the ntp.drift.TEMP file. Then see if you like that better OR was also thinking, could make a /var/lib/misc/ntp folder. That way could try changing the permissions on it to root:ntp or ntp:ntp and see what happens.

Can try all of it and see which you like best. Going away for the weekend, so after won't be able to work on it after tomorrow morning until Tuesday.
Comment 6 Andreas Simon 2003-08-31 02:43:01 UTC
This bug report is a duplicate of #26501 and #26259.

I explained everything in 26501 and don't understand
how the bug should have been fixed without changing the directories permission.
To write a new file you need write permission in the respective directory. The propematic file is not the drift file but the temporary file which is needed by ntpd.

Just give ntpd it's own directory (say /var/lib/ntp/) for it's drift file where it has WRITE PERMISSION, i.e. owner ntp. It's really no rocked science.

Adding a ntp.drift.TEMP file in /var/lib/misc is no solution because ntpd deletes this file when it's not needed anymore.
Comment 7 Decibels 2003-09-01 12:34:37 UTC
Sorry, been away for the weekend didn't get to try that till now. No, not rocket science, was working from the premise that had been worked out and was just a permission thing with the new group. TEMP wasn't being deleted either when made it in the /var/lib/misc folder, it was writing to it instead and not replacing value in ntp.drift.

Also I searched before posting and those two bugs didn't pop up for some reason. Weird.

I confirm that works using /var/lib/ntp with ntp:ntp as owner:group. And changing drift file location in /etc/ntp.conf.

It did write to the ntp.drift file!!! Still checking on the log file. Wrote to drift file in new location, exactly 1 hour after restarting ntpd. About 20 minutes later wrote to log file 'time reset 124.063735 s'

I would go with Andreas Simon on this, then problems solved.
Comment 8 SpanKY gentoo-dev 2003-09-02 17:53:50 UTC
so, if i make these changes you guys should be all set ? (i dont use ntpd so ive never had these problems ...)

ntp-4.1.2.ebuild:
dodir /var/lib/ntp
fowners ntp.ntp /var/lib/ntp

files/ntp.conf:
driftfile    /var/lib/ntp/ntp.drift
Comment 9 Decibels 2003-09-02 18:03:21 UTC
Yes, ntp.drift in /var/lib/ntp with those permissions is still working on my system. Don't forget to add the new location in /etc/ntp.conf :)

Thanks SpanKY
Comment 10 SpanKY gentoo-dev 2003-09-02 18:23:17 UTC
ok, i've updated the ebuild and the ntp.conf file ... thanks guys ... 
 
i'll hold off version bumping once ive cleaned out the ntp bugs so these small 
changes wont make ppl constantly update ntp ...