Differences between revisions 35 and 54 (spanning 19 versions)
Revision 35 as of 2007-05-24 03:02:58
Size: 6457
Editor: ?RyanJamieson
Comment: Italicized commands.
Revision 54 as of 2012-04-27 09:46:12
Size: 10207
Editor: ?IanCampbell
Comment: Link to wiki.xen.org installation guide, the Xen page previous referenced seems to only contain a circular link back to this page.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
/!\ ToDo: update for the Backports change, etch->lenny->squeeze?
Line 2: Line 4:
Line 6: Line 7:

The only things influencing the installation through d-i of the xen environment are diskspace and RAM. To start with the last: usually 196 MB RAM is needed for domain0. You can do with less: 128MB and I've even seen reports from people running with 64MB or even 32MB, but keep to defaults if this is your first time with xen. Aditional functionality for domain0 like dhcpd, iptables and installation services (eg. apache with apt-proxy) claim more. For a default domain0 you need 512MB diskspace and then you've got to keep an eye on it, so do at least 1GB. I use 2GB to be safe. For simplicities sake I keep it all in 1 filesystem. Local requirements for logging, accounting and/or auditing may claim extra. Swap space is the usual rule of thumb: RAM * attention. General methods for storing your user-domains file data are, in the order of preference: external san/nfs, local lvm2, local partitions, local files.
The only things influencing the installation through d-i of the xen environment are diskspace and RAM. To start with the last: usually 196 MB RAM is needed for domain0. You can do with less: 128MB and I've even seen reports from people running with 64MB or even 32MB, but keep to defaults if this is your first time with Xen. Additional functionality for domain0 like dhcpd, iptables and installation services (eg. apache with apt-proxy) claim more. For a default domain0 you need 512MB diskspace and then you've got to keep an eye on it, so do at least 1GB. I use 2GB to be safe. For simplicities sake I keep it all in 1 filesystem. Local requirements for logging, accounting and/or auditing may claim extra. Swap space is the usual rule of thumb: RAM * attention. General methods for storing your user-domains file data are, in the order of preference: external san/nfs, local lvm2, local partitions, local files.
Line 10: Line 10:
Theses installation notes are focusing on installing Xen during Debian installation (i.e under D-I). Some general notes for Installation Xen can be found in the [[Xen]] page.
Line 11: Line 12:
Pop in your installation media (be it CD, DVD, PXEboot, whatever), and commence with a standard Debian installation. Pick a standard kernel and make sure to use GRUB as your bootloader, and LILO and Xen don't play well with one another. That's it. Once you have the installation completed, reboot and log in. Do a regular install and select a standard kernel. Use grub for the bootloader (xen is not compatible with lilo) and choose mkinitramfs-tools for the ramdisk creator (which is default). Continue right up to the menu option "Finish the installation" but stop there (don't select it). Switch to the second console with 'Ctrl-Alt-F2' and hit enter.
Line 13: Line 14:
Once you're in, you’ll need to update your apt cache, so type "apt-get update". Next we’ll install Xen with "apt-get install xen-hypervisor-3.0.3-1-amd64 xen-linux-system-2.6.18-4-xen-amd64 xen-tools xen-utils-3.0.3-1 xen-ioemu-3.0.3-1 bridge-utils". This provides the basic Xen packages, as well as the network bridging utilities and the xen-tools package, which we’ll be using later. Additionally, these version numbers are current as of writing. You may want to check what’s out there now by running an apt-cache search on xen- and looking near the end of the list. They're also architecture specific on amd64 platforms. If you're an i386 user, you'll want to check for packages that fit your arch. If you don't already know, you can check if your cpu has hardware virtualisation [the "vmx" flag for Intel or the "svm" flag for AMD]
Line 15: Line 16:
Once your packages are downloaded and installed, you’ll want to make a couple quick edits. First we’ll need to change the networking options within the xen config file so that future domUs will be able to connect to the net. To do that, edit /etc/xen/xend-config.sxp and uncomment "(network-script network-bridge)" midway through the file, then comment out "(network-script network-dummy)" a few lines beneath it. Next we’ll go edit /etc/xen-tools/xen-tools.conf and make sure that our toolkit is ready to use. Xen-tools is a great little suite that makes your life easier when it comes to making lots of little Debian VPSs (domUs) on your server. Canvass the config file to make sure that it's up to snuff and reflecting the parameters of your system before you use it, though.  . {{{ grep "vmx" /proc/cpuinfo }}}
or
Line 17: Line 19:
Once all that fun is done, feel free to reboot into the new xen kernel and start spawning lots of little domUs!  . {{{ grep "svm" /proc/cpuinfo }}}
Chroot into your target install with
Line 19: Line 22:
 . {{{ chroot /target /bin/sh }}}
Optionnaly, you can enable "command line completion" to complete package using "tab" key :

 . {{{ . /etc/bash_completion }}}
You need to install a few package that pulls most of the dependencies (xen-ioemu is only needed by CPU with virtualisation hardware) :

 . {{{ apt-get install xen-hypervisor-3.0.3-1-i386 libc6-xen linux-image-xen-686 bridge-utils libsysfs2 xen-ioemu-3.0.3-1 }}}
Warning: (as of 2006-10, might be an obsolete warning) : if you are useing a separate filesystem for /boot like I do, your /boot/grub/menu.lst bootloader configuration file doesn't get modified correctly. In this case every path needs to read /<filename>, but for some bug the one for xen.gz doesn't but looks like '/boot/xen.gz', so change it to '/xen.gz'.

Since we have the opportunity, adjust your xen config file /etc/xen/xend-config.sxp (save the original for later study). The following works on a system with a single nic:

 . {{{ (xend-relocation-server no) }}} <<BR>> {{{ (xend-relocation-hosts-allow '') }}} <<BR>> {{{ (network-script 'network-bridge netdev=eth0') }}} <<BR>> {{{ (vif-script vif-bridge) }}} <<BR>> {{{ (dom0-min-mem 196) }}} <<BR>> {{{ (dom0-cpus 0) }}} <<BR>>
Exit your chroot

 . {{{ exit }}}
and change back to your installation screen with 'Ctrl-Alt-F1' and select "Finish the installation".

If the system does not boot, try adding a 'noacpi' option to the vmlinux line in menu.lst first.
Line 24: Line 45:
 /!\ Work in progress, your help is appreciated  . /!\ Work in progress, your help is appreciated
= DomU =
As of Lenny installation under Xen is directly supported by the Debian Installer.
Line 26: Line 49:
= DomU = The Xen wiki page [[http://wiki.xen.org/wiki/Debian_Guest_Installation_Using_Debian_Installer|Debian Guest Installation Using Debian Installer]] describes this process in some detail.
Line 28: Line 51:
You can start d-i in DomU by The [[Xen]] page also details some ways of installing a Xen guest without using D-I.
Line 30: Line 53:
creating a DomU config file with the xen DomU kernel and the initrd from the netboot images (http://ftp.nl.debian.org/debian/dists/testing/main/installer-i386/beta3/images/netboot/netboot.tar.gz) and granting the DomU (or user-domain) read/write acces to some empty pre-created filesystems you want to use in it since you definitely do not want to give the DomU access to your mbr.
You need to copy the DomU kernel's /lib/modules/<version> to the initrd.
The following describes ways of installing Etch using Debian Installer.
Line 33: Line 55:
It works, I did this some months ago with the 3.0.1 xen version from backports.org, but am unable to reproduce due to the current state of the xen software on etch and backports.org. Waiting for http://lists.alioth.debian.org/pipermail/pkg-xen-devel/2006-September/000739.html, I suppose :-( == Installing DomU with D-I ==
Running the full D-I inside a domU is for some users and use cases a more appropriate option than the other methods without D-I. This is also the preferred method some other distributions offer their users - fedora/redhat runs anaconda in a domU, suse runs yast inside a domU. If this is fully working, users have (nearly?!) not differences between installing a real hardware system or a virtualized one.
Line 35: Line 58:
(mm) I've tried following this path, as I find myself annoyed at the limitations of xen-tools and the amount of manual setup debootstrap leaves.
It seems to be usable with the released Etch Xen.
There are some rough spots - keyboard config fails (left it unchanged), no kernel modules were found...
Partitioning is a bit of a surprise, though.
The trick seems to be to format all the partitions (I'm using LVM and testing with /dev/sda1 and /dev/sda2 as disk and swap), otherwise the partitioner will insist on creating partition tables for them.
Didn't experiment to see how that would work out as I really didn't want partitioned partitions!
Other problems (some of which I could have avoided):
You can start d-i in DomU by creating a DomU config file with the Xen DomU kernel and the initrd from the netboot images (http://ftp.nl.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/netboot.tar.gz) and granting the DomU (or user-domain) read/write acces to some empty pre-created filesystems you want to use in it since you definitely do not want to give the DomU access to your mbr. You need to copy the DomU kernel's /lib/modules/<version> to the initrd.

It works, I did this some months ago with the 3.0.1 Xen version from backports.org, but am unable to reproduce due to the current state of the Xen software on etch and backports.org. Waiting for http://lists.alioth.debian.org/pipermail/pkg-xen-devel/2006-September/000739.html, I suppose :(

=== experience report for D-I in domU ===
by: (mm)

I've tried following this path, as I find myself annoyed at the limitations of xen-tools and the amount of manual setup debootstrap leaves. It seems to be usable with the released Etch Xen. There are some rough spots - keyboard config fails (left it unchanged), no kernel modules were found... Partitioning is a bit of a surprise, though. The trick seems to be to format all the partitions (I'm using LVM and testing with /dev/sda1 and /dev/sda2 as disk and swap), otherwise the partitioner will insist on creating partition tables for them. Didn't experiment to see how that would work out as I really didn't want partitioned partitions! Other problems (some of which I could have avoided):
Line 45: Line 70:
(/mm) === Another experience report on D-I in DomU ===
By: HenningSprang - tested version etch released netboot.tar.gz from the above loaction on 2007-05-28
Line 47: Line 73:
In the mean time the easiest way to create a domU filesystem from a dom0 is by following
["Installing Debian GNU/Linux from a Unix/Linux System"]; http://www.debian.org/releases/stable/i386/apcs04.html.en ;
As mm described, setting the ramdisk xen domain config parameter to the location of the initrd.gz file gets a D-I session going. Via the Xen console, this doesn't look exactly nice (TODO: add screenshot), but thsi might also have something to do with locale settings on dom0, I am not sure.

Still, one of the first things I have to do is to select a keyboard layout, and right after this step, I get a red screen saying "Installation step failed". I get around this by selecting the keyboard setup again in the menu, and this time telling "keep the kernel keymap".

The next warning after some steps is "no kernel modules found...continue install without loading kernel modules" - I chose "yes".

The next warning: "Could not get identity of device /dev/hda - Invalid argument" I chose "ignore". This message repeats some times in the partitioning process.

Just for fun I tried to use the "configure crypted disk option", but that failed somehow(worry, not details about how and why). Actually, chosing a normal partitioning does not help me further here. While I can make a filesystem on the disk when entering the console from D-I, I am unable to mount it, but fail to see the reason:

{{{
~ # mkfs.ext3 /dev/hda1
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
243360 inodes, 485958 blocks
24297 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=499122176
15 block groups
32768 blocks per group, 32768 fragments per group
16224 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
~ # mount /dev/hda1 /mnt/
mount: Mounting /dev/hda1 on /mnt/ failed: Invalid argument
~ # mount -t ext3 /dev/hda1 /mnt/
mount: Mounting /dev/hda1 on /mnt/ failed: No such device
}}}
I think, that's it for today - I'll try further and report...

=== little remark about D-I in DomU ===
by DustinGoetsch

I had the same problem with the keyboard layout like HenningSprang. The problem is the xen console which isn't a "real" console, it behaves like a serial terminal. I edited the /etc/xen/testguest01.cfg and added "console=ttyS0" to the root parameter like this:

{{{
root = 'dev/sda2 ro console=ttyS0'
}}}
It Works :)
Line 53: Line 124:
Line 58: Line 128:
  {{{ vnc=1 }}}[[BR]]
 
{{{ vnclisten=<ipofthedom0> }}}
 . {{{ vnc=1 }}}<<BR>> {{{ vnclisten=<ipofthedom0> }}}
and then
Line 61: Line 131:
and then
 
{{{ xvncviewer <ipofthedom0> }}}
 . {{{ xvncviewer <ipofthedom0> }}}
Line 67: Line 135:
Line 71: Line 138:
  {{{ kernel = "/usr/lib/xen-3.0.3-1/boot/hvmloader" }}}[[BR]]
 
{{{ builder = "hvm" }}}[[BR]]
 
{{{ memory = "256" }}}[[BR]]
 
{{{ disk = [ 'phy:/dev/dom-u/internal_webservices,ioemu:hda,w' }}}[[BR]]
 
{{{ device_model = '/usr/lib/xen-3.0.3-1/bin/qemu-dm' }}}[[BR]]
 
{{{ name = "internal_webservices" }}}[[BR]]
 
{{{ vif = [ 'type=ioemu, bridge=br-xen' ] }}}[[BR]]
 
{{{ vnc=1 }}}[[BR]]
 
{{{ vnclisten="192.168.0.1" }}}[[BR]]
  {{{ boot="cda" }}}[[BR]]
 
{{{ on_poweroff = 'destroy' }}}[[BR]]
  {{{ on_reboot = 'restart' }}}[[BR]]
  {{{ on_crash = 'restart' }}}[[BR]]

 .
{{{ kernel = "/usr/lib/xen-3.0.3-1/boot/hvmloader" }}}<<BR>> {{{ builder = "hvm" }}}<<BR>> {{{ memory = "256" }}}<<BR>> {{{ disk = [ 'phy:/dev/dom-u/internal_webservices,ioemu:hda,w' }}}<<BR>> {{{ device_model = '/usr/lib/xen-3.0.3-1/bin/qemu-dm' }}}<<BR>> {{{ name = "internal_webservices" }}}<<BR>> {{{ vif = [ 'type=ioemu, bridge=br-xen' ] }}}<<BR>> {{{ vnc=1 }}}<<BR>> {{{ vnclisten="192.168.0.1" }}}<<BR>> {{{ boot="cda" }}}<<BR>> {{{ on_poweroff = 'destroy' }}}<<BR>> {{{ on_reboot = 'restart' }}}<<BR>> {{{ on_crash = 'restart' }}}<<BR>>
Line 86: Line 143:

* [http://wiki.debian.org/Xen]
 * http://wiki.debian.org/Xen

/!\ ToDo: update for the Backports change, etch->lenny->squeeze?

Dom0

For installing Dom0 on etch you have to do a regular install, while keeping the following in mind and doing the extra stuff at the end.

Considerations: diskspace and RAM

The only things influencing the installation through d-i of the xen environment are diskspace and RAM. To start with the last: usually 196 MB RAM is needed for domain0. You can do with less: 128MB and I've even seen reports from people running with 64MB or even 32MB, but keep to defaults if this is your first time with Xen. Additional functionality for domain0 like dhcpd, iptables and installation services (eg. apache with apt-proxy) claim more. For a default domain0 you need 512MB diskspace and then you've got to keep an eye on it, so do at least 1GB. I use 2GB to be safe. For simplicities sake I keep it all in 1 filesystem. Local requirements for logging, accounting and/or auditing may claim extra. Swap space is the usual rule of thumb: RAM * attention. General methods for storing your user-domains file data are, in the order of preference: external san/nfs, local lvm2, local partitions, local files.

Installation

Theses installation notes are focusing on installing Xen during Debian installation (i.e under D-I). Some general notes for Installation Xen can be found in the ?Xen page.

Do a regular install and select a standard kernel. Use grub for the bootloader (xen is not compatible with lilo) and choose mkinitramfs-tools for the ramdisk creator (which is default). Continue right up to the menu option "Finish the installation" but stop there (don't select it). Switch to the second console with 'Ctrl-Alt-F2' and hit enter.

If you don't already know, you can check if your cpu has hardware virtualisation [the "vmx" flag for Intel or the "svm" flag for AMD]

  •  grep "vmx" /proc/cpuinfo 

or

  •  grep "svm" /proc/cpuinfo 

Chroot into your target install with

  •  chroot /target /bin/sh 

Optionnaly, you can enable "command line completion" to complete package using "tab" key :

  •  . /etc/bash_completion 

You need to install a few package that pulls most of the dependencies (xen-ioemu is only needed by CPU with virtualisation hardware) :

  •  apt-get install xen-hypervisor-3.0.3-1-i386 libc6-xen linux-image-xen-686 bridge-utils libsysfs2  xen-ioemu-3.0.3-1 

Warning: (as of 2006-10, might be an obsolete warning) : if you are useing a separate filesystem for /boot like I do, your /boot/grub/menu.lst bootloader configuration file doesn't get modified correctly. In this case every path needs to read /<filename>, but for some bug the one for xen.gz doesn't but looks like '/boot/xen.gz', so change it to '/xen.gz'.

Since we have the opportunity, adjust your xen config file /etc/xen/xend-config.sxp (save the original for later study). The following works on a system with a single nic:

  •  (xend-relocation-server no) 
     (xend-relocation-hosts-allow '') 
     (network-script 'network-bridge netdev=eth0') 
     (vif-script vif-bridge) 
     (dom0-min-mem 196) 
     (dom0-cpus 0) 

Exit your chroot

  •  exit 

and change back to your installation screen with 'Ctrl-Alt-F1' and select "Finish the installation".

If the system does not boot, try adding a 'noacpi' option to the vmlinux line in menu.lst first.

Ref:

http://lists.xensource.com/archives/html/xen-users/2006-09/msg00966.html (dd. 20070930) en-unstable.

  • /!\ Work in progress, your help is appreciated

DomU

As of Lenny installation under Xen is directly supported by the Debian Installer.

The Xen wiki page Debian Guest Installation Using Debian Installer describes this process in some detail.

The ?Xen page also details some ways of installing a Xen guest without using D-I.

The following describes ways of installing Etch using Debian Installer.

Installing DomU with D-I

Running the full D-I inside a domU is for some users and use cases a more appropriate option than the other methods without D-I. This is also the preferred method some other distributions offer their users - fedora/redhat runs anaconda in a domU, suse runs yast inside a domU. If this is fully working, users have (nearly?!) not differences between installing a real hardware system or a virtualized one.

You can start d-i in DomU by creating a DomU config file with the Xen DomU kernel and the initrd from the netboot images (http://ftp.nl.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/netboot.tar.gz) and granting the DomU (or user-domain) read/write acces to some empty pre-created filesystems you want to use in it since you definitely do not want to give the DomU access to your mbr. You need to copy the DomU kernel's /lib/modules/<version> to the initrd.

It works, I did this some months ago with the 3.0.1 Xen version from backports.org, but am unable to reproduce due to the current state of the Xen software on etch and backports.org. Waiting for http://lists.alioth.debian.org/pipermail/pkg-xen-devel/2006-September/000739.html, I suppose :(

experience report for D-I in domU

by: (mm)

I've tried following this path, as I find myself annoyed at the limitations of xen-tools and the amount of manual setup debootstrap leaves. It seems to be usable with the released Etch Xen. There are some rough spots - keyboard config fails (left it unchanged), no kernel modules were found... Partitioning is a bit of a surprise, though. The trick seems to be to format all the partitions (I'm using LVM and testing with /dev/sda1 and /dev/sda2 as disk and swap), otherwise the partitioner will insist on creating partition tables for them. Didn't experiment to see how that would work out as I really didn't want partitioned partitions! Other problems (some of which I could have avoided):

  • libc6-xen: you need it
  • udev's persistent-net rule will screw you unless you're setting a fixed MAC in the VM config.
  • probably need to read about preseeding and other d-i customizations

Another experience report on D-I in DomU

By: HenningSprang - tested version etch released netboot.tar.gz from the above loaction on 2007-05-28

As mm described, setting the ramdisk xen domain config parameter to the location of the initrd.gz file gets a D-I session going. Via the Xen console, this doesn't look exactly nice (TODO: add screenshot), but thsi might also have something to do with locale settings on dom0, I am not sure.

Still, one of the first things I have to do is to select a keyboard layout, and right after this step, I get a red screen saying "Installation step failed". I get around this by selecting the keyboard setup again in the menu, and this time telling "keep the kernel keymap".

The next warning after some steps is "no kernel modules found...continue install without loading kernel modules" - I chose "yes".

The next warning: "Could not get identity of device /dev/hda - Invalid argument" I chose "ignore". This message repeats some times in the partitioning process.

Just for fun I tried to use the "configure crypted disk option", but that failed somehow(worry, not details about how and why). Actually, chosing a normal partitioning does not help me further here. While I can make a filesystem on the disk when entering the console from D-I, I am unable to mount it, but fail to see the reason:

~ # mkfs.ext3 /dev/hda1
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
243360 inodes, 485958 blocks
24297 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=499122176
15 block groups
32768 blocks per group, 32768 fragments per group
16224 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
~ # mount /dev/hda1 /mnt/
mount: Mounting /dev/hda1 on /mnt/ failed: Invalid argument
~ # mount -t ext3 /dev/hda1 /mnt/
mount: Mounting /dev/hda1 on /mnt/ failed: No such device

I think, that's it for today - I'll try further and report...

little remark about D-I in DomU

by ?DustinGoetsch

I had the same problem with the keyboard layout like HenningSprang. The problem is the xen console which isn't a "real" console, it behaves like a serial terminal. I edited the /etc/xen/testguest01.cfg and added "console=ttyS0" to the root parameter like this:

root = 'dev/sda2 ro console=ttyS0'

It Works :)

/!\ Work in progress, your help is appreciated

DomU graphical

I guess it must be possible to do this, maybe in a similar way as the DomU, through the xen native vnc support or in a straight X11 session over a network connection with the ssh console option (does the graphical installer have X11 client support?).

To boot a domU with graphical (VNC) access use the following options :

  •  vnc=1 
     vnclisten=<ipofthedom0> 

and then

  •  xvncviewer <ipofthedom0> 

/!\ Work in progress, your help is appreciated

Using HVM (VT processors)

Make sure you have the "xen-ioemu" package installed

Sample config file :

  •  kernel = "/usr/lib/xen-3.0.3-1/boot/hvmloader" 
     builder = "hvm" 
     memory = "256" 
     disk = [ 'phy:/dev/dom-u/internal_webservices,ioemu:hda,w' 
     device_model = '/usr/lib/xen-3.0.3-1/bin/qemu-dm' 
     name = "internal_webservices" 
     vif = [ 'type=ioemu, bridge=br-xen' ] 
     vnc=1 
     vnclisten="192.168.0.1" 
     boot="cda" 
     on_poweroff = 'destroy' 
     on_reboot = 'restart' 
     on_crash = 'restart' 

Resources