Skip to content

Instantly share code, notes, and snippets.

@JojjeE
Last active October 25, 2025 16:19
Show Gist options
  • Select an option

  • Save JojjeE/0088c9ab6a6c5262de92dd64df917633 to your computer and use it in GitHub Desktop.

Select an option

Save JojjeE/0088c9ab6a6c5262de92dd64df917633 to your computer and use it in GitHub Desktop.
Building Sunshine on Ubuntu 25.04 + fix DualSense PS5 controller

Building Sunshine remote gaming server for Ubuntu 25.04

The repo maintainers for Sunshine only build for the LTS versions of Ubuntu. Which is fair enough.

I run Kubuntu 25.04 on my desktop at time of writing, and the LTS build versions of Sunshine would not work. It expected certain libraries to be a certain version and it just wouldn't start. The AppImage and Flatpak versions had their own problems. Documentation on building and its challenges were decently sparse but some sharp Google-fu despite Google's lobotomization enlightened me to the solutions.

I write my experiences here in case it helps anyone who needs it.

First, I created an Ubuntu Server 25.04 VM on my Proxmox server. That's just me, you don't have to do that, I'm just insane.

I began by cloning the repo like the instructions say. The flag is important because there's third party libraries and things that I won't get if I skip it. I need cmake as well.

sudo apt install cmake
git clone https://github.com/lizardbyte/sunshine.git --recurse-submodules
cd sunshine
mkdir build

Now I elevate to root and continue to try to build.

sudo -i
cd /home/username/sunshine/
./scripts/linux_build.sh

Eventually after cuda has downloaded and the build proceeds, the build fails because cospi, sinpi, cospif and sinpif math functions in cuda error out.

As per this StackOverflow question, I need to add noexcept (true) to the end of each of these methods. In my case, the error message told me the math_functions.h file in question can be found at sunshine/build/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h.

I open this file with nano and search for cospi, sinpi, cospif and sinpif methods. I alter them by adding noexcept (true) at the end.

Example before:

extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);

Example after:

extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept(true);

I had to do this for all four of the math functions mentioned in the error.

When this was done, I could try building again. I went back and ran ./scripts/linux_build.sh and at this point all should be well and a Sunshine.deb package should be generated in /sunshine/build/cpack_artifacts/.

I could also as per the instructions go back to the root sunshine folder and run these commands to build.

cmake -B build -G Ninja -S .
ninja -C build
cpack -G DEB --config ./build/CPackConfig.cmake

After that I could find sunshine-0.0.0.deb in the build folder.

Roadblock 1: Graphics drivers?

After installing the new Sunshine deb-package with sudo apt install ./Sunshine.deb on my desktop and setting it up the way I like it, everything was fine and working at first test. Finally I had Sunshine on my Linux partition!

But when I rebooted, things were very strange with my NVIDIA drivers. My second monitor wouldn't work and GPU Screen Recorder kept complaining. I don't know what Sunshine did exactly but it appears my drivers were outdated perhaps because sudo ubuntu-drivers install and flatpak update and a reboot solved all of this.

Roadblock 2: DualSense

While Sunshine was just peachy, I use the DualSense PS5 controller on my Moonlight home theater PC client and I want all functionality in the Sunshine end as well. It appears to be emulating an Xbox Series S controller. In the Sunshine web UI settings I switch the controller to PS5 and start Steam through my Moonlight client.

There is no controller input.

I go back to Sunshine and check the logs. Warning: Unable to create virtual DualShock 5 controller: Permission denied.

Some more Googling leads me to this GitHub issue. Through the very helpful comments I run a series of commands to remedy the situation.

sudo setfacl -m g:input:rw /dev/uhid
echo "uhid" | sudo tee /etc/modules-load.d/uhid.conf
sudo modprobe uhid

This was not enough however as it appears I needed the udev rules from the repo. I downloaded this 60-sunshine.rules file and placed it in the /usr/lib/udev/rules.d/ as per the issue comments and rebooted my system.

Now I have a working Sunshine for my Kubuntu 25.04 system with working DualSense support.

I hope this is helpful for anyone who needs it.

Part 2: Coming Back

I tried to pull and build the latest nightly today (2025-09-17) and had some problems, after they had bumped the cuda version to 12.9 and the necessary gcc version etc. For one, cuda wouldn't download properly.

Ensure there is enough space in /tmp and that the installation package is not corrupt.

My /tmp partition has 7.6G available but apparently that wasn't enough.

I could fix this by editing the /scripts/linux_build.sh file and adding the --tmpdir="${build_dir}/cudatemp" flag to the run command under the install_cuda() function. You'll know the line because it starts with "${build_dir}/cuda.run". I also added a mkdir ${build_dir}/cudatemp just before the run command.

That did allow me to download and run cuda however building failed because update-alternatives refused to use gcc-14.

I could fix this by removing gcc-11 from update-alternatives.

update-alternatives --remove gcc /usr/bin/gcc-11

Now I could build on the latest nightly once again.

@Soupolait
Copy link

Thank you very much ! Works flawlessly.

@John-Development
Copy link

I followed all the steps till the instalation but I cannot make it to launch... seems that it crashes on start 🤔
I tried building it in both ways, both of them giving the same result

Also, I dont know why it is asking me to remove libappindicator3-1 and libappindicator3-dev libraries in order to install the .dev, is this normal?

@JojjeE
Copy link
Author

JojjeE commented Jul 31, 2025

Since I built on another machine than I installed it on, I couldn't say

@John-Development
Copy link

Is there any difference in building in the same machine or in a different one? Maybe I should just create a VM to build it 😆

@JojjeE
Copy link
Author

JojjeE commented Jul 31, 2025

I don't think there is, aside from downloading a bunch of packages that the build process needs.

@shadshack
Copy link

Worked perfectly for me! Didn't bother with a VM.

@orabeidm
Copy link

orabeidm commented Oct 8, 2025

i need deb

@FryFish4U
Copy link

This guide had exactly what I needed! Sunshine is working as expected, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment