VT-switching from X returns you to X the first time

Bug #271962 reported by Alexander Jones
130
This bug affects 15 people
Affects Status Importance Assigned to Milestone
consolekit (Ubuntu)
Fix Released
Medium
James Westby
Intrepid
Won't Fix
Undecided
Unassigned
Jaunty
Fix Released
Medium
James Westby

Bug Description

Binary package hint: consolekit

Looks like an old bug has surfaced.

Hit Ctrl+Alt+F1
Console flashes momentarily
X returns
Hit Ctrl+Alt+F1 again
Console stays open.

ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 8.10
NonfreeKernelModules: ath_hal nvidia
Package: consolekit 0.2.10-1ubuntu4
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/username/.local/bin
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: consolekit
Uname: Linux 2.6.27-3-generic x86_64

Related branches

Revision history for this message
Alexander Jones (alex-weej) wrote :
Revision history for this message
James Westby (james-w) wrote :

Hi,

Can I ask why you reported this against consolekit? I'm not sure
why that would be involved in what you suggest above? Is there
a reason that you reported against this package that I am missing?

Thanks,

James

Changed in consolekit:
status: New → Incomplete
Revision history for this message
Alexander Jones (alex-weej) wrote :

I don't know of any other component that could cause this.

Changed in consolekit:
status: Incomplete → New
Revision history for this message
James Westby (james-w) wrote :

That's fine, but you have given no indication of why you think it is consolekit,
I have no idea how consolekit could be causing this, but I could name a couple
of other packages that could be causing the issue.

Thanks,

James

Revision history for this message
Alexander Jones (alex-weej) wrote : Re: [Bug 271962] Re: VT-switching from X returns you to X the first time

ConsoleKit was the cause of a very similar bug during the Hardy
release cycle, whereby it would ALWAYS return you to X.

Revision history for this message
James Westby (james-w) wrote :

Ah, great, do you have a reference to the bug number by any chance?

Thanks,

James

Revision history for this message
James Westby (james-w) wrote :

Hi,

I guess you refer to bug 131751.

I'll look in to this.

Thanks,

James

James Westby (james-w)
Changed in consolekit:
status: New → Confirmed
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

I can recreate this. I've also noticed that the VT switch doesn't always return back to my own X session when multiple users are logged in to the system. For example, my girlfriend currently has a session open on VT7 (she logged in first), and I have my own session on VT9. I just tried doing a switch to VT1 from my own session, and it immediately returned back to my girlfriends locked session on VT7 (not back to my own session on VT9).

Revision history for this message
LinkMaster03 (linkmaster032000) wrote :

This happens to me too. This didn't happen until I upgraded to Intrepid.

Revision history for this message
LinkMaster03 (linkmaster032000) wrote :

Any more news on this? This still happens to me on Intrepid, and it's very annoying.

Revision history for this message
Reed Bailey (reedmb) wrote :

Have:
Linux home4 2.6.27-11-generic #1 SMP Fri Dec 19 16:29:52 UTC 2008 i686 GNU/Linux
Intrepid V8.10

I also confirm this bug.

Additionally:
Unexpected additional behavior, can't imagine it being correct.
After doing Ctrl+Alt+F2 twice to get login prompt I login normally; do my work with schroot; exit chroot by typing "exit"; then exit tty session by typing "exit"; I am immediately returned to GNOME/tty7; shouldn't I be at tty2 with prompt for login?

Yikes, from user perspective this appears login is broken (Coulson 20081104). Us geeks will deal with it, but layperson business owner will _emotionally_ not like appearance that employee user sessions are insecure (there is confidential business information some employees should not see that is at another's desktop).

I don't know what files you want/need. Please advise and I will duplicate error and send files.

Revision history for this message
Matt Zimmerman (mdz) wrote :

Assigning to James Westby as he said he would look into this

Changed in consolekit:
assignee: nobody → james-w
Revision history for this message
jken146 (jonathankennedy146) wrote :

Any news? I can reproduce this on both Intrepid and Jaunty. It is very annoying.

James Westby (james-w)
Changed in consolekit:
importance: Undecided → Medium
Revision history for this message
James Westby (james-w) wrote :

Hi,

This problem is related to debian/patches/04-consolekit_park.patch, as disabling
that makes it go away in my testing.

That patch adds a call to ck_vt_monitor_set_active which calls VT_ACTIVATE, and
so is likely the issue.

However, I am finding it difficult to investigate this, as adding debugging prints
(or running under --debug to activate the ones there) seems to make the problem
go away.

This would suggest a race condition.

Thanks,

James

Revision history for this message
James Westby (james-w) wrote :

Because I keep losing the bug where this patch was discussed upstream
I'll paste it here:

  https://bugs.freedesktop.org/show_bug.cgi?id=11786

I was wrong about this being a race condition, it in fact doesn't trigger if
you try immediately after logging in, which I do when I aim to reproduce
it, but not when I want to just switch VTs. Very irritating.

The patch allows you to set a "parking place", which is a vt to switch to
when there are no active sessions, the intention being that it returns to
gdm when you leave your session, even after fast user switching.

It decides to do this by seeing "active_session == NULL", which is true
when you leave the session, but also when you VT switch to a VT without
an associated consolekit session.

However, it doesn't do this at all times, hence being able to switch
immediately after logging in. It has an enable flag, which it sets when
a session ends, and then clears after checking if it was the last active
session. That should work fine, except that bug 287715 steps in. If
you wait a few minutes after you log in, then cron will run, open a
consolekit session, and then finish, closing that session. That sets
the enable flag, but doesn't reach the point when it will be disabled
again. Then when you VT switch it falsely thinks that you ended your
session.

This explanation also tallies with Chris' observation about the VT that
you are returned to if you do this while fast user switching.

There are several possible ways that we could fix this, including fixing
bug 287715 I imagine. Attached is a simple fix that should take care
of this issue in a much simpler fashion. Please test the attached fix.

TEST CASE:
start from a standard ubuntu-desktop system
1. log in via GDM.
2. run "sudo su - <username>"
3. type exit to close that session
4. attempt to VT switch to VT 1, note that it returns you to X
5. try to VT switch to VT 1 again, note that it works (with high probability)
repeating steps 2 and 3 will make step 4 not work again.

6. install the fixed consolekit package
7. reboot (to get the new consolekit started. (You can alternatively kill the console-kit-daemon process, and then restart GDM)
8. repeat steps 1 to 3
9. attempt to VT switch to VT 1, note that it works first time unlike before
10. try it a few times, and it should consistently work.

11. try fast user switching to a second user and then VT switching while in that users session
12. keep the second user's session open, but switch back to your primary session and try VT switching
13. close all sessions to return to GDM, try VT switching there

Thanks,

James

Changed in consolekit (Ubuntu Jaunty):
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted consolekit into jaunty-proposed; please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in consolekit (Ubuntu Jaunty):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Anders Kaseorg (andersk) wrote :

I tested consolekit 0.3.0-2ubuntu4 in jaunty-proposed, and it works much better. I can switch to any text console and log in; when I log out, I am switched back to X on console 7. I think this is supposed to be the right behavior.

Revision history for this message
James Westby (james-w) wrote : Re: [Bug 271962] Re: VT-switching from X returns you to X the first time

On Fri, 2009-04-24 at 18:54 +0000, Anders Kaseorg wrote:
> I tested consolekit 0.3.0-2ubuntu4 in jaunty-proposed, and it works much
> better. I can switch to any text console and log in; when I log out, I
> am switched back to X on console 7. I think this is supposed to be the
> right behavior.

Thanks for testing.

Could you go through the "TEST CASE" in my earlier comment? There are
several uses that collide in this patch, so testing that each still
works is important.

Thanks,

James

Revision history for this message
Anders Kaseorg (andersk) wrote :

Yes, all the steps in your TEST CASE work correctly.

I did notice that when there is no graphical session, logging out of a text session sometimes returns you to GDM and sometimes leaves you on the text console. But that is much less likely to be annoying than the current bug.

Revision history for this message
James Westby (james-w) wrote :

On Sat, 2009-04-25 at 06:16 +0000, Anders Kaseorg wrote:
> Yes, all the steps in your TEST CASE work correctly.
>
> I did notice that when there is no graphical session, logging out of a
> text session sometimes returns you to GDM and sometimes leaves you on
> the text console. But that is much less likely to be annoying than the
> current bug.

Thanks for testing. I'm not sure what is going on in that case, I'll
try and think about it.

Thanks,

James

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package consolekit - 0.3.0-2ubuntu4

---------------
consolekit (0.3.0-2ubuntu4) jaunty-proposed; urgency=low

  * debian/patches/04-consolekit_park.patch:
    - When a session is removed parking is enabled, and then the active
      seat is possibly changed. The intention is that parking is only
      enabled if the active seat is changed in response to the session removal.
      However, there are codepaths where the active seat is not changed,
      but the enable flag isn't removed, meaning that the next time the
      active session changes it may inadvertently park. Forcing the enable
      flag to FALSE after possibly updating the active session when removing
      a session ensures that parking will only occur in response to a session
      removal, and not VT switches.
      - In other words, make VT switching away from X not take two attempts
        sometimes and fix LP: #271962.

 -- James Westby <email address hidden> Tue, 21 Apr 2009 14:58:49 +0100

Changed in consolekit (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Copied to karmic.

Changed in consolekit (Ubuntu):
status: In Progress → Fix Released
tags: added: verification-done
removed: verification-needed
Changed in consolekit (Ubuntu Jaunty):
status: Fix Released → Fix Committed
Changed in consolekit (Ubuntu Intrepid):
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package consolekit - 0.3.0-2ubuntu4

---------------
consolekit (0.3.0-2ubuntu4) jaunty-proposed; urgency=low

  * debian/patches/04-consolekit_park.patch:
    - When a session is removed parking is enabled, and then the active
      seat is possibly changed. The intention is that parking is only
      enabled if the active seat is changed in response to the session removal.
      However, there are codepaths where the active seat is not changed,
      but the enable flag isn't removed, meaning that the next time the
      active session changes it may inadvertently park. Forcing the enable
      flag to FALSE after possibly updating the active session when removing
      a session ensures that parking will only occur in response to a session
      removal, and not VT switches.
      - In other words, make VT switching away from X not take two attempts
        sometimes and fix LP: #271962.

 -- James Westby <email address hidden> Tue, 21 Apr 2009 14:58:49 +0100

Changed in consolekit (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Not a critical bug, not worth fixing in intrepid.

Changed in consolekit (Ubuntu Intrepid):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.