30/11/2015

apt-get update gets stuck

Just a quick note: apt-get update froze regularly updating my software sources, with the shell output stuck at 100% [Connecting to security.ubuntu.com] or similar.
Apparently, this was caused due to IPv6 being enabled on my system. See this askubuntu discussion.
Fixes (as copied from the link above):
  • edit /etc/gai.conf and uncomment the last line to change the order of precedence to IPv4 first:
    #
    # For sites which prefer IPv4 connections change the last line to
    #
    precedence ::ffff:0:0/96 100
  • Alternative: disable IPv6. Not sure whether that is a good idea, so first try option 1. Anyway, you can reverse this action by deleting the lines added to /etc/sysctl.conf (everything below #disable ipv6).
    echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
  • Check whether IPv6 is enabled with cat /proc/sys/net/ipv6/conf/all/disable_ipv6, output is 0/1 for enabled/disabled.
  • "Have you tried switching it off and on again?"

27/11/2015

Bunched up fonts in printing (from Okular)

Left side: This is how it looked in Okular. Right side: This is how it was printed. Solution courtesy of  ubuntuforums.org.
Pull up the "Fonts" tab in File->Properties… and look for non-embedded fonts in the document. In this case, Helvetica is substituted wrongly.
Font substitutions are handled in ~/.config/fontconfig/fonts.conf (on (K)ubuntu, that is). I added a new match tag to the end of the file (MS core fonts are installed, so I put in Arial, if not, find a free Helvetica/Grotesk):
 <match target="pattern">
  <test qual="any" name="family"><string>Helvetica</string></test>
  <edit name="family" mode="assign" binding="same"><string>Arial</string></edit>
 </match>
</fontconfig>


Afterwards, I ran fc-cache from a shell and checked whether the substitution was correct:
$ fc-cache 
$ fc-match Helvetica 
Arial.ttf: "Arial" "Normal"

Note: I didn't delve into why the substitution went wrong. Tex Gyre Hero actually seems to be working Helvetica substitute, and the weird bunching showed up all over the printout, not just in the sans serif parts. Whatever, it worked.