Skip to content

Instantly share code, notes, and snippets.

@hwsmm
Last active February 8, 2024 03:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwsmm/ba73a5cd82e17cec14fe8d2cc2a8d32d to your computer and use it in GitHub Desktop.
Save hwsmm/ba73a5cd82e17cec14fe8d2cc2a8d32d to your computer and use it in GitHub Desktop.
How to run osu!stable on various linux distros

This page will explain how to run osu! on various linux distros with low latency. Read https://wiki.archlinux.org/title/User:Katoumegumi if you are using Arch or Arch-based distro.

You can use this guide for Ubuntu LTS/Current, Debian Stable/Unstable, openSUSE Leap/Tumbleweed and Fedora.


1. Installing wine-osu

wine-osu is basically wine with some patches that make osu! run better on WINE.

Debian users (and possibly Ubuntu users) may need to enable Multiarch before installing WINE:

sudo dpkg --add-architecture i386
sudo apt update

To install wine-osu, please follow the instruction in this page: https://software.opensuse.org/download/package?project=home%3Ahwsnemo%3Apackaged-wine-osu&package=wine-osu


2. Installing PipeWire

PipeWire is a replacement of PulseAudio, which is an audio server that's been used for long time, and much more. It will use much less resources compared to PulseAudio when you are trying to get low latency.

Installation steps vary across distros.

Fedora uses PipeWire by default, so skip this section unless you want to try additional tweaks.

Ubuntu (21.04+)/Debian users can follow here: https://wiki.debian.org/PipeWire

Ubuntu users who want recent version (20.04 users need to follow this as PipeWire 0.3+ is not available there): https://pipewire-debian.github.io

# openSUSE Leap
sudo zypper install opi
opi pipewire
# select 'pipewire', choose multimedia:libs and choose to keep the repository after installation
sudo zypper in pipewire-alsa pipewire-pulseaudio wireplumber

# openSUSE Tumbleweed
sudo zypper install pipewire pipewire-alsa pipewire-pulseaudio wireplumber

zypper may provide some options including deinstallation of pulseaudio during installation. As PipeWire is a replacement of PulseAudio, you need to remove PulseAudio.

systemctl --user --now disable  pulseaudio.{socket,service}
systemctl --user mask pulseaudio   
systemctl --user --now enable pipewire{,-pulse}.{socket,service} wireplumber.service
Additional unnecessary tweak - Click here to read
After installing PipeWire, now you need to edit a configuration file to get better latency. Pipewire has low latency by default, but you can push it further.

Run following commands:

mkdir -p ~/.config/pipewire
cp -rv /usr/share/pipewire/* ~/.config/pipewire/

Open a file manager and use Ctrl+H to see hidden files (those with name that starts with .), but if it doesn't work, look for View settings and check something like 'Show Hidden'

Make sure you are in your home folder, go to .config folder, and go to pipewire in order.

Open pipewire-pulse.conf, look for following entries, uncomment them by removing # at the first and edit values as follows:

context.modules = {
    pulse.min.req = 32/48000              # 0.67ms
    pulse.min.quantum = 32/48000          # 0.67ms
}

Now that you are done with editing PipeWire config files, restart PipeWire.

systemctl --user restart pipewire pipewire-pulse


3. Installing osu!

After installing wine-osu and PipeWire, use following commands to use winetricks. Winetricks is a tool to work around problems in Wine.

mkdir ~/osu
cd ~/osu

wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks

Install winetricks from the official repositories to satisfy dependencies of winetricks, but we won't use the packaged version since it may be incompatible with the current wine-osu version.

# Ubuntu / Debian
sudo apt install winetricks

# openSUSE
sudo zypper install winetricks

# Fedora
sudo dnf install winetricks

Install .NET 4.8 with winetricks to run osu! properly.

export PATH=/opt/wine-osu/bin:$PATH
export WINEPREFIX=$HOME/osu/prefix
export WINEARCH=win32

./winetricks -q dotnet48

You can change WINEPREFIX if you want. Don't install Wine Mono and Gecko even if Wine asks you to do so.

Now, download osu! installer and install with it.

mkdir client
cd client
wget 'https://m1.ppy.sh/r/osu!install.exe'
wine 'osu!install.exe'

osu!install will handle installation automatically and launch osu! as soon as the installation is done. Your osu! should run fine at this point. If it launches, close it for next steps. If it doesn't, please let me know (or you can give it a few more restarts with wine 'osu!.exe')


4. Writing a launch script and adjusting latency

Go to your home directory, and go to osu folder you created before. Make an empty file and name it as start.sh

It should look like:

#!/bin/sh
export PATH=/opt/wine-osu/bin:$PATH
# change wine-osu to wine-osu-stable if you installed wine-osu-stable
export WINEPREFIX=$HOME/osu/prefix
export WINEARCH=win32

export vblank_mode=0 # to disable vsync for intel/amd gpu users
export __GL_SYNC_TO_VBLANK=0 # same as above but for nvidia users

#export WINEFSYNC=1
# uncommenting above line improves performance on kernel 5.16+ or custom patched kernels.
# read Personal Recommendation section for details.

#export WINEESYNC=1
# uncommenting above line improves performance on stable wine.
# stable wine doesn't have fsync patches, so use this instead if you are using a stable build

#export WINEDLLOVERRIDES=winemenubuilder.exe=d

#export STAGING_AUDIO_PERIOD=50000

cd ~/osu/client
wine 'osu!.exe' "$@"

Save the file and open a terminal in the current directory (or cd ~/osu after opening a terminal), do chmod +x start.sh and ./start.sh. Your osu! should start now.

Play some maps to see if your audio is fine. If you feel it's nice, you don't need further tweak. But if it is not good, you can try adjusting the value of STAGING_AUDIO_PERIOD.

How to tweak STAGING_AUDIO_PERIOD - Click here to read
Remove `#` at the first and try adjusting the value. Lower value (numbers after `=`) means lower latency, so you can decrease the value to lower latency, but audio becomes unstable after reaching the limitation, which means you need to try many times to find out what value is the best for your environment.

Good starting point is 50000 in my opinion, because most devices don't produce crackling noises at this value.

After editing, save the file and see if the audio is fine. If it was fine, you can decrease the value. If it wasn't, you need to increase the value. You can start osu! again with ./start.sh (you can use ↑ key so that you won't need to type it again)


(Optional) Making a .desktop file

You can make a .desktop file to launch osu! easily.

Make a directory for icons first: mkdir ~/osu/.icons/

osu! logo: wget -O ~/osu/.icons/logo.png https://github.com/ppy/osu-wiki/raw/master/wiki/Brand_identity_guidelines/img/usage-full-colour.png

Go to $HOME/.local/share/applications and make osu.desktop:

[Desktop Entry]
Type=Application                   
Name=osu!
Icon=/home/<put your username without bracket>/osu/.icons/logo.png
Exec=/home/<same as above>/osu/start.sh %u
Categories=Game;

(Optional) Installing osu-handler

You can also install osu-handler to import osu! files (such as osz and osk) easily on Linux. It's made by openglfreak, so are many patches in my wine-osu. Big thanks to openglfreak!

Just install it with your package manager if you installed wine-osu from my repository:

# Ubuntu / Debian
sudo apt install osu-handler-wine

# openSUSE
sudo zypper install osu-handler-wine

# Fedora
sudo dnf install osu-handler-wine

You may want to disable winemenubuilder to prevent WINE from changing the filetype association. Add this to your start.sh:

export WINEDLLOVERRIDES=winemenubuilder.exe=d

(Optional) Installing OpenTabletDriver

OpenTabletDriver is a low-latency tablet driver which supports Linux, Windows and macOS. OTD is basically the best tablet driver for osu! in Linux with nice GUI unless you patch the built-in driver. If any problem comes up during usage, read https://opentabletdriver.net/Wiki/FAQ/Linux

Ubuntu/Debian: https://opentabletdriver.net/Wiki/Install/Linux#debian

openSUSE or Fedora:

First, you need to install .NET manually if you use openSUSE since they don't provide it in their official repository. Install .NET runtime through this guide.

Download RPM from here and install it through your package manager:

cd ~/Downloads
# openSUSE
sudo zypper install ./OpenTabletDriver.rpm

# Fedora
sudo dnf install ./OpenTabletDriver.rpm

Everything should be working if you followed these steps correctly! Please ask me if you got any problems :)

References

Personal recommendations

GameMode

You can try Feral GameMode for extra performance. Install it through your package manager and change wine 'osu!.exe' "$@" to gamemoderun wine 'osu!.exe' "$@" in ~/osu/start.sh.

Patched kernels

You can try custom patched kernels. They may offer extra latency benefit and better performance.

Kernels listed here are in the official repositories, but they don't support fsync unless the version is 5.16+:

  • linux-lowlatency - Ubuntu / sudo apt install linux-lowlatency
  • linux-image-rt-amd64 - Debian / sudo apt install linux-image-rt-amd64
  • kernel-preempt - openSUSE Leap / sudo zypper in kernel-preempt
@Cherenkov11
Copy link

I followed this guide in Fedora, but I noticed some discrepancies with Windows.

  • First, after starting a song, usually the artist and song name are shown with an animation, but with wine doesn't show (screenshot attached)
    Screenshot_20220605_113829
  • And second, the star symbol next to the star rating also doesn't show up.

Those are the only two things that I have noticed.

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