June 23rd, 2011 — Uncategorized
Why bother ?
Both virtualenv and virtualenvwrapper ease the hassle of managing python modules when one does not have root access on a system. In addition, no more “–prefix” flags are needed when installing modules. Or maybe better explained, from the official docs:
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.
Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application.
Also, what if you can’t install packages into the global site-packages directory? For instance, on a shared host.
In all these cases, virtualenv can help you. It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).
After this howto you’ll be able to create an isolated clean python environment where you can install as many python modules as you want and where your PYTHONPATH, PYTHONHOME and friends are not tainted… unless there’s a module system in the way, oh, my !
We’ll see how to tame that beast too. Keep reading.
Continue reading →
March 30th, 2011 — Uncategorized
So you cannot wait for a few days when the new ubuntu release comes out with updated opennebula packages, but you need them right now. What are the options ?
- As the seasoned UNIX guy you are, you go with the good old tar xvfz & compile it yourself, wasting time both by managing its intrinsic dependencies, build dependencies and whatnot: #FAIL
- You get more intrepid and try to perform some black magic with apt-pinning, risking your system’s integrity if you don’t do it properly (thanks @alexmuntada!): #FAIL
- You realize that you want manageable distribution packages as opposed to unmantainable and hard to share hacks and go for the recommended alternative to apt-pinning (using deb-src): #WIN
Now, the #BIGWIN would have been giving back to the community by building my own package and contributing it via PPA or whatever packaging system you use, but that good practice will come eventually
February 24th, 2011 — Uncategorized
Så din webbläsaren funkar inte en dag, vad kan jag gjörde ? Kör GDB med firefox !
$ firefox -g
+ MOZDIR=/home/cristobal/.mozilla
+ LIBDIR=/usr/lib/firefox-3.6.10
+ APPVER=
+ META_NAME=firefox
+ GDB=/usr/bin/gdb
+ DROPPED=abandoned
+ which /usr/bin/firefox
+ NAME=/usr/bin/firefox
+ [ xfirefox != x ]
+ NAME=/usr/bin/firefox
+ basename /usr/bin/firefox
+ APPNAME=firefox
+ [ ! -f /usr/lib/firefox-3.6.10/firefox ]
+ want_debug=0
+ [ 1 -gt 0 ]
+ want_debug=1
+ shift
+ [ 0 -gt 0 ]
+ FOUND=
+ [ -d /home/cristobal/.mozilla/firefox ]
+ FOUND=firefox
+ FOUND_BETA=
+ BETA_LIST=
+ [ -d /home/cristobal/.mozilla/firefox-3.1 ]
+ [ -d /home/cristobal/.mozilla/firefox-3.5 ]
+ [ -d /home/cristobal/.mozilla/firefox-3.6 ]
+ [ firefox != -a != ]
+ [ != -a firefox = ]
+ [ 1 -eq 1 ]
+ [ ! -x /usr/bin/gdb ]
+ mktemp /tmp/mozargs.XXXXXX
+ tmpfile=/tmp/mozargs.bnrfme
+ trap [ -f "/tmp/mozargs.bnrfme" ] && /bin/rm -f --
"/tmp/mozargs.bnrfme" 0 1 2 3 13 15
+ echo set args
+ echo sh /usr/lib/firefox-3.6.10/run-mozilla.sh /usr/bin/gdb
/usr/lib/firefox-3.6.10/firefox-bin -x /tmp/mozargs.bnrfme
sh /usr/lib/firefox-3.6.10/run-mozilla.sh /usr/bin/gdb
/usr/lib/firefox-3.6.10/firefox-bin -x /tmp/mozargs.bnrfme
+ CMDNAME_USER=firefox sh /usr/lib/firefox-3.6.10/run-mozilla.sh
/usr/bin/gdb /usr/lib/firefox-3.6.10/firefox-bin -x
/tmp/mozargs.bnrfme
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /usr/lib/firefox-3.6.10/firefox-bin...(no
debugging symbols found)...done.
(gdb) run
Starting program: /usr/lib/firefox-3.6.10/firefox-bin
[Thread debugging using libthread_db enabled]
[New Thread 0xb4f07b70 (LWP 6792)]
[New Thread 0xb46fbb70 (LWP 6793)]
[New Thread 0xb3cffb70 (LWP 6794)]
[New Thread 0xb34feb70 (LWP 6795)]
[New Thread 0xb29ffb70 (LWP 6796)]
[New Thread 0xb1cffb70 (LWP 6797)]
[Thread 0xb1cffb70 (LWP 6797) exited]
[New Thread 0xb1cffb70 (LWP 6798)]
[New Thread 0xb0dffb70 (LWP 6799)]
[New Thread 0xae8ffb70 (LWP 6800)]
[New Thread 0xadeffb70 (LWP 6801)]
[Thread 0xadeffb70 (LWP 6801) exited]
[New Thread 0xadeffb70 (LWP 6806)]
[New Thread 0xace49b70 (LWP 6807)]
[New Thread 0xac648b70 (LWP 6808)]
^C
Program received signal SIGINT, Interrupt.
0xb7fe2422 in __kernel_vsyscall ()
(gdb) info threads
14 Thread 0xac648b70 (LWP 6808) 0xb7fe2422 in __kernel_vsyscall ()
13 Thread 0xace49b70 (LWP 6807) 0xb7fe2422 in __kernel_vsyscall ()
12 Thread 0xadeffb70 (LWP 6806) 0xb7fe2422 in __kernel_vsyscall ()
10 Thread 0xae8ffb70 (LWP 6800) 0xb7fe2422 in __kernel_vsyscall ()
9 Thread 0xb0dffb70 (LWP 6799) 0xb7fe2422 in __kernel_vsyscall ()
8 Thread 0xb1cffb70 (LWP 6798) 0xb7fe2422 in __kernel_vsyscall ()
6 Thread 0xb29ffb70 (LWP 6796) 0xb7fe2422 in __kernel_vsyscall ()
5 Thread 0xb34feb70 (LWP 6795) 0xb7fe2422 in __kernel_vsyscall ()
4 Thread 0xb3cffb70 (LWP 6794) 0xb7fe2422 in __kernel_vsyscall ()
3 Thread 0xb46fbb70 (LWP 6793) 0xb7fe2422 in __kernel_vsyscall ()
2 Thread 0xb4f07b70 (LWP 6792) 0xb7fe2422 in __kernel_vsyscall ()
* 1 Thread 0xb5df1770 (LWP 6789) 0xb7fe2422 in __kernel_vsyscall ()
(gdb) thread 14
[Switching to thread 14 (Thread 0xac648b70 (LWP 6808))]#0 0xb7fe2422
in __kernel_vsyscall ()
(gdb) bt
#0 0xb7fe2422 in __kernel_vsyscall ()
#1 0xb7fbb245 in sem_wait@@GLIBC_2.1 () from /lib/tls/i686/cmov/libpthread.so.0
#2 0xacfe90e9 in event_wait () from /usr/local/lib/libtokenapi.so
#3 0xad32a4a4 in CInternalThreadObject::EventHandlingThread() () from
/usr/local/lib/personal/libP11.so
#4 0xad32dec6 in CHandleTokenEventThread::Run() () from
/usr/local/lib/personal/libP11.so
#5 0xacfe8934 in CThread_posix::RunInternal() () from
/usr/local/lib/libtokenapi.so
#6 0xacfe8981 in CThread_posix::RunProcess(void*) () from
/usr/local/lib/libtokenapi.so
#7 0xb7fb496e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8 0xb638ca4e in clone () from /lib/tls/i686/cmov/libc.so.6
Visst, /usr/local/lib/libtokenapi.so är den skyldige. Följa en andra post här om du vill fixa det, lycka till !
September 12th, 2010 — Uncategorized
It took a while to figure out this little annoying config issue while setting my android phone for development, so here it goes (thanks to comments on androidboss.com).
At the time of writing these lines, if you follow the official android documentation on this topic, you’ll probably get this frustrating error message.
$ ~/bin/android/tools/adb devices
List of devices attached
???????????? no permissions
Then, to fix it, you should edit your “/etc/udev/rules.d/50-android.rules” that way:
SUBSYSTEM==”usb”, SYSFS{idVendor}==”0fce”, MODE:=“0666″
Please, mind the “:=” on MODE, instead of just “=”. This last one doesn’t work on Ubuntu 10.04. After restarting the udev daemon connecting/desconnecting the device, you should get something like:
$ ~/bin/android/tools/adb devices
List of devices attached
CB511JDU5Y device
Hope that helps !
UPDATE: Filed the issue on android bugtracker.
August 22nd, 2010 — Uncategorized

I would have preferred that my Android 1.6 device supported OpenVPN out of the box. Unfortunately, this is only available for rooted devices and a bit of suffering. Instead, I went for configuring IPsec inside L2TP VPN server. All of it stuffed into an old and low-end Soekris net4511 board running Voyage Linux.
First, I will just redirect you to the well-documented, lengthy but primary resource:
Using a Linux L2TP/IPsec VPN server
On the client side, this post is quite complete:
Adding VPN connections to Android 1.6 (Donut)
If you’re feeling impatient and brave, perhaps you’ll succeed with the configuration files that follow (they worked for me)… since those are highly dependant on your network setup, YMMV, a lot.
Before jumping right into the meat and to avoid confusion, let’s see what is the game all these evil daemons are going to play:
- A client (my android phone), connects to the server on port 4500.
- IPsec server (OpenSWAN) responds and asks for the PSK.
- If the previous “gatekeeper” is ok with you, control is handed over L2TP, the other “tunnel keeper” who will ask for another password.
- If L2TP is satisfied with your answer, PPPD, the ancient UNIX beast will be waken up and ask for… your user and password !
- Congrats ! You’re survived the gates, now you’re on your home network from your smartphone, ain’t it cool ?
Continue reading →