.Xauthority file not found

While attempting to get the spacenav daemon running, it appears to need a .Xauthority file in my home directory and with root privileges defined.

But, there is no such file in ~/

Can I create this file? Should it be there to begin with?

System is as follows:

Operating System: Manjaro Linux
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.4.9-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 6 × AMD FX™-6350 Six-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: TAHITI

Nothing in your $HOME should be owned by root.

Correct.

Yes. It’s a plain text file.

Not normally, because I don’t think anything in an Arch-based distribution would be trying to read it. :thinking:

Apparently the spacnavd does Attempting run the daeomon:

spacenavd -v -d                                                                        ✔  19s  
Spacenav daemon 1.2
reading config file: /etc/spnavrc
found usb device [256f:c652]: "3Dconnexion 3Dconnexion Universal Receiver" (/dev/input/event2) 
adding device (id: 0).
device name: 3Dconnexion 3Dconnexion Universal Receiver
  Number of axes: 6 (6a 0r)
  Number of buttons: 2 (evdev offset: 256)
  Axis 0 value range: -350 - 350 (fuzz: 0)
  Axis 1 value range: -350 - 350 (fuzz: 0)
  Axis 2 value range: -350 - 350 (fuzz: 0)
  Axis 3 value range: -350 - 350 (fuzz: 0)
  Axis 4 value range: -350 - 350 (fuzz: 0)
  Axis 5 value range: -350 - 350 (fuzz: 0)
using device: 3Dconnexion SpaceMouse Wireless (guess) (/dev/input/event2)
  device flags: swap y-z invert y-z
failed to bind unix socket: /var/run/spnav.sock: Permission denied
trying to open X11 display ":0"
   XAUTHORITY=/tmp/xauth_ChdWgv
Using XTEST to send key events

(Discussed in the Arch wiki: 3D Mouse - ArchWiki )

I think this is the problem… :arrow_down:

PIDFile=/var/run/spnavd.pid

/var/run is a symlink to /run, which is not writable to unprivileged users. So you’ll have to edit the configuration file and change the path to the PIDFile. I would recommend putting it in /tmp instead. :arrow_down:

PIDFile=/tmp/spnavd.pid

So, you’re suggesting I create a env var:

PIDFile=/tmp/spnavd.pid

I am suggesting that you edit the file /etc/spnavd.conf and change that line as I have shown above. The daemon already creates that environment variable, but it’s creating it with the wrong value.

Hmm…there is a /etc/spnavrc

No spnavd.conf

Well, okay, I don’t have the Arch Wiki page open right now. Use the /etc/spnavrc file then. :grinning:

Looking at that file, it is an example file. Everything is commented out.

There is no mention of this, or any, environment variable in the file.

My bad. The file to be edited is /etc/systemd/system/spacenavd.service.

That file does not exist.

Create it?

It should normally have been provided as part of the software package, but yes, you’ll need it if you’re going to start this as a daemon by way of systemd. Use the one on the Arch Wiki as your example, but be sure to have the PIDFile line put the file in /tmp instead of /var/run. :arrow_down:

[Unit]
Description=Userspace Daemon of the spacenav driver.

[Service]
Type=forking
PIDFile=/tmp/spnavd.pid
Environment=XAUTHORITY=/run/user/1000/gdm/Xauthority
ExecStart=/usr/bin/spacenavd

[Install]
WantedBy=multi-user.target

I’m not sure whether gdm would be correct in that Environment line, though. You’re using Plasma, and Plasma uses the sddm display manager — gdm is for GNOME.

I’m running Plasma too, and I don’t see anything relating to either gdm or sddm in /run/user/1000. :arrow_down:

[nx-74205:/dev/pts/3][/home/aragorn]
[aragorn] >  ls -l /run/user/1000/
total 4
drwx------ 2 aragorn aragorn 120 Aug 15 23:00 akonadi
drwx------ 2 aragorn aragorn  60 Aug 16 06:24 at-spi
srw-rw-rw- 1 aragorn aragorn   0 Aug 15 23:00 bus
drwx------ 3 aragorn aragorn  60 Aug 15 23:00 dbus-1
drwx------ 2 aragorn aragorn  60 Aug 16 14:15 dconf
dr-x------ 2 aragorn aragorn   0 Jan  1  1970 doc
drwx------ 2 aragorn aragorn 140 Aug 15 23:00 gnupg
srwx------ 1 aragorn aragorn   0 Aug 16 07:45 kio_http_cache_cleaner
-rw------- 1 aragorn aragorn  72 Aug 15 23:00 KSMserver__0
srwx------ 1 aragorn aragorn   0 Aug 15 23:00 kwallet5.socket
drwxr-xr-x 2 aragorn aragorn  60 Aug 15 23:00 p11-kit
drwx------ 2 aragorn aragorn 100 Aug 15 23:00 pulse
drwx------ 6 aragorn aragorn 160 Aug 15 23:00 systemd

But that begs the question: how did you install spacenavd? Is this the package from the AUR?

I created that file and now if I run

sudo spacenavd -v -d

There are no errors. And the device sems to work in, for instance, Blender.

But. I don’t seem to be able to actually run it as daemon with:

sudo spacenavd start

That’s the wrong way to do it. You have to use… :arrow_down:

sudo systemctl enable --now spacenavd.service

This will start it and make sure that it gets started automatically at boot time.

sudo systemctl enable --now spacenavd.service                                       ✔  8m 41s  
[sudo] password for mac: 
Created symlink /etc/systemd/system/multi-user.target.wants/spacenavd.service → /etc/systemd/system/spacenavd.service.

Job for spacenavd.service failed because a timeout was exceeded.
See "systemctl status spacenavd.service" and "journalctl -xeu spacenavd.service" for details.`

And:
`systemctl status spacenavd.service                                                1 ✘  1m 37s  
× spacenavd.service - Userspace Daemon of the spacenav driver.
     Loaded: loaded (/etc/systemd/system/spacenavd.service; enabled; preset: disabled)
     Active: failed (Result: timeout) since Wed 2023-08-16 13:42:08 EDT; 1min 32s ago
    Process: 13980 ExecStart=/usr/bin/spacenavd (code=exited, status=0/SUCCESS)
        CPU: 91ms

Aug 16 13:40:38 ubstwo systemd[1]: Starting Userspace Daemon of the spacenav driver....
Aug 16 13:40:38 ubstwo systemd[1]: spacenavd.service: Can't open PID file /tmp/spnavd.pid (yet?) after start:>
Aug 16 13:42:08 ubstwo systemd[1]: spacenavd.service: start operation timed out. Terminating.
Aug 16 13:42:08 ubstwo systemd[1]: spacenavd.service: Failed with result 'timeout'.
Aug 16 13:42:09 ubstwo systemd[1]: Failed to start Userspace Daemon of the spacenav driver..
lines 1-11/11 (END)

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

I’m sorry, but I’m afraid I cannot be of help anymore at this stage. According to the AUR page for spacenavd, it hasn’t been updated anymore in over a year.

:man_shrugging:

Thank you very much!

1 Like

After having given it some more thought, perhaps you should change… :arrow_down:

[Install]
WantedBy=multi-user.target

… into… :arrow_down:

[Install]
WantedBy=graphical-session.target

I think this may buy it just a little more time, because I suspect that there might be a race condition with the initialization of the tmpfs mounts. :thinking:

It’s worth a try… :man_shrugging: