Category: Debian

IPv4 for APT


At times, apt may try IPv6 to resolve a domain name. In which case, it may not be desirable and sometimes, it just doesn’t work for that particular server. So, to let apt to use only ipv4 for DNS resolution…

Edit /etc/gai.conf

uncomment the following line…

precedence ::ffff:0:0/96 100

If the above line doesn’t exist, just insert it at the bottom or at the top of the file!

Verify the changes with the command (before and after the changes)…


UFW error in Debian

UFW, Uncomplicated Firewall, was created for Ubuntu, then ported to other distributions as well, primarily to Debian. So, it’s no wonder, there are some incompatibilities when running UFW under Debian, at times. Those incompatibilities or errors are usually fixed in the stable releases. However, due to the difference between how things work and how we expect things to work, there may be some errors with the default configuration.

In Debian 7, UFW was installed lately. And, in the end of deploying it, the following command was run…

sudo ufw --force enable

Immediately, it provided the following error…

ERROR: problem running ufw-init

Upon digging through the issue, I noticed that IPv6 address wasn’t available in that server and UFW meant to complain about it. So, the solution is to disable IPv6 in UFW, by editing


and then comment out the line



Happy firewalling!

View Allocated Memcached Memory

Here is a little snippet to see the allocated memory for memcached server in an Debian based distribution…

# install libmemcached-tools, if not done already
apt-get -y install libmemcached-tools

/usr/share/memcached/scripts/memcached-tool stats | grep limit_maxbytes | awk '{print $2/(1024*1024)}'

This will output the max memory that memcached server can use in MBs.