I currently have an Artix OpenRC (xfce) vm with an nVIDIA GRID K520 attached to it. The drivers are installed, and the DE still works (unlike last time). However, I can't seem to get sunshine running as a service. I used a PKGBUILD to build and install the package, and then created an openrc init script for the service. However, attempting to start the service returns the following:
sunshined | * Initialising sunshined... ...
sunshined |[2021:08:20:00:43:00]: Fatal: Could not open x11 display for keyboard
sunshined | * start-stop-daemon: failed to start `/usr/bin/sunshi [ !! ]
sunshined | * ERROR: sunshined failed to start
I'm not sure what has gone wrong, and could use some pointers on where to go next. If you need to see the init script, logs, or anything else, just say so and I'll do my best to grab it for you.
As it states, it cannot connect to x11. This means X11 environment DISPLAY is not preserved when script calls sunshi. Most likely the best way to prevent this message is to start this program manually
I've tried autostarting it and manually starting it, with the same results. I wish it was that :(
Same error message? Are you running a Wayland session?
EDIT:
- Starting it as a system service, get the same error message as OP.
- Starting it from the terminal, I get: "could not create sunshine mouse, no such file or directory"
- running
sudo modprobe uinput makes the program start successfully.
That't the exact same thing that happens for me, which confuses the crap outta me.
Sorry for taking so long to get back to you. I work weekends, and haven't had the time to fire up the VM yet. Will do once I get home today.
Yea, the service could be more clear that it requires the uinput kernel module.
I took a screenshot as well - let me know if you need it:
➜ / echo $DISPLAY
:0.0
As you alluded to recently, I was able to make sure this kernel module was enabled (one-off) with
sudo modprobe uinput
However, I had no change in success with starting sunshine via the startup script. I can post the startup script here for inspection if you want.
Instruct your system to load the module at boot:
# echo uinput >/etc/modules-load.d/uinput.conf
Unfortunately, I'm still running into the same error. The only way I can ever get sunshine to start is manually, with sudo (which was true before and after loading uinput at boot time). I'll post both the Terminal output and a copy of the openrc init script, in case I screwed up in writing the script.
Terminal output:
➜ ~ sudo rc-service sunshined start
[sudo] password for tophatproductions115:
sunshined | * Initialising sunshined... ...
sunshined |[output_name] -- [0]
sunshined |[upnp] -- [enabled]
sunshined |[nv_coder] -- [auto]
sunshined |[resolutions] -- [[
sunshined | 352x240,
sunshined | 480x360,
sunshined | 858x480,
sunshined | 1280x720,
sunshined | 1920x1080,
sunshined | 2560x1080,
sunshined | 3440x1440,
sunshined | 1920x1200,
sunshined | 3860x2160,
sunshined | 3840x1600
sunshined |]]
sunshined |[min_log_level] -- [2]
sunshined |[origin_web_ui_allowed] -- [lan]
sunshined |[origin_pin_allowed] -- [pc]
sunshined |[hevc_mode] -- [0]
sunshined |[amd_rc] -- [auto]
sunshined |[nv_preset] -- [default]
sunshined |[nv_rc] -- [auto]
sunshined |[amd_quality] -- [default]
sunshined |[fps] -- [[10,30,60,90,120]]
sunshined |[2021:08:29:00:09:30]: Fatal: Could not open x11 display for keyboard
sunshined | * start-stop-daemon: failed to start `/usr/bin/sunshi [ !! ]
sunshined | * ERROR: sunshined failed to start
sunshined:
#!/sbin/openrc-run
# For a true tutorial on how to write decent OpenRC init scripts, goto:
# https://github.com/OpenRC/openrc/blob/master/service-script-guide.md
name="sunshined"
description="Sunshine Gamestream Server for Moonlight"
command="/usr/bin/sunshine"
command_args="-p ${pidfile}"
pidfile="/var/run/sunshined.pid"
# The previous two lines assume that sunshine is a 'a well-behaved daemon that backgrounds itself and writes its own PID file by default'.
# If sunshine needs to have its user or group changed for it, the following line can be used.
command_user="tophatproductions115:tophatproductions115"
start() {
ebegin "Initialising sunshined..."
# Be sure to set the X display - if you have more than one X display, set it to the non-local-session.
DISPLAY=:1
start-stop-daemon --start --exec /usr/bin/sunshine
eend $?
}
stop() {
ebegin "Terminating sunshined..."
start-stop-daemon --stop --exec /usr/bin/sunshine
eend $?
}
Please let me know if I made an obvious mistake. This is my first attempt at writing one, and I'm pretty sure I stumbled somewhere in this case...
Your $DISPLAY is :0.0, why did you specify :1 in the script?
This can load
uinput on demand, instead of the previous "at boot" solution:
start_pre() {
einfo "Loading uinput module"
/usr/bin/modprobe uinput 2>&1
}
The VM that this is running in has multiple displays. I'm trying to target the one powered by an nVIDIA GRID card, and not the VMware vsga one. I'm probably going about it completely wrong though. I'll try display 0 as you've stated.
That start_pre() function has me feeling pretty dumb, because I didn't think of it from the start :| Thanks for the tip.
Here is the github for the sunshine project, in case anything else looks strange:
- https://github.com/loki-47-6F-64/sunshine
I made the changes you suggested, plus a few others. Still having some difficulty making Sunshine behave with OpenRC. Here are the script, and the terminal output:
#!/sbin/openrc-run
# An amateur attempt at an OpenRC script for Sunshine
# https://github.com/loki-47-6F-64/sunshine
# For a true tutorial on how to write decent OpenRC init scripts, goto:
# https://github.com/OpenRC/openrc/blob/master/service-script-guide.md
# The service is given a name, a description, and a specified binary location.
name="sunshined"
description="Sunshine Gamestream Server for Moonlight"
command="/usr/bin/sunshine"
# RC_SVCNAME is a variable that should contain the name of the service.
# If this does not work, can replace it with the word sunshine instead.
command_args="-p ${pidfile}"
pidfile="/var/run/${RC_SVCNAME}.pid"
# The previous two lines assume that sunshine is a 'a well-behaved daemon that backgrounds itself and writes its own PID file by default'.
command_background=true
# But this line is here because we know better - it needs to be sent to the background.
# If sunshine needs to have its user or group changed for it, the following line can be used.
command_user="tophatproductions115:input"
# Perhaps I should use the default user group instead (tophatproductions115) ?
depend() {
# Wait for the display manager, so we can actually have a graphical session to work with
need lightdm
}
# Before we begin, there is one last thing to attend to...
start_pre() {
einfo "Loading uinput module"
/usr/bin/modprobe uinput 2>&1
}
# The start-stop commands, for when it's time to roll.
start() {
ebegin "Initialising sunshined..."
# Be sure to set the X display - if you have more than one X display, set it to the non-local-session.
DISPLAY=:0
start-stop-daemon --start --exec /usr/bin/sunshine
eend $?
}
stop() {
ebegin "Terminating sunshined..."
start-stop-daemon --stop --exec /usr/bin/sunshine
eend $?
}
# In many cases, you shouldn't have to roll your own start, stop, and status functions.
# If you need yours to do something that the standard implementation does not do, feel free to write your own.
➜ ~ sudo rc-service sunshined start
sunshined | * Caching service dependencies ... [ ok ]
sunshined | * Loading uinput module
sunshined | * Initialising sunshined... ...
sunshined |[output_name] -- [0]
sunshined |[upnp] -- [enabled]
sunshined |[nv_coder] -- [auto]
sunshined |[resolutions] -- [[
sunshined | 352x240,
sunshined | 480x360,
sunshined | 858x480,
sunshined | 1280x720,
sunshined | 1920x1080,
sunshined | 2560x1080,
sunshined | 3440x1440,
sunshined | 1920x1200,
sunshined | 3860x2160,
sunshined | 3840x1600
sunshined |]]
sunshined |[min_log_level] -- [2]
sunshined |[origin_web_ui_allowed] -- [lan]
sunshined |[origin_pin_allowed] -- [pc]
sunshined |[hevc_mode] -- [0]
sunshined |[amd_rc] -- [auto]
sunshined |[nv_preset] -- [default]
sunshined |[nv_rc] -- [auto]
sunshined |[amd_quality] -- [default]
sunshined |[fps] -- [[10,30,60,90,120]]
sunshined |[2021:08:31:21:31:01]: Fatal: Could not open x11 display for keyboard
sunshined | * start-stop-daemon: failed to start `/usr/bin/sunshine' [ !! ]
sunshined | * ERROR: sunshined failed to start
I'll need to do some more research on this. Something is preventing the service from starting successfully. May have to just kick VMware's video adapter from the equation, so that the only one left standing is the nVIDIA GRID card...
I've tried at least 4 or 5 variations on xorg.conf, and can't get a virtual screen/monitor made for the GRID K520. Without this, I doubt that I'll be able to get Sunshine started properly. I may need to have this thread hibernated indefinitely...
https://github.com/loki-47-6F-64/sunshine/issues/43
https://github.com/loki-47-6F-64/sunshine/issues/52
Hi,
bumping this old thread, just wanted to mention that recently I wanted to install Sunshine in a new setup I'm preparing with Artix Linux and unfortunately the available AUR packages seem to not be working anymore for our distro, a SystemD dependency is preventing them to compile. I followed these steps to successfully compile and install it:
- Clone the project from the Github repository (https://github.com/LizardByte/Sunshine).
- Edit
Sunshine/cmake/packaging/linux.cmake according to what is described in this issue comment: (https://github.com/LizardByte/Sunshine/issues/2038#issuecomment-1937380165)
if (SYSTEMD_FOUND)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
endif ()
- Compile it according to the instructions (https://docs.lizardbyte.dev/projects/sunshine/en/latest/building/linux.html#linux).
- At this point the best idea should be to create a proper PKGINFO but I just generated a DEB file as the project instructions suggest and used the debtap tool (https://aur.archlinux.org/packages/debtap) to convert it to a suitable package for Artix Linux.
And that was it, I'm not using it as a service by now so not missing that. Is working very well to stream videogames and sharing the desktop.
PS. I think I manually installed the suggested dependencies, right now I don't have access to the system where I did this so I'm not sure the the resulting package takes into account that.
PS2. Yeah looked into the package and dependencies look good, so it's just a matter of setting building dependencies.