-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Toshy interacts with Bluetooth keyboard issue on lightdm login screen (elementary OS 8)? #494
Comments
There’s a 5 second delay between attempts to start the config service, so I have no idea how it could cause a race condition. Also the Toshy services are user services, so they shouldn’t even be trying to start until the user actually logs in to the session successfully. Are we talking about logging back in to an existing session from a lock screen? Not much about this is making any sense to me yet. I’ll have to set up elementary 8 in a VM again later and see if I can replicate. But it sounds like this is specific to Bluetooth keyboards? This is a weird one. The session monitor service is also supposed to disable the config service while the session is “inactive”, which normally is the state reported by loginctl when the screen is locked. Maybe that’s not the case under lightdm. That would be bad, probably. |
Yep, its definitely weird. That log might be misleading and not the cause. All I know is the problem went away when I uninstalled. I noticed a while ago that there were quite a few errors in various logs relating to toshy and keymappings but as it was working i ignored them. This problem started happening as soon as I paired a bluetooth keyboard. AFAIK it only happens at boot. I initially suspected lightdm or bluetoothd but I was learning as I went as I don't really know linux at that level. Quite alot of the elementary stuff runs as part of the user service I think. The only other thing I can think of is something blocking dbus messaging. |
I'm sure that's either literally true, or something so subtle happened that it's rational to believe it went away just because Toshy was uninstalled, and software interactions are complex enough that the former is more likely than the latter. I'm just trying to think how that's possible.
It's normal under various circumstances to have errors for the Toshy services, but not typically to have the config trying to restart that many times unless Toshy is just flat out not working correctly on that distro. The complexity of having to implement little workarounds to get the services to start, stop and restart at the right times under various distro types and desktop environments was absolutely shocking when I was putting together the installer and service scripts.
I don't think I can pair a Bluetooth keyboard directly with a VM, so I may have to install eOS 8 on some kind of physical hardware. Not sure if I even have anything suitable for that lying around. I don't have a USB Bluetooth dongle that could allow a VM to interact with a Bluetooth keyboard, unfortunately. Maybe I should get one.
See, that makes it make even less sense. The only thing that I can think of that even exists (as far as the system is concerned) before the user logs into a session is the
A great many things run in the user "slice" as they call it, but login managers always run as root, or perhaps sometimes as some kind of less privileged user with special rules that let it verify your credentials and launch a user login session for you. Toshy's user services are literally in your own home folder, so they shouldn't be capable of affecting anything outside of your own login session. In fact multiple users are supposed to be able to have their own independent installs of Toshy, as long as the config/keymapper is run via the services, where the session monitor service will kill one user's config service if you "switch users" to another user's graphical session. Anyway, I will see if I can come up with anything. I was thinking of telling you that you can disable the auto-starting of the Toshy services, or remove them entirely, and run the config-only manual option after you log in. This is easier when you can use the tray icon menu, but of course elementary doesn't support tray icons. It can be done with some commands in the terminal. Immediately after installing Toshy, to remove the systemd user units:
That will not just disable the user services but remove them entirely. They can be reinstalled with:
Alternately, there are commands to just disable the services (but you have to independently stop them if they already started):
And to reverse:
To run just the config process manually:
And if you want verbose logging (careful with sharing too much of the log if you choose to redirect this to a file, it would contain any password keystrokes along with anything else you typed while running it verbosely like this, but without copying it from the terminal or redirecting to a file this is ephemeral logging):
To stop the keymapper process in either case, just It's a really good idea to set a spare F-key on your keyboard as the emergency stop key. You'll see the place to do this right near the top of your config file. The default key is ###################################################################################################
### SLICE_MARK_START: keymapper_api ### EDITS OUTSIDE THESE MARKS WILL BE LOST ON UPGRADE
# Keymapper-specific config settings - REMOVE OR SET TO DEFAULTS FOR DISTRIBUTION
dump_diagnostics_key(Key.F6) # default key: F15
emergency_eject_key(Key.F8) # default key: F16 The emergency stop key should work even from the login screen, if for some reason the manual keymapper process causes a problem at the lock screen. The side effect of running the config manually is that it continues keymapping even when you "switch user" or when the screen is locked, which is how Kinto works, and how Toshy worked until I figured out the obscure Sorry if all this is too much info, you don't have to try reinstalling or doing any of this if you don't have time on your hands. I'm just trying to put out enough context about how Toshy works to get to a point where someone can say what exactly the problem is here. |
Thanks for all the info. I might try some of these suggestions if I get time on a spare machine but it's not going to be a priority. I'm going to try a much more lightweight solution if I can find one. I remember thinking 'this is installing an awful lot of stuff just to intercept some keystrokes' when I installed toshy; I just need to remap a few shortcuts and have the apple and option keys do what I'm used to - I'm not a power user when it comes to shortcuts. It probably has all sorts of stuff I don't need and is trying to work across a range of distros which inevitably makes it more complicated. It is trying to start services relating to KDE and Cosmic for example which I know I don't need (there are messages in the logs indicating this). But then it seemed to 'just work' without further configuration. I don't really understand the distinction you're making about services (I only have a rudimentary understanding of systemd and unit files). I would need the keymapper to autostart on login. Could I just put something in .zshrc to run toshy as a standalone process? You're right about tray icons but there is a community project which gets round this. If its useful, lightdm runs as its own user called lightdm. Anyway, thanks for getting back to me so promptly. I hope you get to the bottom of it :) |
The main thing that causes Toshy to need to install so many things is dealing with all the different Wayland environments. It tries to be plug-and-play for the end user, regardless of distro or desktop environment, even if you use multiple desktop environments or window managers on the same system. The extra DBus services start and then immediately stop themselves if they aren’t needed for the currently detected environment. They don’t take up any resources beyond that. I’ve only seen a couple of simpler remapper projects for this purpose, like this one: https://github.com/petrstepanov/gnome-macos-remap Many other Linux keymappers still don’t support all the Wayland environments that are supported by the keymapper used by Toshy. For app-specific keymapping, which requires getting info about the active window from the compositor. Some keymappers make you install separate versions for the different environments. I didn’t want users to have to figure out which version to install, or not have the flexibility to change their DE or have multiple DEs without needing to make changes to the keymapper or config file. Toshy is meant to “just work” even for Linux noobs.
I’ve heard of something like this but where is it? How easy was it to get working?
You would want to put it in Use the full path to the Toshy “start” script or it won’t work. I haven’t yet changed the Toshy installer to put local/bin in the PATH in
Or create a “.desktop” file to run the same command and put it in Those are some techniques that work on non-systemd distros. You’d still need to disable or remove the systemd user services any time you reinstall Toshy. If you can see the Toshy tray icon, you could always just disable the autostart option shown in the menu, and then manually run the item marked “Config-Only” every time you log in. Just takes a few seconds to start. As you can see, there are a lot of different ways to manage the keymapper process. I did my best to make Toshy usable under all sorts of conditions. Pick whatever method makes the most sense to you. Hope this helps. |
Good point about .profile - I had forgotten that. The tray icon thing is here - https://github.com/lenemter/wingpanel-indicator-namarupa. It claims to work with eOS 8. I installed it but haven't tested it beyond that. I'm kind of expecting it to be broken in some way. To be honest, I am regretting choosing elementaryOS after a long break from linux. I haven't used it since v5. It has so far been endlessly frustrating and I think it might not be the project it once was. I don't remember it being this problematic last time. I am kind of blown away that just mapping keys is such a complex endeavour. Perhaps not many mac users end up using linux desktops as a second machine. I might try one last time without installing the services. I'll let you know if I do. Thanks again for all your help - much appreciated. |
I can say the same. Used to use v5 myself. I liked the clean UI and unusually fast boot times it had at the time. Gave it up when I realized the eOS devs were less open minded than the GNOME devs. Plus it has always given me a lot of trouble in virtual machines. When I did the first system update on the VM I just installed, it lost the virtual wired networking. Had to revert to the fresh install. I moved from GNOME to KDE Plasma 6 recently, and the Toshy installer has a special flag that will set up an extra KWin script and tweak settings to make the task switcher in Plasma behave like macOS, with grouped app windows. Plus there are some other scripts in the Toshy config folder that will tweak some other things in Plasma apps like Dolphin and Konsole. With a good Mac-like global theme applied, I now prefer Plasma over GNOME. And I tend to use Fedora for a couple of years now, after souring on Ubuntu and their heavy-handed pushing of Snaps.
The mapping of keys is not so bad, the problem is getting the focused window info from Wayland compositors, and the fact that macOS shortcuts are so fundamentally different from Windows and Linux shortcut schemes. To get a good experience you have to do different modmaps for terminals, and remap a large number of combos in all kinds of specific apps to completely different combos. I was the author of the “Finder Mods” in the Kinto config, to try to normalize all the common Linux file managers to act more like the Finder. Including a rudimentary “Enter to rename” simulation.
Thanks. I also expect it to be broken. There were always hacks but they never seemed to work on newer eOS releases. At least GNOME always has the shell extension maintained by Ubuntu. But that was another reason I left both for Plasma. Good luck finding a less abrasive experience, in whatever ways possible. 😅 |
Looks like the fix you linked to works, after using the instructions from the README and logging out. There was what appeared to be some kind of minor permission error at the end of the install, but it does work. It's a fork of an earlier project, as frequently happens with unmaintained GNOME shell extensions too. Unfortunately it's doing the "let's hide all the tray icons in a pop-up dialog behind three dots" kind of thing, which I'm not a fan of, but fits the aesthetic of Pantheon trying to be minimalist, I guess. I can't tell if there's a way to show specific icons on the actual top bar panel, but I doubt it. Not that Toshy's colorful icon would fit the mono-color look of the other symbolic icons. And it looks like I need to adapt the tray icon app to correctly launch the default elementary OS terminal ( I guess in this whole thing I forgot to mention the Toshy Preferences app, another graphical way to interact with the keymapper and the options/preferences you can change (none of which require restarting the keymapper). Unfortunately I never added some buttons to control the "Config-Only" way of running the keymapper, so for your kind of situation it's only relevant for changing Toshy preferences if you can't get the tray icon working. But it could be useful. If nothing else it has basic descriptions to clarify what the preferences actually do. |
Added the fix to the main branch for opening the elementary OS default terminal app to view the services log from the tray icon menu item. Working now. I haven't had tray icons working in elementary for a long time, so I didn't realize I had to add yet another terminal to the list that attempts to launch the default terminal (or some other known terminal command) in various desktop environments. There are still probably many situations where the list fails. Unfortunately most Linux desktop environments really have no concept of "user's default terminal" as some kind of automatic, generic command. It is very hard to make certain things "just work" in Linux. 😆 # List of common terminal emulators in descending order of commonness.
# Each element is a tuple composed of:
# (terminal command name, option used to pass a command to shell, DE list)
# Each terminal app option can be associated with multiple DEs to
# somewhat intelligently use the "correct" terminal for a DE.
terminal_apps_lst_of_tup: List[Tuple[str, List[str], ]] = [
('gnome-terminal', ['--'], ['gnome', 'unity', 'cinnamon'] ),
('ptyxis', ['--'], ['gnome', 'unity', 'cinnamon'] ),
('konsole', ['-e'], ['kde'] ),
('xfce4-terminal', ['-e'], ['xfce'] ),
('mate-terminal', ['-e'], ['mate'] ),
('qterminal', ['-e'], ['lxqt'] ),
('lxterminal', ['-e'], ['lxde'] ),
('terminology', ['-e'], ['enlightenment'] ),
('cosmic-term', ['-e'], ['cosmic'] ),
('io.elementary.terminal', ['-e'], ['pantheon'] ),
('kitty', ['-e'], [] ),
('alacritty', ['-e'], [] ),
('tilix', ['-e'], [] ),
('terminator', ['-e'], [] ),
('xterm', ['-e'], [] ),
('rxvt', ['-e'], [] ),
('urxvt', ['-e'], [] ),
('st', ['-e'], [] ),
# 'kgx' is short for "King's Cross" and represents GNOME Console
('kgx', ['-e'], [] ),
] |
Thanks again. There is also a project gaining traction called ghostty - https://github.com/ghostty-org/ghostty - which you might find people using. If you're interested in figuring out the issue with eOS, I could maybe share an ssh tunnel to a spare laptop I have using ngrok. I'm on discord with the same username. |
Ghostty is impressing a lot of people. A user prompted me to add it to the terminals list just recently. |
I made some changes to the script that comprises the session monitor service portion of Toshy. That's sort of a watchdog service that tries to stop the actual keymapper configuration service from running if you switch users (and stay logged in) or the screen is locked, or you log out entirely. (Still quite weird that you seem to think Toshy does something bad at the initial login screen at boot.) In theory the change should let the session monitor do better at shutting down the services after the user completely logs out (including all the DBus services). But like everything else, the session monitor service can't start in the first place until the user logs into a session. Because it's a "user" service, and the unit file is literally stored inside your home folder. So it should be impossible for it to have anything to do with anything happening at the boot login screen. So in short I can't say this change would make any difference in your case. It should clear up some annoying I'll be getting some USB Bluetooth adapters that should work with Linux, that I may be able to attach to a virtual machine. Tracking says sometime this week, but things are often late these days. We'll see what I can do with those to replicate the Bluetooth keyboard issue and see how Toshy could interact with that. |
Many thanks for continuing to look into this. However, if I am the only one to have reported it, I wouldn't waste any more time on it. There were some other ElementaryOS users with a similar problem, but AFAIK none of them explicitly stated they were using toshy so your original assessment may well have been correct. In the meantime, I became so frustrated with the bugs / annoyances in eOS 8 that I decided to abandon it as my distro of choice and have moved to Pop!_OS. As far as I can tell, eOS has a dwindling user base and only a handful of active developers so the chances of the bluetooth keyboard issue being resolved any time soon are pretty slim. Thanks again for being so responsive and helpful - much appreciated. |
I do try to keep Toshy from causing trouble as much as possible. And don't like when it's not working. Just fixed some issues related to a Wayland compositor's bad behavior a couple of hours ago. I do want to at least check on the Bluetooth issue, for anyone who is still sticking with elementary OS. Even though it's not my cup of tea anymore. Pop!_OS is a sort of unpredictable choice right now. Fortunately I was able to fix the COSMIC support a while ago, so it shouldn't matter whether you went with 22.04 LTS and COSMIC as a GNOME shell extension, or 24.04 LTS (alpha) with the new Wayland-only COSMIC desktop environment. Hope it works out, either way. |
I uninstalled toshy to resolve the issue so can't provide toshy logs. The issue has cost me so much time that I'm not willing to reinstall it at the moment.
elementary OS 8 (GNU/Linux 6.8.0-51-generic x86_64) - latest updates applied
Built on Ubuntu 24.04.1 LTS
lightdm with elementary greeter
Logitech k860 bluetooth
Problem observed:
bluetooth keyboard hangs lightdm greeter for approx 2 minutes. The bluetooth keyboard becomes unresponsive during that time. It is possible to login 'blind' - entering the password and hitting enter will log the user in successfully.
journalctl contains multiple entries of:
Uninstalling toshy returned normal functionality and instant keyboard input into the greeter password field.
I spent hours looking into bluetooth services, other PAM / gnome-keyring errors, scouring logs, enabling debug modes in bluetoothd and lightdm but uninstalling toshy was the only thing that resolved it. I'm assuming that 140 restarts of the toshy service blocks other services from running correctly or creates some other kind of race condition.
There is more detail here:
elementary/greeter#770
The text was updated successfully, but these errors were encountered: