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 1733170

Summary: [rhel8] nfs-utils warning when package removed: file /var/lib/nfs/statd: remove failed: No such file or directory
Product: Red Hat Enterprise Linux 8 Reporter: Yongcheng Yang <yoyang>
Component: nfs-utilsAssignee: Alice Mitchell <ajmitchell>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.0CC: ajmitchell, steved, swhiteho, tdawson, xzhou
Target Milestone: rcKeywords: Patch
Target Release: 8.4Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-2.3.3-36.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1377649 Environment:
Last Closed: 2021-05-18 15:04:48 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: 1377649    
Bug Blocks:    
Attachments:
Description Flags
Patch to cleanup the warnings none

Comment 3 Troy Dawson 2020-03-13 15:33:52 UTC
I'm so sorry for not getting to this before.
It must have came in the middle of a bunch of other bugzilla's and I just went by it without looking.

The problem is with the %preun section of the spec file.
In there you are doing
    rm -rf /var/lib/nfs/statd
    rm -rf /var/lib/nfs/v4recovery

And yet in your %files section you have

%dir %{_sharedstatedir}/nfs/v4recovery
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm.bak

So, when it get's to the files section, it gives a non-fatal error.  It's trying to remove files that you have already removed manually.
My suggestion, don't remove files in %preun.  If you need to, don't do such a wide deletion.  Maybe something like
    rm -rf /var/lib/nfs/v4recovery/*

The last line
warning: directory /var/lib/nfs/rpc_pipefs: remove failed: Device or resource busy

Sounds like some service was not turned off before uninstalling.
Looking at the %preun script, I believe it is sortof right in the spec file, but there must be a bug in the %systemd_preun macro.
This is what actually is in the %preun script.
# rpm -q --scripts nfs-utils
...
if [ $1 -eq 0 ] ; then 
        # Package removal, not upgrade 
        systemctl --no-reload disable nfs-server.server > /dev/null 2>&1 || : 
        systemctl stop nfs-server.server > /dev/null 2>&1 || : 
fi 
...

That is trying to stop nfs-server.server not nfs-server.service
If you try doing the script by hand you get

# systemctl stop nfs-server.server
Failed to stop nfs-server.server.service: Unit nfs-server.server.service not loaded.
# systemctl status nfs-server.server
Unit nfs-server.server.service could not be found.

But if you switch it to nfs-server.service you get
# systemctl stop nfs-server.service
# systemctl status nfs-server.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead)


I hope this helps.

Comment 8 Alice Mitchell 2020-08-17 16:44:55 UTC
As I assume the intention here is to ensure this directory and its contents are always removed, either the %preun commands should be modified to empty the directory whilst leaving the actually directory there for %files to clean up, or simply move the cleanup to %postun

Comment 12 Alice Mitchell 2020-10-12 13:38:12 UTC
Created attachment 1720966 [details]
Patch to cleanup the warnings

Moving the directory removal into %postun scriplet ensures that cleanup happens but doesnt trigger the warnings

Comment 14 Alice Mitchell 2020-10-15 16:21:08 UTC
I don't think it will cause an issue as both the %preun and %postun try to stop the same service, and it doesn't generate any errors or warnings that I can see. there is probably scope to clean that up however

Comment 15 Yongcheng Yang 2020-10-19 04:40:45 UTC
Thanks for the explanation.

I'm marking this as "Tested" and feel free to add it into 8.4.0 nfs-utils erratum.

Comment 18 Yongcheng Yang 2020-12-01 12:02:25 UTC
Moving to VERIFIED based on comment #14

[root@rhel-8-4-latest ~]# rpm -q nfs-utils
nfs-utils-2.3.3-36.el8.x86_64
[root@rhel-8-4-latest ~]# rpm -e nfs-utils
warning: directory /var/lib/nfs/rpc_pipefs: remove failed: Device or resource busy
[root@rhel-8-4-latest ~]# rpm -q nfs-utils
package nfs-utils is not installed
[root@rhel-8-4-latest ~]#

Comment 20 errata-xmlrpc 2021-05-18 15:04:48 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 (nfs-utils bug fix and enhancement update), 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-2021:1669