[Bug 1817738] Re: Can't change virtual terminal on login screen or when auto-login is enabled

Yuan-Chen Cheng yc.cheng at canonical.com
Wed Apr 24 00:18:11 UTC 2019


** Tags added: lp-1804607 somerville

** Changed in: oem-priority
     Assignee: (unassigned) => Yuan-Chen Cheng (ycheng-twn)

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to plymouth in Ubuntu.
https://bugs.launchpad.net/bugs/1817738

Title:
  Can't change virtual terminal on login screen or when auto-login is
  enabled

Status in OEM Priority Project:
  Fix Committed
Status in gdm3 package in Ubuntu:
  Invalid
Status in plymouth package in Ubuntu:
  Fix Released
Status in gdm3 source package in Bionic:
  Invalid
Status in plymouth source package in Bionic:
  Fix Released
Status in plymouth source package in Cosmic:
  Fix Released

Bug description:
  [Impact]

  When AutomaticLogin is enabled in gdm3, or it is showing the login screen,
  the "chvt" command blocks indefinitely (usually resumes with gdm3 restart).

  This prevents users to change the foreground virtual terminal, and it can
  also prevent pm-suspend to complete (as it invokes chvt).

  This problem happens in Bionic; it's already fixed in Cosmic and
  later.

  This patch to plymouth helps it not to revert the VT/tty to VT_AUTO
  (after gdm calls 'plymouth deactivate' and changes it to VT_PROCESS)
  which causes the ioctl(VT_SETACTIVE) not to generate the event that
  the ioctl(VT_WAITACTIVE) will block/wait on just afterward.

  Workarounds are to either disable plymouth / remove 'splash' from the
  kernel command line or change it to use a different/non-graphical VT
  for console (console=tty0 [default] or console=tty1 [equivalent] are
  affected, but console=ttyS0 or console=ttyS1 are not, being serial).

  [Test case]

  1) Install Bionic/18.04 LTS Desktop

  2) Ensure plymouth / 'splash' is enabled (default)

  $ grep splash /proc/cmdline
  BOOT_IMAGE=... root=... splash ...

  3) Ensure console is tty0 (default) or tty1 
  $ dmesg | grep console
  [    0.004000] console [tty0] enabled

  
  A) Login screen, regardless of automatic login

     4) Ensure the login screen/tty 1 is the displaying
        (i.e., it's foregound/active VT) or change to it:

        $ sudo chvt 1 # this works/finishes.
        $

     5) $ ssh <SYSTEM> 'sudo fgconsole' # check tty1 is foreground VT
        1

     6) $ ssh <SYSTEM> 'sudo chvt 4' # this blocks/doesn't finish

  
  B) Automatic login, regardless of login screen

     4) Enable AutomaticLogin in /etc/gdm3/custom.conf
       [daemon]
       AutomaticLoginEnable = true
       AutomaticLogin = <YOUR_USER>

     5) Reboot your system and make sure AutoLogin works by not
  requesting password before opening the <YOUR_USER> session.

     6) Print active VT
        (in Bionic, autologin user session runs on tty1)

        $ sudo fgconsole
        1

     7) sudo chvt 4 # this blocks/doesn't finish

  
  From SSH one can check that chvt is blocked waiting
  on new VT to become active, which doesn't happen in
  this case (old VT in VT_AUTO + KB_GRAPHICS mode):

  $ cat /proc/$(pidof chvt)/stack
  [<0>] __vt_event_wait.isra.2.part.3+0x40/0x90
  [<0>] vt_waitactive+0x80/0xd0
  [<0>] vt_ioctl+0xd26/0x1140
  [<0>] tty_ioctl+0xf6/0x8c0
  [<0>] do_vfs_ioctl+0xa8/0x630
  [<0>] SyS_ioctl+0x79/0x90
  [<0>] do_syscall_64+0x73/0x130
  [<0>] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
  [<0>] 0xffffffffffffffff

  [Potential regression]

  Low.  This plymouth patch is upstream and it's already applied
  in Cosmic and later for ~6 months (0.9.3-1ubuntu10 / Oct 2018)
  for LP: #1795637 (different problem/effect, same root cause).

  Besides, it's conservative in nature, and it's spirit makes a
  lot of sense (stop handling more udev events after deactivate).
  There are no additional fixes to its code changes upstream.

  [Original Description]

  $ sudo strace chvt 4
  <...>
  openat(AT_FDCWD, "/dev/tty0", O_RDWR) = 3
  ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
  ioctl(3, KDGKBTYPE, 0x7ffdcdb0efa7) = 0
  ioctl(3, VT_ACTIVATE, 0x4) = 0
  ioctl(3, VT_WAITACTIVE, 0x4

  VT_ACTIVATE will cause a switch to VT number.
  VT_WAITACTIVE will sleep/wait until the specified VT has been activated.

  $ sudo cat /proc/$(pidof chvt)/stack
  [<0>] __vt_event_wait.isra.2.part.3+0x40/0x90
  [<0>] vt_waitactive+0x80/0xd0
  [<0>] vt_ioctl+0xd26/0x1140
  [<0>] tty_ioctl+0xf6/0x8c0
  [<0>] do_vfs_ioctl+0xa8/0x630
  [<0>] SyS_ioctl+0x79/0x90
  [<0>] do_syscall_64+0x73/0x130
  [<0>] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
  [<0>] 0xffffffffffffffff

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/1817738/+subscriptions



More information about the foundations-bugs mailing list