Sunday, April 29, 2012

HowTo: Sharing Android smartphone 3G connection with CentOS 6.2

I have a LG P500 Android smartphone running Gingerbread 2.3.3 and I've been meaning to try out if I could share the phone's 3G connection with my CentOS 6.2 laptop. Turns out that it is super easy to do so :)

In this post I'll explain the 2 methods that can be used to share your Android smartphone connection with CentOS 6.2 machine:
  1. USB tethering, wired connection
  2. Portable Wi-Fi hotspot, wireless connection
Though this procedure was executed on Gingerbread 2.3.3 and CentOS 6.2 it should apply to other Android versions as well as other Linux distributions equipped with Network Manager.

USB tethering

Activate the 3G data connection on the Android smartphone, connect the USB cable to the Android device and then to your computer. On the Android smartphone go to Settings -> Wireless & networks -> Tethering & portable hotspot and activate USB tethering.

CentOS' Network Manager with automatically create a wired connection assigning the cdc_ether driver to the USB device thus creating an ethernet interface such as usb0.

When your done just disable the 3G data connection or disable USB tethering on the Android smartphone.

Portable Wi-Fi hotspot

Activate the 3G data connection on the Android smartphone and go to Settings -> Wireless & networks -> Tethering & portable hotspot and activate Portable Wi-Fi hotspot.

Tap the Portable Wi-Fi hotspot settings and then Configure Wi-Fi hotspot. Type in a Network SSID such as MyAndroidAP, select Security and choose WPA2 PSK and type in a password in the Password field.

CentOS' Network Manager will identify Android's wireless Network SSID, connect to it and a Wireless Network Authentication Required pop-up will appear. Select WPA & WPA2 Personal and type in the password that you've chosen while configuring the Android smartphone.

To end the connection disable 3G or the Portable Wi-Fi hotspot.

Saturday, April 28, 2012

HowTo: Enable reiserfs support on CentOS 6.2 and SL6.2

By default RHEL clones such as CentOS and Scientific Linux don't come with ReiserFS filesystem support.

However the ELRepo repository has the kmod-reiserfs package which provides the much needed kernel modules. As such enabling ReiserFS support on RHEL/CentOS/SL 6.2 consists of adding the ELRepo repository, installing the kernel module for ReiserFS and the reiserfs-utils package which provide tools for creating and repairing ReiserFS filesystems.

The required steps are:
  1. $ su
  2. # rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org
  3. # rpm -Uvh http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
  4. # yum update
  5. # yum install kmod-reiserfs reiserfs-utils
  6. # modprobe reiserfs

Now you can have GNOME Nautilus mount ReiserFS partitions by simply clicking on the partitions and providing root's password.

It should be noted that the reiserfs-utils is also available in the CentOS-extras repository however the version on ELRepo is newer. If you have priorities associated with third party repositories take this into account.

Wednesday, April 25, 2012

Tip: Fix "pa_stream_writable_size() failed: connection terminated" GNOME Totem error

One of these day I launched a Matroska (.mkv) video when all of a sudden Totem crashes with the following error:
 pa_stream_writable_size() failed: connection terminated  
This error popped-up on CentOS 6.2 however upon investigating the error on Google I came across bug reports on several distribution ranging from CentOS 6, SL 6, Fedora 11-14, Ubuntu 9.10-10.10, etc.

The solution consists of changing PulseAudio configuration and reloading it:

  1. $ su
  2. # echo "resample-method = trivial" >> /etc/pulse/daemon.conf
  3. # exit
  4. $ pulseaudio -k

References:
https://bugzilla.redhat.com/show_bug.cgi?id=566915
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/496616
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/644644
http://pulseaudio.org/ticket/759

Tuesday, April 24, 2012

HowTo: Enemy Territory on CentOS 6.2 / SL 6.2

Wolfenstein: Enemy Territory is a free multiplayer FPS that takes place in the World World II pitting two teams (Allies and Axis) against each other for victory.

In this post I'll detail the steps required to install and update Enemy Territory, namely:
1) Download the necessary files
2) Install and update Enemy Territory
3) Install updated Punkbuster files
4) Generate an etkey
5) Fix sound problem
6) Setup widescreen resolution

These steps can be pretty much be reproduced in any Linux distribution, though some such as Gentoo and Arch Linux have Enemy Territory packages in their package management systems. It should be noted that the steps were performed on CentOS 6.2 but should translate to future CentOS 6.x releases.

1) Download Enemy Territory 2.60 and 2.60b update

Download et-linux-2.60.x86.run, et-2.60b.zip update, updated Punkbuster and the et-sdl-sound.gz sound fix:

  1. $ wget -c http://ftp.freenet.de/pub/4players/hosted/et/official/et-linux-2.60.x86.run
  2. $ wget -c http://darkstar.ist.utl.pt/games/et-2.60b.zip
  3. $ wget -c http://etkey.org/et_linux.zip
  4. $ wget -c http://nullkey.kapsi.fi/~stuff/et-sdl-sound/et-sdl-sound.gz

 

2) Install and update Enemy Territory

Change to root, attribute execute permissions to the installer, install Enemy Territory 2.60, install the 2.60b update, create a profile and check the game's version:

  1. $ su
  2. # chmod +x et-linux-2.60.x86.run
  3. #./et-linux-2.60.x86.run

Press OK in the popup. Agree with the License Agreement by pressing ENTER at the License Agreement prompt and choosing YES on "Do you agree with the license?" popup that follows. Choose NO at the "Would you like to read the CHANGES file?" popup. You can always read the CHANGES file latter on if you want. Choose the installation path and press OK in the Symlink Path popup. Install both Enemy Territory and Punkbuster. Choose to install the startup menu entries. After this the game installs. Don't choose to start the game immediately as we haven't finished installing everything.

Install the 2.60b update:

  1. # unzip et-2.60b.zip
  2. # cp Enemy\ Territory\ 2.60b/linux/* /usr/local/games/enemy-territory/
  3. # exit

Now start the game, create a player profile identifying profile name, connection speed and clicking on Enable Punkbuster; exit the game. By doing so a .etwolf directory will be created in your home directory which includes a folder containing PunkBuster.

Inside the game you can check the installed version by pulling the console down by pressing ~ and typing version. It should output the following:
 ]\version  
 "version" is:"ET 2.60b linux-i386 May 8 2006" default:"ET 2.60b linux-i386 May 8 2006"  

3) Install updated Punkbuster files

Remove old Punkbuster files, extract the last Punkbuster update and place it in the created profile:

  1. $ rm -rf ~/.etwolf/etmain/pb
  2. $ unzip et_linux.zip -d pb
  3. $ cp -R pb ~./etwolf/etmain/

4) Generate an etkey

Point to http://etkey.org/pages/etkey-home.php, press the Get an ETKEY button, download the file and store it under ~./etwolf/etmain/.

5) Fix sound problem

The most dreadful any Linux Enemy Territory player can witness:
 ------- sound initialization -------  
 /dev/dsp: No such file or directory  
 Could not open /dev/dsp  
 ------------------------------------  
Luckily we can use the SDL backend which Enemy Territory will use as audio device replacing /dev/dsp and OSS.

Install SDL, extract the et-sdl-sound script, make it executable and accessible to all and edit the et launcher to have Enemy Territory use SDL instead of OSS:

  1. # yum install SDL -y
  2. # gzip -d et-sdl-sound.gz
  3. # chmod a+x et-sdl-sound
  4. # chown root:root et-sdl-sound
  5. # mv et-sdl-sound /usr/local/games/enemy-territory/
  6. # vim /usr/local/games/enemy-territory/et

 #!/bin/sh  
 # Needed to make symlinks/shortcuts work.  
 # the binaries must run with correct working directory  
 cd "/usr/local/games/enemy-territory/"  
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.  
 ./et-sdl-sound "$@"  

6) Setup widescreen resolution

If you have a widescreen monitor follow the instructions on my previous blog post HowTo: Widescreen resolutions on Enemy Territory.

And we're done installing Enemy Territory!

Lately I've been playing at [fp].:Demolition_Centre as tangram"FreeBSD~ or tangram"GNU/Linux~. See you on the battlefield :D

Sunday, April 22, 2012

HowTo: Firefox Java plugin on CentOS 6.2 / SL 6.2

Enabling Firefox's Java plugin is a necessity these days, especially when you want to do your taxes and the government's online tool demands a Java enabled browser.

OpenJDK (Open Java Development Kit) is a free and open source implementation of the Java programming language. OpenJDK however isn't bundled with the web browser plugin which is a part of Oracle Java.

Fortunately the IcedTea-Web project provides a Java web browser plugin.

On RHEL6 and its clones, icedtea-web depends on java-1.6.0-openjdk and will pull it as a dependency.

In practice, on CentOS 6.2 and Scientific Linux 6.2 if you want to have Firefox working with a Java plugin simply install icedtea-web, like so:

  1. $ su
  2. # yum install icedtea-web

Launch Mozilla Firefox and in the address bar enter about:plugins.

Also you can point Firefox to http://www.javatester.org/version.html and check if you have the Java Run-Time Environment working.

Now we can all submit our tax reports ;)

Saturday, April 21, 2012

Tip: Fixing timezone on CentOS / SL in multi-boot computers

I've installed CentOS and Scientific Linux on two computers each with several operating systems raging from Linux, FreeBSD and Windows. When prompted for Configuring the Time Zone I selected the city nearest to my timezone and left the System clock uses UTC checked.

Wrong!

My system clock was fine on CentOS 6.2 and SL 6.2 but when I booted to one of the other operating systems their clock would be off by 1 hour...

According to the Red Hat Enterprise Linux 6 Installation Guide you should only select System clock uses UTC if RHEL is the only operating system on your computer. So to fix things just use the Time and Date Properties Tool and uncheck the System clock uses UTC option. The tool can be accessed running system-config-date as root or pointing to System -> Administration -> Date & Time.

Simple solution for such an annoying problem ;)

Friday, April 20, 2012

Tip: Fixing Chromuim not compiling with base GCC error on FreeBSD

I haven't updated the ports tree for a month or so imagine my surprise when portmaster aborted with the following message:
 ===>>> Launching child to update chromium-17.0.963.79 to chromium-18.0.1025.162  

 ===>>> Port directory: /usr/ports/www/chromium  

     ===>>> This port is marked IGNORE  

     ===>>> does not compile with base gcc  

     ===>>> If you are sure you can build it, remove the  

         IGNORE line in the Makefile and try again.  

 ===>>> Update for chromium-17.0.963.79 failed  

 ===>>> Aborting update  

Oh!

Quickly browsed through /usr/ports/UPDATING and didn't notice any entry on www/chromium so the next step was checking /usr/ports/www/chromium/Makefile and yes there was an IGNORE line.

I was pretty sure I didn't change the default buid options last time so I browsed to http://www.freshports.org/www/chromium/ and noticed that on chromium-18.0.1025.142 gcc46 and clang were introduced as compilers as base gcc became too old.

Upon running make config on the port I noticed that I hadn't a compiler defined so it was a matter to enabling GCC46 and running portmaster once again to update Chromium.

Of course you can use CLANG instead if you prefer.