Archive for the ‘ubuntu’ Category

building Aegisub on Ubuntu

March 23, 2014 Leave a comment

You want to install Aegisub from source.

Aegisub is a free, cross-platform open source tool for creating and modifying subtitles. Aegisub makes it quick and easy to time subtitles to audio, and features many powerful tools for styling them, including a built-in real-time video preview.” (source)

Aegisub is a wonderful piece of software. It makes subtitle creation almost trivial :)

Here I show you how to build Aegisub 3.1.2 on Ubuntu 13.10 (64 bit). I guess it would work with later versions too after some tweaks :)

Note that Aegisub requires wxWindows > 2.8!

Installation steps:

# install dependencies
$ sudo apt-get install build-essential libasound2-dev libass-dev libffms2-dev libfftw3-dev libgl1-mesa-dev libglu1-mesa-dev libgtk2.0-dev libhunspell-dev liblua5.1-dev
$ sudo apt-get install intltool
$ sudo apt-get install libboost-all-dev
$ sudo ldconfig    # not sure if necessary here

$ cd /opt/wxWidgets-X.Y.Z
$ ./configure --with-opengl && make && sudo make install
$ sudo ldconfig

$ cd /opt/aegisub-X.Y.Z/aegisub
$ ./configure --with-boost-libdir=/usr/lib/x86_64-linux-gnu
$ make && sudo make install

Aegisub’s “configure” gave me the following warning: “configure: error: Could not link against -lGL !“. I could solve this problem with (1) “install libboost-all-dev“, and (2) add “--with-boost-libdir=/usr/lib/x86_64-linux-gnu” to “configure“.


Update (20130330)
I also wanted to install Aegisub on an older laptop of mine that runs Ubuntu 12.04. To make it work, I had to install older versions: wxWidgets-2.9.4 and aegisub-3.0.1. I tried different combinations but it was a failure. If you want to save some headache, use these versions :)

Sorry, Ubuntu has experienced an internal error

February 24, 2014 Leave a comment

ubuntu-12.04-apport-errorSorry, Ubuntu has experienced an internal error.

Does it sound familiar? Are you tired of these messages? Then let’s get rid of them:

sudo apt-get purge apport

More info here.

On one of my machine the package rapport could be removed easily. However, on another machine the package manager wanted to remove a bunch of other packages too. In this case you can simply disable apport.

Edit the file /etc/default/apport and change enabled=1 to enabled=0. This setting will be taken into account on the next boot.

Categories: ubuntu Tags: , ,

Linux host, Windows guest, shared Dropbox folder

February 16, 2014 Leave a comment

My primary operating system is Linux but since I need to work with Powerpoint too, I installed Windows 7 in VirtualBox. Under Windows I prepare my presentations but I want them synchronized on all my machines. For the synchronization I was using Dropbox.

I had Dropbox on Linux (host machine) and on Windows (guest machine) too. When I edited a file under Windows, Dropbox synced it to the Linux host too (the Windows client uploads it to the cloud; the Linux client downloads it from the cloud). It worked fine, though it was not not optimal. If I didn’t use the Windows guest for a long time, then after a boot I had to wait some time till Dropbox synced everything and I could start working only after that.

However, something happened to the Windows Dropbox client recently. Maybe it’s a bug, I don’t know, but the Dropbox client in my Windows guest became terribly slow. It keeps syncing but it doesn’t upload the changes, or I need to wait an hour or so to upload a file 1 MB of size. This is ridiculous and unacceptable. Note that I dind’t experience similar issues with the Linux client.

How to have a synchronized folder between a Linux host and a Windows guest without a Dropbox client on the guest?

First I made sure that my Dropbox folders were synced between the host and the guest. After this I uninstalled Dropbox on Windows and removed the C:\Dropbox folder entirely. Since it was synced with the Linux host, I had an exact copy of the Dropbox folder on Linux. Then shut down the Windows guest.

Here ( you can find an excellent post on how to set up a shared folder between a Linux host and a Windows guest. On the Linux host I shared my Dropbox folder ($HOME/Dropbox) that appears now as a new drive in the Windows guest (G:\ in my case). Now, if I modify something under Windows, it will be visible immediately in the Linux file system that the Dropbox client on Linux will notice and sync.

With this I could solve two problems. First, when I boot up the Windows guest, I don’t need to wait for the Dropbox client to sync. Second, if I change something under Windows, it is still synced to the Dropbox cloud, though I have no Dropbox client on Windows anymore.

Ubuntu, nvidia, projector, screen cloning, 1024×768 resolution

February 14, 2014 Leave a comment

I have a laptop that I use for teaching. It is connected to a projector. Everything was fine until today. The next semester starts next Monday, so today I checked if the laptop still works well with some projectors. Nope. Of course not! I tried three classrooms. One projector was OK, but two others didn’t recognize my laptop (“no connection”).

In order to avoid problems with the nvidia driver, I used to keep an old driver on my machine that worked well. When the packages were updated, I always left out the nvidia packages. But something happened since December… So I decided to upgrade all the Nvidia packages too. By the way, I have Ubuntu 12.04 LTS on this laptop. The result almost made me cry: after the upgrade I couldn’t change the resolution on my laptop anymore. If I want to use a projector in clone mode, switching to resolution 1024×768 is mandatory. Damn!

This article saved my ass. It explains how to update your Nvidia driver with the newest one directly from Nvidia. The new driver, which came out in January 2014, works well. I can change the resolution and cloning works too. Phew…

Here I sum up the steps from the aforementioned article:

(1) Download the latest driver for your card from .

(2) Blacklist the nouveau driver. “sudo vi /etc/modprobe.d/blacklist.conf” and add this line to the end:

blacklist nouveau

(3) Switch to the virtual terminal (Ctrl+Alt+F1) and execute these steps:

$ sudo apt-get remove --purge nvidia*
$ sudo service lightdm stop
# locate the downloaded driver and run it
# your version probably will be newer
$ sudo sh ./
$ sudo reboot

If something went wrong and you encounter some problems during the reboot, here is how to revert the changes. Switch to the virtual terminal (Ctrl+Alt+F1) and execute these steps:

$ sudo sh ./ --uninstall
$ sudo apt-get install nvidia-current
$ sudo service lightdm restart

Remove global menu bar from Firefox (22.0+)

January 17, 2014 Leave a comment

You managed to disable the stupid global menu in your Ubuntu but Firefox still has this shit. How to get rid of it?

Type in about:config and change the value of the line ui.use_unity_menubar to false.

Tip from here.

Categories: firefox, ubuntu Tags: ,

Installing Vagrant on Windows

January 15, 2014 Leave a comment

You have a Windows machine and you want to use Linux (e.g. Ubuntu) in it. That is, you want to install an Ubuntu VM (virtual machine) inside Windows. You want to use the command line only, thus you don’t need any graphical interface. Maybe you have a weak laptop where a graphical VM wouldn’t even run normally. In addition, you want to get it done quickly, you have no time to download an Ubuntu image and go through the installation process. What to do?

Use Vagrant. Vagrant is a tool for building complete development environments. We will use Vagrant with VirtualBox, so we need to install both.

Install VirtualBox
Visit and select Downloads on the left side. Download and install the latest version for Windows hosts. You can also install the Extension Pack. Make sure to install the version that matches with the previously installed VirtualBox version. We won’t work with VirtualBox directly, but Vagrant is built on top of it, so Vagrant will need it.

Install Vagrant
Visit and install the Windows version. For the curious, Vagrant is written in Ruby. It is very likely that you will have to restart your computer after the installation. After the restart, you can use the command “vagrant” in the shell, it is added to the PATH by the installer.

Basic usage of Vagrant
As indicated in the official guide, using vagrant is very easy.

I suggest that you should create a dedicated directory for your first Ubuntu VM, C:\vagrant for instance. Enter this directory, open a terminal (with the command “cmd“) and execute the following commands:

c:\vagrant> vagrant init precise32
c:\vagrant> vagrant up

The first command downloads a basic Ubuntu 12.04 LTS image. The second command starts the VM.

Now it’s time to log in to the running VM:

c:\vagrant> vagrant ssh    # there is a chance that it won't work...

Well, if it doesn’t work for you under Windows, here is alternative solution: use Putty. Details: hostname:, port: 2222, username: vagrant, password: vagrant.

Some other useful commands:

c:\vagrant> vagrant status  # Is the VM running?
c:\vagrant> vagrant halt    # stop the VM; counterpart of "vagrant up"

Use Bash as your shell
The default Windows shell “cmd” is quite lame. If you want to use a better shell, install the Cygwin environment, which is a Unix compatibility layer for Windows. It’s enough to install the default packages, but don’t forget to add the “openssh” package too. In my case, I installed the 64-bit version and added the “c:\cygwin64\bin” directory to my PATH. After this you can launch the command “bash” and execute these commands:

$ cd /cygdrive/c/vagrant
$ vagrant status    # Is it running?
$ vagrant up        # if it was not running
$ vagrant ssh       # thanks to the openssh package, it works now
...                 # work with the VM
$ vagrant halt      # stop it if you don't need it anymore

Using Vagrant under Linux


What is my user agent?

January 13, 2014 1 comment

Figure out the user agent of your browser. But! You are not allowed to visit or any similar service :)

It’s time to discover netcat, the “Swiss-army knife for TCP/IP”. In a terminal launch nc and start listening on a port:

$ nc -l 8080

Visit http://localhost:8080 . Switch back to the terminal and you will see something similar:

GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Categories: ubuntu Tags: ,

docker: installation and getting started

January 10, 2014 Leave a comment

Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. (source)

Docker extends a common container format called Linux Containers (LXC) with a high-level API providing a lightweight virtualization solution that runs processes in isolation. Docker utilizes LXC, cgroups, and the Linux kernel itself. Unlike traditional virtual machines, a Docker container does not include a separate operating system, instead it relies on the operating system’s functionality provided by the underlying infrastructure. (via wikipedia)

In the following, I want to concentrate on how to install Docker and how to make it run on Ubuntu. To learn more about Docker (what is it good for, what can it do for you, etc.), you will have to do some research on your own. But I also plan to make more blog posts on Docker where I want to write about its use cases.

This entry is based on this post, written by Csaba Okrona. For more info check out his excellent post.

At the time of writing docker was not supported on 32 bit machines. Installing the prerequisites and docker on x86_64 machines:

$ sudo apt-get install linux-image-extra-$(uname -r) software-properties-common
$ sudo sh -c "wget -qO- | apt-key add -"
$ sudo sh -c "echo deb docker main > /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker

Let’s try it. Pull down an ubuntu base image:

$ sudo docker pull ubuntu
Pulling repository ubuntu

Let’s execute a command inside docker:

$ sudo docker run ubuntu /bin/echo hello from docker
hello from docker

The echo command was executed in the docker container, it produced an output, and this output was returned to the host (your machine).

Execute docker as non-root
As you noticed, docker must be executed with sudo. If you want to execute it with your non-root account, here is what to do:

# create the 'docker' group
$ sudo groupadd docker  # probably it already exists
# add your user to the 'docker' group
$ sudo gpasswd -a USER docker  # replace USER with your user name
# restart the service
$ sudo service docker restart

You will have to log out and log back in to make the group settings active on your account. After that you can launch docker without sudo:

$ docker images
REPOSITORY          TAG                 ID                  CREATED             SIZE
ubuntu              12.04               8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)
ubuntu              12.10               b750fe79269d        5 months ago        24.65 kB (virtual 180.1 MB)
ubuntu              latest              8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)
ubuntu              precise             8dbd9e392a96        4 months ago        131.5 MB (virtual 131.5 MB)
ubuntu              quantal             b750fe79269d        5 months ago        24.65 kB (virtual 180.1 MB)

Connect to a container

# start a container (and save its ID in an env. variable)
$ DOCK=$(docker run -d -i -t ubuntu /bin/bash)
# it's in the list
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
fe650a3d214f        ubuntu:12.04        /bin/bash           2 minutes ago       Up 2 minutes                            sharp_archimede
# attach to the container
$ docker attach $DOCK

Install some packages in the container

In order to install arbitrary packages, let’s enable the multiverse repos:

root@fe650a3d214f:/# cat > /etc/apt/sources.list
deb precise main universe multiverse
root@fe650a3d214f:/# apt-get update
root@fe650a3d214f:/# apt-get install python-pip
root@fe650a3d214f:/# pip install virtualenv
root@fe650a3d214f:/# apt-get install libpq-dev python-dev
root@fe650a3d214f:/# apt-get install vim

However! Any changes you do in your container, they are not permanent! That is, if you log out and you attach to it again, all your changes will be lost and you get back the same vanilla container that you saw upon your first connect. But don’t worry! Changes can be committed, i.e. changes can be made permanent.

This behaviour is actually useful. You can do anything in the container, you can try anything inside, you can’t f* it up. Just log out and log back in, and everything is back. Imagine the possibilities: you can build a secure sandboxed environment easily where you can run any untrusted code.

Committing changes

You made some changes in your vanilla ‘ubuntu’ container and you want to commit them, i.e. you want to see these changes after a relogin. Let’s commit the changes to a new container called ‘pyenv’ for instance.

You are connected to ‘ubuntu’ in a terminal. Don’t logout, otherwise you lose your changes. Open a new terminal and execute these commands:

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
fe650a3d214f        ubuntu:12.04        /bin/bash           22 minutes ago      Up 22 minutes                           sharp_archimede
$ docker commit fe650a3d214f pyenv

Now you can log out of ‘ubuntu’ and you can log in to ‘pyenv’. From now on you can commit new changes to ‘pyenv’. If you need a new vanilla container, just fork ‘ubuntu’ again.

When you commit changes, docker stores just the diffs, and when you connect to a container, it puts the necessary diffs together.

Sharing a folder between the host and the container

If you want to copy files from the host to the container, the easiest way is to create a shared folder:

$ DOCK=$(docker run -d -i -t -v /tmp/shared.folder:/shared.folder ubuntu /bin/bash)
$ docker attach $DOCK

The folder /tmp/shared.folder on the host will be mounted in the container as /shared.folder . The shared folder must exist on the host.

Categories: python, ubuntu Tags: ,

The difference between 4 GB RAM and 8 GB RAM

November 8, 2013 Leave a comment

Yesterday at my workplace I got +4 GB RAM; now I have 8 GB RAM in my machine. The difference? It’s huge! I was suffering with 4 GB, it was damn slow. When I launched VirtualBox it simply bacame unusable. And now? It’s fast :) I can run Firefox, VirtualBox, PyCharm, etc. at the same time without any problem.

Conclusion: 4 GB sucks, 8 GB rulz.

Categories: ubuntu Tags: , ,

take a screenshot and upload to imgur

November 5, 2013 Leave a comment

I want to grab a part of the screen by selecting a rectangle. I wanto to be able to refine the selection (resize the rectangle) like in Gimp. Then upload the selected image to imgur.

I found a great tool for this task called Nanoshot.

Read more about Nanoshot in this thread.

Download Nanoshot from here.

Note that I had to install the package python-wnck (via apt-get) to make it run.

Categories: python, ubuntu Tags: ,

Get every new post delivered to your Inbox.

Join 61 other followers