Bug 183371

Summary: race condition between USB device creation and hal callouts
Product: [Fedora] Fedora Reporter: Kostas Georgiou <k.georgiou>
Component: halAssignee: David Zeuthen <davidz>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: atontti+rh, davidz, jbarnes, mclasen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-03-19 16:12:58 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:    
Bug Blocks: 150223    
Attachments:
Description Flags
Looping none

Description Kostas Georgiou 2006-02-28 18:07:28 UTC
The "chown $console_user /dev/bus/usb/$bus_num/$dev_num" line in
/usr/libexec/gphoto-set-procperm fails with 
chown: cannot access `/dev/bus/usb/002/018': No such file or directory

A small delay before the chown command seems to fix the problem so it seems
like the script is run before(during?) the device creation, it either needs
to be called after the device has been created or it needs to spin for a while
if the device isn't there yet (probably a bad idea).

Comment 1 Jesse Barnes 2006-03-01 21:01:22 UTC
FWIW, adding a delay before the chown doesn't help in my case.  The selinux  
trace in 180751 indicates that there might be a policy problem with  
gphoto-set-procperm.  Maybe we're chasing two bugs for this problem? 

Comment 2 John (J5) Palmieri 2006-03-01 21:11:33 UTC
There should not be a race.  Looks like se-linux is preventing
/usr/libexec/gphoto-set-procperm from accessing /dev/bus/usb/.  

Comment 3 Jesse Barnes 2006-03-01 21:20:52 UTC
How does that explain what Kostas is seeing then?  In my case, selinux is 
enabled so gphoto-set-procperm might be getting stopped from doing its job.  
In his case though, adding a delay made the script set the permissions 
correctly.  That must mean he has selinux disabled and still sees a problem? 

Comment 4 John (J5) Palmieri 2006-03-01 21:48:06 UTC
Bringing back to HAL.  Davidz says it is a kernel issue with HAL.

Comment 5 Kostas Georgiou 2006-03-01 22:25:09 UTC
I am running with:
SELINUX=permissive
SELINUXTYPE=targeted
so selinux isn't involved.

I was running 1977_FC5 at the time so I just had a test with 1996_FC5 and the
first try worked and the next 5 failed :(

Let me know if you need more debug information.


Comment 6 Ray Strode [halfline] 2006-03-02 22:20:17 UTC
Created attachment 125570 [details]
Looping

Hi Kostas,
The above package works around the HAL/kernel issue by spinning as suggested.
Can you verify that it does work around your problem?

Comment 7 Kostas Georgiou 2006-03-02 22:36:07 UTC
Yes it seems fine, note that since I am in x86_64 system I just grabbed
gphoto-set-procperm from the rpm so if there are other changes they aren't tested.

I am not sure you need to spin around /proc/bus/usb/$bus_num/$dev_num since the
chown was always succesful in my system but it's not going to hurt either.

Comment 8 David Zeuthen 2006-03-02 22:50:32 UTC
Comment 6: This is not really the right solution. Will comment more tomorrow, am
busy all night, sorry.

Comment 9 Ray Strode [halfline] 2006-03-03 23:15:52 UTC
Yes, it's obviously not the *right* solution, but I guess a better question, is
whether it's a *good enough* solution given that FC5 freezes on monday.

Comment 10 Ray Strode [halfline] 2006-03-07 16:30:42 UTC
moving off fc5 blocker since we have a workaround in place now.

Comment 11 Asko Tontti 2006-03-11 16:58:21 UTC
I'm also seeing problems with my digital camera with rawhide (2006-03-11) and
kernel 2.6.15-1.2032_FC5.

Ray Strode, should we open a new bug about SELinux preventing
gphoto-set-procperm for doing its job? I couldn't find an open bug that
discusses only gphoto2 vs. SELinux case which seems to be cause of my problems.

Comment 12 Kostas Georgiou 2007-03-18 18:22:32 UTC
It's been a year without an update, is the workaround still needed? 

Comment 13 David Zeuthen 2007-03-19 16:12:58 UTC
This is fixed in Rawhide with latest HAL packages that manages permissions.