Keyboard won't switch its layout to a newly added second input source unless their order is rearranged

Bug #1890875 reported by Akbarkhon Variskhanov
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNOME Shell
Fix Released
Unknown
gnome-shell (Ubuntu)
Fix Released
Low
Gunnar Hjalmarsson
Bionic
Fix Released
Low
Marco Trevisan (Treviño)

Bug Description

[Impact]

What should happen:
Adding a second input source (Russian, in my case) should result in being able to switch to it and use it immediately.
What happens now:
It is not recognized until you rearrange its order, or reboot.

[Test Case]

Steps to reproduce this bug:

1. Have English set as primary language.
2. Go to Settings > Region & Language > Input Sources and add Russian.
3. Russian layout is added to Input Sources and the indicator becomes visible in the Top Bar.
4. You can switch between languages with the assigned keyboard shortcut but the text input won't change.

5. Rearrange their order in Input Sources: make Russian primary, English secondary.
6. You can now enter text in Russian.
7. You can now put Russian back to being second in the list (so it does not cause problems at logic screen, opening up new browser window, etc.)

or 5. Reboot or re-login (restarting gnome-shell works as well: killall -3 gnome-shell or Alt+F2 > r > Enter)

Then install gnome-shell from bionic-proposed, reboot, and find that an added input source now is effective instantly without any of the mentioned workarounds.

[Regression Potential]

Minimal. The fix consists of a simple upstream commit which has been in use as from GNOME 3.32.

[Other info]

Screenshots are attached. The bug is easily reproduced as many times as possible.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gnome-control-center 1:3.28.2-0ubuntu0.18.04.6
ProcVersionSignature: Ubuntu 4.15.0-112.113-generic 4.15.18
Uname: Linux 4.15.0-112-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.16
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat Aug 8 13:39:01 2020
InstallationDate: Installed on 2016-11-03 (1373 days ago)
InstallationMedia: Ubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
SourcePackage: gnome-control-center
UpgradeStatus: Upgraded to bionic on 2020-07-24 (15 days ago)

Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :
Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :
Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :

Rebooting also solves this issue and can be considered as a work-around.

summary: - Keyboard won't switch its layout to the newly added second input source
+ Keyboard won't switch its layout to a newly added second input source
unless their order is rearranged
description: updated
description: updated
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for your well written bug report!

I can reproduce the problem on 18.04, but not on 20.04 or groovy, so the problem seems to have been fixed in later versions. For that reason, and since the workaround (reboot or relogin) is a natural measure, I set the importance to "Low".

Changed in gnome-control-center (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

^^^
That means the bug is "Fix Released". If the exact fix can be identified then we would be able to provide a fix to 18.04.

Changed in gnome-control-center (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :

I've looked through a lot of various bug trackers and other projects and could not find the exact fix.

It may be an ibus problem.

description: updated
Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :

I have tried to add an input source through gsettings
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ru')]"
but it still produced the same result: text input remains at default layout.

Restarting the GNOME Shell fixes the issue and the 'ru' layout gets added in /etc/default/keyboard configuration file: XKBLAYOUT=us,ru

This may explain why rearranging the order of input sources magically fixes the bug: newly added input sources probably need to be put into defaults once to be recognized later.

However, manually editing the keyboard configuration file does nothing.

What probably happens is that gnome-shell recognizes the added input sources but 'forgets' 1) to send the appropriate command to XKB (setxkbmap ru) whenever the switch shortcut is invoked; or 2) to reconfigure the keyboard settings.

Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :

Maybe the reconfiguration process is delayed as waiting for 20-30 minutes sometimes works, but it's unreliable and I can't seem to reproduce it.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2020-08-12 13:57, Akbarkhon Variskhanov wrote:
> Restarting the GNOME Shell fixes the issue and the 'ru' layout gets
> added in /etc/default/keyboard configuration file: XKBLAYOUT=us,ru

If your system has one user only, and you add an XKB input source via Settings, /etc/default/keyboard is also updated instantly. It's per design; no need to restart anything.

> This may explain why rearranging the order of input sources
> magically fixes the bug: newly added input sources probably need to
> be put into defaults once to be recognized later.

Nope. When testing on 18.04, I added an additional user, so /etc/default/keyboard did not get updated. It behaved the same way. The input source settings for the user don't need to be synced with /etc/default/keyboard.

I saw that your upstream issue was closed. If you want to help solve the problem on 18.04, I would suggest that you look at upstream commits in gnome-shell and/or gnome-control-center which might be related. After all we know that the issue is not present in focal (GNOME 3.36).

Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :

bug-exists Ubuntu 18.04.5 LTS bionic
  GNOME Shell 3.28.4 (=3.28.4-0ubuntu18.04.3)
  gnome-control-center 3.28.2 (=1:3.28.2-0ubuntu0.18.04.6)

bug-exists Ubuntu 18.10 cosmic
  GNOME Shell 3.30.1 (=3.30.1-2ubuntu1)
  gnome-control-center 3.30.1 (=1:3.30.1-1ubuntu2)

no-bug Ubuntu 19.04 disco
  GNOME Shell 3.32.0 (=3.32.0+git20190410-1ubuntu1)
  gnome-control-center 3.32.1 (=1:3.32.1-1ubuntu4)

Tested on various versions of Ubuntu running on a virtual machine.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I found an older upstream gnome-shell issue which seems to have been fixed through this commit:

https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/b405ed64

May be worth a test.

description: updated
affects: gnome-control-center (Ubuntu) → gnome-shell (Ubuntu)
Changed in gnome-shell (Ubuntu Bionic):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Akbarkhon Variskhanov (kbar) wrote :
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for confirming!

On 2020-08-14 15:01, Akbarkhon Variskhanov wrote:
> bug-exists Ubuntu 18.10 cosmic
> GNOME Shell 3.30.1 (=3.30.1-2ubuntu1)
> gnome-control-center 3.30.1 (=1:3.30.1-1ubuntu2)
>
> no-bug Ubuntu 19.04 disco
> GNOME Shell 3.32.0 (=3.32.0+git20190410-1ubuntu1)
> gnome-control-center 3.32.1 (=1:3.32.1-1ubuntu4)

That info was helpful, since it limited the time frame for where to look for a possible upstream fix. And the commit mentioned in comment #11 now has proved to be it. :)

I have uploaded a gnome-shell fix to the bionic SRU queue.

Changed in gnome-shell (Ubuntu Bionic):
assignee: Gunnar Hjalmarsson (gunnarhj) → Marco Trevisan (Treviño) (3v1n0)
Changed in gnome-shell (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
Revision history for this message
Robie Basak (racb) wrote : Proposed package upload rejected

An upload of gnome-shell to bionic-proposed has been rejected from the upload queue for the following reason: "Fix appears incomplete, and no progress in a month. Please see https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1838152/comments/5 and subsequent discussion.".

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Akbarkhon, or anyone else affected,

Accepted gnome-shell into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnome-shell/3.28.4-0ubuntu18.04.7 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gnome-shell (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I verified the test case using gnome-shell 3.28.4-0ubuntu18.04.7 from bionic-proposed.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-shell - 3.28.4-0ubuntu18.04.7

---------------
gnome-shell (3.28.4-0ubuntu18.04.7) bionic; urgency=medium

  [ Matthew Ruffell ]
  * d/p/authPrompt-Properly-get-oVirt-service-name.patch,
    d/p/authPrompt-set-value-of-beginRequestType-to-DONT_PROVIDE_.patch,
    d/p/gdm-Introduce-vmware-credential-manager-for-pre-authentic.patch,
    d/p/gdm-Refactor-oVirt-to-a-generic-CredentialManager-interfa.patch:
    - Enable support for VMware Horizon SSO to ensure compatibility
      with the Horizon Agent (LP: #1886592)

  [ Marco Trevisan (Treviño) ]
  * debian/patches: Rename VMWare OVirt patches to use Gbp-Pq format

gnome-shell (3.28.4-0ubuntu18.04.6) bionic; urgency=medium

  - d/p/util-cache-local-GTimeZone.patch
    d/p/ShellAppCache-add-cache-to-help-keep-I-O-off-main-thread.patch,
    d/p/appDisplay-use-ShellAppCache-to-translate-folder-names.patch,
    d/p/appDisplay-use-ShellAppCache-to-access-GAppInfo.patch,
    d/p/Revert-appDisplay-use-ShellAppCache-to-access-GAppInfo.patch,
    d/p/Revert-appDisplay-use-ShellAppCache-to-translate-folder-n.patch,
    d/p/Revert-ShellAppCache-add-cache-to-help-keep-I-O-off-main-.patch,
    d/p/Revert-util-cache-local-GTimeZone.patch:
    + Include all the upstream patches to fix notification freezes
      (LP: #1838152).
  - d/p/series: Reorder so that upstream fixes come first

gnome-shell (3.28.4-0ubuntu18.04.5) bionic; urgency=medium

  * d/p/keyboardManager_apply-added-input-sources-instantly.patch:
    - Renamed to keyboardManager-Avoid-idempotent-calls-to-meta_backend_se.patch
    - Fixed DEP-3 tagging, and update them as per upstream cherry-pick
  * d/p/shell-global-Make-saving-of-persistent-state-asynchronous.patch:
    - Make saving of persistent state asynchronous (LP: #1838152)

gnome-shell (3.28.4-0ubuntu18.04.4) bionic; urgency=medium

  * d/p/keyboardManager_apply-added-input-sources-instantly.patch:
    - Make added input sources work instantly without relogin/reboot
      or other tricks (LP: #1890875).

 -- Marco Trevisan (Treviño) <email address hidden> Wed, 16 Dec 2020 01:24:41 +0100

Changed in gnome-shell (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for gnome-shell has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Changed in gnome-shell:
status: Unknown → Fix Released
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.