How to download a file concurrently/simultaneously from different sources in Ubuntu

In order to achieve this, you need to download an install Aria2, a lightweight, multi-source download utility. It can be installed from it’s package ‘aria2’ from the universe repositories.

[code language=”bash”]sudo apt-get install aria2[/code]

Now we need to create a file containing the source URLs for the file(s) we need to download. The source/mirror URLs should be separated by a tab or newline. The mirrors can also be used directly as a command line argument, but that would just make things clumsy.

I’m using Lucid Netbook Edition as an example here. My sources.txt contains the following :

Now we need to start the download using Aria2. Type this in the terminal.

[code language=”bash”]aria2c -i /path/to/sources.txt -s 12[/code]

The -i argument specifies the input file and -s argument specifies how many connections will be used to simultaneously download the file. Here, we have 12 mirrors for the .iso file, so I used 12 in the argument. According to the aria2c man page, if the value specified in the -s argument (say, N) is less than the number of mirror URLs, the first N URLs will be used and the rest will be used as backup. Otherwise, if the number of mirrors is less, a single source is used more then once, so that N connections can be made.

Aria2 is a wonderful download utility that support Metalinks and BitTorrent other than the usual http, ftp. It can be used to do a whole range of things, but we will keep ourselves limited to the topic at hand. Maybe we will try out those possibilities in an other post.

Stop applications from auto starting in Ubuntu

If you don’t want an application to auto start in Ubuntu, you can use the instructions in this blog post. There are many ways to go about doing this. It can be performed from the terminal or you can use the BUM GUI (Boot-Up Manager) to remove auto-starting applications.

For example, say, we want to prevent the MySQL server from auto-starting. We need to remove the symlink(s) in /etc/rcX.d directory that cause it to auto start. We can manually go to the directory and delete them. Or we can run this command from the terminal :

[code language=”bash”]sudo update-rc.d -f mysql remove[/code]

You will get a message saying :

[code] Removing any system startup links for /etc/init.d/mysql …[/code]

And any symlinks pertaining to MySQL will be deleted.

Another alternative is to use the Boot-Up Manager GUI. Install it by writing :

[code language=”bash”]sudo apt-get install bum[/code]

After installation, start the application by going to Applications-> System->BootUp-Manager in Xubuntu. (In Ubuntu, the location may be slightly different). Find “Fast and stable SQL database server”, right-click on it and select “Deactivate and apply now”.

Boot-Up Manager

You are done and good to go. MySQL server will not auto-start now.

Resolving the Network Manager bug in Ubuntu 9.10

Due to a bug in Network Manager, establishing PPPoE connections is not possible on a new installation of Ubuntu 9.10 (Karmic Koala).

It is possible to resolve this bug by downloading and installing Network Manager from the Network Manager Team Launchpad Personal Package Archive (PPA). But you need to connect to the internet first, for which you can use pppoeconf.

[bash]sudo pppoeconf[/bash]

Follow the instructions that appear and set up your PPPoE connection. After it is set up, you can start your internet connection by typing in :

[bash]sudo pon dsl-provider[/bash]

And you can terminate your connection by using :

[bash]sudo poff dsl-provider[/bash]

Now that we are connected to the internet, we need to add the Launchpad PPA URL to the sources list :

[bash]gksudo gedit /etc/apt/sources.list[/bash]

For Kubuntu and Xubuntu, you will need to use kdesu kate and gksudo mousepad in place of gksudo gedit respectively.

Add these lines to the end and save the file.

[code]deb karmic main
deb-src karmic main[/code]

Now update the source list :

[bash]sudo apt-get update[/bash]

Now install Network manager using apt-get :

[bash]sudo apt-get install network-manager[/bash]

We now need to disable the “pppoe on boot” setting which is configured by pppoeconf.

[bash]gksudo gedit /etc/ppp/pppoe_on_boot[/bash]

Comment out the exec pppd call dsl-provider by adding a leading #.

We now need to rename /etc/network/interfaces to backup file. Deleting it is also an option, but keeping a backup is always recommended.

[bash]sudo mv /etc/network/interfaces /etc/network/interfaces.bak[/bash]

Edit /usr/share/polkit-1/actions/ :

[bash]gksudo gedit /usr/share/polkit-1/actions/[/bash]

Find out the line that contains :

[xml]<message xml:lang="en_GB">System policy prevents modification of system settings</message>[/xml]

Find this line after it :

[xml] <allow_active>auth_admin_keep</allow_active>[/xml]

Above it, find :

[xml] <allow_inactive>no</allow_inactive>[/xml]

Change it to :

[xml] <allow_inactive>yes</allow_inactive>[/xml]

You may revert back this change after your connections are set up.
Restart your computer after doing this. Network manager will work right after this.

Get rid of freeze-ups during disk I/O activity in Ubuntu

If you are using Ubuntu(or it’s variants), and your computer locks/freezes up or becomes unusable during copying files or heavy disk activity, this post is for you.

Ubuntu currently employs the kernel default I/O scheduler, CFQ or Completely Fair Queuing. It has been known to cause lags and lock-ups during heavy disk activity like copying/moving or backing up data, and one (still-active) bugs report demands the use of an alternative I/O scheduler by default in future Ubuntu releases.

Personally, my computer became virtually unusable during moving/copying files and it has been completely eradicated by the use of an alternative scheduler, Deadline. I’ll be using it for the examples here. Other alternative I/O schedulers include :

  • noop
  • anticipatory

At first, you need to check whether you really benefit from the use of an alternative i/o scheduler. To do this, run this from the console :

echo "deadline" | sudo tee /sys/block/sda/queue/scheduler

Now copy a large file to/from your hard drive. If the lock-ups vanish, this has worked for you. Now, we need to make this permanent for your system. To do this, you need to know which version of Ubuntu you are using. If you are using Ubuntu 9.10 (Karmic Koala) or higher, you will be using Grub2, else you’ll be using Grub Legacy. I have got instructions for both.

For Grub2 :

gksudo gedit /etc/default/grub

For Kubuntu and Xubuntu, you will need to use kdesu kate and gksudo mousepad in place of gksudo gedit respectively.

Find :


Add elevator=deadline before the end of the closing double-quotes. For me, after the edit, that line looked like this :

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline"

After you are done, save and close the file. Now run “update-grub” from the terminal.

sudo update-grub

You’ll get something like this :

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-20-generic
Found initrd image: /boot/initrd.img-2.6.31-20-generic
Found memtest86+ image: /boot/memtest86+.bin

It means grub.cfg has been rebuilt successfully. You are now good to go.

For legacy Grub :

gksudo gedit /boot/grub/menu.lst

For Kubuntu and Xubuntu, you will need to use kdesu kate and gksudo mousepad in place of gksudo gedit respectively.

Find the kernel line for your current kernel. It will be something like :

kernel /boot/vmlinuz-2.6.12-10-386 root=/dev/hda2 ro quiet splash

It will differ according to the kernel version and the logical drive to which Ubuntu is installed. Now add elevator=deadline to it. After the edit, it should look like this :

kernel /boot/vmlinuz-2.6.12-10-386 root=/dev/hda2 ro quiet splash elevator=deadline

Reboot your system and you are good to go.

Loving the Penguin

Windows XP has been replaced by Ubuntu Linux as my choice of primary operating system. I have been using it for the last three months and the experience has been amazing. The startup/shutdown happens in an instant, the machine is more responsive and it’s a good feeling to know that you are using open source software.

I’m using Xubuntu 9.10 (a variant of Ubuntu for slower systems) since my 2.8 GHz Prescott- 256 MB machine is underpowered to run Ubuntu. You can surely expect a lot of Ubuntu-related articles in the coming months.