Installing Wine i386 on Pinebook Pro
#1
I've mostly followed the Novaspirit's tutorial from:
https://www.novaspirit.com/2019/04/15/run-x86-arm/

First, I've built and run vmsplit checking code from wine (from https://gist.github.com/liuqi/ccf638adc675a3b00c98):
Code:
#include <sys/mman.h>
#include <stdio.h>
#include <errno.h>

static void check_vmsplit( void *stack )
{
   printf("user space is %x\n", stack);
   if (stack < (void *)0x80000000)
   {
       /* if the stack is below 0x80000000, assume we can safely try a munmap there */
       if (munmap( (void *)0x80000000, 1 ) == -1 && errno == EINVAL)
           fprintf( stderr,
                    "Warning: memory above 0x80000000 doesn't seem to be accessible.\n"
                    "Wine requires a 3G/1G user/kernel memory split to work properly.\n" );
   }
}

int main()
{
   int temp;

   check_vmsplit( &temp );

}
I assume, if above code doesn't print warning, everything is OK and I don't need to rebuild kernel.

Then we need to install prerequisites:
Quote:sudo apt update && sudo apt upgrade

sudo apt install qemu qemu-user qemu-user-static binfmt-support debootstrap binutils
After successful install, run:
Quote:sudo debootstrap --foreign --arch i386 stretch ./chroot-stretch-i386 http://ftp.us.debian.org/debian
Then prepare system to run chroot:
Quote:sudo mount -t sysfs sys ./chroot-stretch-i386/sys/
sudo mount -t proc proc ./chroot-stretch-i386/proc/
sudo mount --bind /dev ./chroot-stretch-i386/dev/
sudo mount --bind /dev/pts ./chroot-stretch-i386/dev/pts/
sudo mount --bind /dev/shm ./chroot-stretch-i386/dev/shm/

With system qemu-i386-static there may be 'illegal instruction' errors, so we'll build qemu from source. I've followed instructions from
http://logan.tw/posts/2018/02/18/build-q...urce-code/

Quote:sudo apt-get build-dep qemu
$ git clone git://git.qemu.org/qemu.git
$ cd qemu
$ git submodule update --init --recursive
$ ./configure --prefix=$(cd ..; pwd)/qemu-user-static --static --disable-system --enable-linux-user --target-list=i386-linux-user --disable-tools
make -j6
make install
cd ../qemu-user-static/bin
mv qemu-i386 qemu-i386-static
sudo mv qemu-i386-static ./chroot-stretch-i386/usr/bin
Without --disable-tools there were linker errors, --target-list=i386-linux-user will build only qemu-i386 binary.

And start second stage:
Quote:sudo chroot ./chroot-stretch-i386/ /debootstrap/debootstrap --second-stage
On my Pinebook Pro it took 28 minutes 30 seconds to finish second stage.

Next, we'll chroot as root user:
Quote:sudo chroot ~/chroot-stretch-i386/ /bin/su -l root
If your DNS isn't working inside chroot check /etc/resolv.conf and fix your name server address!
Quote:nano .bashrc

Then we need to add this:
Code:
export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:0
to the end of .bashrc file and run:
Quote:source ~/.bashrc
so change will to effect.
Then run:
Quote:apt update
And create user account:
Quote:adduser -uid 1000 <username>
where <username> is your chosen username.
Then install leafpad or xterm to install all needed dependencies.
Quote:apt install leafpad
Then open second terminal window and enter:
Quote:sudo chroot /home/marek/chroot-stretch-i386/ /bin/su -l <username>
to chroot as your newly created user.
Quote:nano .bashrc
Add at the end:
Code:
export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:0
and run:
Quote:source ~/.bashrc
and then run leafpad (or xterm):
Quote:leafpad

Now we are ready to install Wine.

Switch focus to your root terminal window or run:
Quote:sudo chroot ~/chroot-stretch-i386/ /bin/su -l root

To make things easier first install apt-transport-https package:
Quote:apt install apt-transport-https
It will install all dependencies for SSL certificates to work (and we might need apt-transport-https it in the future).
Download Wine from Playonlinux with:
Quote:wget -c https://www.playonlinux.com/wine/binarie...ux-x86.pol
I've chosen version 3.20, but you can choose a different version (and maybe have better luck with running Windows programs).
Then install bzip2:
Quote:apt install bzip2
and then unpack previously downloaded Wine and "install' it:
Quote:tar -jxf PlayOnLinux-wine-3.20-linux-x86.pol --strip-components=1
mv ./3.20/bin/wine-preloader ./3.20/bin/wine-preloader.renamed
mv ./3.20 /opt/wine-3.20/
cd /opt
ln -s wine-3.20 wine
cd
Symbolic link will help with switching wine versions in the future.
Then open .bashrc:
Quote:nano .bashrc
and add this:
Quote:export PATH=/opt/wine/bin:$PATH
at the end and run:
Quote:source ~/.bashrc
to refresh session then do the same line to the .bashrc file of your new i386 user account.
Run:
Quote:sudo chroot ~/chroot-stretch-i386/ /bin/su -l <username>
Then open .bashrc:
Quote:nano .bashrc
and add this:
Quote:export PATH=/opt/wine/bin:$PATH
at the end and run:
Quote:source ~/.bashrc
to refresh session.
Now you need to check, if Wine is working, run:
Quote:winecfg
The window should appear and it will download gecko and stuff, finally Wine config window should appear.

Novaspirit has prepared winetricks but I haven't tried them, yet.
https://github.com/novaspirit/winetricks

Let's finish the installation.
Outside of chroot we'll create script to mount /sys, /proc and the rest at start.
Quote:sudo mkdir -p /opt/chrootscript/
sudo nano /opt/chrootscript/chrootmount
Paste this:
Code:
#!/bin/sh
mount -t sysfs sys /opt/chroot-stretch-i386/sys/
mount -t proc proc /opt/chroot-stretch-i386/proc/
mount --bind /dev /opt/chroot-stretch-i386/dev/
mount --bind /dev/pts /opt/chroot-stretch-i386/dev/pts/
mount --bind /dev/shm /opt/chroot-stretch-i386/dev/shm/
As you can see I've moved chroot-stretch-i386 to /opt but I've forgot to umount previously mounted sys, proc and the rest, which wasn't probably a good idea  Shy

Next, make above script executable:
Quote:sudo chmod a+x /opt/chrootscript/chrootmount
Then create service file:
Quote:sudo nano /etc/systemd/system/chrootmount.service
paste this:
Code:
[Unit]
Description = mounts chroot on boot

[Service]
Type=one-shot
ExecStart=/opt/chrootscript/chrootmount

[Install]
WantedBy=multi-user.target
Then enable service:
Quote:sudo systemctl enable chrootmount.service
Then we will make scripts to make chrooting easier:
Quote:sudo nano /opt/chrootscript/start_x86_user
And paste:
Code:
#!/bin/sh
/usr/sbin/chroot /opt/chroot-stretch-i386/ /bin/su -l <username>
Make it executable:
Quote:sudo chmod a+x /opt/chrootscript/start_x86_user
Repeat this process for root:
Quote:sudo nano /opt/chrootscript/start_x86_root
Code:
#!/bin/sh
/usr/sbin/chroot /opt/chroot-stretch-i386/ /bin/su -l root
Quote:sudo chmod a+x /opt/chrootscript/start_x86_root

At last create desktop shortcuts:
Quote:nano ~/Desktop/chroot_user.desktop
Code:
[Desktop Entry]
Type=Application
Comment=Start Wine x86 Environment
Name=Wine x86 User
Exec=mate-terminal -e 'sudo /opt/chrootscript/start_x86_user'
Icon=utilities-terminal
Terminal=false
Categories=Utility
StartupNotify=True
Quote:nano ~/Desktop/chroot_root.desktop
Code:
[Desktop Entry]
Type=Application
Comment=Start Wine x86 Environment
Name=Wine x86 Root
Exec=mate-terminal -e 'sudo /opt/chrootscript/start_x86_root'
Icon=gksu-root-terminal
Terminal=false
Categories=Utility
StartupNotify=True
And make them executable:
Quote:chmod a+x ~/Desktop/chroot_user.desktop
chmod a+x ~/Desktop/chroot_root.desktop
Restart Pinebook Pro. After restart check status of our mounting service:
Quote:sudo systemctl status chrootmount.service
If there are no error, you can double click on one of Wine x86 shortcuts to open terminal.

Unfortunately, I was only able to run installers but installed programs (like Notepad++ or Treesheets) crashed but I haven't used Wine for years, so maybe recent Notepad++ or Treesheets are not good starting points. Don't look at me, I didn't touch it, I swear Angel
Maybe different Wine version would do the trick.

Good luck, and good night.

EDIT: One of the problems was broken qemu-i386-static (there was qemu's 'illegal instruction' error at one of last lines of messages when putty crashed), so I've added instructions to build qemu. I've also changed icons of desktop shortcuts.
Now putty works and I was able to install Notepad++ 6.7.4, but it crashed anyway with wine client bad descriptor error.


Messages In This Thread
Installing Wine i386 on Pinebook Pro - by wrzomar - 01-31-2020, 03:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinebook Pro Recovery with Void Linux (xbps) bds 4 1,353 09-13-2024, 07:01 PM
Last Post: bds
  Write SD cards with Etcher for Pinebook Pro futurejones 17 33,109 03-19-2021, 12:52 AM
Last Post: Alex007
  [GUIDE] ArchLinuxARM on Pinebook Pro hku2 10 21,430 12-25-2020, 05:44 AM
Last Post: boteium
  Program SPI NOR Flash on Pinebook Pro with u-boot on micro SD Card hmuller 0 3,754 09-21-2020, 10:02 AM
Last Post: hmuller
  Installing Ubuntu 20.04 (Focal) with BSP uBoot with deep sleep and sound Syonyk 43 60,209 07-28-2020, 03:18 PM
Last Post: SamWilts
  Installing WPS Office on Manjaro brent.thierens 5 10,745 07-13-2020, 03:13 AM
Last Post: brent.thierens
  Instructions for Installing VS Code on Manjaro clover 6 15,643 06-04-2020, 09:37 PM
Last Post: pfeerick
  Installing Docker on Pinebook Pro - update 1/18/20 SuperXkoodA 4 8,421 03-24-2020, 03:19 PM
Last Post: chaoskampf
  Swaywm on Pinebook Pro anjanmomi 10 15,535 02-06-2020, 11:47 AM
Last Post: xmixahlx
  Quick Guide to installing Ubuntu Unity on your Pinebook Pro andybleaden@gmail.com 19 26,421 02-03-2020, 11:17 AM
Last Post: MIchael

Forum Jump:


Users browsing this thread: 1 Guest(s)