Bug 2105898

Summary: Removing pulp2 content fails during Upgrade to 6.11 when on dedicated mount points
Product: Red Hat Satellite Reporter: Evgeni Golov <egolov>
Component: Satellite MaintainAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: medium Docs Contact:
Priority: high    
Version: 6.11.0CC: agadhave, ahumbe, apatel, aupadhye, avnkumar, egolov, gscarbor, gtalreja, jjansky, jkrajice, kgaikwad, msunil, osousa, pcfe, pdwyer, peter.vreman, pmendezh, rcavalca, saydas, zhunting
Target Milestone: 6.11.1Keywords: PrioBumpGSS, Triaged, Upgrades
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-1.0.14 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2027567 Environment:
Last Closed: 2022-07-27 17:27:10 UTC Type: ---
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: 2027567    
Bug Blocks:    

Description Evgeni Golov 2022-07-11 06:22:24 UTC
# satellite-maintain upgrade run --target-version 6.11
- Removing pulp2 packages                                                       
\ Removing mongo packages                                                       
\ Removing additional packages                                                 
/ Dropping migration tables                                                     
- Dropping migrations                                                           
| Deleting pulp2 data directories                                     [FAIL]   
Failed executing rm -rf /var/lib/mongodb/, exit status 1:
 rm: cannot remove ‘/var/lib/mongodb/’: Device or resource busy
--------------------------------------------------------------------------------
Scenario [Procedures before migrating to Satellite 6.11] failed.


A viable workaround should be:
1. install f-maintain from 6.10 (0.8.31)
2. explicitly remove pulp2 content: satellite-maintain content remove-pulp2
3. re-run the actuall 6.11 upgrade


+++ This bug was initially created as a clone of Bug #2027567 +++

Description of problem:

After upgrading to 6.10, the remove pulp2 content step fails if one of the directories being removed are dedicated mount points.


Version-Release number of selected component (if applicable):
Satellite 6.10


How reproducible:
Everytime

Steps to Reproduce:
1. Create a 6.9 Satellite with /var/lib/mongodb as a dedicated mount point.
2. Upgrade to 6.10
3. Try removing the pulp2 content:
~~~
# satellite-maintain content remove-pulp2
~~~

Actual results:
The below output is seen:
~~~
Failed executing rm -rf /var/lib/mongodb/, exit status 1:
 rm: cannot remove ‘/var/lib/mongodb/’: Device or resource busy
--------------------------------------------------------------------------------
Scenario [Remove Pulp2 and mongodb packages and data] failed.

The following steps ended up in failing state:

  [pulp-remove]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="pulp-remove"
~~~


Expected results:
Pulp2 content should be removed graciously, check if any of the directories being deleted are dedicated mounts or not. If they are, then delete the contents inside them but not delete the directory itself as that will still be an active mount.

Comment 3 Gaurav Talreja 2022-07-21 09:33:29 UTC
Hi,

Tested upgrade to Satellite 6.11.1 Snap 2.2 from Satellite 6.9.9, with version rubygem-foreman_maintain-1.0.14-1.el7sat.noarch

Steps followed,
1. Prepared Satellite 6.9.9 with /var/lib/mongodb as a dedicated mount point, then upgraded to 6.10.7 
(Also, Tried adding a second pulp directory mount point to /var/cache/pulp.)
2. As "foreman-maintain content remove-pulp2" procedure is now run while upgrading to 6.11
  # foreman-maintain upgrade run --target-version 6.11 --whitelist 'repositories-validate,repositories-setup' 
...
--------------------------------------------------------------------------------
Add maintenance_mode tables/chain to nftables/iptables:               [OK]
--------------------------------------------------------------------------------
Remove pulp2:
/ Removing pulp2 packages
/ Removing mongo packages
| Removing additional packages
- Dropping migration tables
| Dropping migrations
- Deleted: /etc/pki/pulp/content
/var/lib/pulp/published
- The directories /var/lib/mongodb/,/var/cache/pulp are individual mountpoints.
The satellite-maintain won't delete these directories.
You need to remove content and these directories on your own.
\ stopping pulpcore-content
Warning: Stopping pulpcore-api.service, but it can still be activated by:
  pulpcore-api.socket

Warning: Stopping pulpcore-content.service, but it can still be activated by:
  pulpcore-content.socket
/ Done restarting pulpcore services                                   [OK]
--------------------------------------------------------------------------------
...

It seems that instead of fail-upgrading here, the steps above pass in upgrades when there are mount points listed by remove-pulp2 that cannot be deleted. Is this expected?


Thanks,
Gaurav

Comment 4 Evgeni Golov 2022-07-21 09:39:34 UTC
Yes, I think this is in line with what I'd expect.

Comment 6 Gaurav Talreja 2022-07-22 12:44:41 UTC
Ack, Thanks for confirming, I'm marking this BZ as verified

Comment 10 errata-xmlrpc 2022-07-27 17:27:10 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 (Satellite 6.11.1 Async Bug Fix 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:5742