Running GUI apps in Docker containers using VNC

In case you don’t feel like reading yet another rant, this is the gist of it:

1) Run your container and expose port 5901 to your host
docker run -p 5901:5901 -t -i ubuntu

2) set up VNC server in the container and run it

sudo apt-get install vnc4server
vnc4server -geometry 1400x1000

3) export $DISPLAY environment variable

export DISPLAY=<change this to the right DISPLAY name from vnc server output, see screenshot below>

4) run your GUI app
5) connect to the VNC server ( from your host OS using one of the freely available VNC clients.
I used TightVNC and it sure was tight.

That’s it. Now if you feel like reading, I can explain my use case. Read on.
Continue reading “Running GUI apps in Docker containers using VNC”

Unrar on a RaspberryPi running Raspbian

To my surprise I found that there’s no usable unrar command on my RaspberryPi.
I run Raspbian on it and it so happens that I wanted to unpack a rather large rar file.
The unrar-free package is not good enough for some archives, so that is not an option.

So how to get a working unrar on a Raspbian 8.0? And do you really need it?

Well, there are 2 options that I found, either you use 7zip or if you really want the unrar command, you can build it from Debian source package.

Continue reading “Unrar on a RaspberryPi running Raspbian”

Setting up OpenVPN client on iOS

It goes without saying that it might be a good idea to be careful about what you do on an unsecured wifi. And there are times, such as when travelling, when the only connectivity option is a public, unsecured wifi.

Normally, you just avoid doing anything sensitive while on such connection, but during longer trips, for example, it might be difficult.

There are tons of VPN providers nowadays and these usually make your client setup as easy as possible, but if you want to use your own server for this then for some reason I found that the client configuration part can still take time as the documentation is a bit suboptimal to say the least.

Anyways, long story short, the client configuration is acutally straightforward.
You only need to import one configuration file into your iOS device and in this file you can copy/paste all the certs and key.

Continue reading “Setting up OpenVPN client on iOS”

Xbox and Latvia don’t mix well

Depending on how you define a gamer, I’m pretty sure I don’t fall into that category. That said, I do like to play something from time to time.

Over the last xmas holidays I did have the chance to play a bit of Xbox with some friends and decided to buy one for myself. As I have an old PS3 I thought that Xbox One would be something to try. Change, is good they say, right?

People say that PS4 has better graphics, but damn, stuff looks great as is even on the Xbox One (at least to me).

Games do take some time  load, this can be a bit annoying, no idea how long are the load times on PS4, but I guess I can live with that as well.

So overall life is great if you can ignore some minor issues.

Of course, living in the Eastern block means there are also problems.

Xbox Live

So nowadays it appears that regardless which console you choose, you must also buy some sort of subscription to be able to play online (despite the fact that you already spent like 70 eur on the game). But OK, fine.

Recently on a trip to US I bought a 12 month subscription for my precious new Xbox. Quite frustrating turned out to be the day when I tried activating it because, behold, Latvia is not a supported country and therefore no playing online for you folks (not officially at least)!

Continue reading “Xbox and Latvia don’t mix well”

Switching from a MacBook to HP Spectre

I’ve been using a mid 2013 MacBookPro for the last 3 years now and it was time to do a personal tech refresh sort of thing.

After latest macbooks being kind of a disappointment and also the dongle life being a factor (at least for now, in 2017), I decided to do something kind of radical and buy a windows laptop.

I have owned couple of non-Apple laptops in the past and they were awful. But nowadays the situation seems to be changing rapidly and there are quite a few reasonable choices on the market.

For me, the main contestants were:

  • Surface book
  • Dell XPS 13
  • HP Spectre x360

After some research and watching review videos I decided to go with HP Spectre x360.

Surface book, is expensive and lacks USB-C ports, which is a non-issue today but might become important a year or two from now.

Dell XPS 13 has a really weird camera placement.

So anyways, HP it was.

It’s certainly a change. To move from unix to windows OS is one thing.

But to move from Apple’s perfectionist obsession over every minor detail in the hardware to HP’s wannabe copying of Apple is something you just have to live with I guess.

After using this machine for half a month or so I must say that the hardware and the “feel” is what I dislike the most. Windows itself nowadays is quite usable and has all the tools I need.

More on the topic in the future.

Segfaulting VIM. What?

I got quite the surprise today while opening a file for editing using vim.

fx@teikapi2:~ sudo vim /etc/hosts  
Segmentation fault  

Say what? Vim, segfaulting? Okay.

There was an automatic apt-get upgrade on this machine today, so that is the explanation.
Still quite weird and most definitely not expected.

Quick backtrace under gdb showed:

#0  _dl_lookup_symbol_x (undef_name=0x40a93987 <error: Cannot access memory at address 0x40a93987>, undef_map=undef_map@entry=0x76fff958, ref=ref@entry=0x7efff3ec,
    symbol_scope=symbol_scope@entry=0x76fffb10, version=0x76d1e500, type_class=1, flags=flags@entry=1, skip_map=skip_map@entry=0x0) at dl-lookup.c:715
#1  0x76fdb31c in elf_machine_rel (reloc=0x54abe014, skip_ifunc=<optimized out>, reloc_addr_arg=0x54c7f4a0, version=<optimized out>, sym=0x54b2c384, map=0x76fff958)
    at ../ports/sysdeps/arm/dl-machine.h:377
#2  elf_dynamic_do_Rel (skip_ifunc=<optimized out>, lazy=0, nrelative=<optimized out>, relsize=<optimized out>, reladdr=<optimized out>, map=0x76fff958) at do-rel.h:137
#3  _dl_relocate_object (scope=<optimized out>, reloc_mode=<optimized out>, consider_profiling=<optimized out>, consider_profiling@entry=0) at dl-reloc.c:264
#4  0x76fd23a4 in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2201
#5  0x76fe5b30 in _dl_sysdep_start (start_argptr=start_argptr@entry=0x7efff800, dl_main=0x0) at ../elf/dl-sysdep.c:249
#6  0x76fd3c78 in _dl_start_final (arg=0x7efff800, arg@entry=0x0, info=info@entry=0x7efff580) at rtld.c:330
#7  0x76fd3f08 in _dl_start (arg=0x0) at rtld.c:558
#8  0x76fcfd50 in _start () from /lib/

So looks like a fail whilst doing ELF dynamic relocation.

Somewhat regretfully, I reinstalled vim and this fixed the problem.

Now, in retrospect, should have saved the binary.
The more I think about it the more interesting this seems.

System testing after upgrades seems like a good idea at this point, ofc that would be an overkill for my poor raspberry Pi that servers mainly as a Samba server at home 🙂

More digging next time, eh?

Systemtap on Debian Jessie

So I wanted to play a bit with Systemtap on Debian Jessie.

I installed it:

sudo apt-get install systemtap  

Afterwards I wanted to run a quick one-liner:

fx@cloudhawk:~$ stap -L 'nd_syscall.*'  
Checking "/lib/modules/3.16.0-4-amd64/build/.config" failed with error: No such file or directory  
Tip: /usr/share/doc/systemtap/README.Debian should help you get started.  

It failed, but hey, at least it provided a clue – the README.Debian file.
So I looked at the provided doc in /usr/share/doc/systemtap/README.Debian.

I mean, you would imagine that this would be the best place to look for tips on how to get it running.

To quote it:

To use systemtap you need to  
manually install the linux-image-*-dbg and linux-header-* packages  
that match your running kernel. To simplify this task you can use the  
stap-prep command. Please always run this before reporting a bug.  

Then it goes on talking about using vim-addon-manager which makes no sense to me.
But ok, so far so good, the doc suggests to run stap-prep.

fx@cloudhawk:~$ sudo stap-prep  
/usr/bin/stap-prep: line 30: rpm: command not found

What the hell? RPM??? Crazy.

And if you look at the script, what it wants to do is to use yum to install the dependencies.
Looks as if someone @Debian just blindly took this from RedHat/Centos.

But all you actually need to get Systemtap going on Debian is to do:

sudo apt-get install systemtap linux-image-`uname -r`-dbg linux-headers-`uname -r`  

As simple as that.
Now it works:

fx@cloudhawk:~$ sudo  stap -L 'nd_syscall.*'|head -n 5  
nd_syscall.accept sockfd:long addr_uaddr:long addrlen_uaddr:long name:string argstr:string  
nd_syscall.accept4 sockfd:long addr_uaddr:long addrlen_uaddr:long flags:long name:string flags_str:string argstr:string  
nd_syscall.access name:string pathname:string mode:long mode_str:string argstr:string  
nd_syscall.acct name:string filename:string argstr:string  
nd_syscall.add_key name:string type_uaddr:long description_uaddr:long payload_uaddr:long plen:long ringid:long argstr:string  

Docker for Windows: shared folders not working

There have been several not so flattering blog entries lately about docker and its maturity level.

I was quite excited to move away from having to use VirtualBox and indeed Docker for Mac works great but on my Windows machine I noticed that the shared folders don’t seem to work.

After clicking, resetting to default and lastly googling, I found this really great blog entry on the MSDN blog that explains the problem and shows ho to fix it.

Lesson for me here – indeed docker is quite unstable/green still, but the good news – community is great and seems getting stronger and stronger.

PowerShell on Unix

As crazy as that sounds it actually works.
MSFT has open sourced PowerShell. I have now tested it on both OSX and Linux and it does indeed work as advertised.

Granted some methods throw exceptions as they are missing DLLs and that is explained by the fact that only “core” functionality is currently supported. This is good enough though at the moment and you can do basic stuff with PowerShell.

Their GitHub issue list is filling up quickly, so if you get an error, likely it is already on the list to be fixored, if not – report it.

To me the use case currently is that I jump between Windows and Mac frequently and being able to write some automation helpers in a uniform way sure sounds good as before this I would have just resorted to Python. Not saying this is better, but hey, more choices can’t be bad.

TomTom GO Mobile iOS app is crap

This turned out rather long, so to sum it all up:
Don’t buy TomTom Go Mobile app, it really is crap (at least as of mid-2016).
My biggest reasons why it’s crap:

  • expensive (compared to free options like Waze or Google maps)
  • no way to calculate alternative routes (just basic options like, don’t take ferry)
  • no way to add stops to the route
  • speed limits in eastern Europe are inaccurate

And really, how can it be that a paid navigation application does not have support for adding stops or doing alternative routes? This is simply mind boggling.

And now, the back story, more details and ranting.

So I decided to go on a small road trip from Latvia to Czech republic. Being the geek that I am, I obviously had to have the best possible navigation software as obviously using plain google maps or paper maps is a no-go.

In the Baltics I usually stick with Waze or Google maps, but the former can sometimes take very weird routing decisions and the latter does not warn about accidents on the road or speed cameras or anything else for that matter. So Waze it is by default.

However, when going out of the home country, it would be beneficial to have offline maps that can also do routing offline. And since this was supposed to be my first roadtrip across Poland, I thought I should be better prepared.

So after some slight Googling I decided to give TomTom Go Mobile a try. I have used their devices before and was reasonably satisfied.

So I installed the app (it allows for 70 km per month free navigation as well), tested it in my local town and it was ok. Clear instructions, route choice looked ok, so I bought the subscription for a year.

On the day of the trip, fun started. I belatedly discovered that there’s no way to add stops on the route and by default, when navigating from West-Latvia to Central Poland it absolutely wants to go via the Russian enclave of Kaliningrad (which requires a visa). And no way to change that. Wow.
I thought, surely this is just me, not knowing how to use the app, googling turned up many complaints like mine and even some references to ways how to do it, however none of them are implemented in the iOS app. So I wrote to TomTom support, just to get back the templated answer about “developers are working on it, it’s taking some time…” yada yada.

So OK, I though I’d give it a try anyways and I set my route manually with destinations being just the intermediary points on my route.

This worked but was cumbersome, also I soon discovered that TomTom reports inaccurate speed limits while driving through Lithuania and Poland. Not a big deal, but still, better not to show them at all rather than showing misleading ones (for example showed 130 in Lithuania where actual limit was 110 and so on).
And also it does not know about all the speed cameras in Lithuania and vice versa sometimes reports on non-existing ones.

So all of that can be tolerated, but then while driving through Poland and headed to Warsaw TomTom directed me off of a highway and onto a small country road. I obeyed, despite the signs but stopped to check the map and it made no sense at all. I entered my destination into TomTom from scratch and it immediately changed the route back to normal. This was the end of me using TomTom.

When driving via foreign country the last thing I need is to be directed off my route and loosing time to get back on track.

So lesson learned. For the remainder of the trip I used Waze and I’m very happy with it. The traffic data seems to be quite accurate, whenever it decides to change the route it informs me about it clearly. Speed limits are shown well. And really, the only downside is that it requires a data connection.

Luckily, the roaming charges are decreasing fast in the EU. I pay 5 EUR per 150 MB a day while roaming which is enough to navigate and do some light browsing and email.