IT, Linux, Debian, AWS, Cloud Computing, Bash, Python, Chef

Debian apt-get errors about gpg key

If during your apt activity you are getting some errors like this:  

W: GPG error: etch Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE302B

Try to add the key from keyserver specifying the key id and you should be ok

~# gpg --keyserver --recv-key  9AA38DCD55BE302B ~# gpg -a --export 9AA38DCD55BE302B | apt-key add -


Debian Lenny locales problem

Recently I bumped in a Debian Lenny locales problem,  on some amd64 cluster inside the cloud, during apt-get operations the system complains continuously about wrong or missing locales with messages like this:

perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:LANGUAGE = (unset),LC_ALL = (unset),LANG = “en_US.UTF-8″are supported and installed on your system.

or like this:

manconv: can’t set the locale; make sure $LC_* and $LANG are correct

The issue was fixed using this method,  reinstalling and regenerating the locales on the system, to avoid dependencies I used the following packages as a “bridge”:

~# apt-get install belocs-locales-bin belocs-locales-data~# locale-gen~# dpkg-reconfigure locales

After issuing the command dpkg-reconfigure locales select the locales you need from the list and you should be done.

Vmware 2.0.x build problem

If you get this error during the Vmware module compilation:

Unable to make a vsock module that can be loaded in the running kernel:insmod: error inserting ‘/tmp/vmware-config1/vsock.o’: -1 Unknown symbol in module

What you need to do is the following:

untar vmci.tar (in /usr/lib/vmware/modules/source)build the module with ‘make’untar vsock.tar and copy the “Modules.symvers” file resulting from the previous compilation into the “vsock-only” directory. Rebuild the vsock.tar file and run “”.

Speaking in bash language:

cd /usr/lib/vmware/modules/source/tar xvfp vmci.tartar xvfp vsock.tar cd vmci-only/makecp -av Module.symvers ../vsock-only/cd ..tar -f vsock.tar -cv vsock-only/

Now it should compile just fine.Thanks to Javier, I got this solution from

WordPress mu random timeouts

I would like to inform the WPMU users about a strange behavior that drove me crazy some days ago.Upgrading from previous versions to the 2.7.1 version, we got strange random errors, some kind of random “hang on” in the wpmu blogs network.After digging for a while, we found this bug: problem totally went away installing php5-curl package, on my debian servers:

apt-get install php5-curl ;/etc/init.d/apache2 restart

Hope this can help

Bandwidth: kbps to GB/month conversion

How you know how much will pay for the bandwidth used in a server inside the Cloud?Often cloud services give you a calculator but this is based on Giga Bytes per Month of traffic but normally you measure bandwidth throughput on your server in kbps.

  1. Install some graphical tool for collection of bandwidth data in your server (like Cacti, Munin, Zabbix ecc.)
  2. After some time (the longer the better, for statistical purposes) take the average bandwidth consumption, often given in kbps (Kilo Bytes per Second)
  3. Convert kbps in GB per month and this where this post become useful 🙂

So to convert kbps in GB/Month we can simply obtain a constant from the following logic steps:

  • 1kbps = 1KiloBitperSecond
  • 1KiloBitperHour = 3600 kbps
  • 1KiloBitperDay = 3600*24 kbps
  • 1KiloBitperMonth = 3600*24*30 kbps
  • 1Bit = 1Byte/8
  • 1Kilo = 1Giga/1.000.000

So the constant will be 3600*24*30/8/1.000.000 = 0.324

For example 150kbps of bandwidth will generate 150*0.324=48.6GB per month trafficor conversely, for example 80GB per Month will be 80/0.324 = 246.91 kbps on average throughtput

Therefore the constant is 0.324 and as a rule of thumb you can remember 0.3 or one/third 😉

Quick data pipeline for encryption and decryption

In the need for a quick pipeline to encrypt and decrypt data, gpg can be quite handy, for example it can be used in this way to encrypt  some backup before transferring it to a third part hosted  storage:

cat backupfile.tgz | gpg -c --cipher-algo=BLOWFISH > backupfile.tgz.gpg

(you’ll be asked for the Passphrase to use for encryption)and for decryption:

cat backupfile.tgz.gpg |gpg -d --cipher-algo=BLOWFISH > backupfile.tgz

(you’ll be obviously asked for the Passphrase again, don’t forget it and save it in a safe place!)To use it inside a script (batch process) the useful --passphrase switch can be employed:

cat backupfile.tgz | gpg -c –cipher-algo=BLOWFISH --passphrase abcdefghi1234567890 > backupfile.tgz.gpg

in this case, do not forget to set 700 the file for avoiding unwanted reading…

Clear the whole Postfix mail queue

To clear the whole Postfix mail queue you can use this command:

~# for i in `mailq|grep '@' |awk {'print $1'}|grep -v '@'`; do postsuper -d $i ; done

Thomas Sewell from contributed with this helpful notes:you could also just do:

postsuper -d ALL

to clear all mail queues or even

postsuper -d ALL deferred

to just get rid of deferred mail from the queue.Thanks Thomas! 🙂