Bug 359361

Summary: ConsoleKit tries to find the console using keyboard ioctls that don't always work
Product: [Fedora] Fedora Reporter: Peter Jones <pjones>
Component: ConsoleKitAssignee: David Zeuthen <davidz>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: jmccann, koala, lkundrak, mclasen
Target Milestone: ---Keywords: EasyFix, Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.2.3-3.fc8.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-01 04:28:11 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 235704    
Attachments:
Description Flags
patch to use VT_ETSTATE and tty0 none

Description Peter Jones 2007-10-30 18:45:58 EDT
Description of problem:  ConsoleKit tries to find a valid fd it can issue
VT_WAITACTIVE against by iterating across a file list and issuing 
ioctl(fd, KDGKBTYPE, &arg), then checking the return value.  Not all console
devices support this ioctl, so in some cases it never finds a valid file
descriptor to use, and from then on never marks any session active.

We probably ought to be using something like VT_GETSTATE instead of a keyboard
ioctl, but that's not sufficient to fix it.  One fix that seems to work, though
I'm not completely sure if it's the best answer, is to add /dev/tty0 to the list
of files to try before /dev/console.

I've attached a patch that seems to resolve the issue for me.
Comment 1 Peter Jones 2007-10-30 18:45:58 EDT
Created attachment 243861 [details]
patch to use VT_ETSTATE and tty0
Comment 2 Peter Jones 2007-10-31 10:34:38 EDT
(Comment #1 should say VT_GETSTATE, of course)
Comment 3 Lubomir Kundrak 2007-12-03 08:51:06 EST
Raising priority to high, keeping track of active sessions is fairly important.
Furthermore the fix is attached to this problem.

I found this issue while determining why was my desktop user unable to hibernate
a machine. This fix fixes the problem for me. The workaround was to run the
consolekit daemon with --no-daemon option which caused it to find the active tty
correctly.
Comment 4 David Zeuthen 2007-12-03 14:07:44 EST
Sorry this bug got lost for me. Jon, what do you think? Thanks.
Comment 5 jmccann 2007-12-03 14:14:49 EST
Hi, sorry for the lag.  I think this looks reasonable.  I'll test and commit
this as soon as I get my development machine back up (hopefully in the next few
days).  Thanks.
Comment 6 jmccann 2007-12-08 23:04:43 EST
In git now.  Thanks for the patch Peter.
Comment 7 Lubomir Kundrak 2008-01-19 09:12:43 EST
I'm wondering if there's a chance that ConsoleKit update will occur for Fedora
8. In case yes, this fix is a good candidate to be included :)
Comment 8 Lubomir Kundrak 2008-02-29 14:39:15 EST
*** Bug 429157 has been marked as a duplicate of this bug. ***
Comment 9 Fedora Update System 2008-03-01 04:28:07 EST
ConsoleKit-0.2.3-3.fc8.1 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Lubomir Kundrak 2008-03-18 11:31:42 EDT
*** Bug 366981 has been marked as a duplicate of this bug. ***