* Suggested changes to util-linux for FHS compliance.
@ 2021-02-12 17:04 Bruce Dubbs
2021-02-15 9:16 ` Karel Zak
0 siblings, 1 reply; 7+ messages in thread
From: Bruce Dubbs @ 2021-02-12 17:04 UTC (permalink / raw)
To: Util-Linux
I don't recall if this has come up before, but I suggest a couple of
changes to the default util-linux build configuuration:
1. Change the default ADJTIME_PATH to be /var/lib/hwclock/adjtime
This would be a one line change to include/pathnames.h:
# define _PATH_ADJTIME "/etc/adjtime"
For a reference, see the FHS paragraph 5.8.6:
https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html#varlibhwclockStateDirectoryForHwclo
Currently this behavior can be done by exporting the environment
variable ADJTIME_PATH=/var/lib/hwclock/adjtime before running configure,
but is undocumented except in the 2.25 release notes.
2. Change the references to /var/run to just /run or at least add a
configure option --runstatedir=<path>.
Most systems today create /run as a tmpfs. See:
https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html and
https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s13.html
Currently this change can be manually made by setting an environment
variable, runstatedir=/run when running configure, but is undocumented.
-- Bruce Dubbs
linuxfromscratch.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Suggested changes to util-linux for FHS compliance.
2021-02-12 17:04 Suggested changes to util-linux for FHS compliance Bruce Dubbs
@ 2021-02-15 9:16 ` Karel Zak
2021-02-18 15:37 ` Bruce Dubbs
2021-02-19 11:30 ` Karel Zak
0 siblings, 2 replies; 7+ messages in thread
From: Karel Zak @ 2021-02-15 9:16 UTC (permalink / raw)
To: Bruce Dubbs; +Cc: Util-Linux
On Fri, Feb 12, 2021 at 11:04:59AM -0600, Bruce Dubbs wrote:
> I don't recall if this has come up before, but I suggest a couple of changes
> to the default util-linux build configuuration:
>
> 1. Change the default ADJTIME_PATH to be /var/lib/hwclock/adjtime
Good idea. I'll do that.
> 2. Change the references to /var/run to just /run or at least add a
> configure option --runstatedir=<path>.
The current default is /run if --localstatedir is NONE or /var, see
configure.ac:
# default for old versions without $runstatedir
AS_IF([test x"$runstatedir" = x], [runstatedir='${localstatedir}/run'])
# our default if $localstatedir unchanged
AS_CASE([$localstatedir:$runstatedir],
[NONE:'${localstatedir}/run' | /var:'${localstatedir}/run' | NONE:'/run' ],
[runstatedir=/run; AC_MSG_NOTICE([ --runstatedir defaults to /run])]
)
AC_SUBST([runstatedir])
Try it without an option:
$ ./configure
...
configure: Default --exec-prefix detected.
configure: --bindir defaults to /bin
configure: --sbindir defaults to /sbin
configure: --libdir defaults to /lib64
configure: --runstatedir defaults to /run
the @runstatedir@ should be available since autoconf 2.70
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
but not sure about the option.
For example for Fedora we use:
./configure --build=x86_64-redhat-linux-gnu \
--host=x86_64-redhat-linux-gnu --program-prefix= \
--disable-dependency-tracking --prefix=/usr --exec-prefix=/usr \
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc \
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 \
--libexecdir=/usr/libexec --localstatedir=/var \
--sharedstatedir=/var/lib --mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-systemdsystemunitdir=/usr/lib/systemd/system \
--disable-silent-rules --disable-bfs --disable-pg --enable-chfn-chsh \
--enable-usrdir-path --enable-write --enable-raw --enable-hardlink \
--with-python=3 --with-systemd --with-udev --with-selinux --with-audit \
--with-utempter --disable-makeinstall-chown
and it also defaults to /run because of --localstatedir=/var
> Currently this change can be manually made by setting an environment
> variable, runstatedir=/run when running configure, but is undocumented.
The current default should be already good enough for usual use-cases :-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Suggested changes to util-linux for FHS compliance.
2021-02-15 9:16 ` Karel Zak
@ 2021-02-18 15:37 ` Bruce Dubbs
2021-02-19 11:14 ` Karel Zak
2021-02-19 11:30 ` Karel Zak
1 sibling, 1 reply; 7+ messages in thread
From: Bruce Dubbs @ 2021-02-18 15:37 UTC (permalink / raw)
To: Karel Zak; +Cc: Util-Linux
On 2/15/21 3:16 AM, Karel Zak wrote:
> On Fri, Feb 12, 2021 at 11:04:59AM -0600, Bruce Dubbs wrote:
>> I don't recall if this has come up before, but I suggest a couple of changes
>> to the default util-linux build configuuration:
>>
>> 1. Change the default ADJTIME_PATH to be /var/lib/hwclock/adjtime
>
> Good idea. I'll do that.
Thanks.
Note: Sorry to take so long to reply. We've been without power/internet
for three days in Texas.
>> 2. Change the references to /var/run to just /run or at least add a
>> configure option --runstatedir=<path>.
>
> The current default is /run if --localstatedir is NONE or /var, see
> configure.ac:
>
> # default for old versions without $runstatedir
> AS_IF([test x"$runstatedir" = x], [runstatedir='${localstatedir}/run'])
>
> # our default if $localstatedir unchanged
> AS_CASE([$localstatedir:$runstatedir],
> [NONE:'${localstatedir}/run' | /var:'${localstatedir}/run' | NONE:'/run' ],
> [runstatedir=/run; AC_MSG_NOTICE([ --runstatedir defaults to /run])]
> )
>
> AC_SUBST([runstatedir])
>
>
> Try it without an option:
>
> $ ./configure
> ...
> configure: Default --exec-prefix detected.
> configure: --bindir defaults to /bin
> configure: --sbindir defaults to /sbin
> configure: --libdir defaults to /lib64
> configure: --runstatedir defaults to /run
>
> the @runstatedir@ should be available since autoconf 2.70
> https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
> but not sure about the option.
We have autoconf 2.71, but we are not using it for util-linux. The
standard tarball defaults to [PREFIX/var] for localstatedir and it is
very common to use --prefix=/usr, so that makes using --localstatedir
required if runstatedir=/run is desired.
This is an indirect implied result. Shouldn't it be made explicit?
Perhaps another solution would be to make the default for localstatedir
be /var instead of PREFIX/var.
For now we are just using the environment variable runstatedir=/run.
-- Bruce
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Suggested changes to util-linux for FHS compliance.
2021-02-18 15:37 ` Bruce Dubbs
@ 2021-02-19 11:14 ` Karel Zak
2021-02-19 17:12 ` Bruce Dubbs
0 siblings, 1 reply; 7+ messages in thread
From: Karel Zak @ 2021-02-19 11:14 UTC (permalink / raw)
To: Bruce Dubbs; +Cc: Util-Linux
On Thu, Feb 18, 2021 at 09:37:21AM -0600, Bruce Dubbs wrote:
> Perhaps another solution would be to make the default for localstatedir be
> /var instead of PREFIX/var.
Ah, I see what do you mean.
We do not alter $localstatedir in the configure script at all. This is is
probably the problem you see. For the other directories we default to /bin,
/lib, ... when the default prefix (NONE or /usr) detected.
It seems $localstatedir and $sysconfdir need our care too.
I have committed:
https://github.com/karelzak/util-linux/commit/3d2899651791bcb4ee8fe4e605acc83f3ae3471b
Please, try it. The final summary from ./configure should be also
more verbose about the paths now.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Suggested changes to util-linux for FHS compliance.
2021-02-15 9:16 ` Karel Zak
2021-02-18 15:37 ` Bruce Dubbs
@ 2021-02-19 11:30 ` Karel Zak
2021-03-08 11:21 ` Karel Zak
1 sibling, 1 reply; 7+ messages in thread
From: Karel Zak @ 2021-02-19 11:30 UTC (permalink / raw)
To: Bruce Dubbs; +Cc: Util-Linux
On Mon, Feb 15, 2021 at 10:16:30AM +0100, Karel Zak wrote:
> On Fri, Feb 12, 2021 at 11:04:59AM -0600, Bruce Dubbs wrote:
> > I don't recall if this has come up before, but I suggest a couple of changes
> > to the default util-linux build configuuration:
> >
> > 1. Change the default ADJTIME_PATH to be /var/lib/hwclock/adjtime
>
> Good idea. I'll do that.
Hmm... I remembered now that we have in our TODO:
hwclock
------
- use /var/lib/hwclock/drift to store hw-clock drift numbers.
- use /etc/adjtime as read-only for UTC/LOCAL information only
- the /var/lib/hwclock/drift should be implemented backwardly compatible,
it means use the file only if exists, otherwise follow /etc/adjtime
so maybe the best would be to keep ADJTIME_PATH=/etc/adjtime and use
it as read-only and use ${localstatedir}/lib/hwclock/drift for the
rest.
Note that ADJTIME_PATH is used by more utils, like rtcwake or systemd,
so move it is not so easy.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Suggested changes to util-linux for FHS compliance.
2021-02-19 11:14 ` Karel Zak
@ 2021-02-19 17:12 ` Bruce Dubbs
0 siblings, 0 replies; 7+ messages in thread
From: Bruce Dubbs @ 2021-02-19 17:12 UTC (permalink / raw)
To: Karel Zak; +Cc: Util-Linux
On 2/19/21 5:14 AM, Karel Zak wrote:
> On Thu, Feb 18, 2021 at 09:37:21AM -0600, Bruce Dubbs wrote:
>> Perhaps another solution would be to make the default for localstatedir be
>> /var instead of PREFIX/var.
>
> Ah, I see what do you mean.
>
> We do not alter $localstatedir in the configure script at all. This is is
> probably the problem you see. For the other directories we default to /bin,
> /lib, ... when the default prefix (NONE or /usr) detected.
>
> It seems $localstatedir and $sysconfdir need our care too.
>
> I have committed:
>
> https://github.com/karelzak/util-linux/commit/3d2899651791bcb4ee8fe4e605acc83f3ae3471b
>
> Please, try it. The final summary from ./configure should be also
> more verbose about the paths now.
Thanks Karel. Works for us.
-- Bruce
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Suggested changes to util-linux for FHS compliance.
2021-02-19 11:30 ` Karel Zak
@ 2021-03-08 11:21 ` Karel Zak
0 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2021-03-08 11:21 UTC (permalink / raw)
To: Bruce Dubbs; +Cc: Util-Linux, J William Piggott
On Fri, Feb 19, 2021 at 12:30:12PM +0100, Karel Zak wrote:
> On Mon, Feb 15, 2021 at 10:16:30AM +0100, Karel Zak wrote:
> > On Fri, Feb 12, 2021 at 11:04:59AM -0600, Bruce Dubbs wrote:
> > > I don't recall if this has come up before, but I suggest a couple of changes
> > > to the default util-linux build configuuration:
> > >
> > > 1. Change the default ADJTIME_PATH to be /var/lib/hwclock/adjtime
> >
> > Good idea. I'll do that.
>
> Hmm... I remembered now that we have in our TODO:
>
> hwclock
> ------
> - use /var/lib/hwclock/drift to store hw-clock drift numbers.
> - use /etc/adjtime as read-only for UTC/LOCAL information only
> - the /var/lib/hwclock/drift should be implemented backwardly compatible,
> it means use the file only if exists, otherwise follow /etc/adjtime
>
> so maybe the best would be to keep ADJTIME_PATH=/etc/adjtime and use
> it as read-only and use ${localstatedir}/lib/hwclock/drift for the
> rest.
>
> Note that ADJTIME_PATH is used by more utils, like rtcwake or systemd,
> so move it is not so easy.
OK, I have implemented it, but frankly, I'm not sure about it ;-)
I have added William to CC:, maybe he will come with comments.
See https://github.com/karelzak/util-linux/tree/topic/hwclock-drift-file
branch.
The idea is to keep /etc/adjtime as a source for UTC/LOCAL flag, but
hwclock drift info (which we need to update occasionally) move to
/var/lib/hwclock/drift. The /etc/adjtime is de-facto standard and
move it means that 3rd party utils will have no way how to determine
hwclock UTC/LOCAL mode.
Both files use "adjtime" file format to make it simple to convert
from one to another.
The change should be backwardly compatible. If you do not have /var/lib/hwclock/drift
then it falls back to /etc/adjtime.
I'm not sure if this is not over-engineering. Maybe the current
solution is good enough, and all we need is to make it more
use-friendly to set ADJTIME_PATH for users like Bruce (although
maintain any status information in /etc (in the year 2021) is not
nice.
The another possibility is to make a real change. Introduce completely
new file in /etc (/etc/clockmode) with only UTC/LOCAL(, force all
applications to use it (I know about rtcwake and systemd), and keep
/var/lib/hwclock/drift as private hwclock(1) file in a private format.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-03-08 11:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 17:04 Suggested changes to util-linux for FHS compliance Bruce Dubbs
2021-02-15 9:16 ` Karel Zak
2021-02-18 15:37 ` Bruce Dubbs
2021-02-19 11:14 ` Karel Zak
2021-02-19 17:12 ` Bruce Dubbs
2021-02-19 11:30 ` Karel Zak
2021-03-08 11:21 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).