Tuesday, February 20, 2007

Debian HOW-TO : AIGLX + Beryl

Last revision : April 23th, 2007

With the recent release of Beryl 0.2, the Beryl Project appears stronger then ever.

Folks using Debian have a good reason to be happy about that: a new Debian repository of Beryl packages has recently been unveiled.

This tutorial aims to explain in a clear and concise manner the installation and configuration of a Beryl enabled Debian desktop.

Setting up a Beryl desktop on Debian has never been simpler.


  • Prerequisites


The whole process has been tested on Debian Etch, but should work just as well in Debian Sid. As always, I use sudo to get root privileges.

First, you need either an Intel, ATI, or NVIDIA video card. Regarding both ATI or NVIDIA cards, the proprietary drivers must be properly installed and configured (ie direct rendering enabled). If you need help about that, please refer to the appropriate tutorials (the ATI or the NVIDIA one).

The next step is to ensure that your /etc/X11/xorg.conf configuration file is rightly set up. As the requirement regarding this point are same as for Compiz, please refer to this article for a more in depth explanation.

Very briefly I will state them.

In Section "Modules", have

   Load   "dbe"

in first position.

The Section "Devices" needs this line:

   Option   "XAANoOffscreenPixmaps"   "true"

in last position.

Also, make sure that a Section "Extensions" with this content:

Section   "Extensions"
Option "Composite" "Enable"
EndSection

is present.

NVIDIA users have a few extra requirements.

In Section "Devices", those lines are required:

   Option   "AllowGLXWithComposite"   "true"
Option "TripleBuffer" "true"


Finally, the Section "Screen" must includes those entries:

   Option   "AddARGBGLXVisuals"   "true"
DefaultDepth 24



  • Beryl


If you were using Compiz, I recommend uninstalling it, to avoid any potential conflicts:

sudo apt-get remove --purge compiz compiz-gtk compiz-core compiz-gnome compiz-plugins


For this point on, the rest of the process is extremely straight forward. Simply add the Beryl repository to your /etc/apt/sources.list file:

deb http://debian.beryl-project.org etch main
deb-src http://debian.beryl-project.org etch main


It is to be noted that an equivalent Ubuntu repository exists: http://ubuntu.beryl-project.org/

Then make sure the PGP key is part of your trusted sources:

wget http://debian.beryl-project.org/root@lupine.me.uk.gpg -O- | sudo apt-key add -


And update the repositories:

sudo apt-get update


Finally you can actually install Beryl. Of course, remember to first uninstall Compiz (if you were using it).

GNOME or Xfce folks can use this command:

sudo apt-get install beryl emerald

which will fetch and set up Beryl, along with the Emerald themes manager.

Beside the default emerald, other themes managers exist : aquarine (KDE style) and heliodor (mimics GNOME).

That's it! The last step involves adding beryl-manager to your desktop environment startup script, so that it replaces your default window manager. Again, make sure you erase any prior entry related to Compiz, as the two will not sail along smoothly.


Gnome


In GNOME, go in Desktop -> Preferences -> Sessions and choose the Startup Programs tab. Simply add an entry for Beryl:

beryl-manager



KDE


Just create a file ~/.kde/Autostart/beryl.desktop with this content :

[Desktop Entry]
Encoding=UTF-8
Exec=beryl-manager &
GenericName[en_US]=
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
X-KDE-autostart-after=kdesktop



Xfce


Just edit the file /usr/share/desktop-base/profiles/xdg-config/xfce4-session/xfce4-session.rc and replace xfwm4 with beryl-manager :

Client0_Command=beryl-manager


It's all over! You can enjoy the advanced eye candy feature of this thing of beauty called Beryl.

>>> Read the full article

Thursday, February 08, 2007

Debian HOW-TO : QEMU virtual machine

Last revision : April 28th, 2007

Virtual machines software are rapidly gaining in popularity. Xen, VMware and VirtualBox are all interesting solutions. However there is one that often gets overlooked : QEMU.

Mandriva 2007 and Knoppix 5.1.1 both running in Debian Etch

While QEMU is an impressive piece of software, it can still benefit from the use of tools like KVM or Kqemu, which will further enhance its performances. As much as the above mentioned tools are considered optional components of the QEMU virtual machine, they do enhance QEMU emulation speed to a near native level.


  • Preparation


KVM, as it relies on true hardware virtualization, is certainly the one that provides better added value. The only downside is that it requires a CPU with virtual capabilities.

To verify if you possess such a processor, check out the output of :

cat /proc/cpuinfo | grep flag


And look for either vmx or svm. If they show, then you can use KVM. Otherwise, Kqemu is your best option.


  • Starting with QEMU


For starter you will need QEMU :

sudo apt-get install qemu


And a few tools :

sudo apt-get install module-assistant build-essential


Plus the proverbial kernel-headers (or linux-headers starting with Debian Etch) :

sudo apt-get install linux-headers-$(uname -r)


Next, we take on the installation of KVM, so those who will rely on Kqemu can skip to the Kqemu accelerator section directly.


  • Hardware virtualization with KVM


For those about to use KVM, you must first install the userspace component (part of Debian's Sid repository). Download the require package :

wget http://snapshot.debian.net/archive/2007/02/08/debian/pool/main/k/kvm/kvm_12-1_i386.deb


Then simply install it like that :

sudo dpkg -i kvm_12-1_i386.deb


Linux Kernel 2.6.20


The module component of KVM is also required. You can either compile it as an external module, or use the latest Linux kernel, 2.6.20, which includes KVM. If you wish to compile a kernel, simply take a look at this tutorial.


Linux Kernel 2.6.19.x and below


Those using a Linux kernel version 2.6.19.x (or below) will have to build the KVM as an external module. The procedure is rather straight forward.

kvm-source, which is part of the Debian Sid official repository, is the required package.

Download it :

wget http://snapshot.debian.net/archive/2007/02/08/debian/pool/main/k/kvm/kvm-source_12-1_all.deb


Then install it :

sudo dpkg -i kvm-source_12-1_all.deb


At this point we can effectively compile the module (with module-assistant) :

cd /usr/src
sudo m-a prepare
sudo m-a a-i kvm


We now have everything needed to use KVM, just make sure you have the necessary rights to use it :

sudo adduser your_username kvm


You must of course use your own username instead of your_username. Then you'll need to log out and log back in so the (permission) changes take effects.

Now that KVM is appropriately set up, you can proceed with installing an OS in QEMU.

First you must load the right module (either kvm-intel or kvm-amd depending on your CPU). For example, installing Debian Etch is done like that :

sudo modprobe kvm-intel


Then create an image for Etch to install (sort of a virtual hard drive) :

qemu-img create etch_qemu.qcow 4G


Now that we have a 4G "disk", we can proceed with the actual installation. First download Etch netinstaller :

wget http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/i386/iso-cd/debian-testing-i386-netinst.iso


Then launch it :

kvm -hda etch_qemu.qcow -cdrom debian-testing-i386-netinst.iso -boot d -m 256


Once this virtual Etch is installed, you can run it like that :

kvm -hda etch_qemu.qcow -m 256



  • Kqemu accelerator


While Kqemu's speed is not on par with KVM's one, it certainly constitutes a worthwhile alternative. Fortunately, installing Kqemu is rather simple with the help of module-assistant :

sudo apt-get install kqemu-source
cd /usr/src
sudo m-a prepare
sudo m-a a-i kqemu


Kqemu is now installed. Before using QEMU, Kqemu needs to be set up (this process must be redone after a reboot) :

sudo modprobe kqemu
sudo mknod /dev/kqemu c 250 0
sudo chmod 666 /dev/kqemu


The rest works exactly like when using KVM, except using the qemu command instead. Again let's take Debian Etch as an example on how to install and run an OS :

qemu-img create etch_qemu.qcow 4G
qemu -hda etch_qemu.qcow -cdrom debian-testing-i386-netinst.iso -boot d -m 256



  • Tips about Virtual Computing


Unfortunately QEMU doesn't take care of loading the required modules associated with either Kqemu or KVM. So make sure you do load the appropriate module (kqemu, kvm-intel or kvm-amd) before starting QEMU.

Instead of launching QEMU from the shell, you can also use qemu-launcher, as it will take care of everything :

sudo apt-get install qemu-launcher



Additionnaly, QEMU can run pre-built VMWARE images, of which you can find a great selection on VMWARE community site.

Some Linux distributions won't work very well with KVM. For example, Ubuntu Edgy installer doesn't support KVM, so you simply launch the installer with QEMU (without KVM) :

qemu -hda ubuntu_qemu.qcow -cdrom ubuntu-6.10-desktop.iso -boot d -m 256


Once you have it installed, Ubuntu can be run with KVM :

kvm -hda ubuntu_qemu.qcow -m 256


Further Reading


Debian - Kernel Based Virtual Machine
Windows XP under QEMU
How to create Screencasts with QEMU

>>> Read the full article

Sunday, February 04, 2007

Debian HOW-TO : Managing networks with NetworkManager

To manage both wired and wireless networks, nothing matches NetworkManager easiness and versatility.

The following tutorial will help you install it on Debian (Etch or Sid) and Ubuntu (Dapper or Edgy).


Keep in mind that I use sudo to get root privileges.



  • Prerequisites


First, make sure your network devices are properly configured, as NetworkManager won't help you with that part. So once you have the necessary drivers for your network devices installed (chances are these drivers are included in the Linux kernel already), you can go on with the tutorial.


  • Installation


The installation part is quite simple.

GNOME and XFCE users need to install network-manager-gnome :

sudo apt-get install network-manager-gnome


KDE fans will need network-manager-kde (which is called knetworkmanager in Ubuntu/Kubuntu) :

sudo apt-get install network-manager-kde



  • Configuration


Once you have it installed, a few steps are needed to render it fully functional. First, both Debian and Ubuntu users will need to modify the file /etc/network/interfaces and comment everything except the loopback interface. So only those lines should be included :

auto lo
iface lo inet loopback


While the previously mentioned step is not mandatory, it does speed up the network interfaces detection process at startup, as NetworkManager has its own method for automatically bringing up interfaces (and simply doesn't use /etc/network/interfaces).

Debian users have an additional step to perform. For NetworkManager to work, permissions have to be set rightly, so make your user part of the group netdev :

sudo adduser your_username netdev


Of course you need to replace your_username with your actual username.

Once all those steps are performed, simply reboot your machine to set things right.


  • Notes


XFCE users might want to enable GNOME services at startup, so that NetworkManager will correctly remember connection passwords and preferences.

>>> Read the full article