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.

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

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 2, 2024

For running steam in box64 I would use krun -e WINEDLLOVERRIDES=libglesv2.dll=d as that’s the only way for steam to get further without vulkan/dxvk with the new wow64 mode in wine

@teohhanhui
Copy link
Author

@m1m1k4tz Thank you. I'll give it a try and update the guide.

@teohhanhui
Copy link
Author

@teohhanhui
Copy link
Author

teohhanhui commented Aug 3, 2024

@m1m1k4tz Unfortunately, the Windows version of Steam is still not able to connect to the Internet with this setup (following this guide)... So it doesn't even reach the next step yet. Haha...

IIRC, your setup is different, right? I wonder what makes it work for you but not in our case...

bootstrap_log.txt: https://gist.github.com/teohhanhui/0e35d451e37a83e22d19162d40278082

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 3, 2024

I use this to compile it and then copy it over to my m1 mac then I run wine from the wine build folder ptitSeb/box64#487 (comment)

@teohhanhui
Copy link
Author

@m1m1k4tz Hmm okay. I guess I just need to update my wine build to a newer version then...

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 4, 2024

@m1m1k4tz Unfortunately, the Windows version of Steam is still not able to connect to the Internet with this setup (following this guide)... So it doesn't even reach the next step yet. Haha...

IIRC, your setup is different, right? I wonder what makes it work for you but not in our case...

bootstrap_log.txt: https://gist.github.com/teohhanhui/0e35d451e37a83e22d19162d40278082

The only thing I do differently is I don’t install it I just copy it over I think you should install the native version of wine also to get the dependencies for box64

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 4, 2024

It could be something weird with your network setup also that’s not playing well with krun

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 4, 2024

Also right now there’s a bug with asahi that if you update wpa supplicant it breaks your wifi right now

@teohhanhui
Copy link
Author

@m1m1k4tz I definitely have connectivity in krun and FEX. Maybe it's missing dependencies in the /x86_64 installroot like you said.

@teohhanhui
Copy link
Author

I think you should install the native version of wine also to get the dependencies for box64

@m1m1k4tz Oh you mean aarch64 wine huh... That'd be really weird. I don't see how that could be the case.

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 5, 2024

I think it uses the dependencies for dynarec and that’s an easy way to install them all also the guide says box64 requires wine to be installed manually

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 7, 2024

Oh also I don’t install the version of bash you do I use the one that comes with box64

@m1m1k4tz
Copy link

m1m1k4tz commented Aug 8, 2024

I think it’s probably the way you compiled and packaged wine though I would just compile it on an x86 machine then download it if steam was 64 bit you could run it thru box64 and it would do all that for you ValveSoftware/steam-for-linux#3518

@teohhanhui
Copy link
Author

I think it’s probably the way you compiled and packaged wine

@m1m1k4tz It's just simply Fedora's wine packaging, adapted for the new wow64 mode. I don't see what could be causing the connectivity issue.

@m1m1k4tz
Copy link

Can you run ping thru bash run by box64 I remember you posting an issue with bash compiled on fedora with box64

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