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 2048023

Summary: uninstalling nfs-utils shows remove failed: No such file or directory
Product: Red Hat Enterprise Linux 9 Reporter: Jiri Jaburek <jjaburek>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: xzhou
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-utils-2.5.4-15.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 11:22:03 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 Jiri Jaburek 2022-01-29 04:30:17 UTC
Description of problem:

When I try to "dnf remove nfs-utils", I see:

Running transaction
  Preparing        :                                                        1/1 
  Running scriptlet: nfs-utils-1:2.5.4-9.el9.x86_64                         1/1 
Removed /etc/systemd/system/multi-user.target.wants/nfs-client.target.
Removed /etc/systemd/system/remote-fs.target.wants/nfs-client.target.

  Erasing          : nfs-utils-1:2.5.4-9.el9.x86_64                         1/1 
warning: file /var/lib/nfs/v4recovery: remove failed: No such file or directory
warning: file /var/lib/nfs/statd/sm.bak: remove failed: No such file or directory
warning: file /var/lib/nfs/statd/sm: remove failed: No such file or directory
warning: file /var/lib/nfs/statd: remove failed: No such file or directory
warning: directory /var/lib/nfs/rpc_pipefs: remove failed: Device or resource busy


This is likely printed by rpm trying to find files packaged by nfs-utils (in %files) and failing to do so because a preuninstall scriptlet removed them already:

preuninstall scriptlet (using /bin/sh):
if [ $1 -eq 0 ]; then
  ...
    rm -rf /var/lib/nfs/statd
    rm -rf /var/lib/nfs/v4recovery
fi


The cleanest fix for this I can think of is to 'rm -rf' only any extra contents of the directories and leave the packaged files alone,

# rpm -ql nfs-utils | grep /var/lib/nfs/
/var/lib/nfs/etab
/var/lib/nfs/rmtab
/var/lib/nfs/rpc_pipefs
/var/lib/nfs/statd
/var/lib/nfs/statd/sm
/var/lib/nfs/statd/sm.bak
/var/lib/nfs/statd/state
/var/lib/nfs/v4recovery

to be removed by rpm(8) through regular erase logic.

If there are no extra contents / files expected, then getting rid of the 'rm -rf' statements is probably the way to go.

Alternatively, if they are runtime-created, do not package these files and only %ghost them, so they belong to nfs-utils, but are not actually touched during installation/removal.


Version-Release number of selected component (if applicable):
nfs-utils-2.5.4-9.el9

Comment 1 Yongcheng Yang 2022-01-29 08:49:06 UTC
Thanks for this bug!

We used to fix the same issue in rhel8 by moving that removal (from %preun) into %postun scriplet.
See https://bugzilla.redhat.com/show_bug.cgi?id=1733170#c12

Anyway it's a fixable issue.

Comment 4 Yongcheng Yang 2022-08-19 09:17:19 UTC
Verified in nfs-utils-2.5.4-15.el9

[root@fsqe-r430-02 ~]# rpm -q nfs-utils
nfs-utils-2.5.4-15.el9.x86_64
[root@fsqe-r430-02 ~]# rpm -e nfs-utils
Removed /etc/systemd/system/multi-user.target.wants/nfs-client.target.
Removed /etc/systemd/system/remote-fs.target.wants/nfs-client.target.
[root@fsqe-r430-02 ~]# rpm -q nfs-utils
package nfs-utils is not installed
[root@fsqe-r430-02 ~]#

Comment 8 errata-xmlrpc 2022-11-15 11:22:03 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-2022:8376