Category Archives: Package Management

Sound problems on Ubuntu 8.04 Hardy Heron

Ubuntu 8.04 users have been facing lots of problems related to sound. This happens when you try to play an embedded flash video inside the browser. This application somewhat locks and doesn’t allow other applications like VLC, Amarok to play anything. Syslog shows

pulseaudio[5903]: module-alsa-sink.c: Error opening PCM device front:0: Device or resource busy

The bug has been reported on Launchpad, many other duplicates exist, one of which is here

A workaround is to kill the daemon and restart it again and again. Once I did these steps, it never locks again. The whole thing is still a mystery.

Kill the daemon:

pulseaudio -k

Restart the daemon

pulseaudio -D -vv

You can even try out installing libflashsupport package, but it didn’t do any magic on my system though people claim that it works. Don’t forget to restart the browser and restart the pulseaudio daemon after installing this package.

This whole killing, restarting the daemon is just a workaround. We hope that it gets fixed. This problem is faced the most in Hardy, though even if you are planning to upgrade to Intrepid, be ready to face this bug. I faced this on the desktop at my home.

Running PHP Applications on Linux

Overview:

I usually find that lots of poeple find it quite difficult to install any application made in PHP and MySQL on their Linux boxes. They find it a bit confusing how to configure the settings. How to install the LAMP stack. Where to put the PHP applications code. I was quite inspired to write to this after having I saw people facing problems on Ubuntu Forums. This is the one which I dealt with.

Sometimes spoon-feeding becomes important,but only for the first time.

Scenario:

A newbie who knows just the basics of Linux. He/She wants to run a PHP application like wordpress / phpBB / osCommerce on their computer.

The distro is assumed to be Ubuntu, though it doesn’t change much for others too.

Lets Start:

Step 1: Getting the LAMP stack on your system

You first need to install LAMP on your box, Installation is quite simple. Just get the following packages using the command on your terminal ( Applications> Accessories>Terminal)

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

While installing MySQL, it might ask for set up the root password,if it doesn’t ask, then continue.

For more information check this post here .

Step 2: Download the PHP application

You need to download the PHP application which you want to run over the webserver. Examples are WordPress, phpBB, osCommerce, MediaWiki etc

Get them and let it be in the folder where you have downloaded it.

Step 3: Moving these software to the Apache’s root directory

Apache’s root directory is /var/www (/var/www/html). This is owned by the user www-data which is a minimal user created just for running apache and web servers. A normal user cant write to this directory.

Now here is the solution of how to copy the data to this directory. This method can be used for any directory which the normal user does not have write access. The concept behind the method is to start an instance of nautilus ( explorer) with root (superuser) privileges. For this follow the isntructions

* Press Alt + F2

* A Run daialog box appears, over there type gksudo nautilus /var/www

* You will be asked for your password as you are elevating your privileges

* Nautilus opens up,now copy the tarball/zip file from the download location to /var/www

* Untar the archive by Right Click > Extract Archive

You may have the package in the folder say /var/www/wordpress. We are supposing wordpress as an example.

Step 4: Setting up username and accounts in database

Now you need to have a create a new database for the software you intent to work on. For this open MySQL from the terminal. If you had been asked to set up the password at time of MySQL installation then use this command

mysql -u root -p

and then enter the root password which you set up

if you were not asked to set up root password, then use this command at terminal

mysql -u root

After this is done you will be dropped to mysql prompt. Create a new database using this:

create database foo;

type quit to exit.

Step 5: Change the data in the config file.

Hunt for file which may have name such as config,settings etc etc. One you locate it,open to find the area for entering database settings. The settings should be:

Hostname: localhost

Username: root

Password: <the password you set up>

Database name: foo (or whatever you created)

Step 6: Access it via browser

Now point your browser to http://localhost/wordpress

You may get the basic installation thing or whatever stuff you need.

Additional Stuffs:

You can be asked to make some locations writable. There may be instances like the software cant write to a specific folder or file. It can be used for cache or any such temporary stuff. Then you need to change the permissions. Simply give write permissions to the user www-root. However this situation may be unlikely. e..g we have to change the permissions of folder /var/www/wordpress/cache

sudo chmod -cR u+w /var/www/wordpress/cache

What is GRUB or a bootloader?

GRUB is an abbreviation for GRand Unified Bootloader, its actually a product of the GNU project aimed at creating a bootloader which can boot nearly all operating systems. So now what is a bootloader? We shall now know this in nearly a layman’s approach.
When you switch on your computer, it fetches which operating system to boot from a special place on the hard disk called Master Boot Record(MBR). After that the required operating system is started. This does not need any complications if you have jus one operating system. Now if you have more than one operating system, the new circumstance are explained below.
Consider that there are two friends who got an internet connection and want to share it. What would they do? They will get a hub or a switch to split the line into two so that both of you can get a chance. In the same way consider a bootloader to be like a hub or a switch. It is placed in the MBR and gives you the option to boot any of the many OS which you might be having on your system. Now let u see how this happens.
Your computer is powered on. The contents of the MBR is checked for booting the OS. GRUB should be placed at the MBR so that it can be booted. Now you get a menu at the GRUB to boot your choice of OS. Just select the required and press Enter. That’s done.
Actually GRUB is not completely installed on the MBR. The size of MBR is very small- just 512 bytes. Actually on the MBR only a small portion of GRUB is placed whose function is the bring up the complete GRUB(bootloader). Thus we can say that MBR contains a pointer to the GRUB which is actually located on some other portion on the disk.

Troubles that can crop up:
If you have GRUB installed on some partition say on partition X and a pointer to this partition on MBR. Now if you by mistake delete that partition or format it, you  will lose you GRUB though a pointer may still be containing on the GRUB. So now even though GRUB is on your MBR, you still cant boot any of your OS and you would be greeted by some error message like GRUB error 15,GRUB error 17 or GRUB error 22 depending on the case.
If you have installed Windows after installing Windows you must have noticed that GRUB has vanished. Actually it does not vanish, what happens that Windows replaces itself to the GRUB unhooking GRUB from it. Now GRUB is installed on your computer but still its does not have pointer from the GRUB, its useless now. You need to put GRUB back to the MBR for restoring the original conditions.

Linux Software Installation : Clear your Myths

THE MYTHS
The first problem which people face while switching over to Linux is the “unavailability of softwares” as they claim. They just try to run their windows installer/setup file and end up with frustration saying “Linux is so incompatible!” Is it really so? Linux is not a clone of Windows. Then how come you expect your softwares built specifically built for windows to run on Linux. Linux has its own OS architecture, filesystem, binary file format and many more.

GETTING LINUX ALTERNATIVES OF YOUR SOFTWARE
So if you really want to switch to Linux, try to get accustomed to Linux alternatives of your software. If you were using Winamp, the alternative is XMMS or Audacious. The replacement of Internet Explorer is Firefox and IceWeasel though Firefox is also available for Windows. It would be better if you spend a week or two using softwares which are available for both Windows and Linux. Some of the examples are:
Firefox- an award winning and largely loved Web Browser
Thunderbird- a portable Mail client
VLC- a highly portable and excellent Media Player
Pidgin – Multi protocol Instant Messenger
Abiword – a lightweight Word processor
OpenOffice – An office suite, installed by default on most Linux distributions
FileZilla – an Open Source FTP client like CuteFTP etc

THE EASE OF INSTALLING SOFTWARES
Installing softwares on windows is claimed to be very simple. You just need to Click on Next and Next and Next. Why click Next so many times if you can install a software with just 2-3 clicks? That even when on windows you have to google desperately on the net to download your software? People usually think that installing software on Linux means compiling from source. I claim this to be a big myth! A really big one! That’s not the case. You also get pre-compiled software packages to just double-click and start, and the better thing is that you wont have to click Next a hundred times.

SOFTWARE PACKAGES
In Linux softwares come as packages. They are not installers in real sense, they contains data which is taken up by the packages installer and now its the packages installer which takes care of the further task. This prevents the package from harming the system if it has some malicious code. It is the work of Package installer to check that malicious code is stopped from executing. Probably the biggest drawback for windows method of installation is the executable installation method, viruses and other malwares may attach themselves to setup files which get executed when you try to install them.

In Ubuntu we have a package manager called APT which is an abbreviation for Advanced Packaging Tool. This utility takes care of all the packages listed on your system. There is another term called repository known as repo in short. Repositories are actually sources of packages, call it as a storehouse. When you add a repository to your package manager and update the list, it fetches the index/list of the softwares present on that repo. It now shows up on the Package manager. Now if you select to install that package it will be fetched from that repository and installed on your system.
A repository can be available anywhere. It can be on a CD, on a website, or a folder on your hard disk.The official Ubuntu repository is very large containing more than 20,000 packages, so one point is very clear “Most of the packages you need will be in the official repo”. This means you wont have to compile any software from source.

There are many package managers available, others being Red Hat Package Manager which is used by Red Hat and its derived distros. Ubuntu is derived from its father distro called Debian which was one of the pioneers in the development of Linux.

METHODS OF INSTALLING
There are two ways of installing any package – Command line way and Graphical way! Its upto you to choose between the two. Each have their own plus and minus points. Graphical method is recommended for a beginner but everyone should have atleast a basic knowledge of command line to deal and cope up with disastrous situations. This is not windows and you wont be reinstalling Linux even in worst situations.

The plus point with graphical method is that its really easy for a beginner to start using and installing any software package. The minus point is that we have to click on search, enter the package name, click on OK, when list comes, select the package, click on Apply and then again OK. It may take time and if you are a bit comfortable with linux and want to do all these stuff quickly you may prefer command line.
Using command line you may have to just type one command and the software installation starts. You dont need to search,OK, Apply and all those headache. The biggest drawback with this method is that it is a bit tough for a beginner who has never even seen the world of commands on windows.
A Point to note: In future in life you may get stuck up anywhere and may ask help from an expert. Dont expect him to give solutions in graphical mode, rather you will get the solution in commands. The reason is quite obvious – “Why would he type so much like “Click System”, then Package Manager, then enter password and all those long long methods”. You may even get stuck somewhere and say that you didnt find that option. To get over this problem too commands come to rescue. Just copy-paste the command to your terminal, no hassles even, if he tells to give the output, just copy-paste back the output. Its so simple, a single command did all that was required even though you might have found that command very absurd and unusual to look at.

SOFTWARE UPDATES:
In windows you had needed to update each application separately, this is not the case in Linux. Here updates arrive via the central “Update Manager” just like “Windows Update”. Unlike windows software updates, kernel updates, security patches and software patches, all comes via this method. If you had installed a software say “ABC” from a official repository “XYZ”, then when an update arrives on that repo, the Update Manager fetches the index of the updates and notifies you. This is an excellent way rather than checking and updating each software manually.

Play with CompizFusion on Ubuntu Gutsy 7.10

One of the most awaited feature of Ubuntu Gutsy was its eye candy. CompizFusion is bundled by default which requires only some hardware acceleration and is best suited for people who have graphics card. One of the major problems which people are facing is that they are unable to find a front-end to configure Compiz. This frontend is called CompizConfig Settings Manager. You only need some tweaks and your system is ready. Get the package named compizconfig-settings-manager using apt or Synaptics

sudo apt-get install compizconfig-settings-manager

You need to have some packages installed. These are bundled by default but if you dont have you need to install them before you can use compiz. These are compiz-fusion-plugins-main , compiz-core , compiz-gnome , compiz-plugins .

Some of the famous effects are cube effect,rotate cube,wobbly windows, water effect and shift switcher. Some of the useful shortcut keys are as follows, just try them out and see

Ctrl+Alt+ <down>

Ctrl+Alt+Tab

Win+Tab

Ctrl+Alt+<right>

Ctrl+Alt+<left>

Ctrl+Alt+<mouse button 1>

Dealing with MP3 problem while playing Amarok on Ubuntu?

here’s probably little choice for Linux users for listening to music on Amarok. No other music player has gained so much reputation. Amarok really rocks! Its bundled with Kubuntu by default. It lacks in Ubuntu, but available in the repositories. Just downloading and installing doesnt work always.The most common problem which people face is that their Amarok does not play MP3’s. Amarok does not have support for playing MP3 by default in ubuntu. It asks you to enable MP3 support but probably that method is broken. Usually KNotify comes up and complains that crash has occurred. All these problems can be fixed very easily. You only need to follow some steps properly.

1) Install libxine1-ffmpeg package through apt. You can install it through terminal or Synaptics Package Manager. Type in terminal:

sudo apt-get install libxine1-ffmpeg

2) Now install Amarok through Synaptic Package Manager. You can install through Terminal (apt-get) also, but the former is better suited as there are probably many dependencies.

Still if you are unable to play MP3’s in Amarok try installing libxine-extracodec instead of libxine1-ffmpeg, but the former should surely work. No guarantee with the extracodec package.

Installing Codecs on Ubuntu Linux

Many of the ubuntu newcomers might be left in a fix when they discover that their system has lost its capability to play media. Actually its not so, those media formats which you might be trying are proprietary ones which requires you to install codecs from a third party. Since ubuntu is shipped with only those packages which are free, according to the policy it has adopted.
You must have tried to play the media with Totem Player. Actually you need to install the gstreamer framework. These are packages from third party. We can adopt two methods for installing them.
Command Line: Just open your Terminal. Applictions> Accessories> Terminal
Type this command, enter your password when prompted.

sudo apt-get install gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-ffmpeg.

You need an active internet connection for downloding them.
GUI Method: Open Synaptic Package Manager. System >Administration> Synaptic Package Manager. You will be prompted for your password.
Now Click on Packages on menu bar. Select in Software Sources. Now select multiverse and restricted so that all four universe, main, multiverse and restricted are selected.
Click on Search. Search for these packages and install them. You need an active internet connection

gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-ffmpeg.