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

@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

@TamasBarta
Copy link

I couldn't enter chroot either, but I figured out, that the issue for me was that I was using zshell, and not bash. I reexported $SHELL to be where bash is (which bash) before unbreak_chroot.sh, and that did the trick, then the script used bash with chroot, which in contrast to zshell, is available in the chroot.

export SHELL=$(which bash)

@teohhanhui
Copy link
Author

@TamasBarta Good find. Thank you. I'll investigate and add a workaround.

@teohhanhui
Copy link
Author

teohhanhui commented Jul 9, 2024

I can run Stardew Valley (Linux x86-64 version) through box64 (v0.3.0) now. Yay!

(But Stardew Valley was also running perfectly fine through box64 on 16K kernel anyway... Haha. But box64 was broken for Fedora 40 before this...)

For whoever interested:

#!/bin/sh
STARDEW_VALLEY="$HOME/.local/share/Steam/steamapps/common/Stardew Valley/StardewValley"

export SMAPI_USE_CURRENT_SHELL=true

export BOX64_LOG=1
export BOX64_ROLLING_LOG=1
export BOX64_DLSYM_ERROR=1
export BOX64_SHOWSEGV=1
export BOX64_SHOWBT=1
export BOX64_DYNAREC_LOG=1
export BOX64_DYNAREC_STRONGMEM=1

args_box64_env=$(awk 'END { for (name in ENVIRON) { if (name ~ /^BOX64_/) { printf " -e=%s", name; }}}' < /dev/null)

exec krun $args_box64_env -e=SMAPI_USE_CURRENT_SHELL -- box64 "$STARDEW_VALLEY" "$@"

# if [ "$(cut -d '' -f1 < /proc/1/cmdline)" = '/init.krun' ]; then
# 	exec "${STARDEW_VALLEY}" "$@"
# 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=SMAPI_USE_CURRENT_SHELL -- "${STARDEW_VALLEY}" "$@"
# elif [ -n "${container_name}" ] && [ "${container_name}" != "asahi-krun" ]; then
# 	exec distrobox-host-exec "$HOME/.local/bin/stardew-valley" "$@"
# else
# 	exec krun -e=SMAPI_USE_CURRENT_SHELL -- "${STARDEW_VALLEY}" "$@"
# fi

@baikaishiuc
Copy link

@teohhanhui

zhengxianwei:4k@~$ ping baidu.com
ping: socktype: SOCK_DGRAM
ping: socket: Address family not supported by protocol
zhengxianwei:4k@~$ ping 8.8.8.8
ping: socktype: SOCK_DGRAM
ping: socket: Address family not supported by protocol

krun /etc/resolve.conf the same as host

Can you teach me how to anlaysis this problem ? rebuild krunvm and kernel ?

@baikaishiuc
Copy link

baikaishiuc commented Jul 12, 2024

@teohhanhui

I Fixed, two point:

  1. I need change to ping -4 baidu.com, default is ipv6
  2. sudo setcap 'cap_net_raw+p' /usr/bin/ping

@teohhanhui
Copy link
Author

teohhanhui commented Jul 12, 2024

sudo setcap 'cap_net_raw+p' /usr/bin/ping

@baikaishiuc If you're doing that inside the container, fine. But please don't do that on your host.

cap_net_raw shouldn't be needed, since Fedora has allowed ping for all user groups: https://fedoraproject.org/wiki/Changes/EnableSysctlPingGroupRange

But it's not set correctly inside the krun VM for now:

[teohhanhui@han-macbook-air ~]$ sysctl net.ipv4.ping_group_range
net.ipv4.ping_group_range = 1	0

(I think just because nothing sets it...)

@baikaishiuc
Copy link

baikaishiuc commented Jul 13, 2024

@teohhanhui

[teohhanhui@han-macbook-air ~]$ sysctl net.ipv4.ping_group_range
net.ipv4.ping_group_range = 1	0

Thank you, I am not familiar with the Internet, I learned a lot today

@neo773
Copy link

neo773 commented Jul 15, 2024

Hi, I keep getting this error steamwebhelper is not responding
when running box64 wine64 "C:\Program Files (x86)\Steam\Steam.exe"
I've already tried restarting and running the command several times but no luck so far.
Any suggestions?

image

@teohhanhui
Copy link
Author

teohhanhui commented Jul 15, 2024

@neo773 Hmm... Looks like it cannot find some of the DLLs. Maybe they're not in BOX64_LD_LIBRARY_PATH. I'll check.

@yuv418
Copy link

yuv418 commented Jul 15, 2024

The unshare -pfr --user --mount --kill-child /usr/bin/bash returns an error of basename: missing operand but still drops me to a root shell. After that, if I try to use the chroot script unbreak_chroot.sh, it drops me to a bash chroot but there are DNS issues (so I can't install anything).

It's also worth noting that mounting sys and dev have permission denied problems when mounting in the unbreak_chroot.sh script.

EDIT: Fixed, my network is weird and blocked the default 8.8.8.8 DNS server in resolv.conf.

@Preston-S
Copy link

Hey! Has anyone else had this pop up when running: krun FEXRootFSFetcher:

The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Could not resolve keysym XF86CameraAccessEnable
> Warning:          Could not resolve keysym XF86CameraAccessDisable
> Warning:          Could not resolve keysym XF86CameraAccessToggle
> Warning:          Could not resolve keysym XF86NextElement
> Warning:          Could not resolve keysym XF86PreviousElement
> Warning:          Could not resolve keysym XF86AutopilotEngageToggle
> Warning:          Could not resolve keysym XF86MarkWaypoint
> Warning:          Could not resolve keysym XF86Sos
> Warning:          Could not resolve keysym XF86NavChart
> Warning:          Could not resolve keysym XF86FishingChart
> Warning:          Could not resolve keysym XF86SingleRangeRadar
> Warning:          Could not resolve keysym XF86DualRangeRadar
> Warning:          Could not resolve keysym XF86RadarOverlay
> Warning:          Could not resolve keysym XF86TraditionalSonar
> Warning:          Could not resolve keysym XF86ClearvuSonar
> Warning:          Could not resolve keysym XF86SidevuSonar
> Warning:          Could not resolve keysym XF86NavInfo
Errors from xkbcomp are not fatal to the X server
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 708, clipping.
>                   X11 cannot support keycodes above 255.
> Warning:          Could not resolve keysym XF86CameraAccessEnable
> Warning:          Could not resolve keysym XF86CameraAccessDisable
> Warning:          Could not resolve keysym XF86CameraAccessToggle
> Warning:          Could not resolve keysym XF86NextElement
> Warning:          Could not resolve keysym XF86PreviousElement
> Warning:          Could not resolve keysym XF86AutopilotEngageToggle
> Warning:          Could not resolve keysym XF86MarkWaypoint
> Warning:          Could not resolve keysym XF86Sos
> Warning:          Could not resolve keysym XF86NavChart
> Warning:          Could not resolve keysym XF86FishingChart
> Warning:          Could not resolve keysym XF86SingleRangeRadar
> Warning:          Could not resolve keysym XF86DualRangeRadar
> Warning:          Could not resolve keysym XF86RadarOverlay
> Warning:          Could not resolve keysym XF86TraditionalSonar
> Warning:          Could not resolve keysym XF86ClearvuSonar
> Warning:          Could not resolve keysym XF86SidevuSonar
> Warning:          Could not resolve keysym XF86NavInfo
Errors from xkbcomp are not fatal to the X server

Then prompts show up

LATER then after doing the y, 1, 1, y following the promts I get this error:
Got error or hangup (mask 5) on X connection, exiting

@teohhanhui
Copy link
Author

@Preston-S All of those error messages are "normal". Don't worry. Just proceed with the rest.

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