reddragdiva: (geek)
divabot ([personal profile] reddragdiva) wrote2019-08-06 09:41 pm

Wine on Windows 10. It works.

Wine is a program to run Windows applications on a Unix PC.

Running Wine on Windows has been a fever dream of those responding to the siren call of "we do what we must, because we shouldn't" since at least 2004, when someone tried compiling Wine in Cygwin and trashed the registry of the host system.

The excuse is "what about ancient applications that don't run properly in recent Windows." But you know the real reason is "I suffered for my art, now it's your turn."

In late 2008, I got a bug in my brain and (I think it was me) started the WineOnWindows page on the Wine wiki. Summary: it was bloody impossible as things stood — going via Cygwin, MinGW or Windows Services for Unix. The current page isn't much more successful.

Windows 10 introduced Windows Subsystem for Linux — and the convenience of Ubuntu downloadable from the Microsoft Store. This makes this dumb idea pretty much Just Work out of the box, apart from having to set your DISPLAY environment variable by hand.

So far, it's mindbogglingly useless. It can only run 64-bit Windows apps, which doesn't even include all the apps that come with Windows 10 itself.

(The original inspiration was someone who couldn't run Encarta 97 on Windows 10. So, like any good geek solution, it doesn't actually solve the user's original problem at all.)

But I want to stress again: this now works trivially. I'm not some sort of mad genius to have done this thing — I only appear to be the first person to admit to it in public.

How to do this dumb thing

1. Your Windows 10 is 64-bit, right? That's the only version that has WSL.

2. Install WSL. Control Panel -> Programs -> Programs and Features -> Turn Windows features on or off — tick "Windows Subsystem for Linux". Restart Windows.

3. Open the Microsoft Store, install Ubuntu. (This is basically what WSL was created to run.) I installed "Ubuntu 18.04 LTS". Open Ubuntu, and you'll see a bash terminal.

4. Install the following from the bash command line:

sudo dpkg --add-architecture i386
sudo apt update; sudo apt upgrade
sudo apt install wine-stable

You can install a more current Wine if you want to faff around considerably. (Don't forget the two new libs that wine-devel >=4.5 needs that aren't in Ubuntu yet!) Let me know if it works.

5. Add to your .bashrc this line:

export DISPLAY=:0.0

You'll probably want to run that in the present bash window as well.

6. Install VcXsrv, which is a nicely packaged version of XOrg compiled for Windows — just grab the latest .exe and run it to install it. Start the X server from the Start button with "XLaunch". It'll take you through defaults — leave most of them as-is. I ticked "Disable access control" just in case. Save your configuration.

6a. If you want to test you have your X server set up properly, install sudo apt install x11-apps and start xeyes for a quick trip back to the '80s-'90s.

7. wine itself doesn't work, because 32-bit binaries don't work in WSL as yet — it gives /usr/bin/wine: 40: exec: /usr/lib/wine/wine: Exec format error on this 64-bit Windows 10. This is apparently fixed in WSL 2.

But in the meantime, let's run Wine notepad!

wine64 /usr/lib/x86_64-linux-gnu/wine/fakedlls/notepad.exe

 

 

TO DO: 32-bit support. This will have to wait for Microsoft to release WSL 2. I wonder if ancient Win16 programs will work then — they should do in Wine, even if they don't in Windows any more.

 

Handling 32-bit with qemu

Thanks to my anonymous commenter below, we have a route to 32-bit:

sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
sudo service binfmt-support start

And now we can do:

fun@DESKTOP-7F6DU8P:~$ wine --version
wine-3.0 (Ubuntu 3.0-1ubuntu1)

Encarta 97 doesn't work, though:

fun@DESKTOP-7F6DU8P:/mnt/e$ wine SETUP.EXE
wine: Unhandled page fault on read access to 0xffffffff at address 0x11df:0x00002c11 (thread 0011), starting debugger...
0011:err:seh:start_debugger Couldn't start debugger ("winedbg --auto 15 108") (2)
Read the Wine Developers Guide on how to set up winedbg or another debugger

I'll leave that bit to someone who knows what they're doing. file says SETUP.EXE: MS-DOS executable, NE for MS Windows 3.x — so we need to get down to casually-clicked 16-bit programs working.

Encarta 97 installs and runs flawlessly in Wine 4.13 on Linux ... 4.13 on Windows 10 still fails:

fun@DESKTOP-7F6DU8P:~$ wine /mnt/e/SETUP.EXE
Xlib: extension "MIT-SHM" missing on display ":0.0".
Xlib: extension "MIT-SHM" missing on display ":0.0".
0009:err:process:__wine_kernel_init boot event wait timed out
001d:err:process:__wine_kernel_init boot event wait timed out
wine: Unhandled page fault on read access to 0xffffffff at address 0x11cf:0x00002c11 (thread 001e), starting debugger...001e:err:seh:start_debugger Couldn't start debugger ("winedbg --auto 28 152") (2)
Read the Wine Developers Guide on how to set up winedbg or another debugger
001d:err:ntdll:RtlpWaitForCriticalSection section 0x7e6273e0 "syslevel.c: Win16Mutex" wait timed out in thread 001d, blocked by 001e, retrying (60 sec)
Xlib: extension "MIT-SHM" missing on display ":0.0".
Could not load wine-gecko. HTML rendering will be disabled.
001e:err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x7b4a6abc
wine client error:1e: write: Bad file descriptor

Of course, it gave different error messages across multiple runs ...

 

oh, this post is popular. While you're here, check out my cryptocurrency/blockchain blog and my book about why Bitcoin and related nonsense sucks. The New York Review of Books and the BBC loved it!

32 bit under WSL-1 (slow, but it works)

(Anonymous) 2019-08-07 10:42 am (UTC)(link)
sorry for the length, but the procedure to use i386 under WSL-1 is the following:

enable i386 architecture
install multilibs
install qemu-user-static

register 32bit elf magic to be executed through qemu-i386-static:
$ sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'

reload binfmt:
$ sudo service binfmt-support start

and it executes i386 elf on WSL as well

we do what we must, because we shouldn't...

(Anonymous) 2019-08-07 07:23 pm (UTC)(link)
I'm getting below the: `sudo apt install qemu-user-static` the following text: [Error: Irreparable invalid markup ('
[Error: Irreparable invalid markup ('<br?>') in entry. Owner must fix manually. Raw contents below.]

I'm getting below the: `sudo apt install qemu-user-static` the following text: [Error: Irreparable invalid markup ('<br?>') in entry. Owner must fix manually. Raw contents below.] (with a bunch of HTML)

steam proton

(Anonymous) 2019-08-07 09:22 pm (UTC)(link)
todo: steam proton on windows via wine on wondows :-)

Running Win16 on modern Windows

(Anonymous) 2019-08-08 12:33 am (UTC)(link)
There is a way to run 16 bit executables on modern Windows 10 systems- use the otya128 fork of winevdm: https://github.com/otya128/winevdm/

If you want to run Encarta 97...

(Anonymous) 2019-08-08 05:47 pm (UTC)(link)
Well... if you really want Encarta 97, why not use Windows 95 inside the browser.

https://win95.ajf.me/

Just saying.

chan

(Anonymous) 2020-05-06 01:52 pm (UTC)(link)
sudo apt install wine-stable

...
Unpacking liblzma5:i386 (5.2.4-1) ...
Setting up gcc-10-base:i386 (10-20200411-0ubuntu1) ...
Setting up libgcc-s1:i386 (10-20200411-0ubuntu1) ...
Setting up libcrypt1:i386 (1:4.4.10-10ubuntu4) ...
Setting up libc6:i386 (2.31-0ubuntu9) ...
sleep: cannot read realtime clock: Invalid argument
dpkg: error processing package libc6:i386 (--configure):
installed libc6:i386 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of libgpg-error0:i386:
libgpg-error0:i386 depends on libc6 (>= 2.28); however:
Package libc6:i386 is not configured yet.

dpkg: error processing package libgpg-error0:i386 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgcrypt20:i386:
libgcrypt20:i386 depends on libc6 (>= 2.28); however:
Package libc6:i386 is not configured yet.
libgcrypt20:i386 depends on libgpg-error0 (>= 1.25); however:
Package libgpg-error0:i386 is not configured yet.

dpkg: error processing package libgcrypt20:i386 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of liblz4-1:i386:
liblz4-1:i386 depends on libc6 (>= 2.4); however:
Package libc6:i386 is not configured yet.

dpkg: error processing package liblz4-1:i386 (--configure):
dependency problems - leaving unconfigured
E: Sub-process /usr/bin/dpkg returned an error code (1)

can't install wine

Hello from the past

(Anonymous) 2021-04-20 04:32 pm (UTC)(link)
I'm that person who wrote that post in 2004 and here I am again. Thank you for this page; it's like a play-by-mail RPG with a twenty year delay. I'm trying to run wine on wsl1 now. Google-bait: wineserver assumes that it can create a unix socket file in /tmp/.wine-1234/socket. It can't do that if you have wsl1 /tmp mapped to C:\tmp, for example (and there are decent reasons for doing that). You'll get this message:

$ cat /etc/redhat-release
> Fedora release 33 (Thirty Three)
$ uname -a
> Linux x 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
$ wine64 cmd.exe
> wine: a wine server seems to be running, but I cannot connect to it.
> You probably need to kill that process (it might be pid 343).
$ echo its not 343 btw

There are not a lot of options for how to fix this. The path is hardcoded in wine. It doesn't examine TMP, TEMP, TMPDIR, or TEMPDIR. You can't just make /tmp/.wine-1234 a symlink; computah sez no. I sedhexed "/usr/bin/wineserver64 /usr/lib64/wine/ntdll.so /usr/bin/wineserver32 /usr/lib/wine/ntdll.so" binaries to convert
"/tmp/.wine-%d" to
"/var/tmp/e-%d"

Does not work

(Anonymous) 2021-05-24 12:39 pm (UTC)(link)
Treid to follow the entire procedure, i have win 10 at rel 1904, i emnabled the subsystem, downloaded ubuntu, but when i run it have this error

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x8007019e
The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again.
See https://aka.ms/wslinstall for details.
Press any key to continue...

and yes i followd all the guides on how to install the subsystem from powershell,. enabled it at least 20 times now and still same issue