Just one more blog on internet

Sync UbuntuTouch Contacts & Calendar with ownCloud

Sync UbuntuTouch Contacts & Calendar with ownCloud

November 21,2015 by mahmadz

UbuntuTouch (also called UbuntuPhone) is new and under active development. One usual expectation from any user is to be able to sync data with services. As of today, it comes with the ability sync with Google only. Problem is Google is really deep and evil when it comes to surveillance. So I tried to sync with my ownCloud and here is what I had to do:

Tools Required

  1. ownCloud server running which would be accessible from the Internet with Contacts and Calendar App installed (whichever is required for sync).
  2. SyncEvolution which is now pre-installed in UbuntuTouch.
  3. Terminal App on your device.

Commands to be Executed

  1. Open the Terminal App on your UbuntuTouch device.
  2. Tell SyncEvolution about your ownCloud server and its details:

    syncevolution --configure --keyring=no --template webdav username=USERNAME password='PASSWORD' syncurl="YOURSERVER.COM/owncloud" target-config@owncloud

    If you are using a self signed certificate, you can use the SSLVerifyServer="0" option to ignore its verification (although this is a security risk):

    syncevolution --configure --keyring=no --template webdav username=USERNAME password='PASSWORD' syncurl="YOURSERVER.COM/owncloud" SSLVerifyServer="0" target-config@owncloud

    Another alternate is to download the certificate and place it in on your UbuntuTouch device. Add the SSLServerCertificates switch to specify the location of the certificate:

    syncevolution --configure --keyring=no --template webdav username=USERNAME password='PASSWORD' syncurl="YOURSERVER.COM/owncloud" SSLServerCertificates="/home/phablet/YOURCERTIFICATE.crt" target-config@owncloud
  3. Now tell SyncEvolution about your phone

    syncevolution --configure --template SyncEvolution_Client sync=none syncURL=local://@owncloud username= password= owncloud
  4. To configure synchronization for:

    a. Contacts:

    syncevolution --configure --template webdav database=https://YOURSERVER.COM/owncloud/remote.php/carddav/addressbooks/USERNAME/contacts backend=carddav target-config@owncloud contacts
    syncevolution --configure sync=two-way backend=contacts database=Personal owncloud contacts
    syncevolution --sync slow owncloud contacts

    b. Calendar:

    syncevolution --configure --template webdav database=https://YOURSERVER.COM/owncloud/remote.php/caldav/calendars/USERNAME/personal backend=caldav target-config@owncloud calendar
    syncevolution --configure sync=two-way backend=calendar database=Personal owncloud calendar
    syncevolution --sync slow owncloud calendar
  5. Once the data is synchronized for the first time, you can use the normal commands:

    syncevolution owncloud contacts
    syncevolution owncloud calendar


I prefer putting all there commands in a script file on my PC and then copy/execute it on the UbuntuTouch device. 👍

I took help from the following links:


Let me know what worked for you 😊

How to execute bash script at upstart

How to execute bash script at upstart

October 29,2015 by fzfatima

In this tutorial, we will learn how to execute a bash script at upstart.

What is Upstart?

Upstart is an event-based replacement for the /sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and supervising them while the system is running.


Create a Job in /etc/init.

sudo gedit /etc/init/sync_user.conf

Job configuration files are named as <name>.conf

Add the following lines to sync_user.conf

start on filesystem and net-device-up IFACE!=lo
  stop on runlevel [016]

  exec bash -c 'path_to_bash_script_file/file_name start'
end script

To ensure that you haven't misused the Upstart syntax, use the init-checkconf command:

init-checkconf sync_user.conf

Then start the job

sudo start sync_user

Understating the code

Start on condition:

start on filesystem and net-device-up IFACE=lo

Job will be started when the filesystem is mounted and net-device-up IFACE=lo event, which signifies the local network (for example, for IPv4) is available.

Stop on conditon:

stop on runlevel [016]

This ensures the job will be stopped on shutdown[0], when switching to single-user mode[1] and on reboot[6].

Runlevels for Debian and Ubuntu systems are generally as follows:

  0 : System halt.
  1 : Single-User mode.
  2 : Graphical multi-user plus networking (DEFAULT)
  3 : Same as "2", but not used.
  4 : Same as "2", but not used.
  5 : Same as "2", but not used.
  6 : System reboot.


All job files must have either an exec or script stanza. This specifies what will be run for the job.

  exec bash -c '/opt/local/our-sync-pkg-2.0/sync_users start'
end script

exec gives the path to a binary on the filesystem and optional arguments to pass to it.

Executing bash script

By default, Upstart uses "/bin/sh" to execute script sections. You can change the default shell.

But it can done in simplest way by executing this line:

exec bash -c '/opt/local/our-sync-pkg-2.0/sync_users start'

bashin exec is used because we're executing the bash script.

-c option after bash means that commands are read from string.

end script will terminate the script.

This will work! If you have any suggestions on improving this post, let me know.

Simplest way to create debian package via fpm

Simplest way to create debian package via fpm

September 17,2015 by owaishanif786

Debian Packaging

In this tutorial we will look through how to package some simple hello world script. A quote from debian maintainer's guide:

One thing is certain, though: to properly create and maintain Debian packages takes many hours. Make no mistake, for our system to work the maintainers need to be both technically competent and diligent.

We have many methods to create a Debian package In this tutorial we will use FPM.


This method requires minimum effort follow this if you don't want to upload to PPA. However it requires ruby gem and package name FPM. check wiki for further details.

mkdir -p ~/via-fpm/debian/usr/bin/
cd ~/via-fpm/debian/
touch ~/via-fpm/debian/usr/bin/
gedit ~/via-fpm/debian/usr/bin/

Add following lines to script.

echo "hello debian packaging via fpm"

Save and close that file. whatever folder structure you will put in your source folder it will automatically copied into respected folders. There is no need to to copy them. For example if you want to put some sources file in /opt/local/sources then you must have same structure in you application source. Similarly usr/bin/ files will automatically copied to their respected folder in this case that will be /usr/bin.

Next we will come towards the scripts that will automatically run like preinstall , post install , pre un-install and post un-install . If you want to create user, directories, set permissions then these scrips are for you. You can use bash here. In this demo we will use "postinst" script to set permission for ~/via-fpm/debian/usr/bin/ create postint file in described location and add the following code.

mkdir -p opt/local/
touch opt/local/postinst
gedit opt/local/postinst

Set so that user can execute command from shell.

set -e
sudo chmod +x ~/via-fpm/debian/usr/bin/ 
exit 0

It't time for packaging.

cd ~/via-fpm
fpm --epoch 1 -s dir -e -C debian \
-a all -m "uncle demo <>" \
--description "our absurd debian package for demo via fpm" \
-v 1.0  -t deb  -n hello-via-fpm --after-install debian/opt/local/postinst 

Switches that we have used and their meaning

-epoch: Used for epoch value is somehow versioning number
-e: Edit the package spec before building. (default: false)
-C: Change directory to here before searching for files
-a: The architecture name. Usually matches 'uname -m'. For automatic values, you can use '-a all' or '-a: native'. These two strings will be translated into the correct value for your platform and target package type.
-m: The maintainer of this package. (default: "djhaskin987@djhaskin987-S301LA")
--description: add description
-v: specify version number
-t: output type
-n: Name to give to the package
--after-install: file to run after post install

Why FPM:

Because it will automatically create necessary files like control, rules and lot other necessary stuff for you. There are other proper ways to do that using official Debian package management through which you can upload your package to PPA. That we will discuss in next demo.


To install that package either open via Ubuntu software center or run command sudo dpkg -i hello-via-fpm_1.0_all.deb


Now try to run command from shell to see that your package is installed now and further you can create your own with customizations.

Installing LibreOffice 5 in Ubuntu

Installing LibreOffice 5 in Ubuntu

August 24,2015 by MAhmadZ

The latest version of LibreOffice is here but unfortunately its not going to be available in Ubuntu 14.04 and 12.04 by default. But the good news is that we can upgrade existing version by typing these commands:

sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get update && sudo apt-get -y dist-upgrade

That should be enough! :-)

Disable Guest Account in Ubuntu

August 24,2015 by MAhmadZ

Ubuntu has a special account, named Guest, which allows access (login) to the system without asking for any password. Although there are limitation applied to this account but maybe its not always desirable to have it. These steps will help in disabling it (tested under 12.04):

Open the file /etc/lightdm/lightdm.conf and add the following line to it at the end:


Once thats done, restart the relevant service:

sudo restart lightdm

This should work!

Installing Ubuntu Updates on Multiple Systems

Installing Ubuntu Updates on Multiple Systems

February 27,2013 by MAhmadZ

Today I was installing Ubuntu in my Olives School lab. There are 20 systems in total. After installing it in the first PC, I ran the Update and there were 443 of them which amounted for 337MB approx. As it can be imagined it took some time to get the first PC updated. This was clearly not what I was going to do with the rest and I had to come up with a solution.

When Ubuntu downloads these updates, it places them in /var/cache/apt/archives/ folder. In fact even after installing updates, they are not removed from the system. So a solution was simple:

  1. Copy all the downloaded packages to a USB
  2. On the next PC, run the command:

    sudo cp [path-to-usb]/* /var/cache/apt/archives
  3. Once all the files have been pasted, run the Update Manager tool and it will tell you that updates have been downloaded but not yet installed.
  4. Click on Install :-)

Tool to Manage Ubuntu Services

Tool to Manage Ubuntu Services

July 21,2010 by MAhmadZ

In an earlier post, I mentioned about the Runlevels in Ubuntu and how its different from the rest of the Linux family. Each Runlevel can be configured to start with certain services. A tool to manage the Services in Ubuntu is sysv-rc-config

This tool can be installed using the command:

sudo apt-get install sysv-rc-conf

Once installed, it can be used as:

sudo sysv-rc-conf

This tool will display all the services and the runlevels. You can easily choose which services to load and which not to. The screenshot shows how it will appear. To exit the tool, press q key.

Install Internet Explorer (IE) on Linux

Install Internet Explorer (IE) on Linux

May 19,2010 by MAhmadZ

Although I am not a fan of Internet Explorer but sometimes it cannot be ignored especially when few websites have limited their access to IE browsers only or some old websites with poor markup which only renders on IE.

Internet Explorer (IE 5, 5.5, 6 and 7) can be installed and run on any Linux distribution. The package can be found and downloaded from these links:


When installing IEs4Linux, the Linux X-Window may crash, giving you the following error message:

The program ‘’ received an X Window System error.
This probably reflects a bug in the program.
The error was ‘RenderBadPicture (invalid Picture parameter)’.
(Details: serial 5546 error_code 158 request_code 148 minor_code 7)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the –sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

The workaround this is to use the non-GUI, command based installation. To install use the command:

./ies4linux --no-gui

For further help:

./ies4linux --help

I hope the day comes when all of this is not required and we have a true cross-browser web.

Join FLV files in Ubuntu

May 19,2010 by MAhmadZ

When we download video from Youtube or any other website, 90% chances are you are watching them using Flash Video Player whose format is FLV. Some of the videos uploaded in Youtube are sliced into multiple parts especially when Youtube only allowed you to upload a video of maximum 10 minute duration.

There is a simple but useful way of joining these files into a single under Ubuntu.

First you will need to install the package:

sudo apt-get install avidemux

Next, keeping the audio/video encoding unchanged, just join them (change the filenames accordingly):

mencoder -forceidx -of lavf -oac copy -ovc copy -o output.flv clip1.flv clip2.flv clip3.flv

Google Chrome error – Your preferences can not be Read

Google Chrome error – Your preferences can not be Read

May 30,2010 by MAhmadZ

Sometimes Google Chrome under Linux or Ubuntu gives the following error:

Your preferences can not be read. Some features may be unavailable and changes to preferences won’t be saved.

This is because the owner of the following files have been changed for some unknown reason: Under /home/[user]/.config/google-chrome/ the file Locale State and under /home/[user]/.config/google-chrome/Default the file Preferences.

Note: This tip works for Linux, for Windows the steps have not been personally tested.

If you are using Windows XP:

C:\Documents and Settings\[Username]\Local Settings\Application Data\Google\Chrome\User Data\Default

If you are using Windows 7:

C:\Users\[Username]\AppData\Local\Google\Chrome\User Data\Default

If you are using Linux:


Where user is the supposed name of the user.

To fix the problem, run the following commands (replacing user with the actual username):

sudo chown user:user /home/user/.config/google-chrome/Locale\ State
sudo chown user:user /home/user/.config/google-chrome/Default/Preferences

To fix the permissions in Windows, visit this link: How do I change folder and file Permissions?. Simply deleting the Google folder in the paths specified will also help.

InshAllah the problem will be solved!

Install Apache, PHP and MySQL on Ubuntu

April 29,2012 by MAhmadZ

Installing these packages on Ubuntu is very simple. Just execute the following commands and you will be done with everything.

Install Apache

sudo apt-get install apache2

Install PHP

sudo apt-get install php5 libapache2-mod-php5

Install MySQL (with Apache & PHP support)

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Restart Apache

sudo /etc/init.d/apache2 restart

Install MySQL Query Browser

sudo apt-get install mysql-query-browser

Update for MySQL

MySQL has officially declared EOL (End of Life) for Query Browser. You can check it on

MySQL Workbench is its replacement and its now available in Ubuntu 12.04 repositories:

sudo apt-get install mysql-workbench

All features are supported by Workbench. Additionally you can check my answer on

Mount BIN CUE Images in Ubuntu

March 15,2010 by MAhmadZ

Mounting ISO files in Linux is quite straight forward and simple e.g. using the mounter function in Ubuntu straight from the context menu or by using a command line like this:

mount -o loop image.iso /mnt

Anyway mounting BIN/CUE image files is not that straight forward as they’ll need conversion to ISO before mounting, however the process is quite simple, but it need a small application called bchunk. The bchunk package contains a UNIX/C rewrite of the BinChunker program. It converts a CD image in a .bin/.cue format (sometimes .raw/.cue) into a set of .iso and .cdr/.wav tracks. The .bin/.cue format is used by some non-UNIX CD-writing software, but is not supported on most other CD-writing programs.

To install the package:

sudo aptitude install bchunk

In order to convert a bin/cue image set:

bchunk image.bin image.cue image.iso

Then to mount the iso image using this command:

mount -o loop image.iso /mnt

Now you can view the contents in the folder /mnt.