Bug 1790886

Summary: ipa-client-automount fails after repeated installation/uninstallation
Product: Red Hat Enterprise Linux 8 Reporter: Sergey Orlov <sorlov>
Component: ipaAssignee: Thomas Woerner <twoerner>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: abokovoy, amore, fcami, ksiddiqu, pasik, pcech, rcritten, tscherf
Target Milestone: rcKeywords: Regression, TestCaseProvided
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-server-4.8.4-6.module+el8.2.0+5773+68ace8c5.x86_64 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1796989 (view as bug list) Environment:
Last Closed: 2020-04-28 15:44:43 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: 1796989    
Bug Blocks:    

Description Sergey Orlov 2020-01-14 13:27:14 UTC
Description of problem:
If you repeatedly install and uninstall automount using ipa-client-automount, installation stops working.

Version-Release number of selected component (if applicable):
# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.2 Beta (Ootpa)

# rpm -q ipa-client
ipa-client-4.8.4-2.module+el8.2.0+5265+c70de5c4.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Execute commands:
ipa-client-automount --location default -U; echo $?
ipa-client-automount --uninstall -U; echo $?
ipa-client-automount --location default -U; echo $?
ipa-client-automount --uninstall -U; echo $?
ipa-client-automount --location default -U; echo $?


Actual results:
...
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
An automount location is already configured
3

Expected results:
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
0

Additional info:

The bug is not present in 
 - RHEL8.1 (release RHEL-8.1.0-20191015.0, ipa-client-4.8.0-11.module+el8.1.0+4247+9f3fd721.x86_64)
 - Fedora 30 (freeipa-client-4.8.3-1.fc30.x86_64) 

Full output of reproducer script:
[root@master1 vagrant]# ipa-client-automount --location default -U; echo $?
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
0
[root@master1 vagrant]# ipa-client-automount --uninstall -U; echo $?
Restoring configuration
0
[root@master1 vagrant]# ipa-client-automount --location default -U; echo $?
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
0
[root@master1 vagrant]# ipa-client-automount --uninstall -U; echo $?
Restoring configuration
0
[root@master1 vagrant]# ipa-client-automount --location default -U; echo $?
Searching for IPA server...
IPA server: DNS discovery
Location: default
Configured /etc/idmapd.conf
An automount location is already configured
3

Comment 1 anuja 2020-01-27 08:18:08 UTC
Also downstream bash:ipa-clirent-automount is failing.
Adding regression label.

Comment 2 François Cami 2020-01-28 12:35:45 UTC
Taking for investigation.

Comment 3 François Cami 2020-01-30 12:45:33 UTC
This is due to ipa-client-automount not removing the following line from sssd.conf:

ipa_automount_location = default

Removing this line and launching "ipa-client-automount --location default -U" works.

Comment 4 François Cami 2020-01-30 17:14:29 UTC
The issue (ipa_automount_location configuration entry not removed from sssd.conf) is also present upstream.

The following patch fixes it on my RHEL 8.2 Beta test system:

diff --git a/ipaclient/install/ipa_client_automount.py b/ipaclient/install/ipa_client_automount.py
index 3ef257a43..fdf974d0d 100644
--- a/ipaclient/install/ipa_client_automount.py
+++ b/ipaclient/install/ipa_client_automount.py
@@ -355,9 +355,10 @@ def uninstall(fstore, statestore):
                         continue
                     if provider == "ipa":
                         domain.remove_option('ipa_automount_location')
+                        sssdconfig.save_domain(domain)
                         domain.remove_provider('autofs')
+                        sssdconfig.save_domain(domain)
                         break
-                sssdconfig.save_domain(domain)
                 sssdconfig.write(paths.SSSD_CONF)
                 sssd = services.service('sssd', api)
                 sssd.restart()

Switching to ASSIGNED. This requires adapting ipatests properly.

Comment 6 François Cami 2020-01-31 17:08:17 UTC
Cloned to SSSD because a fix to https://bugzilla.redhat.com/show_bug.cgi?id=1796989 would fix the issue for IPA.

Still:
* applying the above diff makes sense for multiple domains
* tests should be adapted to avoid future regressions
hence keeping this bug open.

Comment 7 François Cami 2020-02-07 15:43:43 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/8190

Comment 15 anuja 2020-02-24 12:12:45 UTC
Verified using version:
ipa-server-4.8.4-6.module+el8.2.0+5773+68ace8c5.x86_64

As this is regression logged using existing test-suites :
upstream:test_nfs.py and downstream:bash:ipa-client-automount

Adding test-report logs:
==============================================================================
downstream:bash:ipa-client-automount
==============================================================================
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h] ====================================== Final Report =======================================
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]             Test Date: Fri Feb 21 19:38:02 EST 2020         
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]                Total : [57]       
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]                Passed: [57]        
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]                Failed: [0]        
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]            Unfinished: [0]  
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]                Abort : [0]       
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]                Crash : [0]     
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]  +-----------------------------[RPMs & OS: [RedHat - x86_64]-----------------------------+
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h] |       ipa-client-4.8.4-6.module+el8.2.0+5773+68ace8c5.x86_64
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h] |       ipa-client-common-4.8.4-6.module+el8.2.0+5773+68ace8c5.noarch
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h] |       sssd-ipa-2.2.3-16.el8.x86_64
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h] ------------------------------------------------------------------------------------------
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]  +-----------------------------------------------------------------------------------------+
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]      Test:[/ipa-server/rhel80/ipa-client-automount/root]: [ Pass(57/57): 100% ] 
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]  +-----------------------------------------------------------------------------------------+
2020-02-22T00:38:04 [ci-vm-10-0-155-140.h]  +----------------------------------------------------------------------+
==============================================================================
upstream:test_nfs.py
==============================================================================
============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-3.4.2, py-1.5.3, pluggy-0.6.0 -- /usr/libexec/platform-python
cachedir: .pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-180.el8.x86_64-x86_64-with-redhat-8.2-Ootpa', 'Packages': {'pytest': '3.4.2', 'py': '1.5.3', 'pluggy': '0.6.0'}, 'Plugins': {'metadata': '1.8.0', 'html': '1.22.1', 'sourceorder': '0.5', 'multihost': '3.0'}}
rootdir: /home/cloud-user, inifile:
plugins: metadata-1.8.0, html-1.22.1, sourceorder-0.5, multihost-3.0
collecting ... collected 6 items

test_nfs.py::TestNFS::test_prepare_users <- ../../usr/lib/python3.6/site-packages/ipatests/test_integration/test_nfs.py PASSED [ 16%]
test_nfs.py::TestNFS::test_krb5_nfsd <- ../../usr/lib/python3.6/site-packages/ipatests/test_integration/test_nfs.py PASSED [ 33%]
test_nfs.py::TestNFS::test_krb5_nfs_manual_configuration <- ../../usr/lib/python3.6/site-packages/ipatests/test_integration/test_nfs.py PASSED [ 50%]
test_nfs.py::TestNFS::test_automount <- ../../usr/lib/python3.6/site-packages/ipatests/test_integration/test_nfs.py PASSED [ 66%]
test_nfs.py::TestIpaClientAutomountFileRestore::test_nsswitch_backup_restore_sssd <- ../../usr/lib/python3.6/site-packages/ipatests/test_integration/test_nfs.py PASSED [ 83%]
test_nfs.py::TestIpaClientAutomountFileRestore::test_nsswitch_backup_restore_no_sssd <- ../../usr/lib/python3.6/site-packages/ipatests/test_integration/test_nfs.py PASSED [100%]

---------------- generated xml file: /home/cloud-user/junit.xml ----------------
----------- generated html file: file:///home/cloud-user/report.html -----------
========================= 6 passed in 1189.44 seconds ==========================

Based on this marking bz as verified.

Comment 18 errata-xmlrpc 2020-04-28 15:44:43 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/RHEA-2020:1640