Open bhedavivek opened 3 years ago
UPDATE: I guess the DISPLAY env variable is important. Maybe found a solution to dynamically fetch correct value for DISPLAY for plebs like me: https://askubuntu.com/a/744751
This is actually a known issue but one that hasn't come up for me in a long time and doesn't often get reported. It has probably been several months since it was last brought up, but thank you for letting me know as this issue does need to be addressed and providing that link does give a nice starting point.
There are likely other users who have had this same issue but not been reporting it so it gives me the opportunity to address it before potentially losing anyone due to this oversight. Initially I did not want to set it statically and tbh it shouldn't be - if it has to be then it still needs to be somewhat dynamic. It is strange but not every distro requires the display var to be set and I think it is very dependent on the order things come up with systemd.
Found a working version of the command for me
➜ ~ sudo cat /usr/lib/systemd/system/xkeysnail.service
[sudo] password for krypton:
[Unit]
Description=xkeysnail
[Service]
Type=simple
KillMode=process
ExecStart=/usr/bin/sudo /bin/bash -c 'export DISPLAY=$$(w -h krypton | awk \'$$2 ~ /:[0-9.]*/{print $$2}\'); /usr/bin/xhost +SI:localuser:root && /home/krypton/.config/kinto/killdups.sh && /usr/local/bin/xkeysnail --quiet --watch /home/krypton/.config/kinto/kinto.py'
ExecStop=/usr/bin/sudo /bin/bash -c '/usr/bin/sudo pkill -f bin/xkeysnail && exit 0'
Restart=on-failure
RestartSec=3
[Install]
WantedBy=graphical.target
we can't use $USER in this command since USER is root and display server is probably running for normal user. I updated the xkeysnail.service
template that is generated by setup.py
to inject/replace the user's actual username into the command so we can generate the right username.
Although I am not sure if that would be the right path for people with a multi-user setup. maybe we can pass args through systemctl to the command ?
Multi-user support I think is the final step that needs to happen before I start the process of creating repo and submitting the app to the official repos.
Here's a link on how to pass variables through an external file https://superuser.com/questions/728951/systemd-giving-my-service-multiple-arguments.
I tend to start the service via a desktop shortcut under ~/.config/autostart/kinto.desktop - it could be configured to edit the systemd service directly for the current user before start the service or updating a separate arguments file and then starting the systemd service which will link to that file.
I am facing same issue in fedora.
facing the same issue in Ubuntu 22.04.1 LTS
facing the same issue in Ubuntu 22.04.1 LTS
Different issue most likely. Latest master should fix the install on Ubuntu 22.04.1. Whether it’ll fix it for others in this thread I dunno.
@rbreaves unfortunately, it did not. the same issue on Ubuntu 22.04.1. it worked one time after removing and reinstallation and then broke again after restart.
only this solution helped me, not sure how for long: https://github.com/rbreaves/kinto/issues/363#issuecomment-751411920
I'm experiencing this bug under Elementary OS 7 (Ubuntu 22.04.1 LTS based)
Linux MacBookPro-eOS 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Tried modifying xkeysnail service config #363 (comment) with no luck.
More details
echo $DISPLAY
always shows :0
in my case.I'm experiencing this bug under POP OS (Ubuntu 22.04.1 LTS based), same thing. as above, except for me it happened on restart not just log in/out
I experienced the same problem on Ubuntu 22.04.1 LTS.
Steps to reproduce:
I experienced the same problem on Ubuntu 20.04 LTS. I solved it by changing line
Environment=Display=:1
to
Environment=Display=:0
in file sudo vim /usr/lib/systemd/system/xkeysnail.service
My project (Toshy, an experimental offshoot of Kinto) seems to have avoided this kind of issue because it runs as the same user, from systemd "user" services, rather than a system-level service file running the keymapper as root. A udev
rules file is used to manage the permissions on the /dev/uinput
device.
One of the reasons for this was to get it to work with some Wayland environments more easily (Wayland+GNOME and Wayland+KDE Plasma). I'm not sure how easy it will ever be to open up a Wayland compositor instance to root the way Kinto does in the xkeysnail.service
file with xhost
.
Toshy uses a separate service to monitor the user's session to see if it is "active", and disables the keymapper service if the session becomes "inactive". This is according to an obscure bit of info from loginctl
, so this only works if the system is using systemd
. But in that case, this enables viable multi-user support. As long as at least the user account in the background is running the keymapper from the service files, rather than manually, it has worked in testing.
This thread also made me realize that the Toshy session monitor service was not stopping itself when the user logs out, so I fixed that issue. That's a much simpler situation to deal with, compared to when the user chooses the "Switch user" option and keeps the original session logged in in the background.
Describe the bug Kinto fails to restart after logging back into system after logout
Expected behavior Expectation would be kinto is able to restart again.
Install Type: Bare Metal Distro:
DE: Gnome Branch: master Commit: git rev-parse --short HEAD :
51f1498
During the Initial setup
DISPLAY=:0
after log out and log in for some reason on my system, it changes toDISPLAY=:1
.I see when creating the
xkeysnail
service file we are setting environment variableDISPLAY={displayId}
. Not sure why that is set, couldn't see any reasoning specific to it in the git log. Maybe we could remove it? updating my service file with the correct display id fixed it, but now I am assuming after a restartkinto
will fail to start again sinceDISPLAY
will reset to:0
.Gathered relevant log messages. I believe it's failing because
xhost
is targeting the wrong display.xkeysnail
sudo systemctl status xkeysnail sudo journalctl --unit=xkeysnail.service -b
xkb
systemctl --user status keyswap journalctl --user-unit=keyswap.service -b
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Rerunning setup.py or restarting computer fixes issue with kinto startup. Running kinto in debug mode also works.