1

My 32-bit application is running under Wine, and to help it better integrate with the environment, it runs some shell scripts. I was just testing under Ubuntu 14.04 64-bit, and my program crashed with this error:

err:process:create_process starting 64-bit process L"Z:\\bin\\sh" not supported in 32-bit wineprefix

I've tried searching for a 32-bit build of "sh" on my system, but couldn't find one. Any creative ideas on how I can get past this issue?

starrify
  • 14,307
  • 5
  • 33
  • 50
Troy
  • 1,237
  • 2
  • 13
  • 27
  • I would just install a 32 bits shell (and some other essential utilities), perhaps an `schroot`-ed minimal distribution (see `debootstrap`) – Basile Starynkevitch Apr 25 '14 at 14:36
  • You're using `winelib` to build a Linux program with emulated Win32 API, or running a Win32 executable in PE format under Wine? The first would be a programming question, the second is more of a power user question about configuring software you didn't develop (Wine). – Ben Voigt Apr 25 '14 at 18:37
  • I'm the developer, but it's not using winelib. The application is aware of when it's on Linux/Mac (via Wine) and utilizes shell scripts to better integrate with the environment. – Troy Apr 25 '14 at 23:01

1 Answers1

2

I am a user of the program in question and I did some experimenting with it.

Not 32-bit vs. 64-bit but "shared object" vs. "executable" ?

Running file /bin/dash it prints:

/bin/dash: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), ...

Running file /bin/bash however prints:

/bin/bash: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), ...

dash is a "shared object" while bash is an "executable". Clearly /bin/dash seems to work like an executable in some way (I don't know the technical details here), but it seems that this difference matters to Wine.

I got the same error as you reported (can't start 64 bit process) for Wine 1.4, but the error I got on newer versions of Wine was wine: Bad EXE format for Z:\bin\sh..

If you actually just replace /bin/sh with /bin/bash (even though that's a 64-bit binary) it will work. Wine also didn't seem to like running a symlink, but copying over /bin/bash worked.

So first back up the existing (symlinked) /bin/sh with:

sudo cp /bin/sh /bin/sh_orig

Then copy bash to sh:

sudo cp /bin/bash /bin/sh

Then when I ran Wine with the program and its calls to /bin/sh work fine.

Alternatively, you download a 32-bit shell directly

Pull down the .deb file for the 32-bit bash shell:

 wget http://us.archive.ubuntu.com/ubuntu/pool/main/b/bash/bash_4.3-6ubuntu1_i386.deb

I your home directory, extract it into a folder:

mkdir ~/bash_4.3-6ubuntu1_i386
dpkg -x bash_4.3-6ubuntu1_i386.deb ~/bash_4.3-6ubuntu1_i386

Copy the bash script into /bin/sh:

sudo mv /bin/sh /bin/sh64original
sudo cp ~/bash_4.3-6ubuntu1_i386/bin/bash /bin/sh
sudo chown root:root /bin/sh

Or run schroot, but still must copy /bin/bash to /bin/sh

Basile Starynkevitch mentioned above about setting up a 32-bit shell in an schroot environment. I did that with an Ubuntu 14.04 32-bit environment and ran into the same issue with the dash vs. bash "shared object" vs. "executable" (but when I copied /bin/bash to /bin/sh it worked), so that helped me realize that the distinction wasn't the 32-bit vs. 64-bit difference but the format of the shell executables that mattered to Wine.

If you would like I can post details for setting up the schroot evnironment but basically I followed the instructions at https://help.ubuntu.com/community/DebootstrapChroot but needed to configure the /etc/apt/sources.list to have the full list of packages (as are installed in my default host system) for apt-get install wine to work.

draffensperger
  • 310
  • 3
  • 7
  • So maybe if my app just called /bin/bash in place of /bin/sh things will "just work" without any intervention on the user. I'll have to explore this idea! I'll report back with what I find! – Troy May 01 '14 at 21:17
  • 1
    I updated my application to call /bin/bash instead of /bin/sh and now it works great on Ubuntu 14.04 64-bit + Wine. (And it still works great on Mac OS X 10.6-10.9 + Wine). Thanks for your help on this! – Troy May 03 '14 at 01:01