Thursday, March 31, 2011

running more than one linux distribution without rebooting ...

My laptop has reached Nirvana with Debian Squeeze, everything works out of the box, and I very happy with the stability of the system. I don't feel the software is outdated, because I anyway install some applications I need or like directly from source.
However, I still want to be able to run Debian testing, and see how my system evolves. Enter "chroot".

With chroot I can run more that one Linux Distro and more than one X-Server with out the need to stop my work and reboot my laptop. This is just great.

Here is how to do it, assuming you already have a partition with a Debian installed on in do the following (if you don't have a partition with Debian installed, I suggest you take a look at "debootstrap"):

1. First make a location where you will work as the root of the new debian, in my case:
$ su -
# mkdir /debian-sec
2. now mount that partition, in my case /dev/sda5:
mount /dev/sda5 /debian-sec
3. enable important devices so the new Debian will work as expected.
mount -o bind /proc /debian-sec/proc
mount -o bind /dev/ /debian-sec/dev/ 
mount /dev/pts /debian-sec/dev/pts -t devpts 
mount -t sysfs /sysfs/ /debian-sec/sys 
4. finally change the root with chroot:
chroot /debian-sec/ /bin/bash
If you want to run a secondary X-Server, do the following inside the chroot:
chroot # vi /etc/gdm/gdm.conf # do s/vt7/vt9/ in [servers] section
chroot # /etc/init.d/gdm start
this will start another X-Server on vt9, to which you can switch with Alt+Ctrl+F9.

Cheerios, Linux and Debian !

UPDATE: The last section about GDM in chroot seems not to work in gdm3...
with gdm3:

chroot # vim /usr/share/gdm/gdm.schemas

change the following keys:

What does work ?

Switch to tty1, login as root, and chroot into the chrooted debian.
Then chanage to with "su - "

now start the X server as the following:
startx /usr/bin/fluxbox -- :1&
startx /usr/bin/gnome-session -- :1&
startx  -- :1&

Friday, March 25, 2011

'yes,yes' we can ... on the usefull linux command ...

Recently I started building my own LFS, I was pretty amused by the command 'yes'...

However, today I found a use for that command, when I had to install a binary firmware on multiple servers. The binary is not editable and  expects two times 'yes' to finish the process.
So, the solution is to run on all the computers the following command inside a loop :
'yes | sh binary_firmware.exe' - also, this is a simple example a of parallel programming and pipes.

This little trick saved me quite some typing and waiting in front of the computer !

Thursday, March 03, 2011

Matlab Alternative: RStudio

To the list of great Matlab alternative I add today RSTUDIO.
Although, I usually don't program in R, I am glad to see it is not freezing, and continuously develop as a scientific interested language. I am guessing that this fancy IDE for R, would make it easier to accept among people who are deeply rooted in the EXCELLENT MATLAB IDE.
However, doing most of my scientific tasks, and system administration in python, I think Matlab's syntax is equally weird to that of R ;-).

One weird choice of the developers is to call the binary rdesktop instead of rstudio... Maybe they don't know about rdesktop
which is familiar to most system administrators ... oh, well, I guess I'll have to open a bug ...