Running ursim in Windows SubSystem for Linux

After some trial and error I figured out how to get ursim to run on Windows 10. I thought I would share the instructions I typed up in case it helps someone else out in the future. I have only tested this on one machine so far so your mileage may vary…

Install the Windows Subsystem for Linux

In my case I had to manually install the Ubuntu 16.04 distro because the windows store was not working on my pc which appears to be a common issue. I originally tried using Ubuntu 18 but it failed. Just for clarity, I determined which Ubuntu version to use by downloading the entire starter package, running the virtual machine in VMWare player and at the bash prompt I used the command:

‘lsb_release -a’

I discovered that the VM image was using Ubuntu 16.04. I have a hunch that the URControl binary file was compiled using the gcc version common for the 16.04 release. Therefore, to make things compatible you will also want to use 16.04. However, in the future when the URSim is updated, you may have be required to upgrade to a newer version. You can always check which version to use by running the command above. Hopefully by that time someone at universal robots will read my crazy instructions and officially support running ursim on windows. :smiley:

To manually install, I downloaded the appx file for 16.04, rename the file extension to zip. Extract it to a temp folder using 7-Zip or another tool of your choice. Then open and administrative command prompt and run ubuntu.exe. It will take a few minutes to install.

To make things easy, during the install you should assign the default username to “ur” and use the password “easybot”. This will create your home directory so it matches the folder structure in the VMWare image provided by UR. If you choose a different username then you can still use the linux adduser command to create the “ur” user. However, when you compile with maven or run the simulator you will probably want to use the “su ur” command to login to the “ur” account.

Install Xming Server for Windows

After install finished run the program, it will run minimized in your system tray

Upgrade Ubuntu packages

Open a command prompt, then type bash. You should now be running your Ubuntu distro. Now enter the following commands to apply the updates to your Ubuntu install. This will probably take a few minutes because there are a lot of packages to update.

sudo apt update
sudo apt upgrade

Manually Install Required Packages

Download URSim 5.2: URSim. Using 7-zip or another extraction tool of your choice, decompress the files into the /home/ur/ursim directory. Using your bash prompt run the install.sh using the following command.
./install.sh

In my case, the install script returned a few errors and ultimately failed, but not before it installed quite a few dependencies such as java. To finish the install process you will now need to run these additional commands:

sudo apt install lib32gcc1 lib32stdc++6 libc6-i386
sudo apt install libcurl3 libjava3d-* ttf-dejavu* fonts-ipafont fonts-baekmuk fonts-nanum fonts-arphic-uming fonts-arphic-ukai
cd ursim-dependencies
sudo dpkg -i curl-dev-ur_7.18.2-1_amd64.deb
sudo dpkg -i libxmlrpc-c-ur_1.33.14_amd64.deb
sudo dpkg -i libxmlrpc-c-dev-ur_1.33.14_amd64.deb

Install QEMU BinFormat Support

The URControl binary executable does not run by default in WSL. In order to make it work you have to install QEMU Binary Format Support. Thankfully someone else figured this out because I never would have found this one on my own:

https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520

sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'

You will need to reactivate binfmt support every time you start WSL. To simplify this process, I created a .bashrc file in the ur home directory so this happens automatically everytime I login. I also export the DISPLAY variable so my screen is pushed to the Xming window.

sudo service binfmt-support start
export DISPLAY=:0

To start the simulator, navigate to the ~/ursim folder and run the command
./start-ursim

If all goes well, the Xming window should appear.

URCap Development

I use Visual Studio Code with the Maven for Java extension to develop the UR Caps.

If you open a terminal in VS Code, you can access the command prompt and type “bash” to enter your Ubuntu shell. I installed maven 3 using “sudo apt install maven” and I copied the .m2 folder in the UR home directory from the Starter kit. The .m2 folder contains the jar files required for the UR api.

You will need a copy of the sdk folder from the VMWare image in the ur home directory. Run the install.sh script from this folder.

To compile your code use the bash prompt in the terminal window and type “mvn install -P ursim”. To run the simulator type “~/ursim/ursim-5.2.0.61336/start-ursim.sh”.

18 Likes

@michael_ceranski

Thank you for a great write-up of your steps taken, to achieve this.

Perhaps some of the steps listed here, can resolve your “Manually Install Required Packages” steps in a better way?
How to install URSim for URCaps Development

As an alternative, it would also be possible to use WSL to only build and deploy the URCap from Windows, deploying to a URSim in a VM (using the ursimvm deployment method). In this way, you could use your favorite IDE directly in Windows, but execute URSim in virtual Linux.

1 Like

I added some instructions on how I use Visual Studio Code to do URCap development and compilation. At this point, I have completely eliminated the need for VMWare Player on my computer.

For me personally, I have a much better user experience running everything on windows 10 and I use less overhead on my workstation by running things without the overhead of the complete Linux operating system. I feel more productive this way and I hope this post will help others!

3 Likes

Thank you Michael!

Visual Studio Code (VS Code) has been a huge time and resource saver for me. No more running a resource hog virtual machine. Awesome!

Some issues I ran into…

pom.xml file changes needed due to differnece in PC and Linux.

  • Specifically installing PuTTY and using “pscp” commands with “-Premote” to send the URCap to the robot.
  • “copy-rename-maven-plugin” to rename output .jar to “.urcap”

There is even a URScrip extension available: URScript

I was not able to get the simulator fully working but its less useful for me without actual hardware interaction. I don’t believe you can even remote debug with breakpoints with the simulator (or robot) anyway? Not very useful. However, I can run my Daemon either in VS code OR the robot. VS code allows full debugging of it.

Good stuff :slight_smile:

1 Like

This was spot on.

For me I found Xming was causing some sort of issue that led to URSim crashing so I used VcXSrv instead and has been much more stable so far.

I’ve also managed to link IntellilJ to it by altering the pom.xml so that the URCAP builds straight into the WSL based URSIM.
I made a new profile just for ease of use

Apoliges - a few <>'s missing from the xml below as the post is removing them but hopefully you can get the jist.

executable>pscp</executable
commandlineArgs>
-pw ${ursimvm.install.password} -P ${ursimvm.install.host.port} target\${project.build.finalName}.jar ${ursimvm.install.username}@${ursimvm.install.host}:${WSLursim.home}/.urcaps/${urcap.symbolicname}.jar
</commandlineArgs

Due to some permission issues I found the best way to get this to work was to setup ssh on WSL and alter the setup to run on port 2200 instead of 22. This means you can ssh into the WSL via 2200 and the localhost ip (127.0.0.1)
Used commands here
https://www.illuminiastudios.com/dev-diaries/ssh-on-windows-subsystem-for-linux/

This is a really nice setup - if only there was a way to hook in a debugger as well!!

Massive thanks to Micheal the OP. I’m really happy with this setup.

3 Likes

@michael_ceranski
Hi Michael, I have a weird error during installation:

./install.sh
Checking java version
/usr/bin/java
version 11.0.7
java version accepted
Error getting authority: Error initializing authority: Could not connect: No such file or directory

any idea on how to avoid this or have you also had this error?
Thanks!
Selen

This is the error that Micheal mentions in the original post.

At this point you should have already managed to install Java and a few other dependencies.
Run the other commands listed in the Original Post should get you to a stage where ursim will run.

Has anyone managed to get a daemon running on this setup.

I’ve been trying but with no luck so far.

Thank you Michael and everyone for posting a comprehensive guide. I’d just like to add my experience with the latest version UR Software version (URSim_Linux-5.8.2.10297.tar.gz), Ubuntu 20.04 LTS, VcXsrv (1.20.8.1), and wsl 2.

N.B. If you follow Michael’s instructions, I found that in WSL 2 20.04 LTS from Microsft Store (MS Kernel) apt would not resolve libjava3d-* However `apt-get’ would.
The manual steps for installing the required packages were necessary due to the use of pkexec in the install script where the test for a 32 bit system / 64 bit system is coded. AFAIK it does work when running a VM (vmplayer.exe and 20.04 LTS) didn’t need pkexec removing from install.sh

Running URSoftware 5.8.2 with WSL 2 on Ubuntu 20.04 LTS

I have Windows 10 Pro (20H2) with WSL updated to WSL 2. I have tried to do the minimum to the system in order to run URSim.
After configuring WSL 2, following this document:

h t t p s://docs.microsoft.com/en-us/windows/wsl/install-win10 (2 link limit for noobs)

I installed Ubuntu 20.04 LTS from the Microsoft Store. I also installed Windows Terminal for convenience. Once installed and configured I updated and upgraded with sudo apt update, sudo apt upgrade.

Changes to Ubuntu install

Modify .bashrc

append the following to the end of your ~/.bashrc (https://github.com/microsoft/WSL/issues/4106)

export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 export LIBGL_ALWAYS_INDIRECT=0

N.B. Test LBGL_ALWAYS_INDIRECT=1 and X server config to find which works (best) for you. In VcXsrv Launch I have this config (note display set to 0, multiple windows and start no client) :
image

Add extra x11 packages

I installed the following:

sudo apt install x11-apps mesa-utils

The former was to get all the x11 related stuff and in particular xeyes to test that the X server was working, and the latter to get glxgears to check my framerate with openGL.

Download tar.gz file, extract to home and modify install.sh

Following information from Scazlab’s guide (UR5e Setup Guide – ScazLab), I changed the default-jre install to openjdk-8-jre and libcurl3 to libcurl4. I also added the package lib32z1 (just in case). I also removed reference to pkexec and modified the bash strings to use sudo. These are the main changes I made to install.sh:

echo "installing limb32z1"
sudo apt-get -y install lib32z1

# sudo apt-get -y install default-jre
sudo apt-get -y install openjdk-8-jre

# pkexec bash -c "apt-get -y install lib32gcc1 lib32stdc++6 libc6-i386 $commonDependencies && (echo '$packages' | xargs dpkg -i --force-overwrite)" 88 bash -c "sudo apt-get -y install lib32gcc1 lib32stdc++6 libc6-i386 $commonDependencies && (echo '$packages' | xargs sudo dpkg -i --force-overwrite)"

Note the install script still fails when it tries to create the desktop icons but that’s okay.

Issues

Software runs UR5e from start-ursim.sh and seems to work okay with motion and installation (haven’t checked program yet) however I have some warnings and errors:

`/tmp/9fc07c93-6b83-4a7d-96e8-32ebf5412c47.sh: line 1: /sbin/net-statistics: No such file or directory
13:25:49.103 WARN - Could not understand the output from ‘net-statistics’ in ‘/sbin’ {thread: AWT-EventQueue-0 , loggerClass: com.ur.polyscope.system.impl.network.internal.ExternalControllerAdministrator}
13:25:49.103 WARN - Skipping entry: {thread: AWT-EventQueue-0 , loggerClass: com.ur.polyscope.system.impl.network.internal.ExternalControllerAdministrator}
13:55:32.778 ERROR - RobotState messages are queued up: 3 {thread: RobotState - PostMan , loggerClass: com.ur.monitor.RobotState$PostMan}
13:55:42.051 ERROR - RobotState messages are queued up: 3 {thread: RobotState - PostMan , loggerClass: com.ur.monitor.RobotState$PostMan}

Can these be ignored or are there any further packages I should install. (I would normally install the meta-package build-essential but haven’t so far)

Thanks, :slight_smile:

1 Like

Hi All - I come back to this thread as I know you guys are as I am using WSL for their URSIM setup.

Has anyone had issues with return values on script commands? Specifically I have been using socket commands.

I’m concerned it may be related to the WSL setup - I was wondering if you may have seen the same behavior.

Simplest example is when checking the return value of socket_open.

Would this allow you to access polyscope with the same ip as my pc network? I have someone looking to access ursim with an AB plc but they don’t have access to their network adapters to change their ip to match the vm. looking for a workaround.

If anyone has an update on this and how to install it on windows 11 wsl version (‘wslg’) that would be great as I’m having trouble.

You might want to look at Docker Desktop and the Docker containerized version of URSim at DockerHub.

I got that running on Windows (with the WSL backend for Docker). I think the command in the DockerHub instructions that forwards ports 5900 and 6080 is enough to get the basics up and running:

docker run --rm -it -p 5900:5900 -p 6080:6080 universalrobots/ursim_e-series

This works from either a Windows command prompt or a WSL prompt, but I need to run the command on the side of the Windows/WSL fence where I want to communicate with the Docker container.

If I want to view the UI on a browser on Windows, I need to run it in a Windows command prompt. If I run it in Linux I can bring up a Firefox browser using WSLg and view it there. I think there’s an extra step to forward ports between WSL and Windows, and I haven’t figured that out.

I mounted persistent storage to store programs and installation data and install URCaps according to how this script does it

The script itself sets up a ursim_net network and assigns an IP address other than the localhost IP to the container, and that never worked for me on Windows/WSL. Only more explicit port mapping commands at the command line.

I ended up with something like this if I want to work with URSim from Windows:

c:\Code>docker run --rm -it --detach -p 5900:5900 -p 6080:6080 -p 29999:29999 -p 30001-30004:30001-30004 -p 50001-50002:50001-50002 --volume "C:\Users\<username>\.ursim\e-series\urcaps":/urcaps --volume "C:\Users\<username>\.ursim\e-series\programs":/ursim/programs --env ROBOT_MODEL="ur5e" --name ursim universalrobots/ursim_e-series

For Linux the storage paths just need to be changed as appropriate.

I’d love to know how to get the networking working properly in both WSL and Windows. It’s the same Docker container on both sides:

From a Windows command prompt

c:\Code>docker container ls
CONTAINER ID   IMAGE                            COMMAND            CREATED         STATUS         PORTS

                  NAMES
5727fd18d155   universalrobots/ursim_e-series   "/entrypoint.sh"   7 minutes ago   Up 7 minutes   0.0.0.0:5900->5900/tcp, 0.0.0.0:6080->6080/tcp, 0.0.0.0:29999->29999/tcp, 0.0.0.0:30001-30004->30001-30004/tcp, 502/tcp, 0.0.0.0:50001-50002->50001-50002/tcp   ursim

From a WSL prompt

<username>@<computername>:~$ docker container ls
CONTAINER ID   IMAGE                            COMMAND            CREATED         STATUS         PORTS                                                                                                                                                           NAMES
5727fd18d155   universalrobots/ursim_e-series   "/entrypoint.sh"   8 minutes ago   Up 8 minutes   0.0.0.0:5900->5900/tcp, 0.0.0.0:6080->6080/tcp, 0.0.0.0:29999->29999/tcp, 0.0.0.0:30001-30004->30001-30004/tcp, 502/tcp, 0.0.0.0:50001-50002->50001-50002/tcp   ursim

I gave up on trying to get networking to the container working in both Windows and WSL. My use case was using URSim with the UR ROS2 driver, and in the end that really only seems to work if URSim and the driver are running on the same native Linux machine. I’m still using the Docker version there, though.

Ubuntu 16 is no longer available on Microsoft Store.
Has anybody tried installing it on Ubuntu 18?

I have below error while running the start-ursim.sh . I will try additional steps suggested by you.

Error while starting
ERROR: Bundle com.ur.polyscope.logging.polyscope-logging-api [114] Error starting reference:file:/mnt/c/Users//ur/ursim/ursim-5.12.2.1101534/GUI/bundle/polyscope-logging-api-7.8.24.jar (org.osgi.framework.BundleException: Unable to resolve com.ur.polyscope.logging.polyscope-logging-api [114](R 114.0): missing requirement [com.ur.polyscope.logging.polyscope-logging-api [114](R 114.0)] osgi.wiring.package; (&(osgi.wiring.package=com.ur.lang)(version>=3.0.0)(!(version>=4.0.0))) [caused by: Unable to resolve com.ur.polyscope.lang [110](R 110.0): missing requirement [com.ur.polyscope.lang [110](R 110.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.inject.binder)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve com.google.inject [29](R 29.0): missing requirement [com.google.inject [29](R 29.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.6.0))]] Unresolved requirements: [[com.ur.polyscope.logging.polyscope-logging-api [114](R 114.0)] osgi.wiring.package; (&(osgi.wiring.package=com.ur.lang)(version>=3.0.0)(!(version>=4.0.0)))])
org.osgi.framework.BundleException: Unable to resolve com.ur.polyscope.logging.polyscope-logging-api [114](R 114.0): missing requirement [com.ur.polyscope.logging.polyscope-logging-api [114](R 114.0)] osgi.wiring.package; (&(osgi.wiring.package=com.ur.lang)(version>=3.0.0)(!(version>=4.0.0))) [caused by: Unable to resolve com.ur.polyscope.lang [110](R 110.0): missing requirement [com.ur.polyscope.lang [110](R 110.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.inject.binder)(version>=1.4.0)(!(version>=2.0.0))) [caused by: Unable to resolve com.google.inject [29](R 29.0): missing requirement [com.google.inject [29](R 29.0)] osgi.ee; (&(osgi.ee=JavaSE)(version=1.6.0))]] Unresolved requirements: [[com.ur.polyscope.logging.polyscope-logging-api [114](R 114.0)] osgi.wiring.package; (&(osgi.wiring.package=com.ur.lang)(version>=3.0.0)(!(version>=4.0.0)))]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4114)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2111)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1365)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.base/java.lang.Thread.run(Thread.java:829)

Can you provide the link to your setup steps to setup and run the robot simulator on windows. In what simulator or WSL?