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 1078829 - Automatic condrestart upon package upgrade breaks exports from Veritas cluster
Summary: Automatic condrestart upon package upgrade breaks exports from Veritas cluster
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: nfs-utils
Version: 6.5
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Steve Dickson
QA Contact: Yongcheng Yang
URL:
Whiteboard:
Depends On:
Blocks: 1075802 1200713
TreeView+ depends on / blocked
 
Reported: 2014-03-20 11:19 UTC by Oliver Falk
Modified: 2019-10-10 09:16 UTC (History)
6 users (show)

Fixed In Version: nfs-utils-1.2.3-58.el6
Doc Type: Bug Fix
Doc Text:
Not needed because a customer was never affected by the issue
Clone Of:
: 1200713 (view as bug list)
Environment:
Last Closed: 2015-07-22 06:49:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1355773 0 None None None Never
Red Hat Product Errata RHBA-2015:1342 0 normal SHIPPED_LIVE nfs-utils bug fix and enhancement update 2015-07-20 17:54:08 UTC

Description Oliver Falk 2014-03-20 11:19:49 UTC
Description of problem:

When upgrading nfs-utils on RHEL6 (all versions) and I'm sure the same is true for RHEL5, the package triggers an automatic 'condrestart'. However, if you have exported file systems via eg. Veritas cluster, the configuration is not in /etc/exports and therefore the nfs daemon comes up with no exports configured.

How reproducible:

* Export NFS shares manually (using exportfs)
* Trigger a 'service nfs condrestart'
* Check exportfs - nothing there

Expected results:

When doing an automatic condrestart in the nfs-utils package script, the script should first save the current configuration somewhere and afterwards reexport the shares so they are not lost.

Comment 2 Julio Entrena Perez 2015-02-23 10:48:28 UTC
The postuninstall script of the nfs-utils package calls a condrestart on the nfs service, even for an upgrade ( "$1" -ge 1 in postuninstall ):

http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax

# rpm -q --scripts nfs-utils | grep -A100 postuninstall
postuninstall scriptlet (using /bin/sh):
if [ "$1" -ge 1 ]; then
    /etc/rc.d/init.d/rpcgssd condrestart > /dev/null
    /etc/rc.d/init.d/nfs condrestart > /dev/null
    /etc/rc.d/init.d/nfslock condrestart > /dev/null
fi

/etc/init.d/nfs service will issue a stop order to itself:

  condrestart | try-restart)
        [ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd condrestart
        [ -f /var/lock/subsys/nfs ] && {
                $0 stop
                $0 start
                RETVAL=$?
        }
        ;;

/etc/init.d/nfs will execute exportfs -au causing all current exports to be deleted from /var/lib/nfs/etab:

  stop)
[...]
        # Do it the last so that clients can still access the server
        # when the server is running.
        cnt=`/usr/sbin/exportfs -v | /usr/bin/wc -l`    
        if [ $cnt -gt 0 ]; then 
                action $"Shutting down NFS services: " /usr/sbin/exportfs -au
                rval=$?
                [ $RETVAL -eq 0 ] && RETVAL=$rval
        fi

Comment 3 Oliver Falk 2015-02-23 13:25:08 UTC
Hey!

Thanks for the KB article and touching this BR, however, this doesn't solve the issue. Is there no option to save the exports first and afterwards recreate them? At least automatically reconnecting nfs client (that should be anyway the case for all...) wouldn't suffer any longer.

Best,
 Oliver

Comment 4 Steve Dickson 2015-03-07 16:13:45 UTC
(In reply to Oliver Falk from comment #3)
> Thanks for the KB article and touching this BR, however, this doesn't solve
> the issue. Is there no option to save the exports first and afterwards
> recreate them? At least automatically reconnecting nfs client (that should
> be anyway the case for all...) wouldn't suffer any longer.
I'm thinking this is more of a Veritas cluster problem than an
Red Hat nfs-utils problem. 

Squirrelling exports away before the update is dangerous
because we could restore old exports upon new exports
if the exports changed during the upgrade.

So I'm going to close this bz out as NOTABUG. Please 
feel free to reopen the bz if I'm missing something.

Comment 5 Julio Entrena Perez 2015-03-09 10:44:01 UTC
Hi Steve,

Thanks for that.

As per comment 2 the main reason for NFS exports not defined in file /etc/exports are not preserved during the update of 'nfs-utils' package is that the postinstall script runs a "nfs condrestart" which in turn runs a "exportfs -au" thus wiping contents of /var/lib/nfs/etab .

In systems where a 3rd party cluster stack is managing those exports, current behaviour prevents customers from deploying updates to their systems and scheduling a reboot at a later time, since the NFS exports break during the package upgrade.

Could we, at least, make the current behaviour of restarting NFS daemons optional in a similar way as we did for 'httpd' in bug 833042 , by checking for the existence of a file in e.g. /etc/sysconfig/nfs-utils-disable-posttrans and refraining from restarting NFS daemons only if such file exists?

That would not break current behaviour and would give customers impacted by this the possibility of updating systems and rebooting systems at different times.

Comment 6 Steve Dickson 2015-03-09 12:38:11 UTC
(In reply to Julio Entrena Perez from comment #5)
> Could we, at least, make the current behaviour of restarting NFS daemons
> optional in a similar way as we did for 'httpd' in bug 833042 , by checking
> for the existence of a file in e.g.
> /etc/sysconfig/nfs-utils-disable-posttrans and refraining from restarting
> NFS daemons only if such file exists?
> 
> That would not break current behaviour and would give customers impacted by
> this the possibility of updating systems and rebooting systems at different
> times.
Go ahead and post a patch to the current sysinit script to make that happen...

How is this going to work in RHEL7?

Comment 7 Julio Entrena Perez 2015-03-09 17:38:11 UTC
(In reply to Steve Dickson from comment #6)
> Go ahead and post a patch to the current sysinit script to make that
> happen...

The change would be in the postuninstall script rather than in the initscript.

Currently:

postuninstall scriptlet (using /bin/sh):
if [ "$1" -ge 1 ]; then
	if [ -f /etc/rc.d/init.d/rpcgssd ]; then
    	/etc/rc.d/init.d/rpcgssd condrestart > /dev/null
	fi
	if [ -f /etc/rc.d/init.d/nfs ]; then
    	/etc/rc.d/init.d/nfs condrestart > /dev/null
	fi
	if [ -f /etc/rc.d/init.d/nfslock ]; then
		/etc/rc.d/init.d/nfslock condrestart > /dev/null
	fi
fi

Proposed (moving the restart from postuninstall to posttrans):

posttrans scriptlet (using /bin/sh):

if [ ! -f /etc/sysconfig/nfs-utils-disable-posttrans ]; then
	if [ -f /etc/rc.d/init.d/rpcgssd ]; then
    	/etc/rc.d/init.d/rpcgssd condrestart > /dev/null
	fi
	if [ -f /etc/rc.d/init.d/nfs ]; then
    	/etc/rc.d/init.d/nfs condrestart > /dev/null
	fi
	if [ -f /etc/rc.d/init.d/nfslock ]; then
		/etc/rc.d/init.d/nfslock condrestart > /dev/null
	fi
fi

That should preserve the current behaviour of restarting the daemons by default unless user touches file /etc/sysconfig/nfs-utils-disable-posttrans to prevent it.

> How is this going to work in RHEL7?

The same way. For example looking at RHEL7's httpd:

- postuninstall just reloads the systemd unit file for httpd
- only if file /etc/sysconfig/httpd-disable-posttrans does not exist then we restart httpd daemon

"""
postuninstall scriptlet (using /bin/sh):

/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : 


# Trigger for conversion from SysV, per guidelines at:
# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
posttrans scriptlet (using /bin/sh):
test -f /etc/sysconfig/httpd-disable-posttrans || \
  /bin/systemctl try-restart httpd.service htcacheclean.service >/dev/null 2>&1 || :
"""

Comment 8 Oliver Falk 2015-03-10 05:59:04 UTC
Hi!

Steve, you said it's a Veritas problem and yes, indeed, it is, but it's a problem Veritas cannot solve, since it has no influence on the behaviour.
Saving and restoring the exports was only an idea - since the upgrade of the nfs package doesn't take ages, but only a few seconds, I thought it's save to do it that way...

Anyway. What Julio suggested, to do it the same way as with httpd, I'm fine with that as well.

Again, thanks for taking care of this BZ!

Comment 9 Steve Dickson 2015-03-10 18:32:09 UTC
(In reply to Julio Entrena Perez from comment #7)
> (In reply to Steve Dickson from comment #6)
> > Go ahead and post a patch to the current sysinit script to make that
> > happen...
> 
> The change would be in the postuninstall script rather than in the
> initscript.
> 
> Currently:
> 
> postuninstall scriptlet (using /bin/sh):
> if [ "$1" -ge 1 ]; then
> 	if [ -f /etc/rc.d/init.d/rpcgssd ]; then
>     	/etc/rc.d/init.d/rpcgssd condrestart > /dev/null
> 	fi
> 	if [ -f /etc/rc.d/init.d/nfs ]; then
>     	/etc/rc.d/init.d/nfs condrestart > /dev/null
> 	fi
> 	if [ -f /etc/rc.d/init.d/nfslock ]; then
> 		/etc/rc.d/init.d/nfslock condrestart > /dev/null
> 	fi
> fi
> 
> Proposed (moving the restart from postuninstall to posttrans):
> 
> posttrans scriptlet (using /bin/sh):
> 
> if [ ! -f /etc/sysconfig/nfs-utils-disable-posttrans ]; then
Why remove the if [ "$1" -ge 1 ]; then clause? 

> 	if [ -f /etc/rc.d/init.d/rpcgssd ]; then
>     	/etc/rc.d/init.d/rpcgssd condrestart > /dev/null
> 	fi
> 	if [ -f /etc/rc.d/init.d/nfs ]; then
>     	/etc/rc.d/init.d/nfs condrestart > /dev/null
> 	fi
> 	if [ -f /etc/rc.d/init.d/nfslock ]; then
> 		/etc/rc.d/init.d/nfslock condrestart > /dev/null
> 	fi
> fi
> 
> That should preserve the current behaviour of restarting the daemons by
> default unless user touches file /etc/sysconfig/nfs-utils-disable-posttrans
> to prevent it.
> 
> > How is this going to work in RHEL7
> 
> The same way. For example looking at RHEL7's httpd:
> 
> - postuninstall just reloads the systemd unit file for httpd
> - only if file /etc/sysconfig/httpd-disable-posttrans does not exist then we
> restart httpd daemon
> 
> """
> postuninstall scriptlet (using /bin/sh):
> 
> /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : 
> 
> 
> # Trigger for conversion from SysV, per guidelines at:
> # https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
> posttrans scriptlet (using /bin/sh):
> test -f /etc/sysconfig/httpd-disable-posttrans || \
>   /bin/systemctl try-restart httpd.service htcacheclean.service >/dev/null
> 2>&1 || :
> """

Please open up another RHEL7 bz with this info in it.

Comment 11 Oliver Falk 2015-03-11 07:14:51 UTC
Shall I open the BZ for RHEL7 or is anyone else willing to do? :-)

Comment 12 Julio Entrena Perez 2015-03-11 09:25:23 UTC
(In reply to Steve Dickson from comment #9)
> Why remove the if [ "$1" -ge 1 ]; then clause? 

$1 is always 0 in posttrans as per http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax

If we keep the restarts in postuninstall then we should keep if [ "$1" -ge 1 ]; then clause (in addition to the check for the sysconfig file to prevent restarts).

Comment 13 Julio Entrena Perez 2015-03-11 09:28:14 UTC
Cloned for RHEL7 to bug 1200713.

Comment 20 Yongcheng Yang 2015-03-23 10:33:43 UTC
Verified in nfs-utils-1.2.3-58.el6.x86_64

==========================================
[root@hp-dl385pg8-10 ~]# touch /etc/sysconfig/nfs-utils-disable-posttrans
[root@hp-dl385pg8-10 ~]# exportfs -v
/export       	<world>(rw,wdelay,root_squash,no_subtree_check)
[root@hp-dl385pg8-10 ~]# mkdir /export_exportfs
[root@hp-dl385pg8-10 ~]# exportfs -i localhost:/export_exportfs/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Export NFS shares manually (using exportfs)
[root@hp-dl385pg8-10 ~]# exportfs -v
/export_exportfs
		localhost(ro,wdelay,root_squash,no_subtree_check)
/export       	<world>(rw,wdelay,root_squash,no_subtree_check)
[root@hp-dl385pg8-10 ~]# rpm -q nfs-utils
nfs-utils-1.2.3-56.el6.x86_64
[root@hp-dl385pg8-10 ~]# rpm -Uvh nfs-utils-1.2.3-58.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:nfs-utils              ########################################### [100%]
exportfs: scandir /etc/exports.d: No such file or directory

[root@hp-dl385pg8-10 ~]# rpm -q nfs-utils
nfs-utils-1.2.3-58.el6.x86_64
[root@hp-dl385pg8-10 ~]# exportfs -v
/export       	<world>(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,root_squash,no_all_squash)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ With original nfs-utils, will restart NFS daemons even if file /etc/sysconfig/nfs-utils-disable-posttrans exists
[root@hp-dl385pg8-10 ~]# exportfs -i localhost:/export_exportfs/
[root@hp-dl385pg8-10 ~]# exportfs -v
/export_exportfs
		localhost(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,root_squash,no_all_squash)
/export       	<world>(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,root_squash,no_all_squash)
[root@hp-dl385pg8-10 ~]# cat /etc/sysconfig/nfs-utils-disable-posttrans 
[root@hp-dl385pg8-10 ~]# ls -l /etc/sysconfig/nfs-utils-disable-posttrans 
-rw-r--r--. 1 root root 0 Mar 23 18:22 /etc/sysconfig/nfs-utils-disable-posttrans
[root@hp-dl385pg8-10 ~]# rpm -Uvh nfs-utils-1.2.3-59.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:nfs-utils              ########################################### [100%]
[root@hp-dl385pg8-10 ~]# exportfs -v
/export_exportfs
		localhost(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,root_squash,no_all_squash)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Not restart NFS daemons if file /etc/sysconfig/nfs-utils-disable-posttrans exists
/export       	<world>(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,root_squash,no_all_squash)
[root@hp-dl385pg8-10 ~]# 
==========================================

Move to VERIFIED

Comment 22 errata-xmlrpc 2015-07-22 06:49:53 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://rhn.redhat.com/errata/RHBA-2015-1342.html


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