Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 554740

Summary: lazy /dev files creation on ecryptfs module load prevents ecryptfsd daemon to start
Product: Red Hat Enterprise Linux 5 Reporter: Jan Tluka <jtluka>
Component: ecryptfs-utilsAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: ovasik, psplicha, rvokal
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ecryptfs-utils-75-8.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-29 16:20:55 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:
Attachments:
Description Flags
patch to fix this none

Description Jan Tluka 2010-01-12 14:32:48 UTC
Description of problem:
It seems that on ecryptfs module load (modprobe ecryptfs) the module
creates files under /dev /dev/misc for userspace communication with
ecryptfsd. However if you start ecryptfsd fast enough it could not find
these files (because they're not created yet).

I've come to the following test case:

killall ecryptfsd
lsmod | grep ecryptfs && rmmod ecryptfs
modprobe ecryptfs
# echo 'sleep'; sleep 3
ecryptfsd
killall ecryptfsd

If you uncomment the 'sleep' line you will get following messages in
/var/log/messages and ecryptfsd will fail to start.

ecryptfsd[29732]: ecryptfs_init_miscdev: Error whilst attempting to open [/dev/ecryptfs]; errno msg = [No such file or directory]
ecryptfsd[29732]: ecryptfs_init_miscdev: Error whilst attempting to open [/dev/misc/ecryptfs]; errno msg = [No such file or directory]
ecryptfsd[29732]: main: Failed to initialize messaging; rc = [-5]
ecryptfsd[29732]: Failed to send eCryptfs miscdev message; errno msg = [Bad file descriptor]
ecryptfsd[29732]: ecryptfs_send_message: Failed to register miscdev daemon with the eCryptfs kernel module; rc = [-5]
ecryptfsd[29732]: ecryptfsd_exit: Error attempting to send quit message to kernel; rc = [-5]
ecryptfsd[29732]: ecryptfsd_exit: Closing eCryptfs userspace daemon


I've also noticed that if you have ecryptfs module unloaded and start
ecryptfsd it will leave ecryptfs loaded but itself dies because of
unavailable files under /dev. If the ecryptfsd daemon tries to load the
required module why it does not wait (or somehow handle) to succesfully
connect to /dev?


Version-Release number of selected component (if applicable):
RHEL5.5-Server-20091227.0
kernel-2.6.18-183.el5
ecryptfs-utils-75-5.el5

How reproducible:
100%

Steps to Reproduce:

killall ecryptfsd
lsmod | grep ecryptfs && rmmod ecryptfs
modprobe ecryptfs
# echo 'sleep'; sleep 3
ecryptfsd
killall ecryptfsd

Actual results:
errors displayed in /var/log/messages and ecryptfsd could not start

Expected results:
ecryptfsd started successfuly

Additional info:

Comment 1 Jan Tluka 2010-01-13 10:03:10 UTC
(In reply to comment #0)
> killall ecryptfsd
> lsmod | grep ecryptfs && rmmod ecryptfs
> modprobe ecryptfs
> # echo 'sleep'; sleep 3
> ecryptfsd
> killall ecryptfsd
> 
> If you uncomment the 'sleep' line you will get following messages in
> /var/log/messages and ecryptfsd will fail to start.

That should read:
"If you keep the 'sleep' line commented out you will get ..."
In case you uncomment this line all is working fine.

> 
> ecryptfsd[29732]: ecryptfs_init_miscdev: Error whilst attempting to open
> [/dev/ecryptfs]; errno msg = [No such file or directory]
> ecryptfsd[29732]: ecryptfs_init_miscdev: Error whilst attempting to open
> [/dev/misc/ecryptfs]; errno msg = [No such file or directory]
> ecryptfsd[29732]: main: Failed to initialize messaging; rc = [-5]
> ecryptfsd[29732]: Failed to send eCryptfs miscdev message; errno msg = [Bad
> file descriptor]
> ecryptfsd[29732]: ecryptfs_send_message: Failed to register miscdev daemon with
> the eCryptfs kernel module; rc = [-5]
> ecryptfsd[29732]: ecryptfsd_exit: Error attempting to send quit message to
> kernel; rc = [-5]
> ecryptfsd[29732]: ecryptfsd_exit: Closing eCryptfs userspace daemon

Comment 3 Michal Hlavinka 2010-04-20 08:40:34 UTC
Created attachment 407763 [details]
patch to fix this

Comment 13 errata-xmlrpc 2011-11-29 16:20:55 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.

http://rhn.redhat.com/errata/RHBA-2011-1503.html