Skip to content
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

Not working after logout/login #20

Closed
owzim opened this issue Feb 5, 2020 · 30 comments
Closed

Not working after logout/login #20

owzim opened this issue Feb 5, 2020 · 30 comments
Labels
bug Something isn't working

Comments

@owzim
Copy link

owzim commented Feb 5, 2020

  • OS: Pop!_OS 19.10 x86_64
  • DE: GNOME 3.34.1
  • WM: GNOME Shell

After boot:

01-after-boot

After logout/login:

02-after-logout

After restart of service:

03-after-restart-of-keyswap

The fail also happens after fresh install, only a reboot solves it.

I also tried the current dev, as stated in this issue #11

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

You should be able to checkout the latest release of 1.0.4. It should resolve your issue. Just run back through the setup.py install.

The error handling has been improved, and the app will restart automatically if it begins before x11 or the DE isn't fully ready for it. Additional verbosity has been added as well for those that want to add more terminals or additional keyswapping categories.

Screenshot_2020-02-05_03-19-03

I am closing this ticket as I am pretty certain this issue is now fully resolved.

@rbreaves rbreaves closed this as completed Feb 5, 2020
@owzim
Copy link
Author

owzim commented Feb 5, 2020

@rbreaves thanks. I checked out 1.0.4, reinstalled with ./setup.py

There is now a new issue: after reboot the service is inactive and not started

image

after a systemctl --user start keyswap it works.

After logout/login, the service is inactive again:

image

a systemctl --user start keyswap result in the same fail, as before:

image

Is there something I need to do besides ./setup.py to reset everything? Since I tried to roll back to yesterdays dev but I cannot get the previous behaviour back.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

Crap.. I left out a single line in the updated installer.. just run this command and the service will be re-enabled and will work fine after that.

systemctl --user enable keyswap

I guess I will make a 1.0.4-1 release.
https://github.com/rbreaves/kinto/releases/tag/1.0.4-1

@owzim
Copy link
Author

owzim commented Feb 5, 2020

@rbreaves thanks for your efforts

So I checkout 1.0.4-1, installed it but after reboot, the service tried to start but failed:

image

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

Under the [Service] section of the service file can you try adding this.

RestartSec=3

nano ~/.config/systemd/user/keyswap.service

and then reload the service config with this command

systemctl --user daemon-reload

@owzim
Copy link
Author

owzim commented Feb 5, 2020

@rbreaves thanks, the RestartSec=3 fixed the start at boot issue, the logout/login issue is a different now:

The service is inactive, and starting it results in it being in an activating-state

image

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

That is really odd.. I have been able to duplicate a similar issue on ubuntu 19.10 and I cannot say why it occurs yet. I think systemd believes it ran successfully but then stops it prematurely. There's really no good reason for it to end. Something is wrong with the service config file. I will keep working on it and get a release out later today addressing the problem.

This behavior does not occur on xfce4, but I do not know why.

I actually get an exit code of 15, and the only time I can get an activating message to appear is if I change the service type to forking instead of simple.

@rbreaves rbreaves reopened this Feb 5, 2020
@owzim
Copy link
Author

owzim commented Feb 5, 2020

@rbreaves thank you for looking into it. Kinto is an awesome project.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

@owzim Thanks, and I believe I have it worked out now in the 1.0.4-3 release. I found that re-adding the kinto.desktop file to ~/.config/autostart seems to fix it because it will also run the command to start up the service. If the service is already running, such as a fresh boot then it is simply ignored and has no impact from what I can tell.

@rbreaves rbreaves closed this as completed Feb 5, 2020
@owzim
Copy link
Author

owzim commented Feb 5, 2020

@rbreaves with 1.0.4-3 on reboot it now fails, starting the service fixes it. Logout/login results in the service being inactive and starting it results in the service being in activating mode again.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

Weird.. guess I’ll reopen the ticket then for now. My test vm didn’t show it failing on log off & logins, but I didn’t test a full reboot.

Will work on several hours from now.

@rbreaves rbreaves reopened this Feb 5, 2020
@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

I must have been tired last night.. I did not type in the correct path or name for systemctl in that desktop file. That has now been corrected and the kintox11 binary has been updated to apply the gui keymap on init if the window being detected is none. Particularly useful for people that want to immediately open their apps via "Cmd+Space" and not wait until they click on some app.

I will leave this ticket open for the next 24 hours or so just to make sure release 1.0.4-4 fixes the problem.

@owzim
Copy link
Author

owzim commented Feb 5, 2020

@rbreaves I just installed 1.0.4-4

Issues persist:

After Reboot, the service fails to start:

image

After starting the service, it gets activated:

image

Logout/Login problem persists as well:

image

Can you not reproduce the issue, so you're stepping in the dark? How can I be of further help?

I can reproduce the issues both on a vbox machine and a real machine with Pop!_OS 19.10

@owzim
Copy link
Author

owzim commented Feb 5, 2020

When I set RestartSec=3 (it gets overridden and set back to 1 on every ./setup.py) the service gets activated as expected on reboot.

Logout/Login issue then mutates from failed to activating without finishing.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

Yea, I purposely set it to 1 by default, I was asking you to do 3 just because it would give a longer interval between restarts for debugging purposes.

removed some questions - irrelevant

I will test this under my pop_os 19.10 vm.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

This is interesting, it is something that impacts just Pop OS 19.10 and not Ubuntu 19.10, but I will figure it out.. I like Pop OS lol. Also I will need to update the python setup file, it is not setting the right de tweaks at the moment.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

I've made a couple of improvements and merged it into master, but the issue is still unresolved for Pop!_OS atm. From what I can tell though.. the working path is not being respected from the service file.

I can confirm that by doing the following
cd ~/.config/kinto/
./kintox11 or ./xactive.sh

The app will run just fine, but there's obviously an issue with systemd under Pop!_OS. I am not sure what just yet.

@rbreaves
Copy link
Owner

rbreaves commented Feb 5, 2020

Checkout the latest master branch, it is on the 1.0.4-5 release.

If it still fails then run this command and give me the output. I had it still fail on one reboot, but then work after a 2nd reboot, but sadly I did not run this command on the first failure.

journalctl -xe

@owzim It should mostly be fixed now, the primary cause of your issue was that I had hardcoded the Display value in the services file.. which probably works out ok most of the time on other OS's, but there was no real reason to have hardcoded that.

It was also something hardcoded in that file since the very beginning of Kinto, so it predated the new rewrite with the kintox11 binary and that really threw me off - hence all of the additional things I had looked into and added to the binary to try and help with error handling and giving more useful feedback into the terminal while it is running normally.

@rbreaves rbreaves closed this as completed Feb 6, 2020
@owzim
Copy link
Author

owzim commented Feb 6, 2020

on 1.0.4-5 after reboot:

image

Here is the journalctl -xe output:

-- A start job for unit UNIT has finished successfully.
-- 
-- The job identifier is 595.
Feb 06 13:49:37 pop-os geoclue[1658]: Service not used for 60 seconds. Shutting down..
Feb 06 13:49:37 pop-os systemd[1]: geoclue.service: Main process exited, code=killed, status=15/TERM
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit geoclue.service has exited.
-- 
-- The process' exit code is 'killed' and its exit status is 15.
Feb 06 13:49:37 pop-os systemd[1]: geoclue.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit geoclue.service has successfully entered the 'dead' state.
Feb 06 13:49:41 pop-os io.elementary.a[2139]: ComponentValidator.vala:38: Could not get the contents of blacklist file: Failed to open file “/etc/io.elementary.appcenter/app
Feb 06 13:49:41 pop-os io.elementary.a[2139]: Failed to load module "appmenu-gtk-module"
Feb 06 13:49:42 pop-os PackageKit[1689]: get-packages transaction /803_beebdbba from uid 1000 finished with success after 1344ms
Feb 06 13:49:42 pop-os PackageKit[1689]: uid 1000 is trying to obtain org.freedesktop.packagekit.system-sources-refresh auth (only_trusted:0)
Feb 06 13:49:43 pop-os PackageKit[1689]: uid 1000 obtained auth for org.freedesktop.packagekit.system-sources-refresh
Feb 06 13:49:43 pop-os systemd-resolved[739]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature lev
Feb 06 13:49:43 pop-os systemd-resolved[739]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature lev
Feb 06 13:49:43 pop-os systemd-resolved[739]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature lev
Feb 06 13:49:43 pop-os systemd-resolved[739]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature lev
Feb 06 13:49:47 pop-os PackageKit[1689]: refresh-cache transaction /804_cecaaeca from uid 1000 finished with success after 4140ms
Feb 06 13:49:49 pop-os /usr/lib/gdm3/gdm-x-session[1276]: (!!) vmware(0): New layout.
Feb 06 13:49:49 pop-os /usr/lib/gdm3/gdm-x-session[1276]: (!!) vmware(0): 0: 0 0 1680 981
Feb 06 13:49:49 pop-os /usr/lib/gdm3/gdm-x-session[1276]: (!!) vmware(0):
Feb 06 13:49:49 pop-os gsd-color[1742]: unable to get EDID for xrandr-Virtual1: unable to get EDID for output
Feb 06 13:49:49 pop-os gsd-color[1742]: unable to get EDID for xrandr-Virtual1: unable to get EDID for output
Feb 06 13:49:49 pop-os gsd-color[1742]: unable to get EDID for xrandr-Virtual1: unable to get EDID for output
Feb 06 13:49:52 pop-os PackageKit[1689]: get-updates transaction /805_ebddeecd from uid 1000 finished with success after 2810ms

@rbreaves
Copy link
Owner

rbreaves commented Feb 6, 2020

I somehow need a more complete log from your journalctl -xe. That output completely missed anything about the keyswap service.

@rbreaves rbreaves reopened this Feb 6, 2020
@rbreaves
Copy link
Owner

rbreaves commented Feb 6, 2020

*Updated to what Duckinahat says, the command I listed initially did not work with just -u.

Try this

journalctl --user-unit=keyswap.service -b

I think if you add -b it’ll also filter it down to the current boot. It’ll have the answer though, it’s much more verbose than getting the status.

@Duckinahat
Copy link

I was having a similar issue on ubuntu 18.04
Modifying the restart time followed by
systemctl --user daemon-reload
seemed to help after a login.

While debugging though I noticed that keyswap.service wasn't appearing with
journalctl -u keyswap.service
I needed to do
journalctl --user-unit=keyswap.service

Might help, really appreciate this tool, thanks

@rbreaves
Copy link
Owner

rbreaves commented Feb 6, 2020

Nice, thanks @Duckinahat and it appears like adding -b to it helps show the current errors, without it mine starts at the very beginning of my service logs instead of the latest.

@owzim
Copy link
Author

owzim commented Feb 6, 2020

@rbreaves ok so journalctl --user-unit=keyswap.service -b gave me this. Is this sufficient?

-- Logs begin at Thu 2020-01-16 12:22:52 CET, end at Thu 2020-02-06 22:13:02 CET. --
Feb 06 22:11:29 pop-os systemd[1253]: Started keyswap for Terminal and GUI.
Feb 06 22:11:29 pop-os xactive.sh[1269]: Importing user_config.json...
Feb 06 22:11:29 pop-os xactive.sh[1269]: Data from user_config.json imported successfully.
Feb 06 22:11:29 pop-os xactive.sh[1269]: fail to open X server display...
Feb 06 22:11:29 pop-os systemd[1253]: keyswap.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 22:11:29 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:30 pop-os systemd[1253]: keyswap.service: Service RestartSec=1s expired, scheduling restart.
Feb 06 22:11:30 pop-os systemd[1253]: keyswap.service: Scheduled restart job, restart counter is at 1.
Feb 06 22:11:30 pop-os systemd[1253]: Stopped keyswap for Terminal and GUI.
Feb 06 22:11:30 pop-os systemd[1253]: Started keyswap for Terminal and GUI.
Feb 06 22:11:30 pop-os xactive.sh[1413]: Importing user_config.json...
Feb 06 22:11:30 pop-os xactive.sh[1413]: Data from user_config.json imported successfully.
Feb 06 22:11:30 pop-os xactive.sh[1413]: Starting keyswap...
Feb 06 22:11:30 pop-os xactive.sh[1413]: X11 error: type=0, serial=9, code=3
Feb 06 22:11:30 pop-os xactive.sh[1413]: fail
Feb 06 22:11:30 pop-os systemd[1253]: keyswap.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 22:11:30 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:32 pop-os systemd[1253]: keyswap.service: Service RestartSec=1s expired, scheduling restart.
Feb 06 22:11:32 pop-os systemd[1253]: keyswap.service: Scheduled restart job, restart counter is at 2.
Feb 06 22:11:32 pop-os systemd[1253]: Stopped keyswap for Terminal and GUI.
Feb 06 22:11:32 pop-os systemd[1253]: Started keyswap for Terminal and GUI.
Feb 06 22:11:32 pop-os xactive.sh[1564]: Importing user_config.json...
Feb 06 22:11:32 pop-os xactive.sh[1564]: Data from user_config.json imported successfully.
Feb 06 22:11:32 pop-os xactive.sh[1564]: Starting keyswap...
Feb 06 22:11:32 pop-os xactive.sh[1564]: X11 error: type=0, serial=9, code=3
Feb 06 22:11:32 pop-os xactive.sh[1564]: fail
Feb 06 22:11:32 pop-os systemd[1253]: keyswap.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 22:11:32 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:33 pop-os systemd[1253]: keyswap.service: Service RestartSec=1s expired, scheduling restart.
Feb 06 22:11:33 pop-os systemd[1253]: keyswap.service: Scheduled restart job, restart counter is at 3.
Feb 06 22:11:33 pop-os systemd[1253]: Stopped keyswap for Terminal and GUI.
Feb 06 22:11:33 pop-os systemd[1253]: Started keyswap for Terminal and GUI.
Feb 06 22:11:33 pop-os xactive.sh[1604]: Importing user_config.json...
Feb 06 22:11:33 pop-os xactive.sh[1604]: Data from user_config.json imported successfully.
Feb 06 22:11:33 pop-os xactive.sh[1604]: Starting keyswap...
Feb 06 22:11:33 pop-os xactive.sh[1604]: X11 error: type=0, serial=9, code=3
Feb 06 22:11:33 pop-os xactive.sh[1604]: fail
Feb 06 22:11:33 pop-os systemd[1253]: keyswap.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 22:11:33 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:34 pop-os systemd[1253]: keyswap.service: Service RestartSec=1s expired, scheduling restart.
Feb 06 22:11:34 pop-os systemd[1253]: keyswap.service: Scheduled restart job, restart counter is at 4.
Feb 06 22:11:34 pop-os systemd[1253]: Stopped keyswap for Terminal and GUI.
Feb 06 22:11:34 pop-os systemd[1253]: Started keyswap for Terminal and GUI.
Feb 06 22:11:34 pop-os xactive.sh[1646]: Importing user_config.json...
Feb 06 22:11:34 pop-os xactive.sh[1646]: Data from user_config.json imported successfully.
Feb 06 22:11:34 pop-os xactive.sh[1646]: Starting keyswap...
Feb 06 22:11:34 pop-os xactive.sh[1646]: X11 error: type=0, serial=9, code=3
Feb 06 22:11:34 pop-os xactive.sh[1646]: fail
Feb 06 22:11:34 pop-os systemd[1253]: keyswap.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 22:11:34 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:35 pop-os systemd[1253]: keyswap.service: Service RestartSec=1s expired, scheduling restart.
Feb 06 22:11:35 pop-os systemd[1253]: keyswap.service: Scheduled restart job, restart counter is at 5.
Feb 06 22:11:35 pop-os systemd[1253]: Stopped keyswap for Terminal and GUI.
Feb 06 22:11:35 pop-os systemd[1253]: keyswap.service: Start request repeated too quickly.
Feb 06 22:11:35 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:35 pop-os systemd[1253]: Failed to start keyswap for Terminal and GUI.
Feb 06 22:11:36 pop-os systemd[1253]: keyswap.service: Start request repeated too quickly.
Feb 06 22:11:36 pop-os systemd[1253]: keyswap.service: Failed with result 'exit-code'.
Feb 06 22:11:36 pop-os systemd[1253]: Failed to start keyswap for Terminal and GUI.

@rbreaves
Copy link
Owner

rbreaves commented Feb 6, 2020

Thanks, that is what I was needing to see. I will take a moment and look through my code and see what I can do. It looks like it fails on the 1st run due to the DE still loading up, but the 2nd and the rest of the failures are happening for an unknown reason, but it's definitely happening as it is trying to get the current window.

@rbreaves
Copy link
Owner

rbreaves commented Feb 6, 2020

@owzim I can duplicate your error, sorta, but not consistently from boot or login, even on the same version of Pop!_OS.

I have updated the dev branch with the latest kintox11 binary, and since I am batting 0 out of 8 so far I will let you confirm that the latest kintox11 binary in the dev branch fixes your problem before issuing another official release.

Just checkout the latest dev branch. 26f70cc


More details

I'm actually glad you have forced me to make this change because it actually fixes another problem I was aware of but had not been able to fix until now.

The way I had been able to emulate your problem was by opening and closing a preferences panel in the Gnome Terminal which would result in the exact same type of error as what you have in your log. The app in this instance though would actually recover because it was not consistently happening.

So to resolve it I just added in a check to see where the x11 Window value is set at while it is retrieving the top window and if it is 0 then I do not run an XQueryTree function against it, otherwise it will crash and come back with XBadWindow error. I guess there is something different about how your X11 is working for some reason, as I am surprised you'd have a value of 0 that persistently. Previously the app would just exit and start itself back up again quietly and happened so rarely for me I did not worry about it too much. This specific problem is fixed now though and hopefully there's not yet another issue lurking on your setup! 😂

@owzim
Copy link
Author

owzim commented Feb 8, 2020

@rbreaves thanks for the efforts.

I installed 26f70cc and still have this failure at reboot.

image

However if I set the RestartSec=3 it does not fail at reboot.
Also: in both cases (RestartSec=1 and 3) the service successfully restarted after logout/in and even after ALT+F2 -> r (reload Gnome shell), which previously failed as well.

@rbreaves
Copy link
Owner

rbreaves commented Feb 9, 2020

Well that is interesting.. I may update the installer then and give people the option to set the restart interval. I'd prefer to recommend 1 second to most people, just so that the service will restart faster if it fails during normal usage any, but for the sake of a clean reboot 3 seems to be required for you. Perhaps you have a lot of other and additional services loading that requires it? I am not sure.

I am going to go ahead and close it though since it appears like it is running well now on 26f70cc in the dev branch. I don't think there's much more I can add to the binary itself, well maybe a timeout loop of some kind on grabbing that display once it becomes available that could help with the clean reboot.

Thanks for sticking with me this far lol, I know it took some effort to fix.

@rbreaves rbreaves closed this as completed Feb 9, 2020
@rbreaves
Copy link
Owner

@owzim I believe the current release, 1.0.4-6, should now allow you to have a 1 second RestartSec parameter as the Open Display function in the kintox11 program should now attempt to re-open the display for 60 seconds before giving up.

At this point RestartSec could be removed altogether but I think I will keep it in there in case there are other variables I am not taking into account. Restarting too quickly will definitely trigger the service to give up too quickly.


@rbreaves rbreaves added the bug Something isn't working label Feb 20, 2020
@rbreaves
Copy link
Owner

rbreaves commented Mar 29, 2020

@owzim So cold boots were still having issues with another user as well, so I went back and re-added the timer service for cold reboots, but also kept a shortcut that will start the service from logout and login as well.

In both cases those scripts and services have a 5 second delay to them to ensure that the service will start properly. I figured I'd mention this to you since you were the other user that had reported this type of issue. I am surprised I either had a bug regression or never fully resolved, I am not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants