LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-06-2009, 05:48 AM   #1
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91
ntp drift file in /etc/ntp instead of /var/lib/ntp - suggestion for a patch in Slack


I run a script on my Linux machines that every night checks if anything has changed in /etc and below and if it has, makes a backup, keeping the last 5 versions.
This way I can check when something stops working if any configuration has changed.

Now I noticed that on one server (running Slackware 12.2 stable) my script said that the configuration changed every day.
Digging in a bit deeper, I found that ntp that runs on that particular box keeps the drift file in /etc/ntp and that file changes daily.

I found some discussions on the internet that this file should be in /var/lib/ntp - which makes sense to me, as it is not a configuration file at all.

I made the change myself (in /etc/ntp.conf) and now my script stops warning me about the new configuration every day.

The official ntp site says the default is /etc/ntp.drift and does not elaborate much on the subject.

The FHS tells us about /etc:
Quote:
The /etc hierarchy contains configuration files. A "configuration file" is a local file used to control the operation of a program; it must be static and cannot be an executable binary.
The drift file is definitely not "static".

It tell us about /var:
Quote:
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
I vote for changing the ntp drift file to /var/lib/ntp in Slackware.
Should this be changed in the next release of Slackware by including a patched /etc/ntp.conf file?
After all, Slackware seems to follow the FHS quite well.

Last edited by niels.horn; 05-06-2009 at 05:51 AM. Reason: typos...
 
Old 05-06-2009, 06:14 AM   #2
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Hi neils. When I first looked at you post I had to agree as the reasoning behind files in /etc being static makes sense. However that prompted me to have another look at the dates and timestamps of files in there.

Notice there is also the files under /dhcpc and /etc/ld.so.cache which are transient. There are probably others that I haven't noticed yet.

So it would seem some applications do store non-static data in there. Perhaps we are misreading the FHS's meaning on this or perhaps it's just being ignored ?
 
Old 05-06-2009, 06:21 AM   #3
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Indeed, there might be others... This is one I noticed
Well, I'd like to hear opinions: should we follow the FHS standard in these cases or not?
 
Old 05-06-2009, 08:42 AM   #4
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I'm pretty sure that /etc/ld.so.cache is one of those historical exceptions like /etc/mtab is not static. I don't use dhcpc so I'm not sure what files it maintains under /etc.

I also don't use ntp, but from this description:

The drift file is used to record the frequency offset of the local clock oscillator. If the file exists, it is read at startup in order to set the initial frequency offset and then updated once per hour with the current frequency offset computed by the daemon. If the file does not exist or this command is not given, the initial frequency offset is assumed zero. In this case, it may take some hours for the frequency to stabilize and the residual timing errors to subside.

it looks like it gets updated quite a lot. My feeling is that it would be more correctly placed under /var. But I'm not convinced that /var/lib/ntp would be right -it might be more correct under /var/run. But, /var/lib/??? serves as a catchall for other transient, hard-to-define files, so it is probably legal...
 
Old 05-06-2009, 09:04 AM   #5
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
From the ntp documentation.
Quote:
The ntpd behavior at startup depends on whether the frequency file, usually ntp.drift, exists. This file contains the latest estimate of clock frequency error. When the ntpd is started and the file does not exist, the ntpd enters a special mode designed to quickly adapt to the particular system clock oscillator time and frequency error. This takes approximately 15 minutes, after which the time and frequency are set to nominal values and the ntpd enters normal mode, where the time and frequency are continuously tracked relative to the server. After one hour the frequency file is created and the current frequency offset written to it. When the ntpd is started and the file does exist, the ntpd frequency is initialized from the file and enters normal mode immediately. After that the current frequency offset is written to the file at hourly intervals.
So, the ntp.drift file is updated hourly, but over time the data stored within it will become static. It is a file that can fit with either definition.
My opinion is that the decision lies with the upstream developers, who have decided to make /etc/ntp.drift the default. You are free to make a change if you desire.
One of the features of Slackware is that it respects the decisions of the upstream developers. This is usually a good thing, but it is easy to find situations in Slackware where a change in the default configuration can lead to enhanced usability. My pet example here is with xpdf. The default xpdf.rc has entries to point to Windows font files, but these need to changed to point to the default location of these font files in Slackware. This makes xpdf usable for pdf documents developed using Windows fonts. (I know there are better pdf viewers, but xpdf loads up very quickly and I make a lot of use of it for this reason).
I would prefer that Slackware continue with respecting the decisions of the upstream developers.
 
Old 05-06-2009, 09:07 AM   #6
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
I picked /var/lib/ntp as it seems to be a common solution used in other distros.
I did some googling and found several references to this location.
At least it seems more appropriate than anything under /etc.

I also do not use dhcpc so I have had no conflicts with that one.

/etc/mtab is another situation, as it is "quite static" on most servers.
On desktops it might change a lot though.
I *think* the same goes for /etc/ld.so.cache
 
Old 05-06-2009, 12:07 PM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I found some references like this:
ntpd -f /var/run/ntp.drift -p /var/run/ntpd.pid
/var/log/ntpstats
/etc/ntpd.conf
/etc/ntp/step-tickers

but also this:

driftfile /var/lib/ntp/drift
 
Old 05-06-2009, 01:17 PM   #8
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Quote:
Originally Posted by gnashley View Post
driftfile /var/lib/ntp/drift
This is how I did it, putting this line in /etc/ntp.conf
 
Old 05-06-2009, 04:24 PM   #9
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
I never really cared for the idea of /var/lib/... as unlike /lib, or /usr/lib it doesn't contain libraries so the name just doesn't seem right to me. /var/state as a name seemed far more logical to me, but it looks like the FHS has chosen to go with /var/lib instead. Anyway, despite my nitpicking on the name, I agree with the guys above that the file really doesn't belong in /etc. /var/run doesn't seem to be the right place either, so /var/lib/ntp/ seems like a good choice.
 
Old 05-06-2009, 05:49 PM   #10
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Don't worry about the nitpicking. I created this whole thread because I am a nitpicker

I do believe in following standards, as it makes administration of several machines so much simpler...
 
Old 05-06-2009, 06:19 PM   #11
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
Quote:
Originally Posted by niels.horn View Post
I do believe in following standards, as it makes administration of several machines so much simpler...
No argument from me there, I just wish that the 'standards' were a little more logical in places.
 
Old 05-06-2009, 06:30 PM   #12
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
Yeah I know... And I'll never forget a phrase told to me many, many, years ago:
Quote:
The problem with standards is that there are so many to choose from...
 
Old 05-06-2009, 09:55 PM   #13
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Its pretty standard for myself and many others to have /var on it's own partition (and possibly even a network share (unlikely as it may be)) the partition needs to be available when the startup services are run.

I remember dhcpc having issues when someone tried to force a change from /etc to /var for the state files. You want your networking up before trying to mount remote shares after all.

/etc should be on the root partition and is one reason why some of these files reside there. Others (as mentioned) are either just historical or are just the way that upstream do things...

Never take anything at face value as there are often some obscure reasons for things being the way they are.
 
Old 05-06-2009, 10:53 PM   #14
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Original Poster
Rep: Reputation: 91
On most professional *nix servers, /var is on its own partition indeed.
Sub-dirs might be on external network shares or storages, but usually not the standard sub-folders like /var/run, /var/lib etc. At least, in my experience.

I respect (most) upstream developers, but my idea of open software is that I am in control.
So if I think that non-static files don't belong in /etc, I'll move them to a better place.

One thing I learned after several decades of working in the IT / support business is not to accept simply what suppliers / upstream developers tell me to do. I question things a lot. And I don't accept answers like "we do it this way because we always did it this way". I am always open for good arguments though.
 
Old 05-07-2009, 07:37 AM   #15
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Quote:
etc should be on the root partition and is one reason why some of these files reside there.
@mRgOBLIN: Thanks for the information I was wondering about that !
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTP: help me understand the conf file Gozotonmortenfrede Linux - Server 1 04-15-2008 03:56 PM
NTP - how to slack it best? TL_CLD Slackware 27 10-13-2006 11:33 AM
Help with NTP again please!! MaverickApollo Linux - General 2 05-30-2006 07:33 AM
NTP cannot work with timeserver, NTP-d can jerryvapps Linux - Networking 0 08-04-2004 02:04 PM
NTP cannot use server, NTP -d can jerryvapps Linux - Newbie 0 07-28-2004 02:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration