-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run sunshine on a headless server over ssh? #47
Comments
If use Linux, you can configure virtual display. |
I'm trying to use Xvfb like so: Moonlight connects and looks good, but mouse and keyboard just aren't working for mystery reasons. Any ideas? |
Sunshine uses uinput to emulate mouse and keyboard. Do you have it enabled? If you plug in mouse and/or keyboard directly in your pc, do those work? |
After looking around for some time, it seems that Xvfb just doesn't support... input devices? Seems like it's very much the wrong tool for this job. Which is a shame because it otherwise "just worked" as a systemd user service, and also "just worked" in allowing me to choose a 3:2 resolution (for my Surface as a moonlight client). I've moved on to using the X dummy monitor method, but it's much less elegant. Have to set up startx on a user's automatic login, as opposed to a service. Defining modelines for the X dummy display simply does not work for most 3:2 resolutions. xrandr fails to add the resolutions with cryptic errors for which there are no relevant solutions known online. The wonders of linux... |
Did you find a way to solve this? I am also in the same situation. BTW, I am also tried to install it with a headless ubuntu machine. However, I don't have GPU. Is there any way to use sunshine without GPU? |
I have no solutions for Xvfb, but if someone else does I'd love to hear it. |
Maybe you can try this Instead direct start sunshine |
I have a xorg-video-dummy installed and running:
However sunshine is exiting after printing I tried solution mentioned above:
Sunshine starts and I able to connect to it via Moonlight, however I see a black screen with cross icon X. Same display (:0) is working fine with Anydesk. Logs:
Do you have an idea what I can do and what's wrong with my setup?
And crash afterwards. EDIT. figured out that in case of xfvb I need to run something on DISPLAY:99 in order to not see black screen. However I still can't control remote via mouse and keyboard and still see X icon as mentioned above. So xfvb is not an option in my case. |
I managed to add a dummy display in software to get it working with GPU acceleration on a server (well, someone else did and I copy/pasted the config files), I can tell you more if anyone is interested |
I also got it working, although I cannot recommend my solution. After some digging, I learned that intel's linux driver just includes a GPU accelerated virtual display output called VIRTUAL1. Rather than struggling to learn the arcane mysteries of xorg conf, I initialize the display with xrandr via xrandr --newmode "1500x1000_60.00" 102.49 1500 1548 1580 1660 1000 1003 1013 1029 +hsync -vsync
xrandr --addmode VIRTUAL1 "1500x1000_60.00"
xrandr --output VIRTUAL1 --mode "1500x1000_60.00" Sunshine will see this and it will just work. Of course, @Heath123 should share the solution, why would you dangle that with no details? 😩 |
I wasn't sure if anyone was still interested and finding everything I used takes time. Anyway, this might only work on Nvidia, but I'll try to find what I used |
I used the EDID file from https://superuser.com/a/1278264 and the xorg config is based on https://gist.github.com/ArrEssJay/0e126a56b0ee9f23551a98fb258414c6 |
I haven't tried it but maybe you could use https://github.com/akatrevorjay/edid-generator |
Is there any working solution for this and an iGPU? (i.e sunshine on a headless server/onboard iGPU) |
RetroArcher doesn't currently work on linux... |
@Heath123 Would you be so kind to explain a little bit more how you managed to get it working with the resources you shared? I tried using the EDID and adapting the xorg.conf file, but to no avail. I'm running a Ubuntu VM on GCP and struggling to get sunshine to work. I just can't get a virtual monitor setup when connected through SSH / TTY, only if I RDP / VN / Chrome Remote to it and start the service, but then, when launching through Moonlight, I lose all mouse and keyboard inputs (even after manually adding the uinput permissions. |
I can't remember much about it now but I think something about it was specific to Nvidia GPUs, does the VM have one? |
Yes, it does have a Tesla T4. Drivers are installed. I can't generate an EDID file from Nvidia panel as it won't show any monitors connected, so I used the .txt approach mentioned in that first link of yours https://superuser.com/questions/1278256/x-server-on-nvidia-card-with-no-screen/1278264#1278264 |
If it's slow did you try this |
I was able to run sunshine on a headless server with nvidia GPU with the fix presented here: |
on nvidia am on intel and just buyed a dummy plug |
So I was finally able to start and run Sunshine 0.20.0 on a Ubuntu 20.04 system via SSH. Posting here in case anyone is still interested. The procedure is pretty long so I attached it as a text file. UPDATE: Looks like despite triple checking this yesterday I still missed a step :( (setting the DISPLAY variable in your shell before you try to bring up Sunshine). I've updated the steps and added a few more clarification notes; repost is below. |
I followed your instructions on Ubuntu 22.04 but couldn't get the x server to run. It would just exit out immediately after I press enter. Try running sunshine.appimage but get Connection refused error. Any ideas on what I'm missing? |
The Xorg startup should generate 2 log files; the first is whatever path you gave for the -logfile option and the second is the standard stream log created by the redirection (in my example command I had that path represented by [STD_OUT_LOG]). You'll need to look at those to see what error is causing your X-server to fail out. |
I made it work in a headless VM server without a monitor or mouse attached (without audio yet, havent looked into that). The mouse wouldn't come through, but in wayland KDE setting here is the configuration for nixOS I used: hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
nixpkgs.config.pulseaudio = true; # (need to fix audio)
# Use this to force KDE to draw the cursor (slow)
# you should instead tell moonlight (client) to use
# local cursor with Ctrl+Alt+Shift+M and Ctrl+Alt+Shift+C
# (https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide#keyboardmousegamepad-input-options)
environment.sessionVariables = rec {
#KWIN_FORCE_SW_CURSOR="1";
};
services = {
xserver = {
displayManager.startx.enable = true;
enable = true; # X11 because setting up Wayland is more complicated than it is worth for me.
};
desktopManager.plasma6.enable = true;
displayManager = {
#autoLogin.enable = true;
#autoLogin.user = config.mySystem.user;
sddm.enable = true;
defaultSession = lib.mkForce "plasma";
};
};
services.xserver.xkb.layout = "br,pt";
#console.keyMap = lib.mkOverride 1009 "pt";
services.xserver.xkb.options = "eurosign:e,caps:escape";
services.avahi.enable = true;
services.avahi.publish.enable = true;
services.avahi.publish.userServices = true;
services.sunshine = {
enable = true;
autoStart = true;
capSysAdmin = true;
openFirewall = true;
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 47984 47989 47990 48010 ];
allowedUDPPortRanges = [
{ from = 47998; to = 48000; }
{ from = 8000; to = 8010; }
];
};
environment.systemPackages = with pkgs; [
sunshine
];
security.wrappers.sunshine = {
owner = "root";
group = "root";
#capabilities = "cap_sys_admin+p";
#capabilities = "cap_sys_admin+ep";
source = "${pkgs.sunshine}/bin/sunshine";
};
systemd.user.services.sunshine =
{
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
AmbientCapabilities = "CAP_SYS_ADMIN";
};
};
# Requires to simulate input
boot.kernelModules = [ "uinput" ];
services.udev.extraRules = ''
KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"
''; In the case of a VM without a pass-through GPU, using the |
I think the common solution for this problem is not error prone, since it relies on the X Server which is slowly phased out of Ubuntu. I had a look into how we could fake the connected display at a different level. Turns out, there is a possibility. There is the edid file preparation
initramfs modification
kernel parameters
debug and caution
references:
|
How to run sunshine on a server without a monitor?
The server has a GPU but no monitor.
The text was updated successfully, but these errors were encountered: