[SOLVED] Falling back to the standard locale (“C”).

In Ubuntu 8.04 Server, I was getting these messages every now and then:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

To solve this, I just had to install language pack:

apt-get install language-pack-en-base

If this does not solve the problem, you may as well try:

dpkg-reconfigure locales

Hope this helps.

[HOWTO] Configure remote connection to MySQL database server

I recently got a Ubuntu 8.04 Dedicated Server and wanted to move the database of one of my websites from my web host to the Dedicated Server while keeping the website in the web host. To do so, you must make sure you can connect to remote databases from your web host to the Dedicated Server (or VPS).

First, I exported the database from my web server into a .sql.gz file. You can choose .sql too. Then, I created a database (lets call it newdb) in the remote server using phpmyadmin (if you don’t have phpmyadmin, you can install it in your dedicated server) and imported the database.

Now we move on to the remote privilege part. Login to your Dedicated Server via ssh. We will need to edit my.cnf (the MySQL configuration file) to make the mysql server bind to the IP of the Dedicated Server, not localhost or 127.0.0.1. We do that by typing in:

nano /etc/mysql/my.cnf

I use nano as my text editor, you may use vi or whatever text editor you want. Also, my.cnf is in /etc/mysql/my.cnf, yours might be /etc/my.cnf.
Now, scroll down until your find

[mysqld]

Just a few lines below, you will find a line containing:

bind-address            = 

That line may be commented (with a # in the beginning) or may have localhost or 127.0.0.1 as bind-address. We do not want that. We want the IP of our dedicated server. Lets say it is 67.67.67.67, so the new line should look like:

bind-address            =  67.67.67.67

Save the file. If using nano, just press Ctrl+O and Enter. Press Ctrl+X to exit. If using vi, press Esc and type :w to save and :q to quit.
Restart the mysql server by using the following command.

/etc/init.d/mysql restart

Now, fire up mysql:

mysql -u username -p

Enter password when asked. The username must be of an administrative user.
Now, lets switch to the database we created earlier with phpmyadmin:

use newdb

That should say:

Database changed

Now, we create a new user and allow it to connect to the database:

grant CREATE,INSERT,DELETE,UPDATE,SELECT on newdb.* to newuser@66.66.66.66;

where 66.66.66.66 is the IP of the web host. It can be found by pinging your domain. For example, if you have domain mydomain.com, you can simply do a:

ping mydomain.com

and find out the IP in terminal. It should give you something lie:

PING mydomain.com (66.66.66.66) 56(84) bytes of data.

Now, we set password for the user newuser. We do that by typing in:

set password for newuser@66.66.66.66 = password('mypassword');

Finally, we cleanup and exit mysql:

flush privileges;
exit;

Now, we are done. You can configure the website in the web host to connect to the database at your remote Dedicated Server with the following configuration (whatever applies to you):
database=newdb
username=newuser
host=67.67.67.67

References:
http://www.debian-administration.org/article/Adding_new_users_to_MySQL_Databases
http://www.debianhelp.co.uk/remotemysql.htm

[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.