hangover
hangover copied to clipboard
Unable to run Notepad++ in arm64 docker container
Problems Description
I'm trying out using Hangover for my own little docker-wine project. In particular, I've been looking at alternatives for Apple M1 Macs as using the current x86 (linux/amd64) docker image fails with a segfault when trying to run anything at all (see https://github.com/scottyhardy/docker-wine/issues/109).
I myself have an Intel Mac so I've been getting assistance with testing from @brandonros. The issues we're seeing appear to be related to Docker Desktop for Mac's QEMU implementation used to emulate an x86_64 processor on ARM hardware. My first attempt was to build Wine from source code which worked, but overall was a failure as other than running notepad and other built-in apps there weren't any readily available 64-bit Windows binaries compiled for ARM.
So, the thought is that if we use a native ARM image with a newer/better version of QEMU it could solve our problem, which is when I came across Hangover.
In short, I've successfully built hangover using Dockerfile.cross_arm64
(see https://github.com/scottyhardy/docker-wine/pull/139), then I tar the entire /root/hangover
source and build files and use ADD
to untar the lot into /usr/local/lib/hangover
within a Dockerfile that includes all the other packages I normally use in my docker-wine image.
build_hangover_for_arm:
#!/usr/bin/env bash
# Checkout hangover repository
if [ ! -d hangover ]; then
git clone --depth=1 [email protected]:AndreRH/hangover.git
git -C hangover submodule update --init --depth=1
else
git -C hangover fetch
git -C hangover pull origin master
git -C hangover submodule update --depth=1
fi
# Build hangover
docker build \
-f hangover/Dockerfile.cross_arm64 \
-t "hangover-builder" \
hangover
# Extract the build files from the hangover-builder image
docker run --rm hangover-builder tar -C /root/hangover/ --exclude-vcs -czf - . > hangover.tar.gz
docker build \
--platform="linux/arm64" \
-f Dockerfile.build_from_source \
--target="hangover" \
-t "docker-wine:hangover" \
.
Dockerfile.build_from_source (minus parts in original for building wine from source code):
FROM scottyhardy/docker-remote-desktop:latest AS main-base
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
cabextract \
git \
gosu \
gpg-agent \
locales \
p7zip \
pulseaudio \
pulseaudio-utils \
sudo \
tzdata \
unzip \
wget \
winbind \
xvfb \
zenity \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
COPY pulse-client.conf /root/pulse/client.conf
COPY entrypoint.sh /usr/bin/entrypoint
# Final image with Hangover built for ARM (https://github.com/AndreRH/hangover)
FROM main-base AS hangover
ADD hangover.tar.gz /usr/local/lib/hangover
RUN echo '#!/bin/bash' > /usr/local/bin/wine \
&& echo '# Wrapper script for Hangover build of Wine' >> /usr/local/bin/wine \
&& echo 'export HOQEMU="/usr/local/lib/hangover/build/qemu/x86_64-windows-user/qemu-x86_64.exe.so"' >> /usr/local/bin/wine \
&& echo 'exec /usr/local/lib/hangover/build/wine-host/loader/wine "$@"' >> /usr/local/bin/wine \
&& chmod +x /usr/local/bin/wine
ENTRYPOINT ["/usr/bin/entrypoint"]
The base image scottyhardy/docker-remote-desktop:latest
uses ubuntu:latest
for it's base, which is currently Ubuntu 20.04 focal.
I can successfully run wine notepad
which is my normal test to confirm wine is working, but I'm getting errors when I attempt to run a copy of notepad++ portable (tested with both 32-bit and 64-bit versions):
wineuser@Scotts-MacBook-Pro:~$ wine ./notepad++.exe
starting L"./notepad++.exe" with Hangover
00d4:err:secur32:SECUR32_initSchannelSP TLS library not found, SSL connections will fail
Killed
wineuser@Scotts-MacBook-Pro:~$ wine --version
wine-6.5
Here's a more detailed log, using a fresh install where I hadn't already initialised the wine config by running normal notepad:
Scotts-MacBook-Pro:docker-hangover scottyhardy$ ./docker-wine --rm --hangover --volume="$(pwd)/npp.8.1.9.3.portable.zip:/npp/npp.8.1.9.3.portable.zip"
hangover: Pulling from scottyhardy/docker-wine
Digest: sha256:53435edb874c50ab6b2b7e6bb00c5fd118f08641041ccebf3490a31f0a47c6f8
Status: Image is up to date for scottyhardy/docker-wine:hangover
docker.io/scottyhardy/docker-wine:hangover
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
wineuser@Scotts-MacBook-Pro:~$ cp /npp/npp.8.1.9.3.portable.zip .
wineuser@Scotts-MacBook-Pro:~$ unzip ./npp.8.1.9.3.portable.zip
Archive: ./npp.8.1.9.3.portable.zip
creating: autoCompletion/
inflating: autoCompletion/actionscript.xml
inflating: autoCompletion/autoit.xml
inflating: autoCompletion/BaanC.xml
inflating: autoCompletion/batch.xml
inflating: autoCompletion/c.xml
inflating: autoCompletion/cmake.xml
inflating: autoCompletion/cobol.xml
inflating: autoCompletion/coffee.xml
inflating: autoCompletion/cpp.xml
inflating: autoCompletion/cs.xml
inflating: autoCompletion/css.xml
inflating: autoCompletion/html.xml
inflating: autoCompletion/java.xml
inflating: autoCompletion/javascript.xml
inflating: autoCompletion/lisp.xml
inflating: autoCompletion/lua.xml
inflating: autoCompletion/nsis.xml
inflating: autoCompletion/perl.xml
inflating: autoCompletion/php.xml
inflating: autoCompletion/python.xml
inflating: autoCompletion/rc.xml
inflating: autoCompletion/sql.xml
inflating: autoCompletion/tex.xml
inflating: autoCompletion/typescript.xml
inflating: autoCompletion/vb.xml
inflating: autoCompletion/vhdl.xml
inflating: autoCompletion/xml.xml
inflating: change.log
inflating: config.xml
inflating: contextMenu.xml
extracting: doLocalConf.xml
creating: functionList/
inflating: functionList/ada.xml
inflating: functionList/asm.xml
inflating: functionList/autoit.xml
inflating: functionList/baanc.xml
inflating: functionList/bash.xml
inflating: functionList/batch.xml
inflating: functionList/c.xml
inflating: functionList/cobol-free.xml
inflating: functionList/cobol.xml
inflating: functionList/cpp.xml
inflating: functionList/cs.xml
inflating: functionList/fortran.xml
inflating: functionList/fortran77.xml
inflating: functionList/haskell.xml
inflating: functionList/ini.xml
inflating: functionList/inno.xml
inflating: functionList/java.xml
inflating: functionList/javascript.js.xml
inflating: functionList/krl.xml
inflating: functionList/lua.xml
inflating: functionList/nsis.xml
inflating: functionList/overrideMap.xml
inflating: functionList/perl.xml
inflating: functionList/php.xml
inflating: functionList/powershell.xml
inflating: functionList/python.xml
inflating: functionList/ruby.xml
inflating: functionList/rust.xml
inflating: functionList/sinumerik.xml
inflating: functionList/sql.xml
inflating: functionList/typescript.xml
inflating: functionList/universe_basic.xml
inflating: functionList/vhdl.xml
inflating: functionList/xml.xml
inflating: langs.model.xml
inflating: license.txt
creating: localization/
inflating: localization/abkhazian.xml
inflating: localization/afrikaans.xml
inflating: localization/albanian.xml
inflating: localization/arabic.xml
inflating: localization/aragonese.xml
inflating: localization/aranese.xml
inflating: localization/azerbaijani.xml
inflating: localization/basque.xml
inflating: localization/belarusian.xml
inflating: localization/bengali.xml
inflating: localization/bosnian.xml
inflating: localization/brazilian_portuguese.xml
inflating: localization/breton.xml
inflating: localization/bulgarian.xml
inflating: localization/catalan.xml
inflating: localization/chineseSimplified.xml
inflating: localization/corsican.xml
inflating: localization/croatian.xml
inflating: localization/czech.xml
inflating: localization/danish.xml
inflating: localization/dutch.xml
inflating: localization/english.xml
inflating: localization/english_customizable.xml
inflating: localization/esperanto.xml
inflating: localization/estonian.xml
inflating: localization/extremaduran.xml
inflating: localization/farsi.xml
inflating: localization/finnish.xml
inflating: localization/french.xml
inflating: localization/friulian.xml
inflating: localization/galician.xml
inflating: localization/georgian.xml
inflating: localization/german.xml
inflating: localization/greek.xml
inflating: localization/gujarati.xml
inflating: localization/hebrew.xml
inflating: localization/hindi.xml
inflating: localization/hongKongCantonese.xml
inflating: localization/hungarian.xml
inflating: localization/indonesian.xml
inflating: localization/irish.xml
inflating: localization/italian.xml
inflating: localization/japanese.xml
inflating: localization/kabyle.xml
inflating: localization/kannada.xml
inflating: localization/kazakh.xml
inflating: localization/korean.xml
inflating: localization/kurdish.xml
inflating: localization/kyrgyz.xml
inflating: localization/latvian.xml
inflating: localization/ligurian.xml
inflating: localization/lithuanian.xml
inflating: localization/luxembourgish.xml
inflating: localization/macedonian.xml
inflating: localization/malay.xml
inflating: localization/marathi.xml
inflating: localization/mongolian.xml
inflating: localization/nepali.xml
inflating: localization/norwegian.xml
inflating: localization/nynorsk.xml
inflating: localization/occitan.xml
inflating: localization/piglatin.xml
inflating: localization/polish.xml
inflating: localization/portuguese.xml
inflating: localization/punjabi.xml
inflating: localization/romanian.xml
inflating: localization/russian.xml
inflating: localization/samogitian.xml
inflating: localization/sardinian.xml
inflating: localization/serbian.xml
inflating: localization/serbianCyrillic.xml
inflating: localization/sinhala.xml
inflating: localization/slovak.xml
inflating: localization/slovenian.xml
inflating: localization/spanish.xml
inflating: localization/spanish_ar.xml
inflating: localization/swedish.xml
inflating: localization/tagalog.xml
inflating: localization/taiwaneseMandarin.xml
inflating: localization/tajikCyrillic.xml
inflating: localization/tamil.xml
inflating: localization/tatar.xml
inflating: localization/telugu.xml
inflating: localization/thai.xml
inflating: localization/turkish.xml
inflating: localization/ukrainian.xml
inflating: localization/urdu.xml
inflating: localization/uyghur.xml
inflating: localization/uzbek.xml
inflating: localization/uzbekCyrillic.xml
inflating: localization/venetian.xml
inflating: localization/vietnamese.xml
inflating: localization/welsh.xml
inflating: localization/zulu.xml
inflating: notepad++.exe
extracting: nppLogNulContentCorruptionIssue.xml
creating: plugins/
creating: plugins/Config/
inflating: plugins/Config/nppPluginList.dll
creating: plugins/doc/
creating: plugins/mimeTools/
inflating: plugins/mimeTools/mimeTools.dll
creating: plugins/NppConverter/
inflating: plugins/NppConverter/NppConverter.dll
creating: plugins/NppExport/
inflating: plugins/NppExport/NppExport.dll
inflating: readme.txt
inflating: shortcuts.xml
inflating: stylers.model.xml
creating: themes/
inflating: themes/Bespin.xml
inflating: themes/Black board.xml
inflating: themes/Choco.xml
inflating: themes/DansLeRuSH-Dark.xml
inflating: themes/DarkModeDefault.xml
inflating: themes/Deep Black.xml
inflating: themes/Hello Kitty.xml
inflating: themes/HotFudgeSundae.xml
inflating: themes/khaki.xml
inflating: themes/Mono Industrial.xml
inflating: themes/Monokai.xml
inflating: themes/MossyLawn.xml
inflating: themes/Navajo.xml
inflating: themes/Obsidian.xml
inflating: themes/Plastic Code Wrap.xml
inflating: themes/Ruby Blue.xml
inflating: themes/Solarized-light.xml
inflating: themes/Solarized.xml
inflating: themes/Twilight.xml
inflating: themes/Vibrant Ink.xml
inflating: themes/vim Dark Blue.xml
inflating: themes/Zenburn.xml
creating: updater/
inflating: updater/GUP.exe
inflating: updater/gup.xml
inflating: updater/libcurl.dll
inflating: updater/LICENSE
inflating: updater/README.md
inflating: updater/updater.ico
creating: userDefineLangs/
inflating: userDefineLangs/markdown._preinstalled.udl.xml
inflating: userDefineLangs/markdown._preinstalled_DM.udl.xml
wineuser@Scotts-MacBook-Pro:~$ wine ./notepad++.exe
wine: created the configuration directory '/home/wineuser/.wine'
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:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0050:err:ole:apartment_get_local_server_stream Failed: 0x80004002
0050:err:virtual:virtual_setup_exception stack overflow 1648 bytes in thread 0050 addr 0x7f23af77696c stack 0x130990 (0x130000-0x131000-0x230000)
0040:err:setupapi:SetupDefaultQueueCallbackW copy error 1812 L"@C:\\windows\\system32\\drivers\\wineusb.sys,-1" -> L"C:\\windows\\inf\\wineusb.inf"
002c:err:process:NtCreateUserProcess L"\\??\\C:\\windows\\syswow64\\rundll32.exe" not supported on this installation (x86 binary)
009c:err:virtual:virtual_setup_exception stack overflow 2368 bytes in thread 009c addr 0x7fb8dd0cd96c stack 0x5606c0 (0x560000-0x561000-0x660000)
007c:err:service:process_send_command service protocol error - failed to read pipe r = 0 count = 0!
002c:err:setupapi:SetupDiInstallDevice Failed to start service L"winebus" for device L"ROOT\\WINE\\WINEBUS", error 1053.
wine: configuration in L"/home/wineuser/.wine" has been updated.
starting L"./notepad++.exe" with Hangover
0024:err:secur32:SECUR32_initSchannelSP TLS library not found, SSL connections will fail
/usr/local/bin/wine: line 4: 152 Killed /usr/local/lib/hangover/build/wine-host/loader/wine "$@"
wineuser@Scotts-MacBook-Pro:~$ 0048:err:virtual:virtual_setup_exception stack overflow 1648 bytes in thread 0048 addr 0x7fabb633a96c stack 0x130990 (0x130000-0x131000-0x230000)
EDIT: I have no issues running the same commands on my normal x86 image (which just downloads package from winehq) and Notepad++ just runs:
Scotts-MacBook-Pro:docker-hangover scottyhardy$ ./docker-wine --rm --volume="$(pwd)/npp.8.1.9.3.portable.zip:/npp/npp.8.1.9.3.portable.zip"
latest: Pulling from scottyhardy/docker-wine
7b1a6ab2e44d: Already exists
4513a6d9f43e: Already exists
12af66b34363: Already exists
672e4c435d24: Already exists
f53991a75f49: Already exists
5cd1b96eeaeb: Pull complete
9f001aaad41c: Pull complete
0bf36b80f85f: Pull complete
27483b5d491e: Pull complete
f2ee6096ff25: Pull complete
52f2bf7f87f6: Pull complete
6d523444a104: Pull complete
32f4bed8d48c: Pull complete
Digest: sha256:51ac5304728b7a62793debbb70380b66f983899cd0bc6e5907030ef3fb78e309
Status: Downloaded newer image for scottyhardy/docker-wine:latest
docker.io/scottyhardy/docker-wine:latest
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
wineuser@Scotts-MacBook-Pro:~$ cp /npp/npp.8.1.9.3.portable.zip .
wineuser@Scotts-MacBook-Pro:~$ unzip ./npp.8.1.9.3.portable.zip
Archive: ./npp.8.1.9.3.portable.zip
creating: autoCompletion/
inflating: autoCompletion/actionscript.xml
...
inflating: userDefineLangs/markdown._preinstalled_DM.udl.xml
wineuser@Scotts-MacBook-Pro:~$ wine ./notepad++.exe
wine: created the configuration directory '/home/wineuser/.wine'
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:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0050:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0050:err:ole:apartment_get_local_server_stream Failed: 0x80004002
0050:err:ole:start_rpcss Failed to open RpcSs service
0064:fixme:file:NtLockFile I/O completion on lock not implemented yet
0064:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0064:err:mscoree:LoadLibraryShim error reading registry key for installroot
0064:err:mscoree:LoadLibraryShim error reading registry key for installroot
0064:err:mscoree:LoadLibraryShim error reading registry key for installroot
0064:err:mscoree:LoadLibraryShim error reading registry key for installroot
006c:fixme:file:NtLockFile I/O completion on lock not implemented yet
006c:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
006c:err:mscoree:LoadLibraryShim error reading registry key for installroot
006c:err:mscoree:LoadLibraryShim error reading registry key for installroot
006c:err:mscoree:LoadLibraryShim error reading registry key for installroot
006c:err:mscoree:LoadLibraryShim error reading registry key for installroot
006c:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 5)
006c:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 5)
0064:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
0064:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
0084:fixme:file:NtLockFile I/O completion on lock not implemented yet
0084:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0084:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
0084:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
00c0:fixme:file:NtLockFile I/O completion on lock not implemented yet
00c0:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
00c0:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
00c0:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
00c8:fixme:iphlpapi:NotifyIpInterfaceChange (family 0, callback 0x102b9460, context 0x2d4ec8, init_notify 0, handle 0x3e9fde0): stub
00b8:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
wine: configuration in L"/home/wineuser/.wine" has been updated.
0024:fixme:win:LockWindowUpdate (00030046), partial stub!
0024:fixme:imm:ImmReleaseContext (00010100, 02BD7650): stub
0024:fixme:win:LockWindowUpdate (00000000), partial stub!
0024:fixme:msg:ChangeWindowMessageFilterEx 00030046 4a 1 00000000
0024:fixme:win:LockWindowUpdate (00030046), partial stub!
0024:fixme:win:LockWindowUpdate (00000000), partial stub!
0024:fixme:uxtheme:BufferedPaintStopAllAnimations Stub (00010308)
0024:fixme:uxtheme:BufferedPaintStopAllAnimations Stub (0001030A)
0024:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFA, 0031FEAC
wineuser@Scotts-MacBook-Pro:~$ exit
I'm guessing the issue relates to the error 00d4:err:secur32:SECUR32_initSchannelSP TLS library not found, SSL connections will fail
. I've seen a similar error when winbind
isn't installed, but that isn't the case here. I've tried installing pretty much every TLS related package I can find but that hasn't resolved my issue.
This could also be related to the fact I'm using an ARM image on an Intel Mac, so there's first Docker's QEMU then Hangover's QEMU being run, but I'm not seeing segment faults like I normally see when problems related to QEMU occur.
Any ideas? Although wine notepad
works, I don't want to merge this into my master branch until I can at least get one of the programs listed to work on your readme to also work for me.
Shall we retest this (with or without hangover) now that M1 has been out longer?
https://gigazine.net/gsc_news/en/20220607-create-macos-linux-virtual-machines/
I think this might help?
Might be worth a try with Ventura or perhaps an M2 Mac when released. Qemu was the main sticking point as far as I can tell though so I'm not gonna hold my breath.
I'm down to retry what we tried before now that about 6 months have passed (from when we last tried in December, 2021)
I'm sure some fixes have been made in Docker on Mac OS X by now. It's 4.9.0
What shall I try? docker pull
what version of your docker-wine
and what exact command line to try to run Notepad++
?
What's the benefit of using hangover
if we can just run wine
amd64 (on arm64 processor) and let Mac OS/Docker handle the virtualization part? Was the intention performance workaround or something?
The intention was three fold:
-
Sometimes there is no host system able to take care of the emulation. Most notably graphics drivers for ARM systems might not have a x86 userspace version plus the ability to talk to their ARM kernel counterpart
-
Some speed gain of pulling code out of emulation, and figuring out how much it matters. Again, graphics drivers and graphics/sound codecs are the big ones
-
We originally approached hangover as x86-windows on arm-windows, where using Wine as the implementation of "arm-windows" was just an accident. This was before Microsoft's x86-on-arm64 emulation was publicly announced. Now in practice we never ran hangover on ARM windows, and for a few reasons it would not work as is.
You might have noticed the lack of activity on hangover in the past year or more. Wine is currently undergoing big restructuring that will make it possible to include a CPU emulator similarly to how it works on Windows. The big goal here is to run 32 bit Windows programs in a 64 bit Linux process, eliminating the need for 32 bit Linux libs, but it will also make x86 or x86_64 on arm64 much easier. It has actually progressed enough to write a "hangover 2" in the form of a xtajit.dll that works in conjunction with wow64.dll like their windows counterparts. That should eliminate the need for all those thunking DLLs since Wine is / will be able to do the thunking itself.
@brandonros here's what we tried and why:
- amd64 image - this relied on using macOS Rosetta2 for emulation of the ARM processor (Docker doesn't do it's own QEMU implementation) which didn't work
- arm64 image - this was able to run natively and could launch Notepad without issue on ARM, but was not capable of running any x86/amd64 apps
- hangover arm64 image - hangover includes its own implementation of QEMU so in theory would allow running amd64 apps but we were getting errors.
I suspect very little has changed with Rosetta 2's QEMU - I think trying out Ventura's implementation or M2 when released would be more prudent but I'd be very surprised if it actually works.
To test each version:
- amd64:
./docker-wine wine notepad
- arm64:
./docker-wine --arm64 wine notepad
- hangover:
./docker-wine --tag=hangover wine notepad
@scottyhardy
do you want to push a fresher arm64?
The arm64 builds have been failing for months and I hadn't bothered fixing it since it has a limited use case. Just try the latest version in the repo for now and I'll take a look at why the builds have been failing later. Right now I'm trying to get box86 and box64 up and running
Just try the latest version in the repo for now
to clarify, try the x86_64 latest tag and let docker do the x86_64 -> arm64 translation?
Not sure if you want to close this, Notepad++ runs fine?