Skip to content

Instantly share code, notes, and snippets.

@teohhanhui
Last active July 2, 2024 07:31
Show Gist options
  • Save teohhanhui/042a395010d9946ceee14768736e3780 to your computer and use it in GitHub Desktop.
Save teohhanhui/042a395010d9946ceee14768736e3780 to your computer and use it in GitHub Desktop.
Asahi Linux - krun + FEX + Steam

Disclaimer

Make sure you understand the experimental nature of this. Things might stop working anytime, although please let me know if that happens and I will try my best to get them working again. Most importantly, please do not bug the Asahi devs about this. This is not officially released or endorsed by the Asahi Linux project.

Create distrobox container

export DBX_CONTAINER_MANAGER=podman
distrobox create --image quay.io/fedora/fedora-toolbox:40-aarch64 --name asahi-krun

Enter distrobox container

distrobox enter asahi-krun

When it's ready, your terminal prompt should look something like:

📦[teohhanhui@asahi-krun ~]$

Install krun and dependencies inside the container

sudo dnf copr enable slp/asahi-mesa-wip
sudo dnf config-manager --save --setopt=*.priority=5 copr:copr.fedorainfracloud.org:slp:asahi-mesa-wip
sudo dnf copr enable teohhanhui/asahi-krun
sudo dnf install mesa-dri-drivers-24.1.0~asahipre20240228
sudo dnf --best install alsa-lib alsa-plugins-pulseaudio alsa-utils dhcpcd eglinfo glmark2 glx-utils libkrun mesa-demos passt pipewire-libs pulseaudio-libs pulseaudio-utils socat sommelier virglrenderer xorg-x11-server-Xwayland --exclude pipewire --exclude pipewire-pulseaudio --exclude pulseaudio
cd ~/Downloads
git clone https://github.com/slp/krun.git
cd krun
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. ~/.cargo/env
sudo dnf group install c-development
sudo dnf install clang-devel libkrun-devel llvm-devel
cargo build --release
sudo cp target/release/krun{,-guest,-server} /usr/local/bin/
sudo chmod +x /usr/local/bin/krun{,-guest,-server}

Save the krun file from this gist as ~/.local/bin/krun, then chmod +x ~/.local/bin/krun. This will be your entry point to run anything inside krun VM.

Save the krun-guest file from this gist as ~/.local/bin/krun-guest, then chmod +x ~/.local/bin/krun-guest. We use this file to override some things while running inside the krun VM (for now).

Install FEX inside the container

sudo dnf copr enable teohhanhui/fex-emu
sudo dnf install fex-emu

Set up FEX RootFS

krun FEXRootFSFetcher

Then follow the instructions:

  1. Choose y to download.
  2. Choose 1 for Fedora 40.
  3. Choose 1 to extract.
  4. Choose y to set as default.

Save the FEXBash file from this gist as ~/.local/bin/FEXBash, then chmod +x ~/.local/bin/FEXBash. This will be your entry point to run commands in the FEX environment. Tip: Don't use FEXBash in your shell scripts, as it does not properly handle word splitting. Use krun FEXInterpreter or krun FEXInterpreter sh instead.

If you do krun myprogram where myprogram is an x86(-64) executable, it'll automatically get run using FEX, thanks to binfmt_misc rules. Note: This would not work for programs like steam which are only installed inside the FEX RootFS.

chroot into FEX RootFS

sudo dnf install patchelf
krun bash

Once you're inside the krun VM:

cd ~/.fex-emu/RootFS/Fedora_40
unshare -pfr --user --mount --kill-child /usr/bin/bash

Your terminal prompt should become something like:

[root@han-macbook-air Fedora_40]#

Switch into the chroot:

./unbreak_chroot.sh

You should have seen Chrooting into container message, and your terminal prompt should look something like:

bash-5.2#

Install Steam in FEX RootFS

dnf copr enable slp/asahi-mesa-wip
sed 's/\[\(copr:copr\.fedorainfracloud\.org:slp:asahi-mesa-wip\)\]/[\1.i386]/;s/\$basearch/i386/' /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:slp:asahi-mesa-wip.repo > /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:slp:asahi-mesa-wip.i386.repo
dnf config-manager --save --setopt=*.priority=5 copr:copr.fedorainfracloud.org:slp:asahi-mesa-wip copr:copr.fedorainfracloud.org:slp:asahi-mesa-wip.i386
dnf install mesa-dri-drivers-24.1.0~asahipre20240228
dnf remove pipewire pulseaudio
dnf --best install alsa-plugins-pulseaudio alsa-utils eglinfo glmark2 glx-utils mesa-demos mesa-libEGL-devel pulseaudio-utils --exclude pipewire --exclude pipewire-pulseaudio --exclude pulseaudio
dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
dnf install steam --exclude pipewire --exclude pipewire-pulseaudio --exclude pulseaudio

Exit from FEX RootFS chroot

First, exit from the chroot:

exit

(Long spam of error messages... It doesn't clean up properly, but we'll take care of that below.)

And then, exit from the unshare:

exit

This is compulsory as the previous cleanup after exiting from chroot didn't work correctly with our setup:

./break_chroot.sh

Run Steam

Save the steam file from this gist as ~/.local/bin/steam, then chmod +x ~/.local/bin/steam. This will be how you run Steam.

steam

Note: If you get an error like this, just try again. It should work after a few tries.

dlmopen steamui.so failed: steamui.so: cannot open shared object file: No such file or directory
Failed to load steamui.so - dlerror(): (null)

Save the steam.desktop file from this gist as ~/.local/share/applications/steam.desktop. It creates an entry for Steam in your app launcher. (It will launch with the terminal, because Steam is quite slow to launch, so you would want to know what's going on, and it might crash and restart, etc.)

Troubleshooting Steam

Check the Steam logs in ~/.steam/root/logs

Workaround for transparent Steam window

Workaround has already been added in the steam file from this gist (~/.local/bin/steam).

The old workaround (disabling GPU accelerated rendering) was found to be bad, as it caused the renderer process to keep crashing (also, it was just slow).

If you have previously disabled GPU accelerated rendering, you should remove this line from ~/.steam/registry.vdf:

					"GPUAccelWebViewsV3"		"0"

Workaround for Steam menus not working properly

Switch to Big Picture Mode. (Please make sure you don't have GPU accelerated rendering disabled, or it'd be really slow.)

Optional: Lutris

chroot into FEX RootFS

Follow the steps in chroot into FEX RootFS above.

Install Lutris

dnf install lutris --exclude ntfs-3g --exclude pipewire --exclude pipewire-pulseaudio --exclude pulseaudio

Exit from FEX RootFS chroot

Follow the steps in Exit from FEX RootFS chroot above.

Run Lutris

Save the lutris file from this gist as ~/.local/bin/lutris, then chmod +x ~/.local/bin/lutris. This will be how you run Lutris.

lutris

Save the net.lutris.Lutris.desktop file from this gist as ~/.local/share/applications/net.lutris.Lutris.desktop. It creates an entry for Lutris in your app launcher.

Optional: box64

Personally I quite like box64. It's good to have not 1, but 2 x86-64 emulators. More competition, more options, etc.

Enter distrobox container

Follow the steps in Enter distrobox container above.

Install box64

sudo dnf copr enable teohhanhui/box64
sudo dnf install box64
sudo mkdir -p /x86_64/etc/yum.repos.d
sudo cp /etc/yum.repos.d/{fedora,fedora-updates,fedora-updates-testing}.repo /x86_64/etc/yum.repos.d/
sudo dnf --installroot=/x86_64 --forcearch=x86_64 --releasever=/ install system-release
sudo dnf --installroot=/x86_64 --forcearch=x86_64 install bash

Run box64

Save the box64 file from this gist as ~/.local/bin/box64, then chmod +x ~/.local/bin/box64.

box64 bash

Unfortunately this is broken at the moment: ptitSeb/box64#1517 (You could use a separate Fedora 39 distrobox container in the meantime...)

Install Wine (new wow64 mode)

sudo dnf --installroot=/x86_64 --forcearch=x86_64 copr enable teohhanhui/wine
sudo dnf --installroot=/x86_64 --forcearch=x86_64 install wine

Fix up the wine symlinks in /x86_64:

( cd /x86_64/etc/alternatives; _bindir=/x86_64/usr/bin; _libdir=/x86_64/usr/lib64; sudo ln -sf ${_bindir}/wine64 wine; sudo ln -sf ${_libdir}/wine/i386-windows/wine-d3d10_1.dll 'wine-d3d10_1(x86-32)'; sudo ln -sf ${_libdir}/wine/x86_64-windows/wine-d3d10_1.dll 'wine-d3d10_1(x86-64)'; sudo ln -sf ${_libdir}/wine/i386-windows/wine-d3d10core.dll 'wine-d3d10core(x86-32)'; sudo ln -sf ${_libdir}/wine/x86_64-windows/wine-d3d10core.dll 'wine-d3d10core(x86-64)'; sudo ln -sf ${_libdir}/wine/i386-windows/wine-d3d10.dll 'wine-d3d10(x86-32)'; sudo ln -sf ${_libdir}/wine/x86_64-windows/wine-d3d10.dll 'wine-d3d10(x86-64)'; sudo ln -sf ${_libdir}/wine/i386-windows/wine-d3d11.dll 'wine-d3d11(x86-32)'; sudo ln -sf ${_libdir}/wine/x86_64-windows/wine-d3d11.dll 'wine-d3d11(x86-64)'; sudo ln -sf ${_libdir}/wine/i386-windows/wine-d3d9.dll 'wine-d3d9(x86-32)'; sudo ln -sf ${_libdir}/wine/x86_64-windows/wine-d3d9.dll 'wine-d3d9(x86-64)'; sudo ln -sf ${_libdir}/wine/i386-windows/wine-dxgi.dll 'wine-dxgi(x86-32)'; sudo ln -sf ${_libdir}/wine/x86_64-windows/wine-dxgi.dll 'wine-dxgi(x86-64)'; sudo ln -sf ${_bindir}/wine64-preloader wine-preloader; sudo ln -sf ${_bindir}/wineserver64 wineserver; )
( cd /x86_64/usr/bin; _sysconfdir=/x86_64/etc; sudo ln -sf ${_sysconfdir}/alternatives/wine wine; sudo ln -sf ${_sysconfdir}/alternatives/wine-preloader wine-preloader; sudo ln -sf ${_sysconfdir}/alternatives/wineserver wineserver; )

Install Steam (Windows version)

cd ~/Downloads
curl -fsSLo SteamSetup.exe https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe
box64 wine64 SteamSetup.exe

Unfortunately this is broken at the moment: ptitSeb/box64#1393, ptitSeb/box64#1449

Run Steam (Windows version)

box64 wine64 steam.exe

Unfortunately this is broken at the moment: ptitSeb/box64#487 (comment)

#!/bin/sh
export BOX64_LD_LIBRARY_PATH=./:lib/:lib64/:x86_64/:bin64/:libs64/:/x86_64/usr/lib64/
export BOX64_PATH=./:bin/:/x86_64/usr/bin/
export BOX64_BASH=/x86_64/usr/bin/bash
if [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
exec '/usr/bin/box64' "$@"
fi
if [ -z "${DBX_CONTAINER_MANAGER}" ]; then
export DBX_CONTAINER_MANAGER=podman
fi
if [ -n "${CONTAINER_ID}" ]; then
container_name="${CONTAINER_ID}"
# if the variable is not set, let's fall back to some tricks.
elif [ -e /.dockerenv ]; then
# we're in docker, let's use this trick
container_name=$(grep "memory:/" < /proc/self/cgroup | sed 's|.*/||')
elif [ -e /run/.containerenv ]; then
# we're in podman or lilipod, use this other trick
container_name=$(grep "name=" /run/.containerenv | cut -d'=' -f2- | tr -d '"')
fi
if [ -z "${container_name}" ]; then
exec "/usr/bin/distrobox-enter" -n asahi-krun -- krun -e=BOX64_LD_LIBRARY_PATH -e=BOX64_PATH -e=BOX64_BASH -- '/usr/bin/box64' "$@"
elif [ -n "${container_name}" ] && [ "${container_name}" != "asahi-krun" ]; then
exec distrobox-host-exec "$HOME/.local/bin/box64" "$@"
else
exec krun -e=BOX64_LD_LIBRARY_PATH -e=BOX64_PATH -e=BOX64_BASH -- '/usr/bin/box64' "$@"
fi
#!/bin/sh
if [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
exec '/usr/bin/FEXBash' "$@"
fi
if [ -z "${DBX_CONTAINER_MANAGER}" ]; then
export DBX_CONTAINER_MANAGER=podman
fi
if [ -n "${CONTAINER_ID}" ]; then
container_name="${CONTAINER_ID}"
# if the variable is not set, let's fall back to some tricks.
elif [ -e /.dockerenv ]; then
# we're in docker, let's use this trick
container_name=$(grep "memory:/" < /proc/self/cgroup | sed 's|.*/||')
elif [ -e /run/.containerenv ]; then
# we're in podman or lilipod, use this other trick
container_name=$(grep "name=" /run/.containerenv | cut -d'=' -f2- | tr -d '"')
fi
if [ -z "${container_name}" ]; then
exec "/usr/bin/distrobox-enter" -n asahi-krun -- krun -- '/usr/bin/FEXBash' "$@"
elif [ -n "${container_name}" ] && [ "${container_name}" != "asahi-krun" ]; then
exec distrobox-host-exec "$HOME/.local/bin/FEXBash" "$@"
else
exec krun -- '/usr/bin/FEXBash' "$@"
fi
#!/bin/sh
if [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
exec '/usr/local/bin/krun' "$@"
fi
if [ -z "${DBX_CONTAINER_MANAGER}" ]; then
export DBX_CONTAINER_MANAGER=podman
fi
if [ -n "${CONTAINER_ID}" ]; then
container_name="${CONTAINER_ID}"
# if the variable is not set, let's fall back to some tricks.
elif [ -e /.dockerenv ]; then
# we're in docker, let's use this trick
container_name=$(grep "memory:/" < /proc/self/cgroup | sed 's|.*/||')
elif [ -e /run/.containerenv ]; then
# we're in podman or lilipod, use this other trick
container_name=$(grep "name=" /run/.containerenv | cut -d'=' -f2- | tr -d '"')
fi
if [ -z "${container_name}" ]; then
exec "/usr/bin/distrobox-enter" -n asahi-krun -- '/usr/local/bin/krun' "$@"
elif [ -n "${container_name}" ] && [ "${container_name}" != "asahi-krun" ]; then
exec distrobox-host-exec "$HOME/.local/bin/krun" "$@"
else
exec '/usr/local/bin/krun' "$@"
fi
#!/bin/sh
KRUN_GUEST=/usr/local/bin/krun-guest
if ! [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
echo >&2 'krun-guest must be run inside krun VM'
exit 1
fi
user=$1
uid=$2
gid=$3
shift 3
exec "${KRUN_GUEST}" "$user" "$uid" "$gid" "$@"
#!/bin/sh
if [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
exec '/usr/bin/FEXInterpreter' '/usr/bin/python3' '/usr/bin/lutris' "$@"
fi
if [ -z "${DBX_CONTAINER_MANAGER}" ]; then
export DBX_CONTAINER_MANAGER=podman
fi
if [ -n "${CONTAINER_ID}" ]; then
container_name="${CONTAINER_ID}"
# if the variable is not set, let's fall back to some tricks.
elif [ -e /.dockerenv ]; then
# we're in docker, let's use this trick
container_name=$(grep "memory:/" < /proc/self/cgroup | sed 's|.*/||')
elif [ -e /run/.containerenv ]; then
# we're in podman or lilipod, use this other trick
container_name=$(grep "name=" /run/.containerenv | cut -d'=' -f2- | tr -d '"')
fi
if [ -z "${container_name}" ]; then
exec "/usr/bin/distrobox-enter" -n asahi-krun -- krun -- '/usr/bin/FEXInterpreter' '/usr/bin/python3' '/usr/bin/lutris' "$@"
elif [ -n "${container_name}" ] && [ "${container_name}" != "asahi-krun" ]; then
exec distrobox-host-exec "$HOME/.local/bin/lutris" "$@"
else
exec krun -- '/usr/bin/FEXInterpreter' '/usr/bin/python3' '/usr/bin/lutris' "$@"
fi
[Desktop Entry]
Name=Lutris
StartupWMClass=Lutris
Comment=Video Game Preservation Platform
Categories=Game;
Keywords=gaming;wine;emulator;
Exec=lutris %U
Icon=lutris
Terminal=true
Type=Application
MimeType=x-scheme-handler/lutris;
X-GNOME-UsesNotifications=true
X-Desktop-File-Install-Version=0.26
#!/bin/sh
force_args='-cef-force-occlusion -cef-force-opaque-backgrounds'
if [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
exec '/usr/bin/FEXInterpreter' '/usr/bin/steam' ${force_args} "$@"
fi
if [ -z "${DBX_CONTAINER_MANAGER}" ]; then
export DBX_CONTAINER_MANAGER=podman
fi
if [ -n "${CONTAINER_ID}" ]; then
container_name="${CONTAINER_ID}"
# if the variable is not set, let's fall back to some tricks.
elif [ -e /.dockerenv ]; then
# we're in docker, let's use this trick
container_name=$(grep "memory:/" < /proc/self/cgroup | sed 's|.*/||')
elif [ -e /run/.containerenv ]; then
# we're in podman or lilipod, use this other trick
container_name=$(grep "name=" /run/.containerenv | cut -d'=' -f2- | tr -d '"')
fi
if [ -z "${container_name}" ]; then
exec "/usr/bin/distrobox-enter" -n asahi-krun -- krun -- '/usr/bin/FEXInterpreter' '/usr/bin/steam' ${force_args} "$@"
elif [ -n "${container_name}" ] && [ "${container_name}" != "asahi-krun" ]; then
exec distrobox-host-exec "$HOME/.local/bin/steam" "$@"
else
exec krun -- '/usr/bin/FEXInterpreter' '/usr/bin/steam' ${force_args} "$@"
fi
[Desktop Entry]
Name=Steam
Comment=Application for managing and playing games on Steam
Comment[pt_BR]=Aplicativo para jogar e gerenciar jogos no Steam
Comment[bg]=Приложение за ръководене и пускане на игри в Steam
Comment[cs]=Aplikace pro spravování a hraní her ve službě Steam
Comment[da]=Applikation til at håndtere og spille spil på Steam
Comment[nl]=Applicatie voor het beheer en het spelen van games op Steam
Comment[fi]=Steamin pelien hallintaan ja pelaamiseen tarkoitettu sovellus
Comment[fr]=Application de gestion et d'utilisation des jeux sur Steam
Comment[de]=Anwendung zum Verwalten und Spielen von Spielen auf Steam
Comment[el]=Εφαρμογή διαχείρισης παιχνιδιών στο Steam
Comment[hu]=Alkalmazás a Steames játékok futtatásához és kezeléséhez
Comment[it]=Applicazione per la gestione e l'esecuzione di giochi su Steam
Comment[ja]=Steam 上でゲームを管理&プレイするためのアプリケーション
Comment[ko]=Steam에 있는 게임을 관리하고 플레이할 수 있는 응용 프로그램
Comment[no]=Program for å administrere og spille spill på Steam
Comment[pt_PT]=Aplicação para organizar e executar jogos no Steam
Comment[pl]=Aplikacja do zarządzania i uruchamiania gier na platformie Steam
Comment[ro]=Aplicație pentru administrarea și jucatul jocurilor pe Steam
Comment[ru]=Приложение для игр и управления играми в Steam
Comment[es]=Aplicación para administrar y ejecutar juegos en Steam
Comment[sv]=Ett program för att hantera samt spela spel på Steam
Comment[zh_CN]=管理和进行 Steam 游戏的应用程序
Comment[zh_TW]=管理並執行 Steam 遊戲的應用程式
Comment[th]=โปรแกรมสำหรับจัดการและเล่นเกมบน Steam
Comment[tr]=Steam üzerinden oyun oynama ve düzenleme uygulaması
Comment[uk]=Програма для керування іграми та запуску ігор у Steam
Comment[vi]=Ứng dụng để quản lý và chơi trò chơi trên Steam
Exec=steam %U
Icon=steam
Terminal=true
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;x-scheme-handler/steamlink;
Actions=Store;Community;Library;Servers;Screenshots;News;Settings;BigPicture;Friends;
PrefersNonDefaultGPU=true
X-KDE-RunOnDiscreteGpu=true
[Desktop Action Store]
Name=Store
Name[pt_BR]=Loja
Name[bg]=Магазин
Name[cs]=Obchod
Name[da]=Butik
Name[nl]=Winkel
Name[fi]=Kauppa
Name[fr]=Magasin
Name[de]=Shop
Name[el]=ΚΑΤΑΣΤΗΜΑ
Name[hu]=Áruház
Name[it]=Negozio
Name[ja]=ストア
Name[ko]=상점
Name[no]=Butikk
Name[pt_PT]=Loja
Name[pl]=Sklep
Name[ro]=Magazin
Name[ru]=Магазин
Name[es]=Tienda
Name[sv]=Butik
Name[zh_CN]=商店
Name[zh_TW]=商店
Name[th]=ร้านค้า
Name[tr]=Mağaza
Name[uk]=Крамниця
Name[vi]=Cửa hàng
Exec=steam steam://store
[Desktop Action Community]
Name=Community
Name[pt_BR]=Comunidade
Name[bg]=Общност
Name[cs]=Komunita
Name[da]=Fællesskab
Name[nl]=Community
Name[fi]=Yhteisö
Name[fr]=Communauté
Name[de]=Community
Name[el]=Κοινότητα
Name[hu]=Közösség
Name[it]=Comunità
Name[ja]=コミュニティ
Name[ko]=커뮤니티
Name[no]=Samfunn
Name[pt_PT]=Comunidade
Name[pl]=Społeczność
Name[ro]=Comunitate
Name[ru]=Сообщество
Name[es]=Comunidad
Name[sv]=Gemenskap
Name[zh_CN]=社区
Name[zh_TW]=社群
Name[th]=ชุมชน
Name[tr]=Topluluk
Name[uk]=Спільнота
Name[vi]=Cộng đồng
Exec=steam steam://url/SteamIDControlPage
[Desktop Action Library]
Name=Library
Name[pt_BR]=Biblioteca
Name[bg]=Библиотека
Name[cs]=Knihovna
Name[da]=Bibliotek
Name[nl]=Bibliotheek
Name[fi]=Kokoelma
Name[fr]=Bibliothèque
Name[de]=Bibliothek
Name[el]=Συλλογή
Name[hu]=Könyvtár
Name[it]=Libreria
Name[ja]=ライブラリ
Name[ko]=라이브러리
Name[no]=Bibliotek
Name[pt_PT]=Biblioteca
Name[pl]=Biblioteka
Name[ro]=Colecţie
Name[ru]=Библиотека
Name[es]=Biblioteca
Name[sv]=Bibliotek
Name[zh_CN]=库
Name[zh_TW]=收藏庫
Name[th]=คลัง
Name[tr]=Kütüphane
Name[uk]=Бібліотека
Name[vi]=Thư viện
Exec=steam steam://open/games
[Desktop Action Servers]
Name=Servers
Name[pt_BR]=Servidores
Name[bg]=Сървъри
Name[cs]=Servery
Name[da]=Servere
Name[nl]=Servers
Name[fi]=Palvelimet
Name[fr]=Serveurs
Name[de]=Server
Name[el]=Διακομιστές
Name[hu]=Szerverek
Name[it]=Server
Name[ja]=サーバー
Name[ko]=서버
Name[no]=Tjenere
Name[pt_PT]=Servidores
Name[pl]=Serwery
Name[ro]=Servere
Name[ru]=Серверы
Name[es]=Servidores
Name[sv]=Servrar
Name[zh_CN]=服务器
Name[zh_TW]=伺服器
Name[th]=เซิร์ฟเวอร์
Name[tr]=Sunucular
Name[uk]=Сервери
Name[vi]=Máy chủ
Exec=steam steam://open/servers
[Desktop Action Screenshots]
Name=Screenshots
Name[pt_BR]=Capturas de tela
Name[bg]=Снимки
Name[cs]=Snímky obrazovky
Name[da]=Skærmbilleder
Name[nl]=Screenshots
Name[fi]=Kuvankaappaukset
Name[fr]=Captures d'écran
Name[de]=Screenshots
Name[el]=Φωτογραφίες
Name[hu]=Képernyőmentések
Name[it]=Screenshot
Name[ja]=スクリーンショット
Name[ko]=스크린샷
Name[no]=Skjermbilder
Name[pt_PT]=Capturas de ecrã
Name[pl]=Zrzuty ekranu
Name[ro]=Capturi de ecran
Name[ru]=Скриншоты
Name[es]=Capturas
Name[sv]=Skärmdumpar
Name[zh_CN]=截图
Name[zh_TW]=螢幕擷圖
Name[th]=ภาพหน้าจอ
Name[tr]=Ekran Görüntüleri
Name[uk]=Скріншоти
Name[vi]=Ảnh chụp
Exec=steam steam://open/screenshots
[Desktop Action News]
Name=News
Name[pt_BR]=Notícias
Name[bg]=Новини
Name[cs]=Zprávy
Name[da]=Nyheder
Name[nl]=Nieuws
Name[fi]=Uutiset
Name[fr]=Actualités
Name[de]=Neuigkeiten
Name[el]=Νέα
Name[hu]=Hírek
Name[it]=Notizie
Name[ja]=ニュース
Name[ko]=뉴스
Name[no]=Nyheter
Name[pt_PT]=Novidades
Name[pl]=Aktualności
Name[ro]=Știri
Name[ru]=Новости
Name[es]=Noticias
Name[sv]=Nyheter
Name[zh_CN]=新闻
Name[zh_TW]=新聞
Name[th]=ข่าวสาร
Name[tr]=Haberler
Name[uk]=Новини
Name[vi]=Tin tức
Exec=steam steam://open/news
[Desktop Action Settings]
Name=Settings
Name[pt_BR]=Configurações
Name[bg]=Настройки
Name[cs]=Nastavení
Name[da]=Indstillinger
Name[nl]=Instellingen
Name[fi]=Asetukset
Name[fr]=Paramètres
Name[de]=Einstellungen
Name[el]=Ρυθμίσεις
Name[hu]=Beállítások
Name[it]=Impostazioni
Name[ja]=設定
Name[ko]=설정
Name[no]=Innstillinger
Name[pt_PT]=Definições
Name[pl]=Ustawienia
Name[ro]=Setări
Name[ru]=Настройки
Name[es]=Parámetros
Name[sv]=Inställningar
Name[zh_CN]=设置
Name[zh_TW]=設定
Name[th]=การตั้งค่า
Name[tr]=Ayarlar
Name[uk]=Налаштування
Name[vi]=Thiết lập
Exec=steam steam://open/settings
[Desktop Action BigPicture]
Name=Big Picture
Exec=steam steam://open/bigpicture
[Desktop Action Friends]
Name=Friends
Name[pt_BR]=Amigos
Name[bg]=Приятели
Name[cs]=Přátelé
Name[da]=Venner
Name[nl]=Vrienden
Name[fi]=Kaverit
Name[fr]=Amis
Name[de]=Freunde
Name[el]=Φίλοι
Name[hu]=Barátok
Name[it]=Amici
Name[ja]=フレンド
Name[ko]=친구
Name[no]=Venner
Name[pt_PT]=Amigos
Name[pl]=Znajomi
Name[ro]=Prieteni
Name[ru]=Друзья
Name[es]=Amigos
Name[sv]=Vänner
Name[zh_CN]=好友
Name[zh_TW]=好友
Name[th]=เพื่อน
Name[tr]=Arkadaşlar
Name[uk]=Друзі
Name[vi]=Bạn bè
Exec=steam steam://open/friends
@aqrln
Copy link

aqrln commented Jun 1, 2024

@dylanchapell

@aqrln Did you find a solution to not having network access in the krun?

Sorry I didn't notice you mentioned me earlier and the whole discussion above, I got it working by hardcoding Cloudflare's DNS server in /etc/resolv.conf inside the VM after the file is generated like this:

diff --git a/crates/krun-guest/src/net.rs b/crates/krun-guest/src/net.rs
index 3710bd5..27e4d37 100644
--- a/crates/krun-guest/src/net.rs
+++ b/crates/krun-guest/src/net.rs
@@ -1,4 +1,4 @@
-use std::{fs, os::unix::process::ExitStatusExt, process::Command};
+use std::{fs, io::Write, os::unix::process::ExitStatusExt, process::Command};

 use anyhow::{anyhow, Context, Result};
 use log::debug;
@@ -35,5 +35,10 @@ pub fn configure_network() -> Result<()> {
         Err(err)?;
     }

+    fs::File::options()
+        .append(true)
+        .open("/etc/resolv.conf")?
+        .write_all("nameserver 1.1.1.1\n".as_bytes())?;
+
     Ok(())
 }

See slp/krun#17

@teohhanhui
Copy link
Author

not Rust developers right now unfortunately (although knowing it is an advantage) but we do need some TypeScript engineers if this is relevant for you by any chance!

@aqrln Well, I don't have TypeScript experience specifically, only JS, but I'm learning Angular now for a side project , so... 😂

@lacamar
Copy link

lacamar commented Jun 2, 2024

@teohhanhui

I have not experienced that, so no idea. Try to check some of the Steam logs in ~/.steam/root/logs

Here's part of the logs for the steam client: https://pastebin.com/hr7JtKai

AppImage is tricky even just in the Flatpak version of Steam. It uses FUSE which requires root or setuid on fusermount.

That's unfortunate, it would be desirable to get this working somehow. In my experience I have found that much of the Linux software from developers that refuse to budge on supporting arm64 provide their software packaged as AppImages or Flatpak. In light of this, if it's not possible to run AppImages then I fear that it would diminish one of the main reasons for having fast x86_64 Linux emulation.

I have been running into some other problems with asahi-krun.

First, I am getting broken Xwayland pipe errors on Hyprland on some games I have tested.
(EE) failed to write to Xwayland fd: Broken pipe (or similar)
This error does not occur on KDE, so I am wondering if I have the wrong configuration or if Hyprland is bugged. Here are examples of the error:
https://pastebin.com/JzY2gZ9E
https://pastebin.com/90vLqg33

Second, there is an issue with steam's client libraries being unable to be located. When launching certain games, they look in the .steam/sdk32 or .steam/sdk64 folder for steamclient.so, but these directories are empty.
https://pastebin.com/Ngv9Gfmw

Third, sometimes when I click on the settings tag in the steam client, it crashes instantly with this error:
xdg_surface@44: error 3: xdg_surface has never been configured

Fourth, all GUI clients of krun become unresponsive if my computer sleeps while it is running.

Fifth, sometimes when RAM usage is high in krun plus on the host, the computer will crash completely and shut down (this has become less common since built your memory balloon branch of krun).

Thanks for all your work so far and I will do my best to provide more logs if you would like to help debug this.

@teohhanhui
Copy link
Author

Second, there is an issue with steam's client libraries being unable to be located. When launching certain games, they look in the .steam/sdk32 or .steam/sdk64 folder for steamclient.so, but these directories are empty.

The file exists on my system. Maybe there's a way to trigger Steam to revalidate and download missing files...

@QushyQushy
Copy link

Hello! :)
I'm getting this when trying to launch steam:

Error: couldn't parse `ef-force-occlusion`:

@teohhanhui
Copy link
Author

teohhanhui commented Jun 3, 2024

@QushyQushy That's really weird. But you could remove -cef-force-occlusion option from the steam wrapper script. I wonder if that'd help.

EDIT: Oops. That doesn't help. I'll investigate for a bit.

@teohhanhui
Copy link
Author

@QushyQushy Fixed the wrapper scripts. Please see the latest revision for the changes: https://gist.github.com/teohhanhui/042a395010d9946ceee14768736e3780/revisions

@QushyQushy
Copy link

@QushyQushy Fixed the wrapper scripts. Please see the latest revision for the changes: https://gist.github.com/teohhanhui/042a395010d9946ceee14768736e3780/revisions

Yup. Works amazingly now! :) Thank you! :)

@wxllow
Copy link

wxllow commented Jun 5, 2024

I've tried several times but have been unable to get Steam working because of an error during dnf install dbus-x11 steam xdg-user-dirs installing dbus-daemon:

Error unpacking rpm package dbus-daemon-1:1.14.10-3.fc40.x86_64
  Installing       : inih-58-1.fc40.i686                                  11/17 
error: unpacking of archive failed on file /usr/libexec/dbus-1/dbus-daemon-launch-helper;6660f2b8: cpio: chown failed - Operation not permitted
error: dbus-daemon-1:1.14.10-3.fc40.x86_64: install failed

This then leads steam to not start as seen below:

[wl@fedora]$ steam
steam.sh[1069]: Running Steam on fedora 40 64-bit
steam.sh[1069]: STEAM_RUNTIME is enabled automatically
setup.sh[1145]: Updating Steam runtime environment...

(zenity:1153): Gtk-WARNING **: 19:21:01.595: Unable to acquire session bus: Error spawning command line “dbus-launch --autolaunch=20b91177072544e78f5207379cee0cfe --binary-syntax --close-stderr”: Child process exited with code 1
xdg_surface@34: error 3: xdg_surface has never been configured
(EE) failed to read Wayland events: Broken pipe

@teohhanhui
Copy link
Author

@wxllow No, Steam does not need dbus-launch. That's just a warning. But sorry, I've no idea what could cause the errors you're seeing. You'd have to investigate further on your own.

error: unpacking of archive failed on file /usr/libexec/dbus-1/dbus-daemon-launch-helper;6660f2b8: cpio: chown failed - Operation not permitted

This is really weird.

@lacamar
Copy link

lacamar commented Jun 6, 2024

@wxllow

What desktop or window manager are you using? I started getting that error with steam and I’m on Hyprland.
I also had the same problem with installing dbus where it wouldn’t go ahead because of permission issues.

I tried deleting everything and reinstalling but the unbreak chroot script errors out and doesn’t let me enter the FEX root

@wxllow
Copy link

wxllow commented Jun 6, 2024

@wxllow

What desktop or window manager are you using? I started getting that error with steam and I’m on Hyprland. I also had the same problem with installing dbus where it wouldn’t go ahead because of permission issues.

I tried deleting everything and reinstalling but the unbreak chroot script errors out and doesn’t let me enter the FEX root

I'm also on Hyprland :o

@wxllow
Copy link

wxllow commented Jun 6, 2024

@wxllow

What desktop or window manager are you using? I started getting that error with steam and I’m on Hyprland. I also had the same problem with installing dbus where it wouldn’t go ahead because of permission issues.

I tried deleting everything and reinstalling but the unbreak chroot script errors out and doesn’t let me enter the FEX root

I'm not sure what causes it to not work on Hyprland but I tried redoing everything on KDE Plasma Wayland and although dbus daemon installation error still occurs, I am able to start Steam this time :)

@Spidy123222
Copy link

Spidy123222 commented Jun 6, 2024

Is there a way to get these mesa drivers in the container for Vulkan without messing up the host? There is a 1.3 implementation that seems to have a good amount work done on it for compatibility that it’s fully compliant vm 1.3 and just needs more extensions. Probably can just build it. Source code is in the page. I don’t normally mess with drivers so just was wondering. https://rosenzweig.io/blog/vk13-on-the-m1-in-1-month.html

@teohhanhui
Copy link
Author

@Spidy123222 If you want to try that, you're on your own. I don't want to create more PR (public relations, not pull request lol) headaches for the Asahi Linux project people.

@lacamar
Copy link

lacamar commented Jun 7, 2024

@wxllow

I'm also on Hyprland :o

Okay then there is probably something broken here between the VM and Hyprland. I can run it okay in KDE or DWL.

@teohhanhui
I deleted steam's files and reinstalled everything and those missing libraries are all installed properly now.

Also I found out that if you run these commands from the guide by copying them both and running them at the same time, things will look okay but the unbreak chroot script won't run properly. You have to copy and run the lines one at a time

cd ~/.fex-emu/RootFS/Fedora_40
unshare -pfr --user --mount --kill-child /usr/bin/bash

@teohhanhui
Copy link
Author

@lacamar Haha. Yes... All the commands are intended to be run one-by-one. That's why I didn't turn them into scripts or put any -y etc.

@Spidy123222
Copy link

@Spidy123222 If you want to try that, you're on your own. I don't want to create more PR (public relations, not pull request lol) headaches for the Asahi Linux project people.

Totally get it. I was talking to Alyssa earlier about it. Thought was cool and kind of wanted to try it. I think I have an idea on what to do.

@m3957
Copy link

m3957 commented Jun 9, 2024

Can we have an uninstall guide for this?

@teohhanhui
Copy link
Author

@m3957

Can we have an uninstall guide for this?

distrobox rm asahi-krun
rm -rf ~/.fex-emu
rm -rf ~/.local/share/Steam
rm ~/.local/bin/{FEXBash,krun,krun-guest,steam}
rm ~/.local/share/applications/steam.desktop

Something like that...

@KudoLayton
Copy link

@wxllow

Okay then there is probably something broken here between the VM and Hyprland. I can run it okay in KDE or DWL.

I have the same problem even in dwl. I installed Hyprland and dwl on minimal Fedora Asahi Linux without KDE.

@ArtificialAmateur
Copy link

ArtificialAmateur commented Jun 14, 2024

running krun FEXConfig does not have any outputs.

@ghostlypi It's supposed to launch a GUI window.

Having the same issue. Is there any logging or verbosity to krun?

At first ran into asahi_dri.so not found but noticed fedora installed the main repo's version and not the copr one.

@teohhanhui
Copy link
Author

Is there any logging or verbosity to krun?

@ArtificialAmateur Try this:

RUST_LOG='krun=debug,krun_guest=debug,krun_server=debug' RUST_BACKTRACE=1 krun -e=RUST_BACKTRACE FEXConfig

@ElYaiko
Copy link

ElYaiko commented Jun 24, 2024

Isn't box64 working yet?, I get a wine error with Fedora 39 distrobox:
https://pastebin.com/raw/ckSgWs3C

@teohhanhui
Copy link
Author

teohhanhui commented Jun 24, 2024

wine: could not exec wineserver

@ElYaiko That's just a broken symlink that you need to fix up in the /x86_64 install root.

Specifically:

sudo ln -sf /x86_64/usr/bin/wineserver64 /x86_64/etc/alternatives/wineserver
sudo ln -sf /x86_64/etc/alternatives/wineserver /x86_64/usr/bin/wineserver

EDIT: Updated the guide with the full instructions for fixing the symlinks.

Update: Tested with my latest build of box64: https://copr.fedorainfracloud.org/coprs/teohhanhui/box64/build/7661747/ but unfortunately the segfault is still happening on Fedora 40: ptitSeb/box64#1517

@Vincenzo-Puzone
Copy link

I would like to run lutris if it is possible to do, but i can't figure out how to install it. Can someone explain me how to do

@teohhanhui
Copy link
Author

teohhanhui commented Jul 1, 2024

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