The problem of launching spacenavd using systemd in Ubuntu 20.04 OS #112
-
Hi! I have a problem with spacenavd accessing X11 when running through Systemd (the XOpenDisplay(0) function in the proto_x11.c file returns the value "0"). I am using the spacenavd.service file that comes with the source code. I use spacenavd version 1.3 on Ubuntu OS 20.04. I performed the installation for systemd strictly according to the instructions. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
The connection to the X server doesn't have to succeed during boot, because obviously the X server isn't running at that stage. If the X connection fails, spacenavd starts watching for the X socket to appear, and when it does, it attempts to connect again. So it should be able to connect automatically later when the X server starts. There are a few complications which might throw this scheme off:
I expect one or some combination of the above to be the issue you're facing. Feel free to ask followup questions if necessary, and let us know if you come up with a good solution for something. |
Beta Was this translation helpful? Give feedback.
-
As I promised, I describe the solution to this problem. The reason for the failure turned out to be that systemd, from which the spacenavd fork is made, has only two environment variables (you can see the output
It is important to note that the value of the DISPLAY and XAUTHORITY variables can be individual in each individual case. You should get these values using the commands: |
Beta Was this translation helpful? Give feedback.
-
Excellent, glad you fixed it. Yeah, |
Beta Was this translation helpful? Give feedback.
As I promised, I describe the solution to this problem. The reason for the failure turned out to be that systemd, from which the spacenavd fork is made, has only two environment variables (you can see the output
sudo systemctl show-environment
). In my case, the XAUTHORITY and DISPLAY environment variables are missing. Since the daemon is formed as a fork of systemd, it inherits only those environment variables that existed at the start of systemd. Therefore, in order to work around the problem, I added the appropriate variables to the unit file using the commandsudo systemctl edit spacenavd.service
as follows: