Archive for the 'Bits & Bytes' Category

Playstation 3 – der beste Ersatz für echte Freunde

January 13th, 2009

Die Playstation 3 erobert jetzt (dank günstiger Preise in UK) einige Wohnzimmer, so auch unseres.

Um der sozialen Komponente genüge zu tragen hier einige Playstation Network User:

  • Peter & Elke: donpedro80 & elkemaus
  • Martin & Nathalie: basketfighter & spacegirl666
  • Roland & Sonja: Random-Logic & Schnautzal
  • Ferenc: ?
  • Chris: tintifax4711
  • Oliver: okabae
  •   Category: Bits & Bytes   A-Tags:
  • Comments Off on Playstation 3 – der beste Ersatz für echte Freunde

Howto resize a qcow2 disk image

November 8th, 2008

Resizing of the file-based qcow2 format for handling disk images is possible by performing the resize on a different format and use the conversion capabilities of qemu-img.

Having created a 1GB disk image in qcow2 format like this:

quikit:/var/kvm# qemu-img create -f qcow2 mydisk.qcow2 1G
Formatting 'mydisk.qcow2', fmt=qcow2, size=1048576 kB
quikit:/var/kvm# qemu-img info mydisk.qcow2
image: mydisk.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 16K
cluster_size: 4096

The resize existing images the following steps are required:

  1. Convert the qcow2 disk image to raw format

    qemu-img convert -f qcow2 mydisk.qcow2 -O raw mydisk.raw
  2. Resize the raw image using dd (the file contents is not touched)

    dd if=/dev/zero of=mydisk.raw bs=1M count=0 seek=4096
  3. Convert back to the qcow2 format (only used blocks will take up diskspace)

    qemu-img convert -f raw mydisk.raw -O qcow2 newmydisk.qcow2

After conversion the qcow2 info now shows:

quikit:/var/kvm# qemu-img info newmydisk.qcow2
image: newmydisk.qcow2
file format: qcow2
virtual size: 4.0G (4294967296 bytes)
disk size: 28K
cluster_size: 4096

So resizing a partition can be as simple as that. Now try to boot the resized image, if it is not working you may have to reinstall the bootloader.

If you are using a NTFS partition you have to take special care. See the qemu forum for details.

Starting up QuikIT…

September 15th, 2008

Das neue Einzelunternehmerprojekt QuikIT geht an den Start.

Nach doch inzwischen einigen Jahren der minimalen Zeitinvestition in diverse IT-Dienstleistungen soll nun das ganze in einer organisierteren Form von statten gehen und auch die Möglichkeit schaffen größere Projekte (wie eben http://www.quikplan.at) umzusetzen.

Fokus wird anfangs sicher auf:

  • Web-Hosting für Private, Vereine und Kleinunternehmen
  • Domain-Registrierungen verbunden mit obigem
  • System-Administration (Linux, MySQL, PostgreSQL, Virtualisierung)
  • Beratende Tätigkeiten im Bereich Linux, High-Availability mit Open Source, Virtualisierung, Datenbanken und auch der OpenSource Einsatz im Unternehmensumfeld

Mehr unter http://www.quikit.at

Building proprietary ATI fglrx driver on Debian Lenny x86_64

August 25th, 2008

To build the ATI proprietary driver (version 8.8, being reported as 8.522) on Debian Lenny 2.6.26-1-amd64 (probably the same for testing/unstable) on x86_64 I ran into 2 subtle problems which requried a little tricking to get the driver compiled and loaded. The following issues apply only to the x86_64 version of linux.

The first issue is a library problem with a very misleading description .

shell# sh /home/random/ati-driver-installer-8-8-x86.x86_64.run --buildpkg Debian/testing
... build fails with library libXext.so.6 missing ...

The solution is to install the ia32-libs, which contain the correct libs for ia32. Building with the above command work fine afterwards. Then it was possible to install the packages

shell# dpkg -i fglrx-amdcccle_8.522-1_amd64.deb fglrx-driver_8.522-1_amd64.deb fglrx-kernel-src_8.522-1_amd64.deb

The second issue happened during loading of the kernel module after building, installing and loading it with

shell# m-a build fglrx
shell# dpkg -i /usr/src/fglrx-kernel-2.6.26-1-amd64_8.522-1+2.6.26-3_amd64.deb
shell# modprobe fglrx


fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel.
fglrx: Unknown symbol flush_tlb_page

The patch is basically to remove the defined(__SMP__) from a preprocessor rule (this is not my patch, please see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485605 for details).

-#if defined(__x86_64__) && defined(__SMP__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
+#if defined(__x86_64__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))

After applying the patch, rebuilding the packages, recreating the module, installing the resulting kernel-module package and loading the kernel module everything worked like a charm. Of course you need to correctly configure the driver for your X server.

Thoughts on parametrized roles for Moose

July 15th, 2008

Moose is your favorite meta-object system in your favorite language of choice. And you already have a lot of excellent concepts that extend the basic usage of object-oriented programming, like having simple means to override parts of methods (around, before, after) and of course roles.

Roles are great, I even used them for my logging needs in MooseX::Log::Log4perl as stated earlier. After getting getting feedback by Micheal Schilli to add an easier interface for simple logging needs I had two choices to accomplish that:

  • Add another role (and reuse the initial role) like it is implemented currently in MooseX::Log::Log4perl::Easy:

    package MooseX::Log::Log4perl::Easy;
    use Moose::Role; ### Make it a moose role
    with 'MooseX::Log::Log4perl'; ### Reuse the base role with its attributes and methods
    sub log_fatal { my $self = shift; $self->logger->fatal(@_); }
    sub log_error { my $self = shift; $self->logger->error(@_); }
    ...
  • Use a method alias by using import to have a function returning the correct role to use with with. This is exactly what MooseX::Storage does to allow parametrized loading of moose roles to save some typing for lazy people and improving readability.

    use Moose;
    use MooseX::Storage; ### You have to use it to allow import to provide you the Storage alias
    with Storage('format' => 'JSON', 'io' => 'File'); ### Use the function to return the correct roles

The first approch clutters my module package a little, also requiring more documentation and hinting for people to find the module (more of a problem for lazy people like me).
The downside of the second approach is, that you have to use MooseX::Storage first, to have the Storage function exported. And it does not really look like the standard way of adding a role to the object, which is usually defined using quoted string like with 'MooseX::Log::Log4perl'; (note the quotes here).
A solution to that problem might be adding another keyword function to moose e.g. called role that makes use of some import magic and returns the correct role packages to load, also calling role initialization method, that allows to do some role tricks.

use Moose;
with role 'My::Role'; ### no magic here same as: with 'My::Role';
with role 'MooseX::Log::Log4perl' => ':easy'; ### pass a param
### or even
with role 'MooseX::Log::Log4perl', prefix => 'mylog_'; ### pass the param hash/pair to a role

The role keyword would return the correct role method to load, and additionally allow the role to initialize and use the prefix parameter to do some additional initialization, even if that would mean only setting a “_role_param attribute” that could be used later in default coderefs. Using this, would mean that you cannot use multiple roles with the with role keywords, but that’s ok for me, since perl users are used to that anyway, it’s the same for use.

Bringing logging to Moose with MooseX::Log::Log4perl

July 13th, 2008

Finally after some playing around and discovering the main concepts behind moose and failing to find a logging role using my favorite logging system log4perl I sat down an did a little coding (it is really just a few lines) and uploaded to CPAN as MooseX::Log::Log4perl.

As I already received some valuable feedback by Michael Schilli of Log4perl fame, the interface might change a little (staying backwards compatible) to be easier to use for small projects by using something like with MooseX::Log::Log4perl qw(:easy) to give you methods for log_error, log_warn, log_debug, … directly on your class instance.

If your interested see the open RT ticket 37655.

This module was actually written as part of my other project called QuikPlan, a course scheduling and management web application.

« Prev - Next »

primary