Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 835461

Summary: net-misc/dhcpcd-9.4.0-r1 NTP server hook for net-misc/chrony-4.2 looks for config file in wrong place
Product: Gentoo Linux Reporter: Christopher Head <bugs>
Component: Current packagesAssignee: William Hubbs <williamh>
Status: RESOLVED FIXED    
Severity: normal CC: base-system, jstein, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Christopher Head 2022-03-17 04:51:18 UTC
DHCPCD ships with /lib/dhcpcd/dhcpcd-hooks/50-ntp.conf, whose purpose is to take NTP servers from the DHCP reply and communicate that information to the system local NTP client. When deciding which config file to update and what kind of NTP client is running, it looks for the following list of config files:

: ${ntp_confs:=ntp.conf ntpd.conf chrony.conf}

in the following list of directories:

: ${ntp_conf_dirs=/etc /usr/pkg/etc /usr/local/etc}

Unfortunately, Chrony in Gentoo installs its config file at /etc/chrony/chrony.conf, not /etc/chrony.conf, so DHCPCD does not find it and falls back to the default of assuming you are running NTPD instead.

To add further annoyance, I could simply have added “-e NTP_CONF=/etc/chrony/chrony.conf” to the dhcpcd invocation, except that /etc/init.d/dhcpcd doesn’t have a variable for adding extra user-specified command-line parameters in /etc/conf.d (and setting command_args in the conf.d file, at least in my experiments, did not appear to work).

Reproducible: Always




Portage 3.0.30 (python 3.9.9-final-0, default/linux/amd64/17.1, gcc-11.2.1, glibc-2.33-r13, 5.15.26-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.15.26-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-glibc2.33
KiB Mem:    16343464 total,   5110464 free
KiB Swap:   12362176 total,  12362176 free
Head commit of repository steam-overlay: 666f40522a6d5c20dc411423c5fd44431b978e1b

Timestamp of repository gentoo: Wed, 16 Mar 2022 01:49:29 +0000
Head commit of repository gentoo: d1f4eeebbdc6d163e7da8685cfdbca55b89bfa7d

sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p2) 2.37
ccache version 4.5.1 [disabled]
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.34.0-r6::gentoo
dev-lang/python:           3.8.12_p2::gentoo, 3.9.9-r1::gentoo, 3.10.2_p1::gentoo
dev-lang/rust:             1.58.1::gentoo
dev-util/ccache:           4.5.1::gentoo
dev-util/cmake:            3.22.2::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.7-r3::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.25::gentoo
sys-devel/autoconf:        2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.4::gentoo
sys-devel/binutils:        2.37_p1-r2::gentoo
sys-devel/binutils-config: 5.4::gentoo
sys-devel/clang:           10.0.1::gentoo, 13.0.1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/lld:             13.0.1::gentoo
sys-devel/llvm:            10.0.1::gentoo, 13.0.1::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.33-r13::gentoo
Repositories:

steam-overlay
    location: /var/cache/repos/steam
    sync-type: git
    sync-uri: https://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 1

gentoo
    location: /var/cache/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    sync-user: chead
    priority: 3
    sync-git-verify-commit-signature: true

Installed sets: @admin, @desktop, @dev, @emulation, @foldingathome, @fonts, @games, @media, @net, @ocwasm, @office, @vim, @web, @xfce
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE freedist"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs 4 --load-average 8 --with-bdeps y --complete-graph y -1"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
GENTOO_MIRRORS="http://gentoo.gossamerhost.com/ ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles http://gentoo.osuosl.org/"
INSTALL_MASK="/sbin/installkernel"
LANG="en_CA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="--jobs 4 --load-average 8"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/cache"
RUSTFLAGS="-C target-cpu=native"
SHELL="/bin/bash"
USE="X acl amd64 brotli bzip2 cairo caps cli cups dbus dri elogind ffmpeg flac fontconfig fortran gnome-keyring gtk iconv icu idn ipv6 joystick jpeg libglvnd libnotify libsamplerate libtirpc lto multilib ncurses nls nptl ogg opengl openmp opus pam pcre png policykit pulseaudio readline seccomp split-usr ssl startup-notification svg theora threads tiff truetype udev unicode v4l vaapi vdpau vorbis vulkan webp xattr xfce_plugins_logout xfce_plugins_menu xinerama xscreensaver xv xvmc zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx popcnt sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-CA" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

net-misc/chrony-4.2::gentoo was built with the following:
USE="caps cmdmon ipv6 nettle ntp nts rtc seccomp sechash -debug (-html) -libedit -libtomcrypt -nss -phc -pps -refclock -samba (-selinux) -verify-sig" ABI_X86="(64)"


net-misc/dhcpcd-9.4.0-r1::gentoo was built with the following:
USE="embedded ipv6 privsep udev -debug" ABI_X86="(64)"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms sign strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
Comment 1 William Hubbs gentoo-dev 2022-03-18 06:00:05 UTC
@Sam:
Do you know why we install chrony.conf in /etc/chrony instead of /etc?
I looked at the chrony ebuild and didn't see a reason for this.

Thanks,

William
Comment 2 Mike Gilbert gentoo-dev 2022-03-18 17:05:24 UTC
(In reply to William Hubbs from comment #1)

This dates back to when the package was added in 2002.

https://gitweb.gentoo.org/archive/repo/gentoo-2.git/commit/?id=27bd7e317f720113cc10b017bb02275370628c7d
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-22 01:49:44 UTC
(In reply to William Hubbs from comment #1)
> @Sam:
> Do you know why we install chrony.conf in /etc/chrony instead of /etc?
> I looked at the chrony ebuild and didn't see a reason for this.
> 
> Thanks,
> 
> William

I'm fine with moving it as long as we install a compat symlink. Could you give a patch?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-18 22:46:48 UTC
It's too awkward to really move out of the directory, so let's instead symlink the /etc/chrony.conf file to inside.
Comment 5 Larry the Git Cow gentoo-dev 2023-01-18 22:52:10 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bccc7ae446ae4f100cdd87227a636541769ecde6

commit bccc7ae446ae4f100cdd87227a636541769ecde6
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-18 22:51:00 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-18 22:51:40 +0000

    net-misc/chrony: install chronyd.conf symlink
    
    It's easier to just install a symlink from /etc/chronyd.conf -> /etc/chrony/chronyd.conf
    than move the directory out and cause disruption for users.
    
    Needed for alignment with other distros but also because dhcpcd looks there
    for its ntp hook.
    
    Closes: https://bugs.gentoo.org/835461
    Signed-off-by: Sam James <sam@gentoo.org>

 net-misc/chrony/chrony-4.3-r3.ebuild | 264 +++++++++++++++++++++++++++++++++++
 net-misc/chrony/chrony-9999.ebuild   |   6 +-
 2 files changed, 269 insertions(+), 1 deletion(-)
Comment 6 Larry the Git Cow gentoo-dev 2023-01-18 22:55:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=623c01dffa7caefbea2909dbba4c7ed32fd589c3

commit 623c01dffa7caefbea2909dbba4c7ed32fd589c3
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-18 22:52:38 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-18 22:54:38 +0000

    net-misc/chrony: chrony.conf, not chronyd.conf
    
    Bug: https://bugs.gentoo.org/835461
    Fixes: bccc7ae446ae4f100cdd87227a636541769ecde6
    Signed-off-by: Sam James <sam@gentoo.org>

 net-misc/chrony/{chrony-4.3-r3.ebuild => chrony-4.3-r4.ebuild} | 2 +-
 net-misc/chrony/chrony-9999.ebuild                             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)