Closed mnjm97 closed 2 months ago
There are a couple things going on here:
(2) is just a convenience thing and could be worked around by adding udev rules if we found a way to work around (1). I can't remember if there were other reasons now because it's probably been 6 months since I converted it to root.
for users that don't use systemd or simply don't want to have the daemon running, there really should be a way to install and run this manually without root.
also, this is causing me permission issues. which is why I inquired in the first place.
The daemon was the only good way I found to go about this. I tried triggering the program from a udev rule (triggered when a device matching the rule is plugged in), as those can kick off commands, but they don't do well with long-running commands and it got very messy. The daemon approach has caused zero problems since. I'm happy to take a PR on this if you can do it in a way that works well across all platforms and primarily Steam Deck, but it's not something I care to tackle right now.
you could use the --user flag for systemctl and place the xreal-air-driver.service inside $USER_HOME/.config/systemd/user
that would avoid any need for root.
I tested and verified this works on my system. not sure how to do a PR. never done that before.
You would also need to place the udev rules if you're not using root. I believe also the systemctl calls during setup would require root (maybe not for a user daemon?). But, if the setup requires root, and running as root makes things simpler because then I don't have to manage udev rules for the devices I want to support, I'm not really inclined to move forward with this request. I'm also afraid we'll break something subtle in doing so. What exactly is the motivation?
ah, sorry I was confused. I thought that the udev rules weren't being used. I still had the old udev rules installed when I tested. my bad.
as for motivation, I have always believed that root should be used only if absolutely necessary. in this case I guess it is.
You're right, though, so I'll leave this open.
I would be okay going about this if:
I think the extra burden of managing udev rules is a small tradeoff for being able to get rid of excessive usage of root.
This has come up a couple more times in the context of Breezy as a general Linux app, as some distros don't seem to be happy with this service running as root. My previous hesitation was Decky-setup specific because I don't see any way to move that setup away from root. For all other purposes -- and especially as non-decky Linux installs become more common after I get a productivity solution ready -- it's going to become important that we make this a user-level systemd service. The setup and uninstall scripts will still need to run as root, but the service itself should run as the user.
The AUR installation of XR driver is now running it as a user service for use with Breezy GNOME (there's still not a gaming-ready driver setup in AUR). The scripted installation used for all other distros and gaming purposes is still running as root, but I'll be able to move that to a user service shortly. Install and uninstall will always require root, so the decky plugin will always have to have root access.
Finally have an implementation ready to test for this in a branch. Setup still requires sudo to copy the udev rules, unfortunately, but after that, the service itself runs as your user. Here's how to test:
chmod +x ~/Downloads/xr_driver_setup
sudo ~/Downloads/xr_driver_setup --tag v0.10-user-2
. Keep an eye out for any errors, since the setup has changed significantly.xr_driver_cli -e
xr_driver_cli -m
~/.local/state/xr_driver/driver.log
You can verify it's running as user by running ps aux | grep xrDriver
and looking at the process details.
Other things to try:
xr_driver_uninstall
. Verify no errors during this process.Initial testing on steam deck revealed that the /usr
directory is part of the read-only file system, which is where I'm installing the udev rules. Initial testing on my personal Arch linux machine showed that home-directory based udev rules wouldn't be picked up. /etc
is the other standard location, which is also read-only.I'll play around with this a little more on deck, but it may have to continue using a legacy root-service, while all other non-deck installs could use the user-service.
Edit: fortunately I was wrong about /etc
, I've updated the script to copy files there for steamos and it worked!
Resolved in https://github.com/wheaney/XRLinuxDriver/pull/70
To summarize:
I am sure I am missing something but As far as I can tell there is really no need to require root to install this. isn't everything being installed into users home dir anyway?