Running x86 software on the Pi

Hi everyone, Trent suggested that I should put my question up here in order to help find a solution.

The general gist is that I’m trying to run this UPS software (Software download for Uninterruptible Power Supply) on a raspberry pi so that I can reboot the ups without having physical access to it.

What I’ve tried so far:

  • tried to install Ubuntu 16 32bit on the Raspberry Pi 3 but that didn’t work

  • I thought the problem was the compatibility of the OS with the software so I decided to buy the Pi 4 (so I had a 64 bit system and also Ubuntu 20 is officially supported). After doing so I realised that the software is built for x86 platforms and the Pi runs on the ARM architecture

  • So then I tried to use the Box86 emulator but you need to run that on a 32 bit system

  • As a last ditch attempt, I also tried using Raspbian OS, but that didn’t work either

And this is currently where I am stuck

4 Likes

Hi Sentegrate,

Welcome to the forum!!

Unfortunately this is the gotcha, the Pi isnt able to execute the same functions as an x86 processor (those functions are likely there but implemented differently), without the project being open source I dont think there is much of a chance of getting it up and running on a Pi.

There are some x86 single board computers around but they are a bit pricier than the Pi and some are harder to come by due to the silicon shortage - an alternative to grabbing more new parts might be to check out some second hand electronics stores to see if there are any old desktop PC’s or older tech!

Liam.

3 Likes

First off I’d suggest you could get in touch with the supplier and see if they can make an ARM build.

Secondly… well I got curious and downloaded the x64 version, unpacking and looking inside I found this:
installViewPowerHTML_Linux_text_x86_64.tar.gz\installViewPowerHTML_Linux_text_x86.tar\installViewPowerHTML_Linux_text_x86.bin\vm.tar\jre\

That’s the java runtime, so it looks like it’s all a java thing. There’s a java runtime available for arm/raspberry pi, so it might be possible. As @Liam says compiled executables have different processor instructions so they won’t work, but Java is different. Java applications are compiled to a bytecode, the bytecode is executed by the Java Runtime Environment (JRE) and so should be cross platform. You just need a compatible jre, and there are ones for the Pi.

Going deeper…
I then installed the x64 commandline version in Ubuntu (windows subsystem for linux) and had a look at what it did. Here are the main new things off root

/ViewPower/tomcat/webapps/ViewPower/WEB-INF/classes/cn/com/voltronicpower
        /web/action/BaseAction.class
        /servlet/*.class
/tomcat/webapps/ViewPower/WEB-INF/classes/cn/com/voltronicpower
        /webservice/*.class
        /web/service/*.class
        /web/action/*.class
/home/doug/ViewPower // heaps of files under this, it's the main install folder
                     // I chose this during the install

In the main install folder there’s a bunch of shell scripts, and it seems to contfirm that it’s all java based.

What all that means is that you might be able to install the arm java run time and copy all those files over, setup the services. There’s also a jre folder in the main install folder and those files are (almost certainly) platform specific, but you coudl replace that with the arm jre.

I’d be surprised if someone hasn’t written a guide to running java apps created for x86/x64 on the raspberry pi, but I haven’t looked. If you get no response form the supplier then you could give it a try.

One big caviet: I’m no expert in linux or Java (I dabble with RPi and linux, but I’m mostly a dotnet guy), but it’s probably worth a try. The worst that could happen is you need to rebuild your pi. It really depends on how much time you want to invest.

6 Likes

Thanks for the reply Doug.

I tried it out with the ARM installation of JRE and it seemed to unpack without any issues. I then replaced the folders within the JRE directory with the new ARM install but no luck. My guess is that the software is using some platform specific libraries that are not executable on ARM and replacing the folder gets rid of these libraries.

I’m down to give it another shot if you’ve got any more suggestions? And yeah I’m going to ask the supplier to recompile the source code if they can.

3 Likes

Thanks for the input Liam.

Yeah I’ve had a look at the x86 boards out there. The one that stood out to me was the ROCK Pi X, which should work. I just wanted to give the Pi another shot before I threw in the towel.

2 Likes

Actually just curious, @Liam @Doug27394, do you guys know if using Docker here would work?

1 Like

I really don’t think it would. All the container does it provide a separation from the main OS, it’d have the same issues with the processor.

1 Like

What were the errors? Did it acctaull start then crash? Or was it some kind of start-up script error. The executables the script references may have been an issue, or perhaps there were some missing libraries

2 Likes

I don’t have them documented currently, I’ll get back to you with specifics on that. But if I recall correctly, I ran the script as per the manual (http://www.power-software-download.com/viewpower/ViewPowerHTML5_user_manual.pdf), I think it ran and then nothing ese happened? I’m suspecting that there’s some processes it’s trying to start but is unable to because of the unexpected architecture.

Did you try turning the software on? If so what was the behaviour/ did it work?