[cooker] Updated chrony package will not install

(Ben Bullard) #1

I’m attempting to learn how to update
packages. Got a list of some contrib/unsupported packages that
are not up to date. One such package was chrony so I updated it
to V. 3.4 but it will not install. I wonder if I missed
something that needed changing in Github? Or did I do something
else wrong? Here’s cli output:

# dnf install chrony

  Last metadata expiration check: 0:15:45 ago on Mon 18 Mar 2019

05:49:39 PM CDT.

  Dependencies resolved.
0 Likes

(Ben Bullard) #2

Obviously I don’t know how to post the
code in an e-mail in a way that will show up in Discourse…

1 Like

(Bero) #3

"fg: no job control" is almost always caused by a bad rpm macro -- an undefined macro (%xyz) being used in a %post/%postun/... script is expanded to a literal "%xyz" in the script, which in turn is interpreted as job control by bash.

The usual cause of this in packages that work when built locally is that a macro is defined by a different package (quite frequently spec-helper or rpm-helper) that isn't installed into the build environment by default (fix: add a BuildRequires: in the spec file).

In the particular case of chrony, we have this:
%pre
%_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin
%post
%systemd_post chronyd.service

%preun
%systemd_preun chronyd.service

%postun
%systemd_postun_with_restart chronyd.service

So let's see where the macros come from:
$ grep -r _pre_useradd /usr/lib/rpm /etc/rpm
/etc/rpm/macros.d/rpm-helper.macros:%_pre_useradd() %_add_user_helper %{name} $1 %{1} %{2} %{3} \
$ grep -r systemd_post /usr/lib/rpm /etc/rpm
/usr/lib/rpm/macros.d/macros.systemd:%systemd_post() \

So in order to fix it, we need to make sure that /etc/rpm/macros.d/rpm-helper.macros and /usr/lib/rpm/macros.d/macros.systemd are installed.

$ rpm -qf /etc/rpm/macros.d/rpm-helper.macros /usr/lib/rpm/macros.d/macros.systemd
rpm-helper-0.24.17-9.noarch
systemd-macros-240.20190211-6.x86_64

So in order to fix that package, add
BuildRequires: rpm-helper
BuildRequires: systemd-macros

But actually, there's another problem here (though not as clearly visible) -- systemd_post, systemd_preun and friends are obsolete and have been replaced with file triggers (they're now run automatically, no need to call them). So the proper fix is to add only
BuildRequires: rpm-helper
(%_pre_useradd is still needed)
and delete all calls to %systemd_post and friends.

ttyl
bero

0 Likes

(Ben Bullard) #4

Thanks Bero. I’ve got a ways to go before
I understand half of what you wrote but I did make suggested
changes to chrony and now V. 3.4-2 installs here on x86_64
system.

0 Likes