Feb 13, 2014 Downtime

Sorry for the downtime on Feb 13, the VPS which hosts this site had a hypervisor failure, at least that’s what I was told by my hosting provider Digital Ocean.

Download Test Files

While this isn’t a definitive test of available bandwidth it should help you form an idea of what an Internet link throughput is. wget -O /dev/null avoids skewed results caused by disk performance limitations.

Location: CDN

wget -O /dev/null

Location: USA and Amsterdam

wget -O /dev/null
wget -O /dev/null
wget -O /dev/null

Location: USA, UK, and Japan

wget -O /dev/null
wget -O /dev/null
wget -O /dev/null
wget -O /dev/null
wget -O /dev/null
wget -O /dev/null

Location: USA and Netherlands

wget -O /dev/null
wget -O /dev/null

Location: USA

wget -O /dev/null


Location: France

wget -O /dev/null

Automatically Mount A USB Drive In Ubuntu Server

USB drives can be easily and automatically mounted on Ubuntu Server with the help of USBmount which is available from the Ubuntu and Debian repositories. Fortunately, USBmount requires little configuration in order to work. The following was tested in Debian 7 Wheezy and Ubuntu 13.04.

Installation and Configuration

Make sure you run apt-get update/upgrade before starting the tutorial.

sudo apt-get update
sudo apt-get upgrade

Now install USBmount from the repositories.

sudo apt-get install usbmount

USBmount mounts all USB drives in /media/usb*.

Now plug a USB drive and wait for it to be detected and mounted. As long as the host OS supports the File System it should be mounted.


To verify whether the USB drive was mounted correctly you can use df -h to view all available drives and their respective mount points. My 4GB USB drive is accessible from the /media/usb0 mount point.

user@debian:~$ df -h
Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                   49G   18G   29G  38% /
udev                                                     10M     0   10M   0% /dev
tmpfs                                                   100M  432K  100M   1% /run
/dev/disk/by-uuid/af874479-b4ee-4d83-a3da-d2fdb48511ea   49G   18G   29G  38% /
tmpfs                                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                                   404M     0  404M   0% /run/shm
/dev/sdb1                                               138G   14G  118G  11% /media/hdd1
/dev/sdc1                                               3.8G  6.6M  3.8G   1% /media/usb0

To un-mount a drive you can use umount.

sudo umount /media/usb0


USBmount is quite handy for mounting USB drives with no effort.

502 Bad Gateway – Nginx and PHP-FPM

Nginx 502 Bad Gateway cost me more time than the actual Ubuntu + PHP-FPM + MySQL installation I was working on. In my case the 502 Bad Gateway error on my installation was the result of a parameter mismatch between /etc/ningx/sites-available/default and /etc/php5/fpm/pool.d/www.conf.

In order to solve the 502 Bad Gateway problem edit the Nginx file /etc/ningx/sites-available/default.

nano /etc/ningx/sites-available/default

And look for the commented line # fastcgi_pass unix:/var/run/php5-fpm.sock; and uncomment the line.

fastcgi_pass unix:/var/run/php5-fpm.sock;

You location ~ \.php$ { section should look similar to mine.

 location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #       # With php5-cgi alone:
        #       fastcgi_pass;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

The final two steps are to restart Nginx and PHP-FPM.

sudo service nginx restart
sudo service php5-fpm restart

Now you have a working installation like it should have been from the beginning.


Mount A USB Drive In Ubuntu Server

Before we can mount a USB drive we need to gather some information about it. With the help of fdisk we can see that my 4GB USB drive was recognized as /deb/sdc1 and is formatted with FAT32.

sudo fdisk -l

Disk /dev/sdc: 4049 MB, 4049600512 bytes
255 heads, 63 sectors/track, 492 cylinders, total 7909376 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x04c91666

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048     7909375     3953664    b  W95 FAT32

Now create a mount point where the USB drive will be mounted. Only one drive per mount point.

sudo mkdir /media/usb

There is a good change your USB drive will be formatted with FAT16/32 therefore using the parameter -t vfat will suffice, otherwise you can use -t ntfs or -t ext3 depending on the file system.

sudo mount -t vfat /dev/sdb1 /media/usb

Make sure drive was mounted with the help of df -h. The 4GB USB drive is mounted and accessible from the /media/usb mount point.

user@debian:~$ df -h
Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                   49G   18G   29G  38% /
udev                                                     10M     0   10M   0% /dev
tmpfs                                                   100M  432K  100M   1% /run
/dev/disk/by-uuid/af874479-b4ee-4d83-a3da-d2fdb48511ea   49G   18G   29G  38% /
tmpfs                                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                                   404M     0  404M   0% /run/shm
/dev/sdb1                                               3.8G  6.6M  3.8G   1% /media/usb

To un-mount the drive you can simply use the umount command folowed the mount point.

sudo umount /media/usb

Disable Emergency Alerts In The HTC One V

Why would I disable the emergency alerts in my phone, well they tend to sound as if the world is about to end no matter the time of day. Also depending on the season you might received multiple alerts during the day.


Let’s Disable The Alarms

Find and select the Messages icon.


Once in the Messages application tap on Menu which is located in the upper right corner. From the drop down menu select Settings.


Select Emergency alerts.


Uncheck all available options. You can’t uncheck Presidential alert.


This is how your screen should look.


Now you can rest assured an emergency alert won’t wake you up in the middle of the night(multiple times).

Increase Console Resolution In Ubuntu

Higher resolution means more text in the same window this especially applies to the console. The following was tested in Debian 7 Wheezy and Ubuntu 13.04. With Grub 2 with can easily increase the resolution by making a few changes.

Console Resolution

Open and edit the grub file.

nano /etc/default/grub

Search for the following line and uncomment “#GRUB_GFXMODE=640“, modify it to include a higher resolution such as 1440×900. Also add the line “GRUB_GFXPAYLOAD_LINUX=keep“.


The lines above should be what increases the console resolution.

Now update Grub.

sudo update-grub

And restart the system.

sudo shutdown -r now

Now you should be able to make better use of your monitor resolution.

HTOP 1440x900

Passwd: Authentication token manipulation error – Ubuntu

You probably encountered this error while trying to reset the password on a Ubuntu system.

root@u13-04:~# passwd nyuser

Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged

This is the result of trying to work on a file system while mounted as read-only. The solution is a simple one. Before making changes to the users password mount the filesystem as read-write which allows for the necessary changes to be made.

mount -o rw,remount /

Now try to change the users passwords again.

root@u13-04:~# passwd nyuser

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Can Not Add SSH Key To Ubuntu

I wanted to add an SSH key to a new minimal Debian VM install, but attempting to add the key resulted in a No such file or directory error.

# sudo cat >> .ssh/authorized_keys

   cat: No such file or directory

The error was the result of the non-existent authorized_keys file which is where SSH key happens to be stored.

If we look inside the ~/.ssh directory you will notice the missing authorized_keys file.

# cd ~/.ssh

# ls


To be able to store the SSH key create the missing authorized_keys in the right location and with the right permission.

Move to the directory where key files are stored for the user.

# cd ~/.ssh

Create necessary file.

# touch authorized_keys

Assign permission to file.

# chmod 600 authorized_keys

Copy SSH key to authorized_keys file.

# cat >> .ssh/authorized_keys

Optional, but I recommend removing the key since its no longer needed.

# rm

Restart the service.

# sudo service ssh restart

How to Print on an Envelope with LibreOffice

Printing on an envelope with LibreOffice is actually easy, the hardest part being handling the envelope after printing is done.

Here’s what you will need:

  • LibreOffice Writer
  • Regular envelop(mine is a type #10)
  • Printer(Mine is a Samsung laser printer)

Obviously before starting the the tutorial insert the envelope on your printer paper tray, the position may vary depending on your printer. In my printer the envelopes are loaded sideways. Also keep in mind that laser printers will warm the envelope glue which will become somewhat sticky, just make sure that once the envelope is out of the printer you separate the flap to prevent it from sticking to the envelope permanently.

Printing on Envelopes


Open LibreOffice Writer and click on Insert > Envelope…


A new window opens. There are two boxes where you will input the typical information that goes into an envelope. The Addressee information goes on the top and the sender information on the bottom.


On the top of the window click on the Format tab, this tab allows you to select the envelope type. Note: In my case I use envelope type #10 commonly received in the mail.


Change any field you consider necessary. When done click on Insert. This will insert the envelope information into a document.

Now you can once again review the information(again), if you spot any mistakes you can still make changes. If everything is accurate click on the Printer icon to print the information in the envelope.


And here is the result.

libreoffice_envelope_5If you have any comments use the section below to leave one. Thank you.