Ein Tag mit Xen: Vanilla-Xen und -Kernel auf Ubuntu Karmic installieren
Bislang laufen alle unsere Dom0s entweder auf Ubuntu 8.04 oder openSUSE 11.1 oder 11.2. Für einen neuen alten Server wollte ich Ubuntu 9.10 als Basis nehmen, auch um im Mai leichter auf 10.04 wechseln zu können. Bei Ubuntu ist die Xen-Situation nicht besonders rosig: Laut halboffizieller Doku steht weder ein aktueller Xen, noch ein brauchbarer Kernel bereit. Immerhin ein Xend (der Verwaltungsdaemon) in Version 3.3. Erfahrungen seit 3.2 haben gezeigt, dass sich die Schnittstellen kaum noch ändern, so dass der 3.3er Daemon mit dem 3.4er Xen zusammen arbeiten sollte. Denkste.
Ziel waren zwei Server: Ein 64-Bit-System fürs Büro und ein 32-Bit-System für einen alten (AMD Athlon XP 2000, 512MB, 80GB) Hetzner Rootie (Presse-Testsystem). Beide Systeme wurden zunächst mit einem Ubuntu Minimalsystem ausgestattet. Bei Hetzner geschah dies aus dem Notfall-System per debootstrap (fertige OS-Images werden nur einmal am Tag aufgespielt, was stört, wenn man nach einer abgeschossenen Installation neu aufsetzen möchte) und der Server zuhause wurde per Debian-Installer per PXE-Netboot eingerichtet. Die zwei Möglichkeiten, einen Hetzner-Server mit Ubuntu oder Debian auszustatten — debootstrap und den Debian-Installer im SSH-Modus — erkläre ich bei Gelegenheit im Detail.
Benötigte Pakete
Mit dem folgenden Befehl sollten alle Abhängigkeiten aufgelöst werden, die zum Bau von Xen und dem Betrieb einer Dom0 benötigt werden:
apt-get install rsync screen build-essential bin86 bcc libssl-dev \
gettext libncurses-dev python python-dev pciutils-dev libx11-dev \
pkg-config python-twisted bridge-utils gawk
Unter 32 Bit-Systemen sollte man aus Performance-Gründen noch die angepasste C-Bibliothek installieren:
apt-get install libc6-xen
Kernel kompilieren
Ubuntu selbst bietet einen Kernel für Amazons EC2, der sollte einigermaßen gut auf aktuellen Xen-Versionen laufen. Getestet habe ich es nicht. Stattdessen habe ich selbst drei Kernel kompiliert: Einen für AMD64 mit vollem Dom0-Support und vielen Treibern, einen mit stark abgespeckten Treibern (für 64Bit-DomUs) und einen i686-Kernel mit vollem Dom0-Support und der Möglichkeit, auf älteren Xen-Versionen gestartet zu werden. Die für Xen benötigten Frontend- sowie Backend-Treiber habe ich statisch integriert, was den Vorteil hat, dass an der Konfiguration des Initramfs nichts geändert werden muss. Alle Konfigurationen bieten Verbesserungspotential, beispielsweise beim Abspecken um nicht benötigte Treiber. Hier sei allerdings darauf verwiesen, dass das Entfernen vermeintlich nicht benötigter Funktionen Unresolved Symbols und damit Kompilationsabbrüche zur Folge haben kann.
Als Kernel kommt hier Gentoos 2.6.31.12 — konkret das Patchset xen-patches-2.6.31-12.tar.bz2 — zum Einsatz. Die verwendeten Patches stammen größtenteils von openSUSEs Xen-Kernel, wurden aber von SuSE-Spezifika befreit. Das macht das Bauen und die Installation einfacher. Gepflegt werden die Patches als eigenes Projekt bei Google Code.
Meine Konfigurationsdateien:
- config-2.6.31.12-mfs002-xen0-compat-i586
- config-2.6.31.12-mfs001-xen0-amd64
- config-2.6.31.12-mfs006-xenU-minimal-amd64
Und nun zum Bauen des Kernels, hier für AMD64:
mkdir xen-patches-2.6.31-12 cd xen-patches-2.6.31-12 tar xvjf ../xen-patches-2.6.31-12.tar.bz2 cd ../linux-2.6.31 for i in ../xen-patches-2.6.31-12/*.patch1 ; do patch -p1 < $i ; done wget -O .config http://cdprojekte.mattiasschlenker.de/Public/Xen-Kernel/config-2.6.31.12-mfs001-xen0-amd64 make oldconfig make make install make modules_install
Der Kernel braucht noch ein passendes Initramfs, dieses entsteht mit:
mkinitramfs -o /boot/initrd.img-2.6.31.12-mfs001-xen0-amd64 2.6.31.12-mfs001-xen0-amd64
Falls Sie Xen Frontend- oder Backend-Treiber in Module ausgelagert haben, müssen Sie ggf. die Modulliste des Initramfs anpassen!
Xen Hypervisor installieren
Ohne Xen nützt der schönste Kernel nichts, also bauen und installieren wir Xen 3.4.2 aus dem offiziellen Tarball von www.xen.org:
tar xvzf xen-3.4.2.tar.gz cd xen-3.4.2 make xen make install-xen
Bootloader konfigurieren
Der einfachste Weg ist die Erstellung eines simplen Scriptes /etc/grub.d/50_xen, welches hart kodiert Kernelnamen, Xen-Version und Pfade (Root-Device ist hier /dev/sda4) enthält. Zweimal root=... ist kein Tippfehler, sondern als Workaround für einen kleinen Bug in den Scripten des Initramfs gedacht:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Ubuntu 9.10 - Xen 3.4.2 + Linux 2.6.31" {
insmod ext2
set root=(hd0,4)
multiboot /boot/xen-3.4.2.gz
module /boot/vmlinuz-2.6.31.12-mfs001-xen0-amd64 root=/dev/sda4 ro root=/dev/sda4
module /boot/initrd.img-2.6.31.12-mfs001-xen0-amd64
}
Das Script muss nun noch ausführbar gesetzt werden, sonst wird der neue Eintrag nicht in die GRUB-Konfiguration übernommen!
chmod a+x /etc/grub.d/50_xen
In der Datei /etc/default/grub sollten Sie den Standard-Booteintrag auf den neuen Kernel setzen:
GRUB_DEFAULT="Ubuntu 9.10 - Xen 3.4.2 + Linux 2.6.31"
Danach rufen Sie update-grub auf um die Bootloader-Konfiguration neu aufzubauen. Rebooten Sie jetzt den Rechner mit Xen und dem neuen Kernel.
Installation der Xen-Tools
Die Xen-Tools habe ich in einem frisch entpackten Xen-Tarball kompiliert. Die bei der Installation angegebene Variable ist wichtig, damit die Python-Module in den bei Ubuntu üblichen Pfaden landen. Gibt man diese Variable nicht an, ist es ggf. erforderlich eine Umgebunsvariable PYTHONPATH zu setzen und diese ggf. in das Script /etc/init.d/xend einzubauen:
rm -rf xen-3.4.2 tar xvzf xen-3.4.2.tar.gz cd xen-3.4.2 make tools make install-tools PYTHON_PREFIX_ARG=
Wenn alles geklappt hat, lässt sich der Xend starten. Läuft dieser, können die Bootmeldungen des Hypervisors ausgelesen werden.
/etc/init.d/xend start xm dmesg
Xend in den Runleveln verlinken
Ich habe Xend vor dem SSH-Server verlinkt, den Start der domU-Instanzen danach. Grund waren Probleme mit dem SSH-Server: Upstart (oder der Xend?) versucht diesen neu zu starten, wenn neue Interfaces auftauchen. Das gelingt nicht immer, so dass ich während meiner Tests häufiger ohne SSH da stand. Auf einem Root-Server ist so etwas natürlich ganz bescheiden.
update-rc.d xend start 14 2 3 4 5 . stop 80 0 1 6 . update-rc.d xendomains start 21 2 3 4 5 . stop 79 0 1 6 .
Vorbereitung für Routing-Setup
Achtung: Siehe auch den Nachtrag vom 19. März für ein besseres Setup!
Provider wie Hetzner oder Strato routen einem Server zugewiesene Subnetze auf dessen primäre IP-Adresse. Deshalb muss bei diesen Servern das Xen-Netzwerk von bridged auf routed umgestellt werden. Achtung: Einige Provider klemmen Server gnadenlos ab, wenn hinter einem Port des Routers bislang unbekannte MAC-Adressen auftauchen. Wer den Xend bei so einem Provider startet, ohne vorher auf routed umgestellt zu haben, fliegt aus der SSH-Verbindung raus und darf mit dem Support telefonieren!
Zuerst wird die Datei /etc/modules um eine Zeile
dummy
für den Dummy-Netzwerk-Adapter erweitert.
Es folgt die statische Konfiguration der primären IP-Adresse auf eth0 und der ersten nutzbaren IP-Adresse auf dummy. In diesem Fall haben wir das Subnetz 172.16.16.112/ 255.255.255.248 (acht Adressen von .112 bis .119) zugewiesen bekommen, .112 ist hier die Adresse des Netzes, .113 wird auf dummy0 gelegt, .114 bis .118 (fünf von acht Adressen) sind für die domUs nutzbar und .119 ist die Broadcast-Adresse:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
auto dummy0
iface dummy0 inet static
address 172.16.16.113
netmask 255.255.255.248
In der Konfigurationsdatei /etc/xen/xend-config.sxp des Xend muss die Einstellung von bridged auf routed umgestellt werden. Das zu routende Device muss explizit angegeben werden:
# (network-script network-bridge) # (vif-script vif-bridge) (network-script 'network-route netdev=dummy0') (vif-script 'vif-route netdev=dummy0')
An dieser Stelle ist ein Neustart des Xend, besser ein Reboot erforderlich. Anschließend können die domUs konfiguriert werden. Die Routing-Informationen werden hierfür in der Client-Config eingetragen:
kernel = "/boot/vmlinuz-2.6.31.12-mfs006-xenU-minimal-amd64" ramdisk = "/boot/initrd.img-2.6.31.12-mfs006-xenU-minimal-amd64" memory = 256 name = "ubuntu-amd64-minimal" vif = [ 'ip=172.16.16.114' , 'mac=00:16:00:00:00:27' ] disk = [ 'file:/usr/local/xendomains/test01_64/sda1.img,sda1,w' ] root = "/dev/sda1 ro" extras = "console=hvc0 xencons=tty"
Daneben ist es erforderlich, die IP-Konfiguration in der /etc/network/interfaces der domU einzutragen -- DHCP möchte ich an dieser Stelle nicht erklären, das würde den Rahmen sprengen.
Vielen Dank an...
- Installing Xen on Ubuntu 9.10 -- Brandon's Blog ...für die Idee mit dem Gentoo-Kernel und die GRUB-Konfiguration
- An introduction to custom Xen networking -- Debian Administration ...für die Hinweise zum Routed-Setup
Anmerkungen:
-
Nie erst Ubuntus Xen-Tools 3.3 installieren und dann diese Anleitung durchführen. Das resultierende Versionsmischmasch wird garantiert kein funktionierendes Netzwerk zur Folge haben!
-
Details zur domU-Konfiguration bei Hetzner folgen
-
Details zur Ubuntu-/Debian-Installation aus Hetzners Rettungssystem folgen

[...] Wordpress 2.x.x. News und Kommentare können als RSS-2.0-Feed abonniert werden. « Ein Tag mit Xen: Vanilla-Xen und -Kernel auf Ubuntu Karmic installieren [...]
Great website…
Cool post, I really enjoyed reading it. I will check out your site for some more content on this subject….
Websites you should visit…
I really liked your blog, appreciate the great information….
… [Trackback]…
[...] Find More Informations here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More Infos here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] There you will find 72884 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] There you will find 78489 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] There you will find 70798 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
Websites worth visiting…
I enjoyed reading your article, many thanks….
… [Trackback]…
[...] There you will find 61352 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] There you will find 78545 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Find More Informations here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Informations on that Topic: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More Infos here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Informations on that Topic: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Informations on that Topic: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Read More Infos here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
Related……
[...]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[...]……
Recommeneded websites…
[...]Here are some of the sites we recommend for our visitors[...]……
… [Trackback]…
[...] There you will find 78988 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
Websites you should visit…
[...]below you’ll find the link to some sites that we think you should visit[...]……
Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
… [Trackback]…
[...] Read More here: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
Sources…
[...]check below, are some totally unrelated websites to ours, however, they are most trustworthy sources that we use[...]……
Read was interesting, stay in touch……
[...]please visit the sites we follow, including this one, as it represents our picks from the web[...]……
Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
… [Trackback]…
[...] There you will find 79775 more Infos: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
… [Trackback]…
[...] Informations on that Topic: blog.rootserverexperiment.de/2010/03/18/vinalla-xen-und-kernel-auf-ubuntu-karmic/ [...]…
Amazing post…
Read More…
Sites You Should Check Out…
http://www.pentlands.getlisted.co.nz/cheap-hotels-in-auckland-city...
divx-downloads.de/uber-routenplaner…
http://www.divx-downloads.de/uber-routenplaner...
ironmountainobservatory.com…
http://www.ironmountainobservatory.com...
Condo Rentals in Siesta Key…
[...]below you’ll see the links to some sites that we think you will like[...]…
klangklangklang.de…
http://klangklangklang.de...
Emergency dentist san diego…
[...]just underneath, are some completely unrelated places to mine, however, they are definitely worth seeing[...]…
home appliances insurance…
[...]look at the content we have linked to above[...]…
Salt Lake City Corporate Events…
[...]here are some links to web sites that we link to because we think they are worth visiting[...]…
You should check this out…
[...] Wonderful story, reckoned we could combine a few unrelated data, nevertheless really worth taking a look, whoa did one learn about Mid East has got more problerms as well [...]……
singles dating sites…
Hello There. I discovered your weblog the use of msn. That is a very well written article. I๏ฟฝll make sure to bookmark it and come back to learn more of your useful information. Thank you for the post. I will definitely comeback….
Family Dentist Colorado Springs…
[...]while the sites we link to overhere are`nt related to ours,they are worth seeing[...]…
kunstparkost.de/warum-und-wie-grunde-ich-eine-%e2%80%9cmini-gmbh%e2%80%9d…
http://www.kunstparkost.de/warum-und-wie-grunde-ich-eine-%e2%80%9cmini-gmbh%e2%80%9d...
Educational Franchise…
[...]visit the content or sites we have linked to underneath[...]…
it-boerner.de/auch-ein-babyname-will-gut-ausgesucht-sein…
http://www.it-boerner.de/auch-ein-babyname-will-gut-ausgesucht-sein...
Extended Car Warranties…
[...]we like to link to other websites on the internet. Below are some places worth checking out[...]…
Massage Pittsburgh…
[...]just above, are some totally worth checking out places[...]…
gutentak.de/ohne-vorwarnungbeschaftigungslos…
http://www.gutentak.de/ohne-vorwarnungbeschaftigungslos...
cheap health insurance in orange county…
[...]look at the content we have linked to underneath[...]…
Car Warranty News and Reviews…
[...]while the sites we connect to underneath are`nt related to us, but are worth going to[...]…
Looking around…
While I was browsing yesterday I noticed a great post about…
klangklangklang.de/wie-veroffentliche-ich-eine-pressemitteilung…
http://www.klangklangklang.de/wie-veroffentliche-ich-eine-pressemitteilung...
super-black.de/auf-der-suche-nach-dem-geeigneten-babynamen…
http://www.super-black.de/auf-der-suche-nach-dem-geeigneten-babynamen...
divx-downloads.de/uber-routenplaner…
http://www.divx-downloads.de/uber-routenplaner...
robert-wiechmann.de…
http://robert-wiechmann.de...
Christmas Ornaments Wholesale…
[...]we like to link to other pages on the internet, even if they aren’t related to us, by linking to them.[...]…
Cheap Plasma Cutter…
[...]websites we recommend to look at[...]…
Fire odor removal Denver…
[...]below you’ll see the links to some sites that we think you should visit[...]…
[...] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate, just click the links over[...]……
[...] Every once in a while we choose blogs that we read. Listed below are the latest sites that we choose [...]……
Denver Web Marketing…
[...]checking out we have linked to below [...]…
dating online free…
Heya i am for the first time here. I came across this board and I find It really useful & it helped me out much. I hope to give something back and help others like you aided me….
computer repair orange county…
[...]Neat websites we got to[...]…
Window cleaning orange county ca…
[...]Cool websites we check out[...]…
Home Security Nashville…
[...]websites we recommend to see[...]…
Cool sites…
[...]we came across a cool site that you might enjoy. Take a look if you want[...]……
Bored at work…
I like to browse around the web, often I will go to Stumble Upon and follow thru…
Cool sites…
[...]we came across a cool site that you might enjoy. Take a look if you want[...]……
Greeley Apartments…
[...]sites we suggest to look at[...]…
Recommeneded websites…
[...]Here are some of the sites we recommend for our visitors[...]……
chorensemble-intermezzo.de/alles-uber-druckertoner…
http://www.chorensemble-intermezzo.de/alles-uber-druckertoner...
You should check this out…
[...] Wonderful story, reckoned we could combine a few unrelated data, nevertheless really worth taking a look, whoa did one learn about Mid East has got more problerms as well [...]……
Water Damage Colorado Springs…
I saw someone talking about this on Tumblr and it linked to…
Tour Dubai…
[...]underneath are some websites worth checking out[...]…
Colorado Springs Air Conditioning Company…
[...]the time to check out the content or pages we have [...]…
Websites you should visit…
[...]below you’ll find the link to some sites that we think you should visit[...]……
Check These Out…
[...]check below, are some totally unrelated websites to ours, however, they are most trustworthy sources that we use[...]…
Cool sites…
[...]we came across a cool site that you might enjoy. Take a look if you want[...]……
[...]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[...]……
[...]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[...]……
Gordon Flato…
%BLOGURL%…
Wesley Pileggi…
link to original post :…
tb4486194@4486194…
I’ve said that least 4486194 times….
Cool sites…
[...]we came across a cool site that you might enjoy. Take a look if you want[...]……
Sites You Should Check Out…
http://www.christchurchglass.getlisted.co.nz/double-glazing-retrofit...
I love your blog. Very nice colors and choice of theme. Did you create this blog yourself or did you hire someone to do it for you? Plz reply as I am looking to launch my own blog and would like to know where youu got this from. cheers!…
I really like your site. Very nice colors and choice of theme. Did you design this blog yourself or did you hire someone to do it for you? Plz answer back as I am looking to design my own blog and would like to know where youu got this from. thank you!…
the nearby…
comes with a number of advantages as well as disadvantages. The online games are some of the useful and harmless assets which can be…
Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
can be…
is on the market from the free internet sites. You do not want an teacher that will help you find out about on-line games….
I love your blog. Very nice colors and choice of theme. Did you create this blog yourself or did you hire someone to do it for you? Plz reply as I am looking to launch my own blog and would like to know where youu got this from. cheers!…
I really like your site. Very nice colors and choice of theme. Did you design this blog yourself or did you hire someone to do it for you? Plz answer back as I am looking to design my own blog and would like to know where youu got this from. thank you!…
help to…
versions which can be well-liked in the regions wherein you reside. But over the internet things are…
house that…
to choose from while deciding the way to help young people spend their time.The web…
Sites You Should Check Out…
http://www.dwhomes.getlisted.co.nz/...
will find…
enthusiasm the video games arouse in kids signifies that they are going to want to transfer straight to the games without losing a lot time…
[...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]……
[...]Here are some of the sites we recommend for our visitors[...]……
Recommeneded websites…
[...]Here are some of the sites we recommend for our visitors[...]……
Visitor recommendations…
[...]one of our visitors recently recommended the following website[...]……
to be found…
they’re secure online. The contents of on-line games are determinate and certain. It is possible for you to to know what the games are about and might therefore…
be all…
study the games at your personal pace. Online video games are available for you any time of day or night and so there are nearly no limitations to what you are able to do…
Choosing Plastic Pouches…
[...]Neat sites we got to[...]…
bits and…
to discern useful information particularly from the young…
make to…
video games variations no matter where you reside. It is common with sure on-line video games to search out that folks in one…
tops of…
available on the internet. There are a number of websites which are thought of inappropriate or unsuitable for young people because of the…