[HOWTO] Install Firefox 4 in Ubuntu 10.04 Lucid Lynx and 10.10 Maverick Meerkat

UPDATE: Click here for Stable version of Firefox 4.

Firefox 4 beta 2 is already available for Linux, Windows and Mac. You can also install daily builds to get the latest of Firefox. The PPA ubuntu-mozilla-daily provides the daily builds of Firefox, currently beta 3 is available for download. To install the PPA in Lucid or Maverick, just launch Synaptic (System>Administration>Synaptic Package Manager) and then go to Settings>Repositories>Other Software. Now click Add and paste in the following:

ppa:ubuntu-mozilla-daily/ppa

Close the Repositories window and then click reload. When it is done, search for firefox-4.0-gnome-support and mark it for installation. It should mark other required packages. Apply and wait for installation to finish.

To launch it, goto Applications>Internet>Mozilla Developer Preview Web Browser or Minefield 4.0 Web Browser and enjoy.

[HOWTO] Install latest Intel DRM Kernel to avoid crashes on boards with Intel HD Graphics

My friend has a laptop with Intel Core i3 and onboard Intel HD graphics. His Ubuntu used to crash very often. He is using latest Ubuntu 10.04 Lucid Lynx. He then upgraded to latest kernel 2.6.35-997 from drm-intel-next from drm-intel-next PPA which has stopped the crashing. However, the kernel is development kernel and you should use it with caution. If it fails to boot or causes problems, you can always hold on shift key during boot and then boot into the older kernel and remove it from the package manager. Having said that, here is how to install the latest kernel in Ubuntu from the drm-intel-next PPA.
Goto drm-intel-next PPA and then download the following files:
linux-headers-X-all.deb
linux-headers-X.deb
linux-image-X.deb
Here, X is the version which you can use whatever is available and refers to your Ubuntu architecture. In the PPA, 32-bit (i386) and 64-bit (amd64) are available. If you don’t know the architecture of your installation, you can easily check by typing the command

uname -m

in the terminal. If it says x86_64, you should go for amd64 and if it says iX86 (i686 for example), go for i386.
After the download, install in the above order and reboot and it should boot into your newly installed kernel.

Hope this helps.

[HOWTO] Make Firefox faster and more responsive using RAMDISK

I am using Firefox 3.6.6 on my Ubuntu Maverick Meerkat Alpha and wanted to experiment with it.

Firefox uses the profile directory to read and write settings, bookmarks, saved passwords, extension preferences etc. When Firefox is launched, it reads those from profile directory and constantly accesses and writes information to the directory. I thought keeping this in RAM could make Firefox faster. To do so, I wrote a small script that copies the profile to RAMDISK and launches Firefox with that profile directory.

First of all, you will need to increase the RAMDISK size so that it can hold the profile directory. The profile directory can grow with cached files so you may want to limit caching appropriately by setting lower the values of browser.cache.disk.capacity and browser.cache.offline.capacity in about:config. You can set the RAMDISK size by editing /etc/default/grub and appending ramdisk_size=SIZE_IN_BYTES to GRUB_CMDLINE_LINUX_DEFAULT. To edit, you will need to open it as root (gksu gedit /etc/default/grub). The line should look like the following after the edit if you want the RAMDISK size to be approximately 256Mb:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ramdisk_size=256000"

After saving the file, you need to run the following command from the terminal to update grub

sudo update-grub

Now, restart your computer for changes to take effect.

When this is done, save the following file as /usr/local/bin/firefox-ram. Uncomment (remove hash from) the line containing PROFILE_PATH and change the path to your Firefox profile directory.

#!/bin/bash

# firefox_ram v0.1 by _khAttAm_
# www.khattam.info
# July 09, 2010
# Needs RAM_DEVICE larger than the size of profile directory
# Needs zenity installed
# Copyright (C) 2010  _khAttAm_

# will not run as intended and may cause data loss if profile directory
# is full or ramdisk is smaller than profile directory size

#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    See .

# Change the following

PROFILE_PATH=/home/pravin/.mozilla/firefox/e2k9jth5.default/

if [ ! -n "$PROFILE_PATH" ];
then
	zenity --info --text="Profile path not set. Please edit the script \

	to set firefox profile path."
	exit
fi

USER_NAME=$USERNAME
TMP_PROFILE_DIR=/home/$USERNAME/.mozilla/firefox/ramdisk/

RAM_DEVICE=/dev/ram0

if [ -f /tmp/firefox-ram-lock ]

then
	zenity --info --text="Only one instance is allowed. If no instances\
	 are open, it may be performing post save operations. Please wait a\
	 few moments and try again. If this persists and you are sure \
	 nothing is going on, just remove /tmp/firefox-ram-lock and run \

	 again."
	exit
fi

touch /tmp/firefox-ram-lock

echo "

umount $RAM_DEVICE
mkdir -p $TMP_PROFILE_DIR
umount $TMP_PROFILE_DIR
mount -t ext2 $RAM_DEVICE $TMP_PROFILE_DIR
">/tmp/firefox-ram-pre-pre.sh

chmod +x /tmp/firefox-ram-pre-pre.sh
gksu sh /tmp/firefox-ram-pre-pre.sh

# the following needs to be run as root

# this could be done by using gksu followed by command for each,
# but gksu has problem with commandline option -R
# hence the commands that need to be run as root are written to
# a temporary file and then executed using gksu
echo "
umount $RAM_DEVICE
mke2fs $RAM_DEVICE

mkdir -p $TMP_PROFILE_DIR
umount $TMP_PROFILE_DIR
mount $RAM_DEVICE $TMP_PROFILE_DIR
">/tmp/firefox-ram-pre1.sh
chmod +x /tmp/firefox-ram-pre1.sh
gksu sh /tmp/firefox-ram-pre1.sh

PROFILE_DIR_SIZE=`du -s $PROFILE_PATH | cut -f1`

#echo $PROFILE_DIR_SIZE

RAM_DISK_SIZE=`df -k| grep $RAM_DEVICE|cut -d' ' -f16`

#echo $RAM_DISK_SIZE

if [ "$RAM_DISK_SIZE" \< "$PROFILE_DIR_SIZE" ];
then
	zenity --info --text="The size of RAMDISK ($RAM_DISK_SIZE bytes) is\

	 not large enough to hold the profile directory \
	 ($PROFILE_DIR_SIZE bytes). This program can't continue. Either \
	 increase the size of RAMDISK or clear history and cache to reduce \
	 the size of profile directory."
	rm /tmp/firefox-ram-lock
	exit

fi

echo "
cp -u -R $PROFILE_PATH* $TMP_PROFILE_DIR
chown -R $USER_NAME $TMP_PROFILE_DIR
chmod -R 744 $TMP_PROFILE_DIR*

">/tmp/firefox-ram-pre2.sh
chmod +x /tmp/firefox-ram-pre2.sh
gksu sh /tmp/firefox-ram-pre2.sh

echo `date +%s` > $TMP_PROFILE_DIR/firefox_ram.chk

#run firefox with profile directory as the one in ramdisk

firefox -profile $TMP_PROFILE_DIR

#copy profile back to HDD
cp -u -R $TMP_PROFILE_DIR* $PROFILE_PATH

rm /tmp/firefox-ram-lock

Now, Alt+F2 and firefox-ram to run Firefox with profile from RAM. You should enter your password when asked as this is required to create and work with RAMDISK. The first launch can be a little slow, but subsequent launches should be quicker. You can also create a launcher in your dock or your Desktop for easy access.

Please note that when using this script, you should not switch between the other Firefox as that may cause data loss (loss of bookmarks, settings changes etc.). Also, you are advised to backup your profile directory regularly while using this script as it may cause data loss.

Please suggest improvements and changes in the script.

[SOLVED] Volume always muted on startup

I’m using Ubuntu 10.10 Maverick Meerkat and I had been having a problem related to sound. Every time I started the computer, the volume was muted and I had to un-mute it as well as increase the volume. When I searched for a solution, it was brought to my attention that Ubuntu 9.10 Karmic Koala and 10.04 Lucid Lynx also had this problem. I solved it by simply removing the buggy package alsa-utils which was responsible for this. Removing also-utils also removes ubuntu-desktop meta-package, but it does not matter since it is just a meta-package. To those who do not want to remove alsa-utils or ubuntu-desktop, some people in the Bug report have said that removing the line

mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1

from /etc/init.d/alsa-utils (to open, use gksu gedit /etc/init.d/alsa-utils) fixed the problem.

[HOWTO] Install VLC Media Player 1.1 in Ubuntu Lucid Lynx and Maverick Meerkat

One of the most popular media players, VLC Media Player has version 1.1 RC out. The final version should be released shortly. You can install the Release Candidate by installing the following PPA:

ppa:c-korn/vlc

To do that, open System>Administration>Synaptic Package Manager>Settings>Repositories>Other Software>Add and paste in the code above.
If you are on Maverick, since the PPA does not have packages for Maverick, you can install the Lucid packages by editing the added PPA and changing maverick to lucid.
Then close the Repository window and Reload. Then Mark for updates and Apply. That should install the latest vlc packages.

[SOLVED] Can’t open /dev/dsp in Ubuntu 10.10 Maverick Meerkat and Lucid Lynx 10.04

I recently installed a program called SBaGen which uses device /dev/dsp to output audio. However, the OSS (Open Sound System) device is not available anymore in Lucid and Maverick (maybe it doesn’t work with older versions, but I’m not sure), not even with OSS emulation with alsa. The snd-pcm-oss module does not load even when oss-compat and alsa-oss have been installed. It is seen to be blacklisted in /etc/modprobe.d/alsa-base.conf.

However, pulseaudio also supports OSS emulation with an app called padsp. So, for example if you want to launch

sbagen examples/basics/prog-chakras-1.sbg

you should launch

padsp sbagen examples/basics/prog-chakras-1.sbg

This way, you will be able to run OSS based sound apps without need for OSS.

[HOWTO] Install sbagen in Ubuntu 10.04 Lucid Lynx and 10.10 Maverick Meerkat

This guide is outdated. For installing to newer version of sbagen in newer Ubuntu versions, follow instructions here.

SBaGen is a Binaural beat generator. For more info, visit the official SBaGen Website.

It is available for Linux, Windows and Mac. For Ubuntu, it is not available in any official repos so we need to compile it from source. Here is how you can do that.

Open Synaptic Package Manager and enable universe repository if you already haven’t done so. To do so, navigate to Settings > Repositories and check Community-maintained Open Source software (universe)
Now, press Reload in Synaptic Toolbar to reload the package lists.

Now, quit Synaptic Package Manager and open up terminal. First, you will need some packages to start building our app. So lets get those.

sudo apt-get install libvorbisidec-dev libmad0-dev

After installing required development packages, lets create a directory named sbagen where you can work with sbagen and change to it.

mkdir sbagen
cd sbagen

Lets download sbagen-1.4.4.tgz from sbagen website:

wget http://uazu.net/sbagen/sbagen-1.4.4.tgz 

Extract it

tar -xvzf sbagen-1.4.4.tgz

and change to that directory

cd sbagen-1.4.4/

Now, lets copy the required files to libs directory

cp /usr/lib/libvorbisidec.a libs/linux-libvorbisidec.a 
cp /usr/lib/libmad.a libs/linux-libmad.a 

Now, to build it, you need to run the included script called mk. To do so, just execute:

./mk

Now if you see no errors, the code must be compiled by now. You should be able to run it by doing a:

./sbagen

If you see an output like the following:

SBaGen - Sequenced Binaural Beat Generator, version 1.4.4
Copyright (c) 1999-2007 Jim Peters, http://uazu.net/, all rights 
  reserved, released under the GNU GPL v2.  See file COPYING.

Usage: sbagen [options] seq-file ...
       sbagen [options] -i tone-specs ...
       sbagen [options] -p pre-programmed-sequence-specs ...

For full usage help, type 'sbagen -h'.  For latest version see
http://uazu.net/sbagen/ or http://sbagen.sf.net/

this means sbagen has been compiled. To be able to use it conveniently in the future, you just need to move it to some bin directory. Lets move it to /usr/local/bin

sudo cp sbagen /usr/local/bin/ 

Now, you should be able to run it from any path by just invoking:

sbagen

If you encounter any errors in any steps, please post the step and the corresponding error message in the comment box below. I will try to address the problem the best I can.

Now, after it is installed, you may want to try out an example file:

sbagen examples/basics/prog-chakras-1.sbg 

but it will give you the following error:

Can't open /dev/dsp, errno X

Please follow my other post to overcome this problem.

[HOWTO] Get Edit Path Pencil Icon in Nautilus by Switching to Nautilus Elementary

Nautilus has breadcrumbs navigation. When you have a location you want to navigate to in a clipboard (copied from terminal or say a file), and if you wish to navigate to that location, you need to open up the run dialog (Alt+F2) and paste the location there or press Ctrl+L in any nautilus window and paste the location there. Both of these require keyboard. When there was Edit (Pencil) icon in Nautilus in some earlier versions, you could just press it and paste the location right there. But since it is removed now, it is not possible.

Nautilus elementary is a fork of Nautilus File Manager which claims to patched for simplicity. It now has a toolbar editor and you can easily add pencil icon to your toolbar using this feature.

It is currently available for Karmic and Lucid. To install it, open up Synaptic Package Manager (Alt+F2>gksu synaptic) and navigate to Settings>Repositories>Other Software and Add ppa:am-monkeyd/nautilus-elementary-ppa. If you are using Maverick, it is not available now, but you can use the Lucid PPA just by editing the entry (after adding, select it and choose Edit) and it should work fine. Now, close the dialogs and Reload in Synaptic. Mark All Upgrades and install it. You will need to logout and log in (or simply kill nautilus.. Alt+F2>killall nautilus) for changes to take effect. Now, to get the pencil icons or add/remove/move other toolbar elements, navigate to Edit>Customize Toolbar.

Hope this helps.

[SOLVED] Media Playing issues in Ubuntu 10.10 Maverick Meerkat

I am using Ubuntu 10.10 Maverick Meerkat 64bit Alpha 1 and I have been facing problem playing AVI and FLV files. I used to get the the following error “No suitable decoder module: VLC does not support the audio or video format “XVID”. VLC Unfortunately there is no way for you to fix this.”
in VLC when I tried to play some AVI files. Also, in terminal, it said:
“main decoder error: no suitable decoder module for fourcc `XVID’.
VLC probably does not support this sound or video format.”
Also, FLV files failed to play without any error. Totem said:
“No packages with requested plugins found. The requested plugins are: XVID MPEG-4 decoder/H.264 decoder”.

The problem was with libavcodec and libavutil. It can be fixed by removing all of libavutilxx (libavutil50, libavutil49, libavutil-extra-49, libavutil-extra-50) and reinstalling only what is required. This may also remove other packages (vlc for example, if you have it installed that is), so watch out but don’t install them immediately. Exit Synaptic. Now, if you want to fix totem, just open media with it. It should ask you for codecs, install them. Totem should start working. Install vlc later.

Hope this helps.

[HOWTO] Ease your eyes while using Linux with some RedShift

I usually sit in front of my PC for long hours. It is always better to have least effect on my eyes and I used to reduce the brightness and adjust colors for that. Now, I have discovered a software to do just that. It claims to adjust the screen color temperature according to the surroundings. It is called Redshift and can be installed from the PPA ppa:jonls/redshift-ppa. To install it on Karmic and Lucid, open up Synaptic and navigate to Settings>Repositories>Other Software>Add and paste in “ppa:jonls/redshift-ppa” (without quotes) and then close it, Reload the package lists by clicking Reload in the Toolbar and then search for redshift and install it. It is not available for Maverick Meerkat now, but you can install it by following my earlier post. After installation, you can run it by invoking the following command from the terminal:

redshift -l LATITUDE:LONGITUDE

For example, since I am at Lalitpur, Nepal, I ran:

redshift -l 27.4:85.2

You can find latitude and longitude information about your city here. If you don’t, use the one which is nearest to your place and it should work just fine. You will immediately see a change in color. You may also like it to show a tray icon so that you can disable/enable it easily if you have to. To do so, just run:

gtk-redshift -l LATITUDE:LONGITUDE

You can toggle enable/disable by clicking on the tray icon.

You will probably want to install run it on startup. To do so, just open Startup Applications and Add an application with command as

gtk-redshift -l LATITUDE:LONGITUDE

To see how much it is actually helping your eyes, keep it enabled for prolonged hours while you sit in front of your PC and disable it. You will see how difficult it is to see the normal color and how cool RedShift is.

Hope this helps.