Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2000477

Summary: rpm -V setup fail on /var/log/lastlog
Product: Red Hat Enterprise Linux 9 Reporter: Vojtech Eichler <veichler>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: Vojtech Eichler <veichler>
Severity: high Docs Contact:
Priority: medium    
Version: 9.0CC: anderpups, djez, dsilakov, dtardon, fkrska, fsumsal, itewksbu, jamacku, jcastran, kzak, msekleta, paygupta, rmetrich, rskvaril, sbarcomb, sgardner, systemd-maint-list, systemd-maint
Target Milestone: rcKeywords: TestCaseNeeded, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: util-linux-2.37.3-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1798685 Environment:
Last Closed: 2022-05-17 16:04:52 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:
Bug Depends On: 1699310, 1798685, 2044984    
Bug Blocks:    

Comment 1 Denis Silakov 2022-01-17 09:17:26 UTC
This issue actually comes from systemd and its tmpfiles tmpfiles.d/var.conf. It resets ownership and permissions for /var/log/lastlog as well as for /var/log/btmp (so the latter become inconsistent with what is specified in the %files section in systemd.spec).

Comment 2 Karel Zak 2022-02-01 15:11:33 UTC
@jamacku please, how exactly is necessary to change util-linux.spec to be compatible with recent setup and systems changes?

Now there is 

%install
touch ${RPM_BUILD_ROOT}/var/log/lastlog
chmod 0644 ${RPM_BUILD_ROOT}/var/log/lastlog

%post           
# only for minimal buildroots without /var/log
[ -d /var/log ] || mkdir -p /var/log
touch /var/log/lastlog
chown root:root /var/log/lastlog
chmod 0644 /var/log/lastlog
# Fix the file context, do not use restorecon
if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
        SECXT=$( /usr/sbin/matchpathcon -n /var/log/lastlog 2> /dev/null )
        if [ -n "$SECXT" ]; then
                # Selinux enabled, but without policy? It's true for buildroots
                # without selinux stuff on host machine with enabled selinux.
                # We don't want to use any RPM dependence on selinux policy for
                # matchpathcon(2). SELinux policy should be optional.
                /usr/bin/chcon "$SECXT"  /var/log/lastlog >/dev/null 2>&1 || :
        fi      
fi              

%files
%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog

Comment 3 David Tardon 2022-02-01 18:24:56 UTC
@kzak See bug 2044592.

Comment 4 Jan Macku 2022-02-02 08:15:32 UTC
@kzak based on @zjedrzej PR https://src.fedoraproject.org/rpms/util-linux/pull-request/10 I suppose, that change in util-linux spec file is required.

Comment 5 Karel Zak 2022-02-02 10:15:26 UTC
(In reply to Jan Macku from comment #4)
> @kzak based on @zjedrzej PR
> https://src.fedoraproject.org/rpms/util-linux/pull-request/10 I suppose,
> that change in util-linux spec file is required.

Oops, I've completely missed Zbyszek's PR. Sorry

Comment 11 errata-xmlrpc 2022-05-17 16:04:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: util-linux), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:4082