Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 183371 - race condition between USB device creation and hal callouts
Summary: race condition between USB device creation and hal callouts
Alias: None
Product: Fedora
Classification: Fedora
Component: hal
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: David Zeuthen
QA Contact:
Depends On:
Blocks: FC6Target
TreeView+ depends on / blocked
Reported: 2006-02-28 18:07 UTC by Kostas Georgiou
Modified: 2013-03-06 03:45 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-03-19 16:12:58 UTC

Attachments (Terms of Use)
Looping (deleted)
2006-03-02 22:20 UTC, Ray Strode [halfline]
no flags Details

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:
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]

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.

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