Skip to content

Instantly share code, notes, and snippets.

@teohhanhui
Last active December 23, 2024 09:18
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

Nothing to see here.

What you want is https://asahilinux.org/2024/10/aaa-gaming-on-asahi-linux/

But if you have previously followed this guide, use the following to switch:

Cleanup

rm -rf ~/.fex-emu
rm ~/.local/bin/{asahi-krun-overlay-fex-rootfs,FEXBash,krun,krun-guest,steam}
rm ~/.local/share/applications/steam.desktop
rm -rf ~/.local/share/asahi-krun
DBX_CONTAINER_MANAGER=podman distrobox rm asahi-krun

Install Steam (on the host)

sudo dnf upgrade --refresh
sudo dnf install --best --setopt=allow_vendor_change=true steam
sudo dnf remove dhcpcd

You might have to reboot the system.

@teohhanhui
Copy link
Author

but when I open it again it is reverted

@dylanchapell You mean starting a new krun VM, right? /etc/resolv.conf inside the VM is actually a temporary file (/tmp/resolv.conf) that's truncated each time: https://github.com/slp/krun/blob/5a8542a5066bd1a4d8bad99236f05ea3ac687ef7/crates/krun-guest/src/mount.rs#L23

I guess as a temporary workaround, just echo 'nameserver 1.1.1.1' > /etc/resolv.conf once you enter the VM?

@dylanchapell
Copy link

@teohhanhui Does a new VM get started every time I run a command with krun? If so, how can I apply the workaround every time I run a command? I put that line and FEXRootFSFetcher into a shell script and ran that in krun but that still had the error occur.

@teohhanhui
Copy link
Author

@dylanchapell Put it in krun-guest. That's the part that gets run inside the VM.

@Spidy123222
Copy link

@teohhanhui I seem to have an issue starting steam after doing all the instructions using FEX. I get messages like this and it never starts. I am kind of unsure where to go from here. Im on the Fex discord if it helps go by faster.
image

@teohhanhui
Copy link
Author

@Spidy123222 Please make sure you have your FEX RootFS set to use Fedora_40, not Fedora_40.sqsh. You can run krun FEXConfig and check in the Emulation tab.

@Spidy123222
Copy link

@Spidy123222 Please make sure you have your FEX RootFS set to use Fedora_40, not Fedora_40.sqsh. You can run krun FEXConfig and check in the Emulation tab.

Yeah that fixed it. Strange that it defaulted to that, I went to point to point with the normal instructions.

@aqrln
Copy link

aqrln commented Jun 1, 2024

Does anyone else run into issues with logging in and reCAPTCHA in Steam under FEX? There are no issues on the same machine on the same network on macOS, or when logging in in the web browser on the host Linux system.

@teohhanhui
Copy link
Author

@aqrln @NekoToo Does scanning the QR code with Steam app work? That's the only method I've used. But things might have broke in the meantime, so I'd like to know...

@NekoToo
Copy link

NekoToo commented Jun 1, 2024

@aqrln @NekoToo Does scanning the QR code with Steam app work? That's the only method I've used. But things might have broke in the meantime, so I'd like to know...

Oh speaking of that, it just has a refresh arrow on top of a blurred qr code so it doesn't seem to load that :(

@NekoToo
Copy link

NekoToo commented Jun 1, 2024

Screenshot_20240531_223316

@teohhanhui
Copy link
Author

@NekoToo Does it not work if you click on the refresh button? The QR code is time-sensitive, I think. So you'd have to scan it and approve it from the app within like 30 seconds or something.

@NekoToo
Copy link

NekoToo commented Jun 1, 2024

@NekoToo Does it not work if you click on the refresh button? The QR code is time-sensitive, I think. So you'd have to scan it and approve it from the app within like 30 seconds or something.

Refreshing doesn't fix it it still shows the refresh icon unfortunately

@NekoToo
Copy link

NekoToo commented Jun 1, 2024

Screenshot_20240531_224637
This is what it shows if I try to login, clicking enter offline mode does nothing

@Spidy123222
Copy link

Seems like some things don’t run that kind of have unknown source of problem. I asked in fex discord about message and they said they don’t use llvm and could be mesa. This is me launching burnout paradise remastered, I never booted into the game as it needs to go through the EA launcher which this error is from when trying to restart it as it crashes (also happens on my deck sometimes, not always though.)

LLVM ERROR: Instruction Combining did not reach a fix point after 1 iterations pid 1107 != 1105, skipping destruction (fork without exec?)

Any idea where this could be from?

@aqrln
Copy link

aqrln commented Jun 1, 2024

@aqrln @NekoToo Does scanning the QR code with Steam app work? That's the only method I've used. But things might have broke in the meantime, so I'd like to know...

It actually worked now on a fresh boot! I'm pretty sure I tried scanning the QR code yesterday too but it didn't work either (nothing happened after scanning and approving it).

@teohhanhui
Copy link
Author

teohhanhui commented Jun 1, 2024

@aqrln Glad to hear it worked.

I noticed that you work at Prisma. Saw that they're (still) hiring. Sent in my job application. 🙈

@aqrln
Copy link

aqrln commented Jun 1, 2024

@teohhanhui 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
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 https://github.com/slp/krun/issues/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

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