≡ Menu

apt-get command

Ubuntu Linux today pushed out a new version of Linux kernel to fix serval local and remote security issues. A malicious CIFS server could cause a client system crash or possibly execute arbitrary code with kernel privileges. On SMP systems, a race condition existed in fcntl(). Local attackers could perform malicious locks, causing system crashes and leading to a denial of service. This security issue affects the following Ubuntu, Kubuntu, Edubuntu, and Xubuntu. releases:

=> Ubuntu 6.06 LTS
=> Ubuntu 7.04
=> Ubuntu 7.10

To fix this issue type the following two commands:
$ sudo apt-get update
$ sudo apt-get upgrade

You need to reboot your computer to effect the necessary changes, enter:
$ sudo reboot

Ubuntu Software Update How To

One of our regular reader asks:

How do I update and patch system under Ubuntu Linux? How do I update desktop and server edition software?

Updating software under Ubuntu Linux is pretty easy. There are two ways to update software as follows:

Method # 1: Ubuntu Linux Software update using command line tools

apt-get is the command-line tool for handling packages, updating package and installing patches under Ubuntu Linux. All you have to do is type the following two command to update all installed software to latest version.

Open terminal and type the following two commands:
$ sudo apt-get update
$ sudo apt-get upgrade

Sample output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  linux-headers-generic linux-image-generic openssh-client openssh-server ssl-cert
The following packages will be upgraded:
  ca-certificates cupsys cupsys-bsd cupsys-client cupsys-common evolution evolution-common evolution-plugins gstreamer0.10-esd gstreamer0.10-plugins-good
  kdelibs-data kdelibs4c2a libcupsimage2 libcupsys2 libgnutls13 libhsqldb-java libpq5 libsmbclient libsmbclient-dev libspeex-dev libspeex1 libssl0.9.8
  linux-image linux-libc-dev linux-restricted-modules-common linux-source-2.6.22 linux-ubuntu-modules-2.6.22-14-generic openoffice.org openoffice.org-base
  openoffice.org-calc openoffice.org-common openoffice.org-core openoffice.org-draw openoffice.org-evolution openoffice.org-filter-mobiledev
  openoffice.org-gnome openoffice.org-gtk openoffice.org-impress openoffice.org-java-common openoffice.org-math openoffice.org-style-human
  openoffice.org-writer openssl python-uno samba-common smbclient ssh ssh-askpass-gnome ttf-opensymbol tzdata update-manager update-manager-core
  vorbis-tools xserver-xephyr xserver-xorg-core xserver-xorg-dev
56 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Need to get 183MB of archives.
After unpacking 119kB of additional disk space will be used.
Do you want to continue [Y/n]? y 

Method # 2: GUI tool - Ubuntu Update Manager

This is a GUI tool. It works like Microsoft / Red Hat / Fedora update manager i.e. you will see a little icon in the kicker bar/taskbar when there are updates available. It will only appear when new upgrades are available. All you have to do is click on it and follow the online instructions.

You can also star GUI tool by Clicking System > Administration > Update Manager > Select Install update
Ubuntu Linux Software Update manager
(Fig.01: Ubuntu Linux Software Update Manager in Action)

Here is a quick way to fix half installed packages under Debian / Ubuntu Linux.

If you see an error while removing or installing debian / ubuntu package that read as follows:

(Reading database ... 147148 files and directories currently installed.)
Preparing to replace octopussy 0.9.6.2 (using octopussy_0.9.6.2_all.deb) ...
Unpacking replacement octopussy ...
dpkg: warning - old post-removal script returned error exit status 10
dpkg - trying script from the new package instead ...
dpkg: error processing octopussy_0.9.6.2_all.deb (--install):
subprocess new post-removal script returned error exit status 10
dpkg: error while cleaning up:
subprocess post-removal script returned error exit status 10
Errors were encountered while processing:
octopussy_0.9.6.2_all.deb

In above octopussy package is not getting removed because of script error. Mostly these are shell script written using /bin/sh. These scripts called with -e option which means if not interactive, exit immediately if any untested command fails. The exit status of a command is considered to be explicitly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an && or || operator. In short shell scripts will abort with an error if something fails. To fix this problem visit /var/lib/dpkg/info directory
# cd /var/lib/dpkg/info
Now find out files in following format:
packagename.*
octopussy.*
$ ls octopussy.*
Now open each file and find out line that read as follows:
#/bin/sh -e
Replace with
#/bin/sh
Save and close all the files. Now run apt-get / dpkg command again to remove package:
# apt-get --purge remove octopussy
OR
# dpkg -r octopussy

apturl lets you install packages using a apt:pkgname like synatx. For example, install php5 package by visiting url. You should see prompt as follows:
apturl

You can install apturl under Ubuntu Linux by entering following command:
$ sudo apt-get install apturl

=> apturl package project home page. (found via Linux Hack3r)

How to: Linux Play DivX .avi video codec file

From my mail bag:

I've downloaded .avi files which is compressed into small sizes while maintaining relatively high visual quality using DivX format. How do I play DivX compressed files under Debian / Ubuntu Linux?

The current version of the DivX Community Codec for the Windows platform is version 6.6, and for Mac OS X is 6.6x. There is no Linux version available however with the help of VLC and DivX for Linux codec, you should able to play all sort of DivX files.

Download and Install DivX Linux Codec

Open terminal and type the following command to download DivX codec:
$ cd /tmp
$ wget http://download.divx.com/labs/divx611-20060201-gcc4.0.1.tar.gz

Untar DivX 6.1.1 codec for Linux:
$ tar -zxvf divx611-20060201-gcc4.0.1.tar.gz
Install divx611 codec:
$ cd divx611-20060201-gcc4.0.1
$ sudo ./install.sh

Press Q after reading agreement, please type yes to install codes.

Install vlc player

The VLC media player can be installed using apt-get command, type:
$ sudo apt-get update
$ sudo apt-get install vlc

How do I play files?

Open VLC player by Visiting Applications > Sound and Video > VLC Player. You can also open terminal and type the command:
$ vlc /path/to/my-downloaded-movie.avi

Further readings:

Favorites icon (favicon) file is placed in a web server root directory. It is a page icon or associated with a particular website. For example when you visit our site you see favicon in the browser's URL bar, next to the site's name. Also it appears next to the site's name in lists of bookmarks, and next to the page's title in a tabbed document interface.

There is a tool called ppmtowinicon which convert 1 or more portable pixmaps into a Windows .ico file You need to specify one or more portable pixmaps as input and it produces a Microsoft Windows .ico file as output. A Windows icon contains 1 or more images, at different resolutions and color depths. Microsoft recommends including at least the following formats in each icon (size and bits-per-pixel):
=> 16 x 16 - 4 bpp
=> 32 x 32 - 4 bpp
=> 48 x 48 - 8 bpp

How to create a favicon.ico with GIMP

How to create a favicon.ico with GIMP

You need to install netpbm - a graphics conversion tools under Linux / UNIX. You also need GIMP - the GNU Image Manipulation program to create a favicon on Linux.

Install netpbm and GIMP

Use apt-get command to install packages under Debian / Ubuntu Linux:
$ sudo apt-get install netpbm gimp

Step # 1: Convert logo to ppm raw format

  1. Open your logo using GIMP
  2. Now cut and paste logo in square
  3. Next resize logo by visiting Image > Scale image option. Set pixel size to 16 x 16 or 32 x 32 or 48 x 48.
  4. Next click on File > Save as > Enter file name as favicon.ppm > Click on Save > Raw Encoding > Ok

Step # 2: Convert portable pixmaps into a Windows .ico file

Now run the following command to create a .ico file:
$ ppmtowinicon -output favicon.ico favicon.ppm

Step # 3: Upload favicon.ico file

Upload favicon.ico file to webserver root directory such as /var/www/html or /srv/httpd/cyberciti.biz.

Step # 4: Favicon example

To activate favicon, modify your site pages or template by placing following code between <head>...</head> section:

<link rel="shortcut icon" href="/favicon.ico" />

Upgrading lighttpd is a piece of cake. There are two methods:

a) Use yum or apt-get or FreeBSD ports / command to update binary lighttpd package

b) Just download latest lighttpd tar ball from official web site and install the same.

Let us see how to upgrade lighttpd using source code (tar ball).

# 1 : Download lighttpd

Use wget or lftp command line http / ftp accelerator tools:
$ cd /opt
$ wget http://www.lighttpd.net/download/lighttpd-1.4.17.tar.gz

# 2 : Verify lighttpd

Use sha1sum or md5sum hash to verify lighttpd tar ball integrity:
$ md5sum lighttpd-1.4.17.tar.gz

# 3: Configure lighttpd

Now configure and compile lighttpd web server:
$ ./configure
$ make

# 4: Stop lighttpd

First stop currently running lighttpd web server:
# /etc/init.d/lighttpd stop
Make sure you are in installation directory, use the following command to uninstall old version:
# make uninstall

# 5: Install lighttpd

Just enter the following command:
# make install
Start lighttpd:
# /etc/init.d/lighttpd start
Watch out for lighttpd log files for any problems:
# tail -f /var/log/messages
# tail -f /var/log/lighttpd/error.log
# tail -f /var/log/lighttpd/scripts.log
# tail -f /var/log/lighttpd/access.log

A note about binary package upgrade method

You can download rpm file or use yum / apt-get command:
apt-get update lighttpd
yum update lighttpd