Tag Archives: linux

Debugging IO on Android

Android is Linux based, so there are some interesting way to monitor and debug IO activity especially on storage.

The one I found more useful is this:

  1. enable dumping of IO info
    echo 1 > /proc/sys/vm/block_dump
  2. observe kernel log
    cat /proc/kmsg
  3. make your analysis
  4. disable dumping of IO info
    echo 0 > /proc/sys/vm/block_dump

The output you will get is similar to this:
<7>[71477.927886] kswapd0(24): WRITE block 21240712 on mmcblk0p12 (8 sectors)
<7>[71477.928436] kswapd0(24): WRITE block 21410792 on mmcblk0p12 (8 sectors)
<7>[71477.928710] kswapd0(24): WRITE block 21240704 on mmcblk0p12 (8 sectors)
<7>[71477.929016] kswapd0(24): WRITE block 21240656 on mmcblk0p12 (8 sectors)
<7>[71477.929443] kswapd0(24): WRITE block 25427968 on mmcblk0p12 (8 sectors)
<7>[71477.929687] kswapd0(24): WRITE block 8 on mmcblk0p12 (8 sectors)
<7>[71477.930084] kswapd0(24): WRITE block 0 on mmcblk0p12 (8 sectors)
<7>[71478.086639] sdcard(159): READ block 23431168 on mmcblk0p12 (256 sectors)
<7>[71478.087036] sdcard(159): READ block 23430912 on mmcblk0p12 (8 sectors)
<7>[71478.258148] sdcard(159): READ block 23430920 on mmcblk0p12 (200 sectors)
<7>[71478.258514] sdcard(159): READ block 23431424 on mmcblk0p12 (8 sectors)
<7>[71478.266967] sdcard(138): READ block 23430656 on mmcblk0p12 (32 sectors)
<7>[71478.268798] sdcard(159): READ block 23430688 on mmcblk0p12 (64 sectors)
<7>[71478.269409] sdcard(159): READ block 23430752 on mmcblk0p12 (128 sectors)
<7>[71478.271484] sdcard(159): READ block 23430880 on mmcblk0p12 (32 sectors)
<7>[71478.600646] sdcard(138): READ block 23431432 on mmcblk0p12 (512 sectors)
<7>[71478.765136] sdcard(159): READ block 23431944 on mmcblk0p12 (256 sectors)
<7>[71478.958129] Compiler(412): READ block 327320 on mmcblk0p11 (8 sectors)
<7>[71478.958557] Compiler(412): READ block 327400 on mmcblk0p11 (48 sectors)

Tried on my rooted Galaxy Nexus with CyanogenMod 10.1.0-RC1.

 

Postfix with gmail as relay on Debian Squeeze

My Situation

A server running Debian Squeeze.
A valid Gmail account.

Procedure

Make sure you have the right packages installed
# aptitude install postfix libsasl2 ca-certificates libsasl2-modules

Make a backup of your original files
# tar cfz /var/backups/etc-postfix_20121105.tgz /etc/postfix/

Modify /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

Create /etc/postfix/sasl/passwd with your “user” and “password” values
[smtp.gmail.com]:587 theuser@gmail.com:thesecretpassword

Secure your new file and make it usable for Postfix
# chmod 400 /etc/postfix/sasl/passwd
# postmap /etc/postfix/sasl/passwd
# ls -l /etc/postfix/sasl/
total 12
-r-------- 1 root root 57 Nov 5 00:39 passwd
-rw------- 1 root root 12288 Nov 5 00:40 passwd.db

Make sure you have the right certification authorities available to Postfix
# cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem >> /etc/postfix/cacert.pem
# cat /etc/ssl/certs/Equifax_Secure_Global_eBusiness_CA.pem >> /etc/postfix/cacert.pem

Restart Postfix
/etc/init.d/postfix restart

done

Android on Ubuntu: IOException on aapt

As I told in a previous post, I’m setting up a new Ubuntu installation and I want to compile something for Android on it.

After installing Android SDK I got this error on my first iteration of “ant debug”

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:621: The following error occurred while executing this line:
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:657: Execute failed: java.io.IOException: Cannot run program "/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt": error=2, No such file or directory

The error is in some way misleading because the binary is there, but the problem is that it’s a 32-bit executable

max@praxi:~$ ls -l /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
-rwxr-xr-x 1 max max 929400 Jul 27 14:33 /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt

max@praxi:~$ file /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

The solution is near: we need 32-bit libraries

root@praxi:~# aptitude install ia32-libs

As always it’s a good idea to RTFM: