Bug 191204 - Can not log out after updating autofs
Summary: Can not log out after updating autofs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: autofs
Version: 4.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jeff Moyer
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks: 176344
TreeView+ depends on / blocked
 
Reported: 2006-05-09 18:45 UTC by Jeff Moyer
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHBA-2007-0274
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-05-07 22:12:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0274 0 normal SHIPPED_LIVE autofs bug fix update 2007-04-28 19:00:08 UTC

Description Jeff Moyer 2006-05-09 18:45:18 UTC
+++ This bug was initially created as a clone of Bug #161298 +++

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050319

Description of problem:
After updating autofs via ssh, when you log out of ssh the channel is keps open
and the session will not dissconnect (requires a ~&)

Version-Release number of selected component (if applicable):
autofs-4.1.3-130

How reproducible:
Always

Steps to Reproduce:
1. ssh into machine using autofs
2. rpm -U http://some/path/autofs-4.1.3-130.i386.rpm
3. exit
  

Actual Results:  ssh session does not exit.

Additional info:

This is a long standing issue.

-- Additional comment from jmoyer on 2005-06-27 15:35 EST --
I'll try to reproduce this.  Note that I do this sort of thing all of the time,
and have not experienced this issue.

-- Additional comment from jn.edu.au on 2005-11-14 00:22 EST --
This is still a problem when installing U6.  After the update, the automount
daemon is running with a terminal instead of as a daemon.

# ps ax | grep automount
 2615 ?        S      1:08 /usr/sbin/automount --timeout=5 /misc program
/root/miscmount.sh

# rpm -U autofs-4.1.3-154.i386.rpm

# ps ax | grep automount
 1804 pts/0    S      0:00 /usr/sbin/automount --timeout=5 /misc program
/root/miscmount.sh


-- Additional comment from jn.edu.au on 2006-04-11 23:49 EST --
Still a problem in U7
ps -ef show that automount running with a controlling terminal
root     23119     1  0 13:48 pts/1    00:00:00 /usr/sbin/automount --timeout=60
/home/students/accounts program /usr
After logging out from ssh I have to use ~& to background the connection.
Logging back in shows that automount is now running without a terminal
root     23119     1  0 13:48 ?        00:00:00 /usr/sbin/automount --timeout=60
/home/students/accounts program /usr


-- Additional comment from jmoyer on 2006-05-08 18:45 EST --
It looks to me like the become_daemon code in autofs should call setsid() to
clear the controlling tty.

Ian, and particular reason this isn't done?

-- Additional comment from jmoyer on 2006-05-08 19:53 EST --
Ian, nevermind the above.  It seems we are keeping some file descriptors open. 
I know that my daemon-exit-wait patch left one open, I'm pouring through the
rest of the code to find other culprits.

-- Additional comment from ikent on 2006-05-09 00:05 EST --
(In reply to comment #5)
> Ian, nevermind the above.  It seems we are keeping some file descriptors open. 
> I know that my daemon-exit-wait patch left one open, I'm pouring through the
> rest of the code to find other culprits.

There's patch around for 4.1.4 for that.

I didn't notice until it was reported by the Debian folks.
Many moons ago we would do a double fork to do this but
there's only a single fork in become_daemon.

I'll have a look around for the patch.

Ian




-- Additional comment from ikent on 2006-05-09 00:16 EST --
Created an attachment (id=128769)
Change setpgrp to setsid in become_daemon function

We should do this as well as hunt for the open file
handles. The become_daemon function is not incorrect.

-- Additional comment from ikent on 2006-05-09 00:16 EST --
Created an attachment (id=128770)
Change setpgrp to setsid in become_daemon function

We should do this as well as hunt for the open file
handles. The become_daemon function is incorrect.

-- Additional comment from jmoyer on 2006-05-09 14:22 EST --
OK, it turns out that this only happens from upgrading autofs, which points to
RPM.  RPM doesn't seem to set the close-on-exec bit for the file descriptors it
opens, and so those get inherited by automount.

I've modified the daemon to close fd's 0-255, and this appears to fix the
problem.  Note that this is the only change required, though I'll likely include
the setsid patch as well.  I'll follow up with a patch in a moment.

The RPM bug I filed is bz #191196.

-- Additional comment from jmoyer on 2006-05-09 14:23 EST --
Created an attachment (id=128804)
Close fd's 0-255 in become_daemon


-- Additional comment from jmoyer on 2006-05-09 14:34 EST --
Easily reproducable and the fix is straightforward.

Comment 1 RHEL Program Management 2006-08-18 15:57:53 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 3 Jeff Moyer 2006-09-07 19:52:08 UTC
A fix for this issue was built into autofs package version 4.1.3-188.

Comment 6 Red Hat Bugzilla 2007-05-07 22:12:56 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0274.html


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