Kategorie: Linux

Google Nexus One

Google Nexus One Google Nexus One

The making of Google’ Nexus One

Nexus One: The Story – Episode 1: Concept & Design

Nexus One: The Story – Episode 2: Display & 3D Framework

Nexus One: The Story – Episode 3: Testing

Nexus One: The Story – Episode 4: Manufacturing

sysbench unter Debian Lenny kompilieren

sysbench downloaden: http://sourceforge.net/projects/sysbench/

Notwendige Pakete:

apt-get install automake libmysqlclient15-dev

Kompilieren:

./configure
sed -i configure.ac -e 's/AC_PROG_LIBTOOL/AC_PROG_RANLIB/' # fix
./autogen.sh # fix
make
make install

Linux Interface-Mirroring

apt-get install daemonlogger
daemonlogger -i eth0 -o eth3

Bash-Script um zeitgesteuert Programme zu starten

Wenn man beispielsweise heute um 20:15 Uhr ein bestimmtes Script starten möchte, kommt man meist um ein Crontab nicht herum. Mit diesem kleinen Script übergibt man als Parameter ein Datum und/oder Uhrzeit und das Script wartet dann bis zu diesem Zeitstempel, bevor das Script beendet wird und das darauf folgende Programm gestartet wird – somit spart man sich das aufwändige editieren der Crontab-Files.

Beispiel

Uhrzeit:

root@test:~$ ./tsleep.sh 14:30; reboot
i sleep until 2009-12-12 14:30:00 ...

Datum:

./tsleep.sh 2009-12-24; reboot
i sleep until 2009-12-24 00:00:00 ...

Datum mit Uhrzeit:

root@test:~$ ./tsleep.sh 2009-12-24 13:45:12; reboot
i sleep until 2009-12-24 13:45:12 ...

Funktionsweise

Der Zeitstempel wird in Sekunden umgerechnet und über eine while-Schleife sekündlich mit dem aktuellen Datum abgeprüft. Ist das aktuelle Datum gleich oder älter dem Zeitstempel, wird das Script beendet und das darauf folgende Program gestartet. Als Zeitstempel kann man alles verwenden was date futtert.

Eine alternative wäre die Differenz der aktuellen Zeit und des Zeitstempels in Sekunden umzurechnen und dann sleep zu übergeben. Ob das perfomanter ist – keine Ahnung, mein Script dagegen überlebt auch Zeit-Anpassungen (z.b. rdate/ntpdate), daher habe ich diesen Weg gewählt.

Sollte jemand Fehler finden oder das Script verbessern, würde ich mich freuen, wenn Ihr mir das mitteilt ;).

Script

#!/bin/bash
 
if [[ -z "$1" ]]; then
        echo "Usage: $0 <timestamp>" >&2
        exit 1
elif [[ -z "$2" ]]; then
        date="$1"
else
        date="$1 $2"
fi
 
date_end=$(date --date="$date" +%s 2>/dev/null);
 
if [[ ! $? -eq 0 ]]; then
        echo "error: invalid date" 2>&1
        exit 1
fi
 
if [[ $date_end -le $(date +%s) ]]; then
        echo "error: end time is lower or eqal start time" >&2
        exit 1
fi
 
echo "i sleep until $(date --date="$date" "+%Y-%m-%d %H:%M:%S") ..."
 
while [[ $(date +%s) -le $date_end ]]; do
        sleep 1
done
 
exit 0

Download

Download tsleep.sh

wget http://blog.kevin-k.com/wp-content/uploads/2009/12/tsleep.sh
chmod +x tsleep.sh

at

Alternativ gibt es auch at, das Befehle direkt von Standard-Input oder einer Datei ließt und zu einer bestimmten Uhrzeit ausführt.

iop0: DMA / IO allocation for I2O controller failed

After the installation of debian lenny on my i2o controller (via manual bootloader installation), the system halts:

iop0: DMA / IO allocation for I2O controller failed

The problem is that the dpt_i2o module is loaded before i2o_core, so that i2o_core module cannot allocate the i2o controller.

The simplest solution is to to blacklist the dpt_i2o module, so that module is not loaded at startup and i2o_core can successfull allocate the i2o controller.

For lilo, add this in your /etc/lilo.conf:

image=/vmlinuz
        ...
        append="blacklist=dpt_i2o"

Do not forget to run “lilo” afterwards.

For grub, you must add the the following kernel parameter:

...
kernel /vmlinuz ro root=/dev/i2o/hda1 blacklist=dpt_i2o

I do not use grub, so please correct me if the param is somehow wrong.

Download VMware Server 2 via wget

Its a little bit tricky, but this is how it works:

Get download-url

Go to http://www.vmware.com/go/getserver and login (or register).

get the download-url of the file (right-click…):
vmware download Download VMware Server 2 via wget

Get cookie

To download via wget, you need to get the cookie named “ObSSOCookie” from your browser.
vmware download cookie Download VMware Server 2 via wget

Download via wget

Use this command to download the file:

wget --no-check-certificate --header="Cookie: ObSSOCookie=<content>" "<url>" -O vmware-server.tar.gz

Example:

wget –no-check-certificate –header=”Cookie: ObSSOCookie=content” “https://www.vmware.com/freedownload/p/download.php?product=server20&a=DOWNLOAD_FILE&baseurl=http://download2.vmware.com/software/server/&filename=VMware-server-2.0.1-156745.i386.tar.gz” -O vmware-server.tar.gz

Happy downloading ;).

Installation von VMware Tools auf Debian Lenny

apt-get install build-essential psmisc gcc-4.1 linux-headers-$(uname -r)
tar xfzv VMwareTools-7.8.4-126130.tar.gz
./vmware-tools-distrib/vmware-install.pl
CC=/usr/bin/gcc-4.1 /usr/bin/vmware-config-tools.pl

gcc-4.1 ist notwendig, wenn der Kernel (z.b. aus den Repositories) mit einer anderen GCC Version kompiliert wurde, als auf dem System vorhanden:

Your kernel was built with “gcc” version “4.1.3″, while you are trying to use
“/usr/bin/gcc” version “4.3.2″. This configuration is not recommended and
VMware Tools may crash if you’ll continue. Please try to use exactly same
compiler as one used for building your kernel. Do you want to go with compiler
“/usr/bin/gcc” version “4.3.2″ anyway?

mysql-server-5.0 ohne exim4 installieren

aptitude --without-recommends install mysql-server-5.0

snmpd: cannot open /proc/net/dev or /proc/net/snmp

I get the following message in syslog from snmpd:

Jun 22 17:10:43 test snmpd[9508]: cannot open /proc/net/snmp ...
Jun 22 17:10:45 test snmpd[9508]: cannot open /proc/net/dev ...

The problem is, that snmpd has no rights to access the proc-filesystem to gather information about interfaces and so.

check the rights of the user and group of snmpd:

root@test:~$ cat /proc/$(pidof snmpd)/status | grep -i -e "^[u|g]id"
Uid:    106     106     106     106
Gid:    0       0       0       0

In my case, the problem was that i was running a grsec kernel (stupid default kernel of my root) and access to proc by users was permitted by the kernel.
to change this, you must change your kernel config (see grsecurity for instructions).

another solution is to change the user or group to a special grsec user/group. but event this is not working correct under some distributions, but patching the source code of snmpd may help.

Debian Lenny auf Hosteurope VPS installieren

Mit dem folgenden Howto zeige ich euch, wie man auf einem Hosteurope VPS (Virtual Private Server), der unter der Virtualisierungssoftware Parallels läuft, ein aktuelles Debian Lenny installiert. Leider ist nur Debian 4.0 als neustes Debian-Image verfügbar, daher installieren wir Lenny mittels debootstrap über den Recovery-Modus.

Installation

Als aller erstes Installieren wir debootstrap unter dem bereits laufendem Etch-System:

apt-get update
apt-get install debootstrap

Wir werden das neue Lenny-System in einem Unterordner innerhalb des alten Systems installieren.

mkdir /.new

Das neue Lenny-System wird nun mittels debootstrap in den Ordner /.new installiert:

debootstrap --arch i386 lenny /.new http://ftp.de.debian.org/debian/

Konfiguration

Wir kopieren wir ein paar notwendige Konfigurationsdateien aus dem laufenden System in das neue:

cp /etc/fstab /.new/etc
cp /etc/network/interfaces* /.new/etc/network
cp /etc/hosts /.new/etc
cp /etc/hostname /.new/etc

Nun starten wir im Rescue-Modus, wo wir den Inhalt des alten Systems in /repair finden.
/.new ist also nun in /repair/.new.

Wir löschen als aller erstes das alte System:

// entfernt alle ordner außer ".new" von /repair
rm -rv /repair/*

Danach verschieben wir das neue System von /repair/.new nach /repair:

mv /repair/.new/* /repair
rm -r /repair/.new

Damit apt/dpkg (rm) korrekt für die SSH-Installation funktioniert, müßen wir noch das proc- und devpts-Dateisystem in das neue System mounten:

mount -t proc proc /repair/proc
mount -t devpts none /repair/dev/pts

chroot in das neue Lenny-System…

LANG=C chroot /repair /bin/bash

… und SSH installieren:

apt-get update
apt-get install ssh

Passwort setzen nicht vergessen:

passwd

… und wieder raus aus dem chroot:

exit

Das wars!
Nun in das Virtuozzo PowerPanel rein, den Repair-Modus beenden und danach sollte das neue Lenny-System erreichbar sein.