Saturday, 6 October 2012

Downgrading GDM to version 2.20 on CentOS

Sun Ray Server Software requires GDM <= 2.20. Unfortunately contemporary (i.e. up-to-date) Linux distros do not offer outdated GDM. However GDM is surprisingly easy to build from source on CentOS.


Step 1: Get GDM 2.20 source

wget http://download.gnome.org/sources/gdm/2.20/gdm-2.20.11.tar.bz2
tar xf gdm-2.20.11.tar.bz2
cd gdm-2.20.11


Step 2: Edit gdm-2.20.11/daemon/gdm-net.c


Change

#define MAX_CONNECTIONS 15

to

#define MAX_CONNECTIONS 100

(Prevents GDM from hanging when all your Sun Ray terminals connect)


Step 3: Install dependencies

su
yum install audit-libs-devel \
 libglade2-devel \
 libart_lgpl-devel \
 libgnomecanvas \
 libgnomecanvas-devel \
 librsvg2-devel \
 dbus-glib-devel \
 popt-devel \
 gnome-doc-utils


Step 4: Configure and make a dirty install

./configure
make
make install



Step 5: Logout and test

gdm --version
GDM 2.20.11


Leave a comment if the above didn't work. This was done on a CentOS 6.3 64-bit machine.

Friday, 7 September 2012

Downgrading from NVIDIA 304.43 to 295.71 on CentOS 6

The latest upgrade in 'elrepo' updates the NVIDIA drivers from version 295.71 to version 304.43. However, it ain't no bed of roses. On my CentOS 6.3 box, 3D performance under Wine took a massive hit, to the point where even sound playback was affected.

However, it's easy to just roll back the NVIDIA driver upgrades and get on with your life. First, grab the latest working version from elrepo:

wget http://elrepo.reloumirrors.net/elrepo/el6/x86_64/RPMS/kmod-nvidia-295.71-1.el6.elrepo.x86_64.rpm
wget http://elrepo.reloumirrors.net/elrepo/el6/x86_64/RPMS/nvidia-x11-drv-32bit-295.71-1.el6.elrepo.x86_64.rpm
wget http://elrepo.reloumirrors.net/elrepo/el6/x86_64/RPMS/nvidia-x11-drv-295.71-1.el6.elrepo.x86_64.rpm

Now, remove the new, buggy 304.43 drivers:

yum remove nvidia-x11-drv kmod-nvidia nvidia-x11-drv-32bit
 
Beware that uninstalling kmod-nvidia may take quite a while. Finally, install the fresh, old drivers:

rpm -Uvh kmod-nvidia-295.71-1.el6.elrepo.x86_64.rpm \
nvidia-x11-drv-295.71-1.el6.elrepo.x86_64.rpm \
nvidia-x11-drv-32bit-295.71-1.el6.elrepo.x86_64.rpm

Reboot. Commence life.

Monday, 3 September 2012

minimalistic laptop setup

I recently fell in love with i3wm, a tile window manager, so I wanted to format my computer and have a bare-minimum installation (instead of running gnome in the background). I checked out tile-window-managers after using pywo, and wanted to 'go the extra mile'.

This resulted in me downloading the minimal CD from ubuntu (12.04) and installing X, i3 and a smallest login manager I could find.

I just ordered the ASUS UX31A and so I need to install everything from scratch again, so what I did was to create a github project with bash file installing all the nice small packages from the first time.

https://github.com/charnley/ubuntu-mts

Here is an outline of the install script, which basicly uses apt-get (why I choose ubuntu) and installs everything needed.


Afterwards all the setup RC's, icon, font setup is done via setup.sh.

I really like this setup for a fast on-the-go geeky setup, especially on a 13" where room on the screen is limited.

Saturday, 14 July 2012

[SOLVED] segmentation fault in shared-mime-types - Ubuntu 10.04 LTS

I just did a kernel + gfx driver upgrade on our Beowulf cluster (Running Ubuntu 10.04 LTS Server), `hostname`=sunray.

However, apt-get upgrade choked (with nothing less than a segmentation fault) when I tried to update the package 'shared-mine-types'. Even a gdb backtrace wasn't helpful at all.

I could replicate the seg/fault by trying to update the mime database:

sudo update-mime-database -V /usr/share/mime

The workaround I found was pretty easy (though also ugly). The problem is a conflict with an early version of libxml2 and libxml2-dev. The workaround is to do this (pull never versions from Ubuntu 10.10 (Maverick)):

sudo -s
apt-get update
apt-get purge  shared-mime-info
cd /root/
wget https://launchpad.net/~ubuntu-security/+archive/ppa/+build/3103171/+files/libxml2-dev_2.7.7.dfsg-4ubuntu0.3_amd64.deb
wget https://launchpad.net/~ubuntu-security/+archive/ppa/+build/3103171/+files/libxml2_2.7.7.dfsg-4ubuntu0.3_amd64.deb
dpkg -i libxml2-dev_2.7.7.dfsg-4ubuntu0.3_amd64.deb
dpkg -i libxml2_2.7.7.dfsg-4ubuntu0.3_amd64.deb
apt-get install shared-mime-info

Now you should be able to do:

apt-get upgrade

^_^



The specs of the Ubuntu is 10.04.4 LTS (Lucid) with a custom compilation of gdm-2.20 from Ubuntu 9.10 (Karmic).

Happy apt-get upgrade'ing!


Friday, 29 June 2012

Shutting down at 6:30 AM?

We're having cooling maintenance carried out on Monday morning at 7:30 (yes AM!). As nobody likes getting up so friggin' early in the morning, here's how I'm going to shut down the servers nicely at 6:30. The command is simply called 'at'.

You envoke it by 'at <time>', e.g.:

# at 6:30
> shutdown -hP [Ctrl-D]

Here is where write the command being carried out .. when you're done, simply exit with a [Ctrl-D]. You wil be greeted by a message like

job 3 at 2012-06-29 6:30

The integer is the job id. You can also be more specific:

# at 6:30 monday

Jobs are executed only once. List your current at jobs with atq:

# atq
3    2012-06-29 6:30 a root

And cancel your at jobs with atrm (using the job id):

# atrm 3

Back to the problem at hand. We have a bunch of compute nodes, named *unray (i.e. bunray, gunray, funray, zunray, punray, wunray, runray,). Since I don't want to manually SSH into every node, I use SSH-keys and a for loop. All nodes mount the same /opt/folder. I put a file containing the command "shutdown -hP now" in /opt/scripts/shutdown.txt. at reads commands from a file via the -f switch. Now it is very easy to make all nodes receive the at command:


for i in b f g z p r w
do
ssh root@$i\unray at -f /opt/scripts/shutdown.txt 6:30am monday
done


Happy at'ing!

Saturday, 9 June 2012

Linux alternative to spotlight and windows startmenu

I really like the work flow of "run command" alt+f2 in most of the linux distros, but i would like to extend the functionality from just running a command to search etc.

I really dig the spotlight functionality on Mac OS X, and the startmenu functionality of windows.

windows 7 - start menu

OS X - Spotlight


I tried alternatives like The Synapse Launcher, Gnome Do and Google Desktop Search, but they seemed slow and very slow (and everyone working with unity will tell you how much of a pain alt+f2 is when it is slow).

I finally found Kupfer, which is really cool. Check it out in this video for an longer introduction of kupfer:




Personally I use Kupfer under LXDE which works great.


Light alternative to compiz grid effect


Implementing the

  • unity - window placement half-screen (ctrl+alt+numpad 4/5)
  • compiz - grid
  • windows 7 - window half screen (Super + Left/RightArrow)

effect on a 'naked system', without install heavy window management tools like Compiz.

Problem:
Okay, So I like being efficient with my working environment, especially with my window management, as I don't like wasting space on my 13" laptop screen.

I'm running LXDE with OpenBox and Anders is running gnome2 with Metacity.


PyWO - Python Window Organizer

The solution is too use the small python script provided by PyWo which can be downloaded from http://code.google.com/p/pywo/ written by http://kosciak.blox.pl/html.
In writing I'm using the 0.2 version.

Implementation (really easy!):

  1. Download version 0.2 from google code, and put in a folder. I put it in ~/settings/pywo-2.0/
  2. Run the downloaded script (/home/charnley/settings/pywo-2.0/pywo.py) 
  3. DONE


Default keyboard shortcuts:



Alt-Ctrl-Shift-Q    - exit PyWO
Alt-Ctrl-Shift-R    - reload configuration fileAlt-Ctrl-Shift-I    - print debug information about window manager and current window
Alt-KP_Divide       - switch windows (change position of the window)
Alt-Shift-KP_Divide - cycle windows (change contents of the window)
Alt-KP_1-9          - move window in a direction (KP_1-9 - numpad keys)
Shift-KP_1-9        - expand window in a direction (5 works as maximumize compiz plugin)
Alt-Shift-KP_1-9    - shrink windowAlt-Ctrl-KP_1-9     - put window to predefined positionCtrl_KP_1-9         - put and resize (grid), and cycle widthsCtrl-Shift_KP_1-9   - put and resize (grid), and cycle heights

Note, the default configuration is to use the numpad as the control, but being a laptop user this is not an option. So my setup is:

Laptop configuration:

Create ~/.pyworc and fill in:


[SETTINGS]
; 1/on/yes/true - work only when NumLock is on
; ignore - ignore NumLock state (works when on and off)
; 0/off/no/false - work only when NumLock is off
numlock = ignore

; invert window gravity if it needs resizing (eg terminals with incremental
; size change), works only for grid
invert_on_resize = yes

; if true try expandig in vertical axis first
vertical_first = yes

; grid_2x2, grid_3x2, grid_3x3, custom
layout = grid_2x2

;ignore_actions = grid_height

[KEYS]
; section/point-name =  key
top-left = KP_7
top = KP_8
top-right = KP_9
left = Left
middle = Up
right = Right
bottom-right = KP_3
bottom = KP_2
bottom-left = KP_1

switch = Alt-KP_Divide
cycle = Alt-Shift-KP_Divide

; key modifiers (Alt, Shift, Ctrl, Super) for actions
float = Alt-Shift
expand = Alt-Shift
shrink = Alt-Shift
put = Super-Ctrl
; cycle widths
grid_width = Super
; cycle heights
grid_height = Ctrl-Shift

; exit PyWo
exit = Ctrl-Shift-Alt-Q
; reload configuration file
reload = Ctrl-Shift-Alt-R
; print info for current window
debug = Ctrl-Shift-Alt-I


I changed the configuration so it works almost like the windows alternative, with arrow and super key.

Grid: 2x2

Shortcuts:
Super+Left Arrow  = fill left half of screen
Super+Right Arrow = fill right half of screen
Super+Arrow Up = fill full screen


For list of shortcut/keys available check:
http://python-xlib.svn.sourceforge.net/viewvc/python-xlib/trunk/Xlib/keysymdef/miscellany.py?revision=151&view=markup&pathrev=151
http://python-xlib.svn.sourceforge.net/viewvc/python-xlib/trunk/Xlib/keysymdef/latin1.py?revision=151&view=markup&pathrev=151



Autostart the script:

LXDE:

To autostart a script in LXDE you create a .desktop file in ~/.config/autostart/.
If you are a awesome LXDE user, create ~/.config/autostart/pywo.desktop and fill in the following:


[Desktop Entry]
Encoding=UTF-8
Name=PyWo
Comment=Python Window Organizer
Exec=/home/charnley/settings/pywo-0.2/pywo.py
X-GNOME-Autostart-enabled=true

Where you substitute the Exec with the path to where you downloaded pywo too.



And that is it! Happy windowing!





Monday, 14 May 2012

Biopython tip

Installing Biopython on CentOS is easy. You need the following:


If haven't already done so install this (rather large) package. It loosely corresponds to what I was used to in Ubuntu as "build-essential":

yum groupinstall 'Development Tools'

You  also need this package, or it won't compile (it's not included in "Development Tools):


yum install python-devel

# Now the fun stuff:
wget http://biopython.org/DIST/biopython-1.59.tar.gz
tar xf biopython-1.59.tar.gz
cd biopython-1.59
python setup.py build
python setup.py test
python setup.py install


Happy biopython'ing!

Tuesday, 8 May 2012

Spotify on CentOS 6

There is no installation for Spotify on CentOS, and there are some whacked dependencies which are cumbersome to get around. I tried this on CentOS 6.2

First install Alien (and git):

yum install git make
git clone git://git.kitenet.net/alien
cd alien/
perl Makefile.PL; make; make install

Now download spotify .deb files from:

http://repository.spotify.com/pool/non-free/s/spotify/


Convert and install the Debian/Ubuntu packages:

alien --to-rpm spotify-client-qt*.deb
rpm -Uvh --nodeps spotify-client-qt*.rpm
alien --to-rpm spotify-client*.deb
rpm -Uvh --nodeps spotify-client*.rpm

You're almost done! Now download my magical package of required libraries:
http://dl.dropbox.com/u/17435887/CentOS6/andersx/spotify_libs.tar.gz

Extract these in your home folder. It'll create a directory and a file named (in my case):

/home/andersx/spotify_libs
/home/andersx/spotify.sh

Edit the .sh file so it points to your home directory. In my case:
export LD_LIBRARY_PATH=/home/andersx/spotify_libs

The libraries in spotify_libs were carefully taken from a Ubuntu 10.04 LTS, and in order to NOT mess up your CentOS, use the supplied script to start Spotify without exporting it to your $LD_LIBRARY_PATH when you don't need it.

Of course feel free to put the libraries and launcher script somewhere else.

Happy listening!
:wq