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

@4kz Could you try compiling krun from this branch and see if it makes any difference?

https://github.com/teohhanhui/krun/tree/feat/balloon-more-ram

@iraizo
Copy link

iraizo commented May 28, 2024

ulimit: value exceeds hard limit

setting it to 2000 is already exceeding it

@iraizo @zimsneexh Can you let me know if setting ulimit -n 524288 in krun-guest fixes the problem? It's required for wine's esync to work anyway... But maybe the problem you're facing is unrelated...

@teohhanhui
Copy link
Author

@iraizo Then you need to fix your environment.

You may refer here for some pointers: https://github.com/lutris/docs/blob/master/HowToEsync.md

@Spidy123222
Copy link

I notice that Lina did a live stream of full tso support and wined3d fully working. Would this setup support that now or would you have to use https://github.com/slp/krun
In some way.

@teohhanhui
Copy link
Author

@Spidy123222 WineD3D is fully working, provided you allocate enough RAM to the VM. For now, that means building krun from this branch: https://github.com/teohhanhui/krun/tree/feat/balloon-more-ram

TSO support will not be coming anytime soon. We'll just have to wait for Lina to push those patches and/or for them to be built and released.

@Spidy123222
Copy link

Spidy123222 commented May 29, 2024

@Spidy123222 WineD3D is fully working, provided you allocate enough RAM to the VM. For now, that means building krun from this branch: https://github.com/teohhanhui/krun/tree/feat/balloon-more-ram

TSO support will not be coming anytime soon. We'll just have to wait for Lina to push those patches and/or for them to be built and released.

Alrighty. I’ll do that when I get a moment. Before in the original libkrunvm setup it wouldnt run wined3d well (broken sonic adventure 2). Will see how far I can get with it then on my m2 pro.

I probably would change the instructions to change the git branch to -b balloon-more-ram

Since it used 80% ram than just 4gib

@dylanchapell
Copy link

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

@teohhanhui
Copy link
Author

@dylanchapell What's in your /etc/resolv.conf inside the krun VM?

@dylanchapell
Copy link

It was the same as the one normally on my machine, but now it is truncated to just the search field, with no change in functionality.

$ krun cat /etc/resolv.conf
<many errors>
search tailc594c.ts.net. dia.dnvr.

From a normal terminal:

nameserver 127.0.0.53
options edns0 trust-ad
search tailc594c.ts.net dia.dnvr

@teohhanhui
Copy link
Author

@dylanchapell Uhh... I thought you have no Internet access in krun VM. From what I could tell, that's most probably caused by problems with the DNS resolver.

Mine is like this in the krun VM:

; generated by /usr/sbin/dhclient-script
nameserver 192.168.0.1

Which is bad, because that's my router's IP address...

I think this is why krunvm set nameserver 1.1.1.1 as the default:
https://github.com/containers/krunvm/blob/5494d84a66bee3b802a0392cf8d662158ac7287d/src/main.rs#L51

@dylanchapell
Copy link

dylanchapell commented May 30, 2024

@teohhanhui Correct, I have no internet access in krun. How can I edit /etc/resolv.conf? I tried to do krun vi /etc/resolv.conf and change it to nameserver 1.1.1.1 but when I open it again it is reverted.

@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

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