Getting RPi-QEMU-x86-wine Too Run winetricks on a Raspberry Pi


Scroll down to see the rest of this webpage.

RPiModelB Desktop

The above picture is the desktop of my early Raspberry Pi (700 MHz processor). As you can see, I've put the OS package RPi-QEMU-x86-wine on it; available from https://github.com/mikerr/RPi-QEMU-x86-wine. There are two icons on the desktop, that if double-clicked will bring up a terminal window that enables you to run Windows programs; e.g., # wine ~/.wine/drive_c/windows/notepad.exe. In the /home/wine-user directory, there is a winetricks script; it doesn't work. ...and this is what I mean by getting RPi-QEMU-x86-wine too work. The non-running winetricks showed up some deficiencies in the package (right out of the box - NOTE: deficiencies as far as running winetricks, and X11 dependent programs in general), and this blog is about how I got winetricks too work.

Winetricks up and running

Modified start_x86env_root Script

   #!/bin/sh

   # Setup qemu-i386
   echo -1 > /proc/sys/fs/binfmt_misc/status
   echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/usr/bin/qemu-i386-static:' > /proc/sys/fs/binfmt_misc/register
   
   # DMK 12202018 - Start of code to enable execution of winetricks script
      cd chroot-wheezy-i386
      mount -t sysfs /sys sys
      mount -t proc /proc proc
      mount --bind /dev dev
      mount --bind /dev/pts dev/pts
      mount --bind /dev/shm dev/shm
      xhost +
      export DISPLAY=:0.0
   # DMK 12202018 - end of code to enable execution of winetricks script

   # Start chroot
   /usr/sbin/chroot /home/pi/chroot-wheezy-i386/ /bin/su -l root
   

The above code is now what executes when you double-click on the desktop icon that looks like a paper plane, and has the the label start_x86env_root, or source it from /home/wine-user (which is what I do). There were still two things that were required before enabling the above modifications (demarcated with # DMK); (1) installing zenity, and (2) installing X11 (GUI library). When I first tried running winetricks, I got an error message that said no protocol was provided, and that zenity was required. I took a look at the script source, and winetricks could be run from the command line (without graphics), but needed zenity installed too provide a dialogue box (kdialog for KDE users). apt-get install zenity. Now I got to an error that said winetricks was unable to open display :0.0

Fortunately for me, I knew why I was getting an error about unable to open display :0.0 I had already tried installing an x86 environment on my "new" Raspberry Pi ( it's a Pi 3 Model B); that worked, but all I did was follow the advice given by Mitchell Gosse on the webpage How to run x86 programs on the Raspberry Pi I also tried installing wine on my emulated x86 environment, but got an error message saying that I needed to add Xlib (at least) so I could open up the :0.0 display. Too install the X11 libraries, you enter apt-get install xorg. Note: I didn't need to prefix the install zenity and install xorg commands with a sudo, because in the x86 environment, you're already root. I.e., you enter these two install commands while in the qemu x86 environment.

Now when I tried to run winetricks, it told me it was still unable to open up the :0.0 display I fixed this problem in the start_x86env_root script (this is a good time to mention that I su to root before running the script) by adding the line xhost + (it disables authentication for running xtart - or directly through X) and then export DISPLAY=:0.0. However, when I ran winetricks again, it complained about some files in the /tmp directory should only be accessible to the current user. I had already run chown -R root / and chmod -R 777 / for the entire chroot-wheezy-i386 directory, because I was getting permission issues early on (even though I was already running as root). I went ahead and deleted everything in the /tmp directory, so winetricks could create it's own files there.

Almost there. When I tried running winetricks again, I got a warning that it was unable to write to a log file, and asked if /dev/pts was mounted. That advice (and list of instructions) I read by Mitchell Gosse included mount --bind /dev/pts dev/pts. As you can see in my modified listing of start_x86env_root, I added the aforementioned mount statement to the script. The other mounts are for shared memory, virtual file system, and kernel access. Putting everything together (you can see them in my winetricks script, and know that I also installed zenity and xorg) I was then able to start up wine; see the image above.

RPiModelB Desktop
RPiModelB Desktop
RPiModelB Desktop
RPiModelB Desktop
RPiModelB Desktop
RPiModelB Desktop
RPiModelB Desktop