All posts by JohanJ

Heroes of the Storm for Linux

A friend of mine asked if I wanted to play Heroes of the storm with him. But then I found out that the creators were blizzard, and they are known to hate Linux. But often you can emulate windows games, and heroes of the storm should be no difference right?

In this post I will show how to install Heroes of the storm though wine in a container.

Table of Content

  • Introduction
  • Step 0 Install lxc
  • Step 1 Install missing package
  • Step 2 Fix the gui
  • Step 3 Graphics
  • Step 4 Wine
  • Step 5 Heroes of the storm
  • Step 6 Further


These days steam are making games more common for Linux ( well, ubuntu at least) but it’s always been the downside of Linux. The solution for this has in many cases been to use a windows emulator called Wine. My experience with OS emulators (like cygwin) are that they tend to make a mess of your installation. For the last few years containers has been hot stuff with Linux. It’s a semi VM, it actually runs on your hosts kernel (protected by namespaces) and it is really useful for just this kind of situation when you don’t want to install a horde of compatible libraries on your machine.

Is it possible to combine containers and wine? Well yes!

Step 0 Install lxc

Containers are easy to create, but they can really put your linux knowledge to test when you want to modify them and grant permissions. I recommend you to read Stéphane Graber posts at before you try what I do in this post. A lot of the graphics is taken from his post about gui.

Install lxc

# apt-get install lxc

Then let’s create a container called wine

lxc-create -t download -n wine

You will have to select distro, version and architecture.

  • Distro: I picked ubuntu and for two good reasons. 1: My host is ubuntu making it easier to compare with the guest (especially for fixing the gl drivers) 2: a lot of programs are made for ubuntu making installation less of a hazzle.
  • Version. I picked same as my host: wily. Much for the same reason as mentioned in 1 above.
  • Architecture: I found the i386 being slightly easier to install than amd64, but I prefer having 64-bit.

There are some difference in the error output you get when using 32 respectively 64-bit architecture. I’ll post both output, but keep in mind that it might differ depending on architecture.

Start it and log in to make sure everything went ok.

$ lxc-start -n wine

$ lxc-attach -n wine


# apt-get update;apt-get upgrade

tips: to log out you can send EOF with ctrl+D

Step 1 Install missing package

Log in to your guest. First of all, if you use any other locale than US you should install the correct language package to avoid the annoying error message:

perl: warning: Setting locale failed.

I’m using Swedish:

2016/05/heroes-of-the-storm-for-linux# apt-get language-pack-sv

Next you want to  add auto completion:

# apt-get install bash-completion

start it by: . /etc/bash_completion

If you use the terminal a lot it can be a good idea to put it in .bashrc

Step 2 Fix the gui

Next thing we should install some GUI application . Install chromium, it will be used later in the tutorial anyway (and in heroes of the storm when it want to show a web page from

# apt-get install chromium-browser

(500 Mb!)

Try to start it.

Gtk: cannot open display: :0

Problem with open the display. That’s not so strange. The container is minimum installation of  ubuntu, no desktop environment and no xorg.

Let’s use the hosts xorg by mounting it to the guest. Add following section in .local/share/lxc/wine/config

lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir

I also had to allow connection by: xhost +

This is probably not good for security to allow anyone to connect. I haven’t tried but you can probably tweak it and use localhost for allowed IP addresses.

Stop the container and restart it.

Chromium will now complain that you are using root — as it should. Surfing from root is a really really bad idea.

lxc created a user “ubuntu” in my guest tat is user 1000. If you do not have one then create one with adduser and make sure it is uid 1000. Switch to the user.

# su – ubuntu

Now chromium should work!

Try to use the unprivileged user as much as possible. Obviously you need to be root to install packages, but don’t run wine and other programs as root.

If you get the error:

[0520/] Failed to create /home/ubuntu/.pki/nssdb directory.
[0520/] Failed to create /home/ubuntu/.pki/nssdb directory.
[0520/] Check failed: process_type.empty(). Unable to get the user data directory for process type: zygote


Then you need to map the guest user with a host owner that got permission to write to hosts: .local/share/lxc/wine/rootfs/home/ubuntu

This is done in the end of next step.

Step 3 Graphics

This was by far the toughest part to fix. I use ATI/AMD while most guides online use Nvidia. Those did not work very well for me, and I expect if you got another manufacture you probably have to do it different, but I will try to write how to troubleshoot and find what libraries you need.

Install opengl utils

# apt-get install mesa-utils

start glxgears

$ glxgears

ibGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

That’s bad news. Let’s see what glxinfo says:

$ LIBGL_DEBUG=verbose glxinfo

name of display: :0
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/fglrx/dri/tls/
libGL: OpenDriver: trying /usr/lib/fglrx/dri/
libGL: dlopen /usr/lib/fglrx/dri/ failed (/usr/lib/fglrx/dri/ cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/
libGL: Can’t open configuration file /home/zabbat/.drirc: No such file or directory.
libGL: Can’t open configuration file /home/zabbat/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
display: :0  screen: 0
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)

This basically means that it’s not possible to use hardware and  you will make your CPU render. Also as we scroll through the text we can see that the gl version is really low (mine was 1.4).

How does it look like on the host side?

$ LIBGL_DEBUG=verbose glxinfo

name of display: :0
display: :0  screen: 0
direct rendering: Yes


libGL: OpenDriver: trying /usr/lib/dri/
ukiDynamicMajor: found major device number 243
ukiDynamicMajor: found major device number 243
ukiDynamicMajor: found major device number 243
ukiOpenDevice: node name is /dev/ati/card0

The driver it is using is fglrx. Let’s install this on the guest too.

# apt-get install fglrx

(Almost 500Mb!)

reboot and run glxinfo again.

name of display: :0
libGL: AtiGetClientDriverName: 15.20.3 fglrx (screen 0)
libGL: OpenDriver: trying /usr/lib/fglrx/dri/
libGL error: OpenDriver: failed to open /usr/lib/fglrx/dri/, error[/usr/lib/fglrx/dri/ cannot open shared object file: No such file or directory]
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/
libGL error: OpenDriver: failed to open /usr/lib/x86_64-linux-gnu/dri/, error[/usr/lib/x86_64-linux-gnu/dri/ cannot open shared object file: No such file or directory]
libGL: OpenDriver: trying /usr/lib/dri/
ukiDynamicMajor: found major device number 243
ukiOpenDevice: node name is /dev/ati/card0
Error: No root privilege. Please check with the system-admin.


The gl version is higher but still low:

OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: AMD Radeon R9 200 Series
OpenGL version string: 2.1 (4.5.13399 Compatibility Profile Context 15.201.1151)

let’s try glxgears again:

open uki failed (Operation not permitted)
libGL error: reverting to (slow) indirect rendering

“ukiOpenDevice: node name is /dev/ati/card0
Error: No root privilege. Please check with the system-admin.”


“Operation not permitted”

tells us that accessing the driver is not going well.

To fix this we should mount the driver. Add

lxc.mount.entry = /dev/ati/card0 dev/ati/card0 none bind,optional,create=file

in  the config file. Containers still don’t like any user to have permission to mess with  device drivers, so we should add it as an exception. We are using /dev/ati/card0, let’s check the device version numbers for it. On the host:

$ ll /dev/ati

crw-rw-rw-  1 root root 243, 0 maj 15 19:48 card0

Add the permision for the device in the config file:

# groups
lxc.cgroup.devices.allow = c 243:* rwm

restart the container and try gears again. It should work.

glxinfo gives:

ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 4, (OK)
ukiGetBusid returned ‘PCI:1:0:0’

It could be useful to add mappings from you container to your host so that you user has same permissions. I’m not sure if you need this, but if you get any problem add:

lxc.id_map = u 0 100000 1000
lxc.id_map = g 0 100000 1000
lxc.id_map = u 1000 1000 1
lxc.id_map = g 1000 1000 1
lxc.id_map = u 1001 101001 64535
lxc.id_map = g 1001 101001 64535

in your config ( remove any other default mapping).

Step 4 Wine

The current supported wine version in ubuntu is 1.6 and that does not work very well with Heroes of the new earth. Install a newer version, I used  the latest (1.9.9) staging. Newer version usually got much better performance and when using 1.6 the game would freeze.

# apt-get install software-properties-common

For i386:

# add-apt-repository ppa:wine/wine-builds
# apt-get update
# apt-get install –install-recommends wine-staging
# apt-get install winehq-staging

If you are on 64-bit then:

# add-apt-repository ppa:wine/wine-builds
# apt-get update
# apt-get install –install-recommends wine-staging-amd64

trying to install:
# apt-get install winehq-staging

will give you:
The following packages have unmet dependencies:
winehq-staging : Depends: wine-staging (= 1.9.10~ubuntu15.10.1) but it is not going to be installed

you must add multi arch:
# sudo dpkg –add-architecture i386 

Step 5 Heroes of the storm

Open chromium and download the installer:

once downloaded start it. Remember to not be root when you shouldn’t.

wine installer.exe

(or wine64)

I had problems that when there were an update I would get an error message :

“To install this game, please run the Blizzard Setup program while logged in to this computer as an administrator.​
Errors: BLZBNTBTS00000023, BLZBNTBTS00000024, BLZBNTBTS0000H”

I solved this problem by removing white space in the installation path:


Note that blizzard will automatically install it to a folder with white space “Heroes of the storm”, but you can rename it afterwards and then go to settings and change the installation folder.

Step 6 Further

In this post I have not added sound. should give you the needed information.

The game works well in minimal graphics settings (35~40 fps in game), thought I’ve notice my ping can be high some times. I suspect the performance depends quite heavily on wine. It would be nice to see how much different the game would be if it was installed on my host, and on real Windows on my machine.

I am considering to add this as a docker. It could be a future project.

GL HF noob.


Brackets and the curse of dependencies

So the other day I wanted to install Brackets for front end development. No problems, it’s open source, how hard can it be?

Thought when trying to install from the deb file on my ubuntu 15 I get the error message that there’s no libgcypt11 that are a required dependency.

That’s not strange, it’s deprecated and new systems should use libgcrypt20, that comes with ubuntu 15. But unfortunately the install script still require libgcrypt11 ( >= 1.4.2)

Sure, it’s open source, why not download the source and change the dependency?

Turns out that creating the build script is not that easy. You need to run the grunt tasks, thought “grunt installer” won’t complete unless you do a full build. Guess what, full build won’t complete because the source code require symbols from libgcrypt11.

OK, what about to manually edit the install scripts in the deb file? Unpacking the deb file and changing the control file to libgcrypt11( >= 1.4.2) | libgcrypt20 (>= 1.5.0)

Nope, there’s still a library that don’t work without a call to a crypt function of version 1.2 :(

My advice? If you are going to use a virtual machine anyway, install an older distro, such as Ubuntu 14.

Reading the comments on Brackets they seem to have big problems to create a installer for new Linux distros. For over a year they have not managed to solve this issue. The conclusion is that they don’t really care about Linux so it’s a good idea to use another software. I’ll try Atom.

Another reason I like rolling releases is that you often avoid these dependency problems. Thank you Arch.





Arch and Virtualboxing

Today after upgrading Virtualbox on my Arch host I found that I could no longer run Virtualbox.

$ virtualbox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (4.4.3-1-ARCH) or it failed to
load. Please recompile the kernel module and install it by

sudo /sbin/rcvboxdrv setup

You will not be able to start VMs until this problem is fixed.

As told I could not boot any of my VMs.

It was not possilbe to run sudo /sbin/rcvboxdrv setup, all I got was another error message:

Unloading modules:
Loading modules: modprobe: FATAL: Module vboxnetadp not found in directory /lib/modules/4.4.3-1-ARCH
modprobe: FATAL: Module vboxnetflt not found in directory /lib/modules/4.4.3-1-ARCH
modprobe: FATAL: Module vboxpci not found in directory /lib/modules/4.4.3-1-ARCH
modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.4.3-1-ARCH

After banging my head and reinstalling Virtualbox I found out that the problem is that virtualbox-host-modules package were simple removed. I suspect the dependency became broken when installing either the new arch kernel or the new Virtualbox package.


Simply reinstall the host modules again

# pacman -S virtualbox-host-modules

You will need to manually load the modules the first time:

# modprobe vboxdrv

or reboot.



Breaking that virtual machine

Have you ever forgotten your root password and thought about ways to recover it? It is possible to change it but that also means it’s possible to hack your computer. In this post we take a look how to use a live USB and chroot to gain root access.

Table of content:


All modern distros comes with a live version, where you don’t need to install the OS but are able to run Linux directly from CD/USB. This is perfect when you need to emergency repair your main OS. However if you are able to boot from another device you  can also access the files on any available hd. This can be used to change password on an installed Linux, for good or bad.

I was surprised how easy this was to boot up from a live USB and then just use chroot to be able to use passwd to change the  and from now on I will make sure to protect my machine better. Is it possilbe to break a VM with the same method? Of course! Let’s get started.


0 – Installing the tools

First install a guest that you want to break into. See previous post Let’s call it Guest A. In this guide I’ll use Lubuntu* and like for most Ubuntu clones it means there’s no root password, but all we need is a admin password. If you use another distro you probably just want to change the root password. Don’t add any encryption or UEFI support (we talk more about this later).

* I found out that Lubuntu got problem to add encryption, so you probably don’t want to use it. A good alternative is Xubuntu.

Next we want a Linux live USB. You can skip this step and boot from the Lubuntu CD, our VM will always have a CD drive but some real world machines doesn’t these days so it’s a good exercise to practice with a virtual USB. An option to create a virtual USB is that you use a real USB and add a filter for it under USB settings.

Add a new HD to Guest A.

Go to Storage and click on the hd with a green plus. Create a 8 Gb drive and check the “solid state drive” and “hot pluggable” check boxes. I have named it liveusb.vdi as seen below.


Keep the live CD and boot up (either live or Guest A).  Use lsblk to check what hd’s we have:

sda      8:0    0 20,5G  0 disk
├─sda1   8:1    0 16,5G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0    4G  0 part [SWAP]
sdb      8:16   0    8G  0 disk
sr0     11:0    1  744M  0 rom  /media/zabbat/Lubuntu 15.10 amd64

As we can see, sda is for Guest A , sdb is our new hd for the live usb and sro contains the Live CD. Let’s copy the CD to sdb using dd. I know dd is synonym for disk destroy, but that’s why I like VM, the damage is at least restrained to your guest OS.

#dd if=/dev/sro of=/dev/sdb

lsblk should now show sdb as:

sdb      8:16   0    8G  0 disk
├─sdb1   8:17   0  744M  0 part
└─sdb2   8:18   0  2,2M  0 part

1 – Booting Up

Now let’s boot from the live USB. There’s two ways you can make your system boot from it. You can either mash F12 at VM start up and select the drive. Other wise you can assign the hd to the lowest SATA port number of your hard drives from the storage menu. In the real world boot menu might be locked, but in virtualbox it’s not possible to do so.

Start the live USB without installing, then open a terminal.

Mount Guest A’s root partition to /mnt. In our case you could see that only sda1 can possible be a root partition, sda2 is too small and probably reserved for boot record and sda5 is 4 GB swap.

#mount /dev/sda1 /mnt

then let’s change the fs root:

#chroot /mnt

Now you have root privilege in Guest A’s file system.

In ubuntu clones you normally don’t have a root user. To find the user name you want to change password for check either /etc/passwd or /etc/group. Let’s open group and see who’s in admin or sudo group.

#vi /etc/group

my file says something like:


So let’s change zabbat’s password to 123456:

#passwd zabbat

We’re done! Exit from chroot and reboot. Remember to change back the boot order.

When Guest A promts to log in, select zabbat as user and 123456 as password.

2 – Protection

Since you are mounting the file system you can protect it by encrypting your drive. It is not enough to choose “encrypt my home folder” that is a popular choice for ubuntu clones. Your home folder is quite unintresting when it comes to getting your password. Depending on your distro and partition set up it varys what folders you need to encrypt. Don’t take any risk, encrypt everything, since chroot will make it possible to read and edit sensitive files. For an example, one could go to your /etc/passwd and change so that root do not require any password at all.
A note, while I was creating an ecrypted installation of Lubuntu I noticed that there’s a bug that stops you from encrypting. I tried Xubuntu instead as seen above and it worked.


If some one has physical access to your computer it is incredible easy to hack it. If you have a laptop there really is no excuse for not encrypting your drives, if you loose it without encryption you can assume they break into it.
For VM there’s no need to have physical access to the computer. Someone could SSH into the host and break your guest OS. All they need is permission to edit the VM so that it boots from a live CD/USB, or perhaps from the network.

“Where’s my phone” flowchart

When you are setting up your android development environment it’s common that you can’t detect you USB device. The following flowchart is to make troubleshooting easier. The environment is Linux host with virtualbox installed and a Linux guest. If you are not using a virtual machine you can go directly to “Does guest ‘lsusb’ detect the device”



Worst case scenario is to not finding the device on neither host or guest.