Red Hat Satellite engineering is moving the tracking of its product development work on Satellite 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 "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. 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 "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-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 1717731 - katello-remove failed to remove '/var/cache/pulp' because it is a mounted directory.
Summary: katello-remove failed to remove '/var/cache/pulp' because it is a mounted dir...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.6.0
Assignee: Chris Roberts
QA Contact: Devendra Singh
URL: https://projects.theforeman.org/issue...
Whiteboard:
Depends On:
Blocks: 1796615
TreeView+ depends on / blocked
 
Reported: 2019-06-06 03:21 UTC by Hao Chang Yu
Modified: 2024-06-13 22:08 UTC (History)
6 users (show)

Fixed In Version: katello-3.12.0-2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1796615 (view as bug list)
Environment:
Last Closed: 2019-10-22 19:51:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27186 0 Normal Closed katello-remove failed to remove '/var/cache/pulp' because it is a mounted directory 2020-10-30 18:31:21 UTC
Red Hat Knowledge Base (Solution) 4207341 0 None None None 2019-06-07 15:29:41 UTC

Description Hao Chang Yu 2019-06-06 03:21:12 UTC
Description of problem:

# katello-remove -y

Starting removal

Stopping services

Removing RPMs

Cleaning up configuration files

Cleaning up log files

Cleaning up certs

Cleaning up content
/usr/share/ruby/fileutils.rb:1433:in `rmdir': Device or resource busy - /var/cache/pulp (Errno::EBUSY)
        from /usr/share/ruby/fileutils.rb:1433:in `block in remove_dir1'
        from /usr/share/ruby/fileutils.rb:1444:in `platform_support'
        from /usr/share/ruby/fileutils.rb:1432:in `remove_dir1'
        from /usr/share/ruby/fileutils.rb:1425:in `remove'
        from /usr/share/ruby/fileutils.rb:770:in `block in remove_entry'
        from /usr/share/ruby/fileutils.rb:1477:in `block (2 levels) in postorder_traverse'
        from /usr/share/ruby/fileutils.rb:1481:in `postorder_traverse'
        from /usr/share/ruby/fileutils.rb:1476:in `block in postorder_traverse'
        from /usr/share/ruby/fileutils.rb:1475:in `each'
        from /usr/share/ruby/fileutils.rb:1475:in `postorder_traverse'
        from /usr/share/ruby/fileutils.rb:768:in `remove_entry'
        from /usr/share/ruby/fileutils.rb:626:in `block in rm_r'
        from /usr/share/ruby/fileutils.rb:622:in `each'
        from /usr/share/ruby/fileutils.rb:622:in `rm_r'
        from /sbin/katello-remove:188:in `remove'
        from /sbin/katello-remove:231:in `<main>'


This following bugzilla doesn't fix the issue completely.

# katello-remove does not completely remove data on mounted filesystems
https://bugzilla.redhat.com/show_bug.cgi?id=1574257


I think the issue is in the codes below. It only checks whether "/var/cache" is a mounted directory or not, but it doesn't take the sub directories of "/var/cache/" into consideration.

# katello-remove
------------------------------
<snip>

CONTENT.map! do |dir|
  if File.readlines('/proc/mounts').any? { |line| line.split(' ')[1] =~ /#{dir}$/ }
    dir + '/*'
  else
    dir
  end
end

<snip>
-----------------------------

I think what it should do are:
1) Loop into the subdirectories of "/var/cache".
2) If any sub directory is a mounted directory then append it to the MOUNTS array.
3) If no mounted sub directories found in it then simply rm "/var/cache/*"

Comment 5 Jerry Williams 2019-06-07 14:40:38 UTC
There are more problems that just "/var/cache".
If for example you have a mounted file system "/var/log/candlepin" or "/var/log/httpd" it aborts and doesn't finish the cleanup and at that point katello-remove is also gone, so the only option to run it again is to reinstall katello-common.

It also might be nice to have an option like --real-clean, that would remove all the rpms in rhel-7-server-satellite-6*, or rhel-7-server-satellite-maintenance-6-rpms or rhel-server-rhscl-7-rpms.  Or even remove anything that isn't @base for the OS. --super-clean.

Comment 7 Devendra Singh 2019-08-30 14:17:57 UTC
This bug has successfully verified in 6.6.0 Snap17.

Katello-remove command executed successfully.
# katello-remove -y

Starting removal

Stopping services

Removing RPMs

Cleaning up configuration files

Cleaning up log files

Cleaning up certs

Cleaning up content

Finished

Comment 8 Bryan Kearney 2019-10-22 19:51:46 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, 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/RHSA-2019:3172

Comment 9 patalber 2020-01-27 16:23:25 UTC
Hi Team,

I have a customer that wishes for this to be re-opened and a few code changes made which worked for him and may work for others. I will upload his code to this bugzilla.

Thank you.

--Patrick

Comment 11 Bryan Kearney 2020-01-27 20:08:57 UTC
Can you please open a new bug with this requests. Once the bug has been released via an errtaa, we can not re-open it.

-- bk


Note You need to log in before you can comment on or make changes to this bug.