Random HOW-TOs
Make your old .exe files work in Linux
(1)
Install WINE. You should afterwards have an executable named "
wine-stable" in your
/usr/bin/ (or
/usr/local/bin/) directory. There should also be an executable symbolic link in there named "
wine".
Mine is
/usr/bin/wine, which is what I will use in the next steps.
You should, at this point, be able to open the terminal and run any Windows executable by typing "wine myprog.exe. As yet, you might not be able to simply click on it in the file explorer.
(2)
Make sure the
binfmt_misc package is installed. For Linux Mint it gets installed as part of the "binfmt" package, and should be already installed by the OS. Just check that it is there.
(3)
Set up a
root account. Linux Mint does not do this by default, but
sudo won't work for the next steps. Online people recommend you use the same password for your user account and the root, just so you never forget it. While this is a security concern, on a home PC it doesn't really matter -- your user account is in the Admin ring anyway.
(4)
Open a terminal and make sure that the binfmt stuff is mounted:
$ sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc/
mount: /proc/sys/fs/binfmt_misc: none already mounted or mount point busy.
$ _
|
In my case it was already mounted, so I got the weird message. All is good.
(5)
Switch to root using the "
su" command. Type in your root password (it will not show up as you type). Your new terminal prompt string will now end in a
#
(instead of a
$
).
$ su
Password:
root@...# _
|
(6)
Add the magic powers using the following line. (Adjust as necessary for the location of your
wine executable.)
# echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
# _
|
You can read more about how to do this here:
https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/binfmt-misc.rst
(7)
Get out of root!
(8)
You can verify that DOSWin powers were added to binfmt by listing the contents of the directory:
$ ls /proc/sys/fs/binfmt_misc/
DOSWin jar llvm-14-runtime.binfmt python3.10 register status
$ _
|
If you have a Windows executable laying around, you can also make it work too! I conveniently have one named "
hello.exe".
First we need to add execute permissions, then we can run it as we would any other binary.
$ chmod +x hello.exe
$ ./hello.exe
Hello world!
$
|
(9)
Alas, your file explorer may not have picked up the executable powers properly. For
nemo, I had to go to the file, right-click, and add "wine" to the
what to do with this file type list and select
make it do that for every file of this type.
(Be aware that a terminal program needs extra help, so nemo ran it, but I never saw any output. Test with your GUI Windows executables.)
(10) !!!
Sorry, left this step out the first time. We need to make the change PERSISTENT. (So that the next time you turn off and restart your PC it still works!)
Add a file to
/usr/lib/binfmt.d/ containing the string you echoed. For the Windows executable I added a file named
/usr/lib/binfmt.d/doswin.exe.conf
(the actual name doesn't matter, so long as it doesn't clash and it must end in "
.conf"). The contents of the file are the same string as before:
|
:DOSWin:M::MZ::/usr/bin/wine:
|
It is OK (and expected!) that the file terminate in a newline.
You will need superuser powers for this -- the file must belong to
root.
That's it!
LOL, seems like more than it was...