** Also affects: oem-priority
   Importance: Undecided
       Status: New

** Changed in: oem-priority
   Importance: Undecided => Critical

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

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

Status in OEM Priority Project:
  New
Status in gdm3 package in Ubuntu:
  Fix Released
Status in linux package in Ubuntu:
  Invalid
Status in gdm3 source package in Bionic:
  In Progress
Status in linux source package in Bionic:
  Invalid

Bug description:
  [Impact]

  When AutomaticLogin is enable in gdm3. The "chvt" command hangs
  forever, preventing from changing foreground virtual terminal.

  [Test case]

  1) Install Bionic/18.04LTS Desktop

  2) Enable AutomaticLogin
   2.1) Modify /etc/gdm3/custom.conf
  # Enabling automatic login
    AutomaticLoginEnable = true
    AutomaticLogin = <YOUR_USER>

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

  4) Print active VT
  $ sudo fgconsole

  Without the fix, it will be "1". # BAD
  With the fix, it will be "2". # GOOD

  5) sudo chvt 4 ## chvt will hang here.

  Verification can be made from a 2nd terminal, run :
  $ 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

  It's basically waiting for the VT to be activated, but it never
  happens.

  [Potential regression]

  Low.

  Current gdm3 run autologin display on tty1. tty1 is really meant for
  the login screen. This commit changes autologin to not use the initial
  vt.

  If one switch to tty1, the next VT switch attempt will hangs again and
  one won't be able to switch it. tty1 is really the problem here, so by
  forcing the autologin to not use tty1 we improve the current behaviour
  where we can't switch VTs at all when autologin is enabled.

  The tty1 behaviour will still need (normal behaviour or not ???) to be
  investigated, but not mandatory required for the sake of this SRU
  IMHO.

  I suspect systemd-logind to be the reason of the tty1 behaviour:

  # ps
  root      1350     1  0 Mar03 ?        00:00:03 /lib/systemd/systemd-logind

  #lsof
  systemd-l  1350                   root   24u      CHR                4,1      
 0t0         45 /dev/tty1

  But I haven't dig much in it for now.

  So the fix will works as long as one doesn't do run on tty1.

  Exactly like when autologin isn't enable.

  * From a machine with autologin enable:

  /etc/gdm3/customer.conf
  # Enabling automatic login
    AutomaticLoginEnable = true
    AutomaticLogin = user1

  $ sudo fgconsole
  1

  * From a machine with autologin disable:

  /etc/gdm3/customer.conf
  # Enabling automatic login
  #  AutomaticLoginEnable = true
  #  AutomaticLogin = user1

  $ sudo fgconsole
  2

  [Other information]

  * Upstream fix:
  https://github.com/GNOME/gdm/commit/39fb4ff6

  $ git describe --contains 39fb4ff6
  3.30.1~2^2~3

  $ rmadision gdm3
   ==> gdm3 | 3.28.3-0ubuntu18.04.4       | bionic-updates   | ...
       gdm3 | 3.30.1-1ubuntu5             | cosmic           | ...
       gdm3 | 3.30.1-1ubuntu5             | disco            | ...
       gdm3 | 3.30.1-1ubuntu5.1           | cosmic-security  | ...
       gdm3 | 3.30.1-1ubuntu5.1           | cosmic-updates   | ...
       gdm3 | 3.31.4+git20190225-1ubuntu1 | disco-proposed   | ...

  [Original Description]
  sudo strace chvt 4
  execve("/bin/chvt", ["chvt", "4"], 0x7ffd63e5c758 /* 17 vars */) = 0
  brk(NULL) = 0x561e18430000
  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
  access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
  openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
  fstat(3, {st_mode=S_IFREG|0644, st_size=74655, ...}) = 0
  mmap(NULL, 74655, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5059e7d000
  close(3) = 0
  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
  openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
  read(3, 
"\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 832) = 
832
  fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0
  mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5059e7b000
  mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f5059878000
  mprotect(0x7f5059a5f000, 2097152, PROT_NONE) = 0
  mmap(0x7f5059c5f000, 24576, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f5059c5f000
  mmap(0x7f5059c65000, 15072, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5059c65000
  close(3) = 0
  arch_prctl(ARCH_SET_FS, 0x7f5059e7c500) = 0
  mprotect(0x7f5059c5f000, 16384, PROT_READ) = 0
  mprotect(0x561e17e87000, 4096, PROT_READ) = 0
  mprotect(0x7f5059e90000, 4096, PROT_READ) = 0
  munmap(0x7f5059e7d000, 74655) = 0
  brk(NULL) = 0x561e18430000
  brk(0x561e18451000) = 0x561e18451000
  openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
  fstat(3, {st_mode=S_IFREG|0644, st_size=10281936, ...}) = 0
  mmap(NULL, 10281936, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5058ea9000
  close(3) = 0
  openat(AT_FDCWD, "/proc/self/fd/0", O_RDWR) = 3
  ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
  ioctl(3, KDGKBTYPE, 0x7ffdcdb0efa7) = -1 ENOTTY (Inappropriate ioctl for 
device)
  close(3) = 0
  openat(AT_FDCWD, "/dev/tty", O_RDWR) = 3
  ioctl(3, TCGETS, {B38400 opost isig icanon echo ...}) = 0
  ioctl(3, KDGKBTYPE, 0x7ffdcdb0efa7) = -1 ENOTTY (Inappropriate ioctl for 
device)
  close(3) = 0
  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

  Enable debuglogs doesn't provide additional details.

  As soon as auto-login is turned off, chvt is back to normal.

  The above has been reproduced on Ubuntu:
  - Ubuntu Bionic w/ gdm3 3.28.3 & kbd 2.0.4

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

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to