-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mising option to run x86_64 container on M1 MacBook #168
Comments
I've actually been working on a solution to this the last couple of weeks. I gave up a few years ago because compiling and running wine in an ARM container meant it could only run windows executables compiled on ARM, or when trying to run the x86 image on M1 (ARM) with emulation, Docker's qemu emulator would fail and cause the container to throw a segmentation fault. The new solution is to use an ARM based image in combination with box86 and box64 that does the emulation for x86 binaries on the fly without needing qemu. I've got it working with Ubuntu 20.04 focal and wine version 8.0.2 but run into issues with newer versions of wine or Ubuntu, so I'm still trying to see if I can improve more before release. So watch this space, I'll be releasing the new code and container images soon. |
I have to correct myself: This statement is wrong. After a couple of attempts, I was able to log in. I notice it sporadically also fails on ARM using an ARM container, so this issue is maybe not even related. Once I did log in, I failed to run anything with wine though. Here's what I got:
So something is wrong with the prefix. I first had to create two new prefixes:
Those two prefixes than worked and allowed me to run x86/x86_64 binaries in my Docker container. Painfully slow to start and not that fast when running either, but they did run which was already beyond my expectations. So
works fine for me. And after patching the script to support the
also worked fine for me, after I created two new prefixes by hand. Side note: That this option should probably not be named |
Ok, that's interesting - obviously there's been improvements to allow the x86 image to run on ARM. It used to just fall over immediately with a segmentation fault and unfortunately I don't have an M-series Mac to test with so I had no idea things had changed. My new image should be significantly faster though, as it's running native ARM and uses emulation only for the x86 binaries. I'm hoping to release this weekend. |
Just having this same issue. I can run the container in qemu emulation mode but I get too many errors (for example trying to run a .net 3.5 app crashes outright with I was just about to look into https://github.com/alzhahirdev/winebox64 which is doing something similar you're looking into right now, but otherwise it's support (like properly setup rdp & X) is nowhere near what this package has, so I might wait for your release. I'm happy to test if you have something. |
That'd be great, I'm relying on emulation to test the ARM image as I only have an old Intel MacBook. 32 bit prefixes work fine for me but I get a segmentation fault for 64 bit, so I'm not sure if that's a symptom of emulation or if it's genuinely broken. I've only got ci and documentation to go, but at worst I'll just push an image out today for testing. |
Ok, I've just push a new image for testing: docker run -it \
--rm \
--hostname="docker-wine" \
--env="RDP_SERVER=yes" \
--publish="3389:3389/tcp" \
scottyhardy/docker-wine:debian /bin/bash Or if you want to use the docker-wine helper script: wget https://raw.githubusercontent.com/scottyhardy/docker-wine/feature/debian_with_arm/docker-wine
chmod +x docker-wine
./docker-wine --tag=debian --rdp I've got wrappers set up to set You can also force to use the x86_64 image to compare by adding |
I had a go with your pushed image. Main notes:
I think the issue is that you are trying to run bash under box86 and hoping that will keep resolving stuff, but I don't think it's working. What I tried instead is just modifying wine to use a box86 wrapper, and keep using arm bash. So the two changes:
(I installed vim to have an editor) edit
While this still has issues, I'm trying to debug, I did manage to get much closer to actually have things run, compared with the box'd bash version, although commands still die:
or for example
I've seen you added some commits recently, so I'll try to build the container myself and see what I come up with. I think I'll keep trying the "everything is arm except wine itself which runs under box" route for now, which based on https://github.com/alzhahirdev/winebox64/blob/main/image/Dockerfile should hopefully work. Thanks for your recent contributions, if I manage to get this running I'll let you know or potentially drop a PR |
If that doesn't work, the other potential thing to look at the native support for this in Wine 10.0+ using ARM64EC & FEX for 64 bit apps, and in Wine 9.0+ for 32 bit apps |
Had a couple tries, I'm usually stuck at getting any kind of win32 apps running regardless of what I try. The common error is always
Which is probably odd as I'm not sure where qemu comes from, as i386 emulation should be taken care of by box86 if I'm not mistaken, and qemu is not installed at all on the containers themselves, so I'm wondering if Docker Desktop's binfmt is doing something weird and the error is coming from there |
Final update from me today, looks like I was wrong, the bash redirection does work (or at least that's not the problem), but apparently running commands is not deterministic. Simply trying to run
So this works some of the time, not the other times. I also tried to build the container with mono Also one thing I noticed is that |
Bug might be with BOX64 calling BOX86, as the error happens when context switches between BOX64 and BOX86: with logging enabled this is a failed attempt: wineuser@docker-wine:/$ wine cmd.exe
[BOX64] Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT AFP
[BOX64] Running on - with 12 cores, pagesize: 4096
[BOX64] Will use hardware counter measured at 24.0 MHz emulating 3.0 GHz
[BOX64] Detected 48bits at least of address space
[BOX64] Counted 22 Env var
[BOX64] Library search path:
[BOX64] Binary search path: /usr/lib/box64-x86_64-linux-gnu/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
[BOX64] Looking for /usr/local/bin/box64-bash
[BOX64] Bash detected, disabling banner
[BOX64] Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT AFP
[BOX64] Running on - with 12 cores, pagesize: 4096
[BOX64] Will use hardware counter measured at 24.0 MHz emulating 3.0 GHz
[BOX64] Detected 48bits at least of address space
[BOX64] Counted 23 Env var
[BOX64] Library search path:
[BOX64] Binary search path: /usr/lib/box64-x86_64-linux-gnu/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
[BOX64] Looking for /usr/local/bin/box64-bash
[BOX64] Bash detected, disabling banner
Illegal instruction and this is a successful one: [BOX64] Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT AFP
[BOX64] Running on - with 12 cores, pagesize: 4096
[BOX64] Will use hardware counter measured at 24.0 MHz emulating 3.0 GHz
[BOX64] Detected 48bits at least of address space
[BOX64] Counted 22 Env var
[BOX64] Library search path:
[BOX64] Binary search path: /usr/lib/box64-x86_64-linux-gnu/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
[BOX64] Looking for /usr/local/bin/box64-bash
[BOX64] Bash detected, disabling banner
[BOX64] Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT AFP
[BOX64] Running on - with 12 cores, pagesize: 4096
[BOX64] Will use hardware counter measured at 24.0 MHz emulating 3.0 GHz
[BOX64] Detected 48bits at least of address space
[BOX64] Counted 23 Env var
[BOX64] Library search path:
[BOX64] Binary search path: /usr/lib/box64-x86_64-linux-gnu/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
[BOX64] Looking for /usr/local/bin/box64-bash
[BOX64] Bash detected, disabling banner
[BOX64] Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT AFP
[BOX64] Running on - with 12 cores, pagesize: 4096
[BOX64] Will use hardware counter measured at 24.0 MHz emulating 3.0 GHz
[BOX64] Detected 48bits at least of address space
[BOX64] Counted 23 Env var
[BOX64] Library search path:
[BOX64] Binary search path: /usr/lib/box64-x86_64-linux-gnu/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
[BOX64] Looking for /usr/local/bin/box64-bash
[BOX64] Bash detected, disabling banner
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 SWP IDIVA AES PMULL PageSize:4096 Running on - with 12 Cores
Params database has 32 entries
BOX86: Wine detected, WINEPRELOADRESERVE=""
BOX86: Warning, program break not found
BOX86_LD_LIBRARY_PATH: /usr/lib/box86-i386-linux-gnu/
BOX86_PATH: /usr/lib/box86-i386-linux-gnu/
Counted 21 Env var
Looking for /opt/wine-stable/bin/wine
argv[1]="cmd.exe"
Rename process to "wine"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0
Using emulated /opt/wine-stable/bin/../lib/wine/i386-unix/ntdll.so
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 SWP IDIVA AES PMULL PageSize:4096 Running on - with 12 Cores
Params database has 32 entries
BOX86: Wine detected, WINEPRELOADRESERVE=""
BOX86: Warning, program break not found
BOX86_LD_LIBRARY_PATH: /usr/lib/box86-i386-linux-gnu/
BOX86_PATH: /usr/lib/box86-i386-linux-gnu/
Counted 23 Env var
Looking for /opt/wine-stable/bin/wine
argv[1]="cmd.exe"
Rename process to "wine"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0
Using emulated /opt/wine-stable/bin/../lib/wine/i386-unix/ntdll.so
wine: created the configuration directory '/home/wineuser/.wine'
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 SWP IDIVA AES PMULL PageSize:4096 Running on - with 12 Cores
Params database has 32 entries
BOX86: Warning, program break not found
BOX86_LD_LIBRARY_PATH: /usr/lib/box86-i386-linux-gnu/
BOX86_PATH: /usr/lib/box86-i386-linux-gnu/
Counted 23 Env var
Looking for /opt/wine-stable/bin/wineserver
Rename process to "wineserver"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0
Using emulated /opt/wine-stable/lib/wine/i386-unix/libwine.so.1
002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
0048:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
0050:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0048:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
0048:err:systray:initialize_systray Could not create tray window
0048:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0048:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0048:err:ole:apartment_get_local_server_stream Failed: 0x80004002
0050:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0050:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly."
002c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 3
002c:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly."
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 0
0050:err:ole:apartment_createwindowifneeded CreateWindow failed with error 14007
0050:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x800736b7
0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x800736b7
0050:err:ole:apartment_get_local_server_stream Failed: 0x800736b7
0050:err:ole:start_rpcss Failed to open RpcSs service
0040:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0040:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly."
008c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
008c:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly."
0094:fixme:file:NtLockFile I/O completion on lock not implemented yet
0094:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
009c:fixme:file:NtLockFile I/O completion on lock not implemented yet
009c:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
00ac:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
00ac:err:winediag:nodrv_CreateWindow L"Make sure that your X server is running and that $DISPLAY is set correctly."
009c:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 5)
009c:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 5)
0094:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
0094:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
008c:err:localspl:process_attach failed to load symbol cupsFinishDocument
00c4:err:service:process_send_command service protocol error - failed to write pipe!
0074:err:dnsapi:DllMain No libresolv support, expect problems
0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
wine: configuration in L"/home/wineuser/.wine" has been updated.
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 SWP IDIVA AES PMULL PageSize:4096 Running on - with 12 Cores
Params database has 32 entries
BOX86: Wine detected, WINEPRELOADRESERVE="000400000-00048d000"
BOX86: Warning, program break not found
BOX86_LD_LIBRARY_PATH: /usr/lib/box86-i386-linux-gnu/
BOX86_PATH: /usr/lib/box86-i386-linux-gnu/
Counted 25 Env var
Looking for /opt/wine-stable/bin/wine
argv[1]="C:\windows\system32\conhost.exe"
argv[2]="--unix"
argv[3]="--width"
argv[4]="183"
argv[5]="--height"
argv[6]="45"
argv[7]="--server"
argv[8]="0x10"
Rename process to "wine"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0
Using emulated /opt/wine-stable/bin/../lib/wine/i386-unix/ntdll.so
0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0110:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
Using emulated /opt/wine-stable/lib/wine/i386-unix/libwine.so.1
Using emulated /opt/wine-stable/lib/wine/i386-unix/win32u.so
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using native(wrapped) libexpat.so.1
Using emulated /opt/wine-stable/lib/wine/i386-unix/win32u.so
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using native(wrapped) libexpat.so.1
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 SWP IDIVA AES PMULL PageSize:4096 Running on - with 12 Cores
Params database has 32 entries
BOX86: Wine detected, WINEPRELOADRESERVE="000400000-000571000"
BOX86: Warning, program break not found
BOX86_LD_LIBRARY_PATH: /usr/lib/box86-i386-linux-gnu/
BOX86_PATH: /usr/lib/box86-i386-linux-gnu/
Counted 25 Env var
Looking for /opt/wine-stable/bin/wine
argv[1]="C:\windows\system32\cmd.exe"
Rename process to "wine"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) librt.so.1
Using native(wrapped) libm.so.6
Using native(wrapped) libbsd.so.0
Using emulated /opt/wine-stable/bin/../lib/wine/i386-unix/ntdll.so
Using emulated /opt/wine-stable/lib/wine/i386-unix/libwine.so.1
Using emulated /opt/wine-stable/lib/wine/i386-unix/win32u.so
Using native(wrapped) libfreetype.so.6
Using native(wrapped) libfontconfig.so.1
Using native(wrapped) libexpat.so.1
Microsoft Windows 6.1.7601
Z:\> wine doesn't even load at all on crashed instances. Note, I have explictly disabled i386 qemu in Docker Desktop by calling (from the host): docker run --rm -it --pid=host --privileged ubuntu:22.04 nsenter --all -t 1 -m sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/i386' but this just helps with getting different error messages when I had trouble with ld_linux.so.2 |
I released the new docker wine code earlier today and the new images have been pushed out. I can only get the box86/box64 arm image to work with 8.0.2, so no point testing with 9.0.0.0 or 10.0.0.0 or the wine-devel versions either because they also don't work. The tags for the 9 and 10 (if you wanted to test x86 images with emulation) are:
or substitute stable for devel if you wanted to try those too. I'm not sure your dotnet example actually works. I tried it on x86 wine-stable 8.0.2 and 10.0 but I also get errors: wineuser@docker-wine:~$ WINEARCH=win32 winetricks --unattended -q --force winxp cmd dotnet35
Executing cd /usr/local/bin
Using winetricks 20250102-next - sha256sum: fd4f57a2b385c89ea896a3a8115003e935551e410128b2353dfebe2915d93d3f with wine-8.0.2 and WINEARCH=win32
Executing w_do_call winxp
Executing load_winxp
Executing wine winecfg -v winxp
------------------------------------------------------
warning: Running /usr/bin/wineserver -w. This will hang until all wine processes in prefix=/home/wineuser/.wine terminate
------------------------------------------------------
Application could not be started, or no application associated with the specifie
d file.
ShellExecuteEx failed: File not found.
------------------------------------------------------
warning: Note: command load_winxp returned status 1. Aborting.
------------------------------------------------------ Instead, could you please try running this for me:
This is what I use to confirm wine is working (to some degree at least) in my ci. I've tested with an ARM runner and it worked without at hitch (also built the image in 8 mins vs 1.5 hrs for cross-compile on x86). I was trying earlier to test with a macOS M-series runner but it doesn't come with docker installed so might try again later. If that command doesn't work, try running |
while dotnet is my end goal, but currently I'm just trying with |
What I'm curently trying is 8.0.2 with box86, completely skipping box64. It seems the most stable config for 32 bit apps for now, at least the errors I'm getting seem to be unrelated to box. |
Here is my latest update: sztupy@6566e6b In short it:
Note that 64 bit wine still doesn't work as the wineserver in the install is the 32 bit version, I guess becuase it's the same filename in both wine-adm64 and wine-i386, and as the latter is installed later it just overwrites it or something. I don't have any more random crashes with this setup, e.g. I can consistently load up wineuser@docker-wine:~$ winetricks winxp
Executing cd /usr/local/bin
Using winetricks 20250102-next - sha256sum: fd4f57a2b385c89ea896a3a8115003e935551e410128b2353dfebe2915d93d3f with wine-8.0.2 and WINEARCH=win32
Executing w_do_call winxp
Executing load_winxp
Executing wine winecfg -v winxp
------------------------------------------------------
warning: Running /usr/bin/wineserver -w. This will hang until all wine processes in prefix=/home/wineuser/.wine terminate
------------------------------------------------------
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: File not found. (Not sure which file it's referring to that's missing, using WINDEBUG=all also didn't really get me closer to it) |
That’s a great start - could you put through a pull request so I can check it out further? |
Just done that. Meanwhile I realized OSX Macs don't support 32 bit ARM anyway, so BOX86 runs under qemu emulation in docker. Hence if I have time I might actually play around with Wine 9/10s native x86/x64 emulation under ARM with FEX, it might be a more future proof solution, at least for architectures without native 32 bit support |
Have you checked out hangover? It uses FEX as the default emulator but I got segmentation faults immediately so moved on to trying box. FEX looks interesting by itself though, so worth a try. |
Not yet, but I'll take a look. I've also just seen there's a new compile-time option flag for BOX64 named BOX32, that would allow 32 bit x86 apps to be run natively under aarch64, but it's not yet feature complete Might be worth trying it out though and see how it behaves instead of BOX86 |
fwiw, this was working perfectly for me but the latest push broke it. switching to the previous tag gets everything working again with the latest docker-wine script.
I followed this comment to get set up: #168 (comment) with the latest image it's broken because WINEARCH is now win32, it might possibly work with a fresh winehome volume. |
Make sure you run with |
Just to add to that I'm back on plain x86_64 I'm having trouble with the new builds, for example the |
Ok, I'll roll back soon just to keep things going as they were. I really need to get my hands on an apple silicon Mac! |
Ok, I've rolled back all the changes, which has prompted new images to be pushed out. Thanks for the feedback everyone, I've got a few more things to test now to ensure the next update I push works properly. I'm going to avoid trying to do any ARM-related updates until I get my hands on an M-series Mac and concentrate on getting a decent updated x86 image running as Ubuntu 20.04 is almost end of life. It sounds like the emulation is doing a pretty decent job for now anyways. Regarding @CodingMarkus original post, I've removed the |
When I just run this on a M1 MacBook
I end up with this error
This confuses me, since when I run it like this
it does work fine and according to script, all that this option does is
So platform
linux/arm64
is fine but when I searched forlinux/arm64/v8
before it was an error?Also I miss an option to force x86 after all Docker can run x86 code on ARM Macs. E.g. if I add the folllowing
this also does work and now I have a container running in x86 emulation mode but this container doesn't allow log in (attempting to log in always fails).
Even though much slower, a x86_64 container is much more useful considering that a huge chunk of Windows software only exists for that architecture.
The text was updated successfully, but these errors were encountered: