Bug 995158

Summary: acpid: unexpaned rpm macro in post scriptlet
Product: [Fedora] Fedora Reporter: Paulo Andrade <paulo.cesar.pereira.de.andrade>
Component: acpidAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: charles.unix.pro, geslinux, jskarvad, michal, misc, mstevens, mzdunek, tech, ted, travneff
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: acpid-2.0.19-6.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-14 14:24:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paulo Andrade 2013-08-08 16:40:44 UTC
After yum telling me I had two acpid packages installed, and
running:

$ sudo rpm -e --justdb --allmatches acpid
$ sudo yum install acpid

it still failed, because of:

$ rpm -q --scripts acpid
[...]
postinstall scriptlet (using /bin/sh):
%systemd_post acpid.service
preuninstall scriptlet (using /bin/sh):
%systemd_preun acpid.service
postuninstall scriptlet (using /bin/sh):
%systemd_postun_with_restart acpid.service

Looks like a missing build requires (systemd, owner of
/usr/lib/rpm/macros.d/macros.systemd that defines the macro)
providing the proper macros, e.g.:

]$ rpm -E "%systemd_post acpid.service"

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        /usr/bin/systemctl preset acpid.service >/dev/null 2>&1 || : 
fi

Comment 1 Jaroslav Škarvada 2013-08-09 08:58:42 UTC
The macros are provided by systemd package:
$ repoquery --enablerepo=rawhide -ql systemd | grep macros.systemd
/usr/lib/rpm/macros.d/macros.systemd

$ repoquery --enablerepo=rawhide -q systemd
systemd-0:206-2.fc20.x86_64

The main requirement seems to be OK. I fixed the post, preun, postun requirements, which weren't correct. If the problem persists, please let me know.

Fixed in: acpid-2.0.19-4.fc20

Comment 2 Michal Jaegermann 2013-08-13 21:17:01 UTC
(In reply to Jaroslav Škarvada from comment #1)

> 
> Fixed in: acpid-2.0.19-4.fc20

I am afraid that this is not really the case.  Both in acpid-2.0.19-4.fc20 and 
acpid-2.0.19-5.fc20 I see in package scripts:
.....
postinstall scriptlet (using /bin/sh):
%systemd_post acpid.service
preuninstall scriptlet (using /bin/sh):
%systemd_preun acpid.service
postuninstall scriptlet (using /bin/sh):
%systemd_postun_with_restart acpid.service

Moreover, on an update I got in a cleanup phase:

error: acpid-2.0.19-4.fc20.x86_64: erase failed

and after that 'rpm -q acpid' shows:

acpid-2.0.19-4.fc20.x86_64
acpid-2.0.19-5.fc20.x86_64

and this will require cleaning up with '... --noscripts ...'.

Comment 3 Michal Jaegermann 2013-08-13 21:23:35 UTC
Oh, and multiple packages now show similar troubles.  See in particular bug 983760 which claims that this is there at last resolved.  I guess that a mysterious "BR" is supposed to stand for "BuildRequires" but why systemd needs to be present to expand some rpm macros is something which leaves me somewhat baffled.

Comment 4 Jaroslav Škarvada 2013-08-14 08:43:23 UTC
Probably not an acpid issue. The requires are compliant with the guideline:

> Requires(post): systemd
> Requires(preun): systemd
> Requires(postun): systemd
> Requires: systemd

Could you explain how the build time dependency could affect the runtime?

Comment 5 Jaroslav Škarvada 2013-08-14 14:16:15 UTC
This is ugly, the macro is expanded in build time.

Comment 6 Jaroslav Škarvada 2013-08-14 14:23:59 UTC
Thanks for the report, it should be fixed in acpid-2.0.19-6.fc20. The F19 seems to be also affected, backporting there. The problem probably appear by some implicit build dep that was removed.

Comment 7 Michal Jaegermann 2013-08-14 14:31:47 UTC
(In reply to Jaroslav Škarvada from comment #4)
> 
> Could you explain how the build time dependency could affect the runtime?

If this was a question to me then I wrote explicitely "leaves me somewhat baffled".  This was a claim in comments to bug 983760.  If this is correct then some weirdness in a build system, I guess.  Yes, rpm package macros need to be expanded in a build time but for that they only need to be defined at that stage.  Sounds to me like something which should be independent on a presence of systemd itself.

Comment 8 Fedora Update System 2013-08-14 14:34:42 UTC
acpid-2.0.19-6.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/acpid-2.0.19-6.fc19

Comment 9 Jaroslav Škarvada 2013-08-14 14:47:22 UTC
(In reply to Michal Jaegermann from comment #7)
The macro is provided by 'systemd' package. The 'systemd' package was previously required by some package that was implicit dep of the build system (I do not have time to trace it down). This was changed by some recent update. The packaging guidelines are in sync with this change.

Comment 10 Jaroslav Škarvada 2013-08-26 08:07:04 UTC
*** Bug 1000726 has been marked as a duplicate of this bug. ***

Comment 11 Jaroslav Škarvada 2013-08-26 08:08:56 UTC
*** Bug 1000712 has been marked as a duplicate of this bug. ***

Comment 12 Morten Stevens 2013-08-26 11:59:38 UTC
2.0.19-6:

[root@fc19 ~]# rpm -q acpid
acpid-2.0.19-5.fc19.x86_64
[root@fc19 ~]# yum remove acpid
Resolving Dependencies
--> Running transaction check
---> Package acpid.x86_64 0:2.0.19-5.fc19 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch            Version                 Repository         Size
================================================================================
Removing:
 acpid          x86_64          2.0.19-5.fc19           @updates          145 k

Transaction Summary
================================================================================
Remove  1 Package

Installed size: 145 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
/var/tmp/rpm-tmp.AUCo07: line 1: fg: no job control
error: %preun(acpid-2.0.19-5.fc19.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package acpid-2.0.19-5.fc19.x86_64
  Verifying  : acpid-2.0.19-5.fc19.x86_64                                   1/1

Failed:
  acpid.x86_64 0:2.0.19-5.fc19

Comment 13 Morten Stevens 2013-08-26 12:04:46 UTC
The update to 2.0.19-6 also fails:

[root@fc19 ~]# yum update acpid
updates-testing/19/x86_64/metalink                       |  27 kB     00:00
updates-testing                                          | 4.6 kB     00:00
(1/2): updates-testing/19/x86_64/group_gz                  | 385 kB   00:00
(2/2): updates-testing/19/x86_64/primary_db                | 991 kB   00:00
(1/2): updates-testing/19/x86_64/updateinfo                | 418 kB   00:00
(2/2): updates-testing/19/x86_64/pkgtags                   | 497 kB   00:00
Resolving Dependencies
--> Running transaction check
---> Package acpid.x86_64 0:2.0.19-5.fc19 will be updated
---> Package acpid.x86_64 0:2.0.19-6.fc19 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package      Arch          Version                Repository              Size
================================================================================
Updating:
 acpid        x86_64        2.0.19-6.fc19          updates-testing         68 k

Transaction Summary
================================================================================
Upgrade  1 Package

Total download size: 68 k
Is this ok [y/d/N]: y
Downloading packages:
acpid-2.0.19-6.fc19.x86_64.rpm                             |  68 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : acpid-2.0.19-6.fc19.x86_64                                   1/2
/var/tmp/rpm-tmp.8P7Woy: line 1: fg: no job control
error: %preun(acpid-2.0.19-5.fc19.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package acpid-2.0.19-5.fc19.x86_64
  Verifying  : acpid-2.0.19-6.fc19.x86_64                                   1/2
  Verifying  : acpid-2.0.19-5.fc19.x86_64                                   2/2

Updated:
  acpid.x86_64 0:2.0.19-6.fc19

Failed:
  acpid.x86_64 0:2.0.19-5.fc19

It is now installed twice?

[root@fc19 ~]# rpm -q acpid
acpid-2.0.19-5.fc19.x86_64
acpid-2.0.19-6.fc19.x86_64

Comment 14 Morten Stevens 2013-08-26 12:20:36 UTC
Update:
2.0.19-6 works fine on a clean install. It's only a problem during the update from 2.0.19-5 to 2.0.19-6.

Comment 15 Jaroslav Škarvada 2013-08-26 12:30:18 UTC
Sorry for the inconvenience, you need to use rpm with --noscripts to get rid of the 2.0.19-5. It's a pity it was not caught by the QE, it was in the testing for week or more.

Comment 16 Fedora Update System 2013-08-26 22:28:49 UTC
acpid-2.0.19-6.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Jaroslav Škarvada 2013-08-28 12:01:02 UTC
*** Bug 1001785 has been marked as a duplicate of this bug. ***

Comment 18 Marek Zdunek 2013-09-30 15:38:13 UTC
today's problem with updating:

  Czyszczenie              : acpid.x86_64                                                                                                                                             378/394 
/var/tmp/rpm-tmp.HJp543: line 1: fg: brak kontroli zadań
error: %preun(acpid-2.0.19-5.fc19.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package acpid
  Czyszczenie              : zeromq3-3.2.3-1.fc19.x86_64                                                                                                                              379/394 
error: acpid-2.0.19-5.fc19.x86_64: erase failed
  Czyszczenie              : nscd.x86_64                                                                                                                                              380/394 
/var/tmp/rpm-tmp.OSGm9F: line 1: fg: brak kontroli zadań
error: %preun(nscd-2.17-13.fc19.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package nscd
  Czyszczenie              : 2:microcode_ctl-2.0-4.fc19.x86_64                                                                                                                        381/394 
error: nscd-2.17-13.fc19.x86_64: erase failed

rpm -qa | grep acpid
acpid-2.0.19-5.fc19.x86_64
acpid-2.0.20-1.fc19.x86_64

also nscd stills there

Comment 19 Marek Zdunek 2013-09-30 15:52:19 UTC
ok I found solution in rbz1001785 

rpm -e --noscripts acpid-2.0.19-5
rpm -e --noscripts nscd-2.17-13.fc19.x86_64

Comment 20 Grzegorz Witkowski 2013-10-06 21:39:39 UTC
[root@aspire ~]# yum check
Loaded plugins: langpacks, refresh-packagekit
acpid-2.0.20-1.fc19.x86_64 is a duplicate with acpid-2.0.19-5.fc19.x86_64
[root@aspire ~]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 19 (Schrödinger’s Cat)
Release:	19
Codename:	Schrödinger’sCat
[root@aspire ~]# uname -a
Linux aspire.localdomain 3.10.11-200.fc19.x86_64 #1 SMP Mon Sep 9 13:03:01 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@aspire ~]

Comment 21 Jaroslav Škarvada 2013-10-30 08:42:45 UTC
*** Bug 1001398 has been marked as a duplicate of this bug. ***

Comment 22 Jaroslav Škarvada 2014-02-10 13:21:58 UTC
*** Bug 1058369 has been marked as a duplicate of this bug. ***