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.

@aqrln
Copy link

aqrln commented May 25, 2024

@teohhanhui indeed:

$ krun curl -v google.com
(...)
* Could not resolve host: google.com
* Closing connection
curl: (6) Could not resolve host: google.com
Child exited with status: 6
(...)
$ krun ping 8.8.8.8
(...)
ping: socktype: SOCK_DGRAM
ping: socket: Address family not supported by protocol
Child exited with status: 2
(...)

@teohhanhui
Copy link
Author

@aqrln Check your /etc/resolv.conf inside the container / krun VM - should be able to fix DNS resolving by changing some of that...

@lacamar
Copy link

lacamar commented May 25, 2024

I have been trying to get this working on my M1 pro tonight. Everything seems to have installed okay, but while running the steam process, the steam window repeatedly opens for about 10 seconds then closes again. No games that I have run so far have successfully launched. This behaviour has been the same on both KDE6 and Hyprland.

Here's the log for steam:

steam.sh[266]: Running Steam on fedora 40 64-bit
steam.sh[266]: STEAM_RUNTIME is enabled automatically
setup.sh[349]: Steam runtime environment up-to-date!
steam.sh[266]: Steam client's requirements are satisfied
[2024-05-26 01:41:36] Startup - updater built May 24 2024 20:46:19
[2024-05-26 01:41:36] Startup - Steam Client launched with: '/home/snow/.local/share/Steam/ubuntu12_32/steam' '-cef-force-occlusion' '-cef-force-opaque-backgrounds'
src/steamexe/updateui_xwin.cpp (1466) : BFileExists( m_FontFileRegular )
src/steamexe/updateui_xwin.cpp (1466) : BFileExists( m_FontFileRegular )
05/26 01:41:36 /tmp/dumps: insufficient permissions - delete and recreate
05/26 01:41:36 /tmp/dumps: could not delete, skipping.
05/26 01:41:36 /tmp/dumps01: insufficient permissions - delete and recreate
05/26 01:41:36 /tmp/dumps01: could not delete, skipping.
05/26 01:41:36 minidumps folder is set to /tmp/dumps02
05/26 01:41:36 Could not find steamerrorreporter binary. Any minidumps will be uploaded in-process05/26 01:41:36 Init: Installing breakpad exception handler for appid(steam)/version(1716584667)/tid(396)
05/26 01:41:37 Failed writing minidump, nothing to upload.
src/steamexe/updateui_xwin.cpp (1467) : BFileExists( m_FontFileLight )
src/steamexe/updateui_xwin.cpp (1467) : BFileExists( m_FontFileLight )
05/26 01:41:37 /tmp/dumps: insufficient permissions - delete and recreate
05/26 01:41:37 /tmp/dumps: could not delete, skipping.
05/26 01:41:37 /tmp/dumps01: insufficient permissions - delete and recreate
05/26 01:41:37 /tmp/dumps01: could not delete, skipping.
05/26 01:41:37 minidumps folder is set to /tmp/dumps02
05/26 01:41:37 Could not find steamerrorreporter binary. Any minidumps will be uploaded in-process05/26 01:41:37 Init: Installing breakpad exception handler for appid(steam)/version(1716584667)/tid(396)
05/26 01:41:37 Failed writing minidump, nothing to upload.
05/26 01:41:37 /tmp/dumps: insufficient permissions - delete and recreate
05/26 01:41:37 /tmp/dumps: could not delete, skipping.
05/26 01:41:37 /tmp/dumps01: insufficient permissions - delete and recreate
05/26 01:41:37 /tmp/dumps01: could not delete, skipping.
05/26 01:41:37 minidumps folder is set to /tmp/dumps02
05/26 01:41:37 Could not find steamerrorreporter binary. Any minidumps will be uploaded in-process05/26 01:41:37 Init: Installing breakpad exception handler for appid(steam)/version(1716584667)/tid(396)
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[2024-05-26 01:41:38] Loading cached metrics from disk (/home/snow/.local/share/Steam/package/steam_client_metrics.bin)
[2024-05-26 01:41:38] Using the following download hosts for Public, Realm steamglobal
[2024-05-26 01:41:38] 1. https://client-update.akamai.steamstatic.com, /, Realm 'steamglobal', weight was 1000, source = 'update_hosts_cached.vdf'
[2024-05-26 01:41:38] 2. https://cdn.cloudflare.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'update_hosts_cached.vdf'
[2024-05-26 01:41:38] 3. https://cdn.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'baked in'
[2024-05-26 01:41:38] Checking for update on startup
[2024-05-26 01:41:38] Checking for available updates...
[2024-05-26 01:41:38] Downloading manifest: https://client-update.akamai.steamstatic.com/steam_client_ubuntu12
[2024-05-26 01:41:38] Manifest download: send request
[2024-05-26 01:41:38] Manifest download: waiting for download to finish
[2024-05-26 01:41:39] Manifest download: finished
[2024-05-26 01:41:39] Download skipped: /steam_client_ubuntu12 version 1716584667, installed version 1716584667, existing pending version 0
[2024-05-26 01:41:39] Nothing to do
[2024-05-26 01:41:39] Verifying installation...
[2024-05-26 01:41:39] Performing checksum verification of executable files
[2024-05-26 01:41:40] Verification complete
UpdateUI: skip show logo
Steam logging initialized: directory: /home/snow/.local/share/Steam/logs

pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
XRRGetOutputInfo Workaround: initialized with override: 0 real: 0xebedce90
XRRGetCrtcInfo Workaround: initialized with override: 0 real: 0xebedb5f0
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
steamwebhelper.sh[465]: === Sun May 26 01:41:47 CEST 2024 ===
steamwebhelper.sh[465]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/snow/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
CAppInfoCacheReadFromDiskThread took 231 milliseconds to initialize
Steam Runtime Launch Service: starting steam-runtime-launcher-service
Steam Runtime Launch Service: steam-runtime-launcher-service is running pid 521
bus_name=com.steampowered.PressureVessel.LaunchAlongsideSteam
MESA: info: wrong context_type: 2
TU: error: ../src/freedreno/vulkan/tu_knl_drm_virtio.cc:1294: could not get connect vdrm: No such file or directory (VK_ERROR_INCOMPATIBLE_DRIVER)
MESA: info: wrong context_type: 2
TU: error: ../src/freedreno/vulkan/tu_knl_drm_virtio.cc:1295: could not get connect vdrm: No such file or directory (VK_ERROR_INCOMPATIBLE_DRIVER)
src/common/html/chrome_ipc_client.cpp (1719) : iRet == 0
src/common/html/chrome_ipc_client.cpp (1719) : iRet == 0
05/26 01:42:10 Init: Installing breakpad exception handler for appid(steam)/version(1716584667)/tid(396)
05/26 01:42:10 Failed writing minidump, nothing to upload.
src/common/html/chrome_ipc_client.cpp (1738) : res > 0
src/common/html/chrome_ipc_client.cpp (1738) : res > 0
05/26 01:42:10 Init: Installing breakpad exception handler for appid(steam)/version(1716584667)/tid(396)
05/26 01:42:10 Failed writing minidump, nothing to upload.
BRefreshApplicationsInLibrary 1: 33ms
BuildCompleteAppOverviewChange: 388 apps
RegisterForAppOverview 1: 146ms
RegisterForAppOverview 2: 151ms
[2024-05-26 01:43:49] Background update loop checking for update. . .
[2024-05-26 01:43:49] Checking for available updates...
[2024-05-26 01:43:49] Downloading manifest: https://client-update.akamai.steamstatic.com/steam_client_ubuntu12?t=4163407937
[2024-05-26 01:43:49] Manifest download: send request
[2024-05-26 01:43:50] Manifest download: waiting for download to finish
[2024-05-26 01:43:50] Manifest download: finished
[2024-05-26 01:43:50] Download skipped by HTTP 304 Not Modified
[2024-05-26 01:43:50] Nothing to do
BuildCompleteAppOverviewChange: 393 apps
RegisterForAppOverview 1: 25ms
RegisterForAppOverview 2: 27ms
BuildCompleteAppOverviewChange: 393 apps
RegisterForAppOverview 1: 31ms
RegisterForAppOverview 2: 32ms
BuildCompleteAppOverviewChange: 393 apps
RegisterForAppOverview 1: 9ms
RegisterForAppOverview 2: 10ms
BuildCompleteAppOverviewChange: 393 apps
RegisterForAppOverview 1: 10ms
RegisterForAppOverview 2: 11ms
BuildCompleteAppOverviewChange: 393 apps
RegisterForAppOverview 1: 22ms
RegisterForAppOverview 2: 23ms

Also, I can't run any appimages.

@iraizo
Copy link

iraizo commented May 26, 2024

@iraizo Have you found any fix for running out of FDs? I have the same issue

@zimsneexh nope, no fix found yet

@teohhanhui
Copy link
Author

teohhanhui commented May 26, 2024

@lacamar

while running the steam process, the steam window repeatedly opens for about 10 seconds then closes again

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

Also, I can't run any appimages.

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

flathub/com.valvesoftware.Steam#770

@teohhanhui
Copy link
Author

@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

@4kz Did you accidentally cut off the output? The part that you've shared only shows it's starting.

also for some reason I the desktop entry file doesn't show up in applications

Have you tried log out and log in again? Usually that's required.

@7-75
Copy link

7-75 commented May 27, 2024 via email

@7-75
Copy link

7-75 commented May 27, 2024

Yeah, I'm having issues trying to log in (code 2e) even whilst disabling 2fa, and the desktop entry file still doesn't show in Gnome 46, I'll check logs tomorrow unless you already know of this sort of issue

@teohhanhui
Copy link
Author

@4kz Just to confirm, you're using my steam wrapper script, right?

It contains an important workaround to fix transparent Steam windows (and steamwebhelper crashing).

and the desktop entry file still doesn't show in Gnome 46

And you confirm that it's correctly saved as ~/.local/share/applications/steam.desktop? There's a desktop file cache but that's only for MIME types, AFAIK... But just in case, you could try running update-desktop-database -v ~/.local/share/applications

https://wiki.archlinux.org/title/Desktop_entries#Update_database_of_desktop_entries

@7-75
Copy link

7-75 commented May 27, 2024 via email

@7-75
Copy link

7-75 commented May 27, 2024 via email

@teohhanhui
Copy link
Author

@4kz Weird, I'm on Fedora 40, GNOME 46. It's definitely working for me. Do you have some GNOME Shell extensions that might be causing that?

@7-75
Copy link

7-75 commented May 27, 2024 via email

@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.

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