If suddenly noticed that your apt-get hangs on for example update command – and the line on which it is hanging resembles something like that:

Ign http://mirror2.hs-esslingen.de precise InRelease
Get:1 http://mirror2.hs-esslingen.de precise Release.gpg [189 B]
Get:2 http://mirror2.hs-esslingen.de precise Release [1,394 B]
Get:3 http://mirror2.hs-esslingen.de precise/main Sources [887 B]
Get:4 http://mirror2.hs-esslingen.de precise/main amd64 Packages [3,280 B]
Get:5 http://mirror2.hs-esslingen.de precise/main i386 Packages [3,275 B]
Ign http://mirror2.hs-esslingen.de precise/main TranslationIndex
Ign http://mirror2.hs-esslingen.de precise/main Translation-en_US
Ign http://mirror2.hs-esslingen.de precise/main Translation-en
100% [Connecting to mirror.hetzner.de (2a01:4f8:0:a101::1:1)]

This means your apt-get is trying to update itself and use IPv6 for that purpose. If you wish to force your system to always use IPv4, then add the following line into /etc/gai.conf file:

precedence ::ffff:0:0/96  100

That should fix the problem.