[ConsoleKit] Active VT tracking can fail at startup

Leen Besselink consolekit at consolejunkie.net
Tue Aug 24 16:27:06 PDT 2010


On 08/24/2010 04:08 PM, Ray Strode wrote:
> Hi,
>
> On Mon, Aug 23, 2010 at 6:30 PM, Leen Besselink
> <consolekit at consolejunkie.net> wrote:
>   
>> The last few days I've been trying to fix an issue with consolekit which
>> I noticed when I did an upgrade (clean install) of Ubuntu on a laptop I
>> had lying around.
>>
>> It doesn't seem to be Ubuntu specific though.
>>
>> The issue seems, to me atleast, that when consolekit starts up, it grabs
>> the console_fd so it can do it can start the threads and do the ioctl
>> for VT_WAITACTIVE for each vt.
>>
>> Then I think the kernel does a mode change (kernel mode setting) of the
>> console and when consolekit wants to start the threads and use the
>> console_fd it isn't valid anymore and fails.
>>     
> Nah, I doubt modesetting is causing that kind of problem.  If it is,
> that's probably a kernel bug that should get fixed. Are you sure it's
> caused by modesetting and not just something happening around the same
> time? Do it happen if you don't do modesetting at boot time and then
> do it manually with modprobe later?
>
> It's more likely something is stealing the tty away, causing a hangup I think.
>
> The ck_get_a_console_fd () function looks pretty bogus.
>
> If it's being used for VT_WAITACTIVE it should be passing the fd to a
> tty associated with a vt, but looking at the function I see it tries
> /dev/tty before trying /dev/tty0.
>
> /dev/tty is the tty of the controlling terminal of the currently
> running process.  consolekit is daemon, so it shouldn't have a
> controlling terminal.  It could be that ck is getting started with
>   

Yes, in Ubuntu, it is started with --no-daemon.

And possible others, because it seems to be the current default for dbus
in git:

http://cgit.freedesktop.org/ConsoleKit/tree/data/org.freedesktop.ConsoleKit.service.in

> --no-daemon though. In that case it might be picking up the
> controlling tty of whatever it was started from.  If another process
> took the same controlling terminal, it could cause a hangup to be sent
> to console kit on the fd.  I basically don't think ck should be using
> /dev/tty at all.
>
> After trying /dev/tty it tries /dev/tty0.  That's a good one to use.
> It's the vt "master" tty.
>
>   

I unexpectedly didn't have a lot of time today.

I've added some debug and this is what was choosen when it didn't fail:

/dev/tty0

> Do you get better results if you just drop the /dev/tty / _PATH_TTY stuff?
>
> If not, I think the first thing to do is figure out what actually is
> causing the hangup, next would be to figure whether we should stop it
> from causing the hangup or change consolekit to reopen its tty when it
> gets a hangup.
>
> --Ray
>
>   



More information about the ConsoleKit mailing list