Virtual openSUSE : Différence entre versions

Un article de Bulles.
Aller à : navigation, rechercher
Ligne 103: Ligne 103:
 
In all scenarios, we override the ''bootloader'' directive and specify the installation kernel.
 
In all scenarios, we override the ''bootloader'' directive and specify the installation kernel.
 
<br />We also need to ask for a ''destroy'' at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!
 
<br />We also need to ask for a ''destroy'' at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!
 +
{{Box Code|shell|2=<nowiki></nowiki>
 +
XmCreate="bootloader= \
 +
            kernel=/boot/opensuse/vmlinuz-xenpae-install \
 +
            ramdisk=/boot/opensuse/initrd-xenpae-install \
 +
            on_reboot=destroy"
 +
}}
 +
  
 
===  Text Mode ===
 
===  Text Mode ===
Ligne 108: Ligne 115:
 
{{Box Code|shell|2=<nowiki></nowiki>
 
{{Box Code|shell|2=<nowiki></nowiki>
 
  xm create -c /etc/xen/openSUSE.cfg \
 
  xm create -c /etc/xen/openSUSE.cfg \
           vfb='type=vnc,vncunused=1' \
+
           ${XmCreate} \
          bootloader= kernel=/boot/opensuse/vmlinuz-xenpae-install \
+
           extra="xencons=tty ${LinuxRC}"
          ramdisk=/boot/opensuse/initrd-xenpae-install \
 
           extra="xencons=tty ${LinuxRC}" \
 
          on_reboot=destroy
 
 
}}
 
}}
  
Ligne 119: Ligne 123:
 
{{Box Code|shell|2=<nowiki></nowiki>
 
{{Box Code|shell|2=<nowiki></nowiki>
 
  xm create /etc/xen/openSUSE.cfg \
 
  xm create /etc/xen/openSUSE.cfg \
 +
          ${XmCreate} \
 
           vfb='type=vnc,vncunused=1' \
 
           vfb='type=vnc,vncunused=1' \
          bootloader= kernel=/boot/opensuse/vmlinuz-xenpae-install \
+
           extra="${LinuxRC}"
          ramdisk=/boot/opensuse/initrd-xenpae-install \
 
           extra="${LinuxRC}" \
 
          on_reboot=destroy
 
 
}}
 
}}
  
Ligne 136: Ligne 138:
 
{{Box Code|shell|2=<nowiki></nowiki>
 
{{Box Code|shell|2=<nowiki></nowiki>
 
  xm create /etc/xen/openSUSE.cfg \
 
  xm create /etc/xen/openSUSE.cfg \
           bootloader= kernel=/boot/opensuse/vmlinuz-xenpae-install \
+
           ${XmCreate} \
          ramdisk=/boot/opensuse/initrd-xenpae-install \
+
           extra="vnc=1 vncpassword=<mypass> ${LinuxRC}"
           extra="vnc=1 vncpassword=<mypass> vnc${LinuxRC}" \
 
          on_reboot=destroy
 
 
}}
 
}}
The password must be at least 8 characters long!
+
{{Boite Attention|The password is mandatory and must be at least 8 characters long!}}
  
Note that this time, we connect directly to the virtual machine and no more to the Dom0:
+
Note that this time, we have to connect directly to the virtual machine and no more to the Dom0:
 
{{Box Code|shell|2=<nowiki></nowiki>
 
{{Box Code|shell|2=<nowiki></nowiki>
 
  xvncviewer <DomU>:1
 
  xvncviewer <DomU>:1
Ligne 149: Ligne 149:
  
 
== Installing ==
 
== Installing ==
Your are now in the (graphical) installer.
+
We are now in the (graphical) installer.
<br />You will be asked for the language, timezone...
+
<br />We will be asked for the language, timezone...
  
 
When it comes to the ''Overview'', switch to ''Expert'' mode and ensure {{Command|grub}} is selected as boot loader. This is not the case by default!
 
When it comes to the ''Overview'', switch to ''Expert'' mode and ensure {{Command|grub}} is selected as boot loader. This is not the case by default!
{{Boite Attention|You need to get this right, otherwise you will be in trouble when the system reboots. You need to ensure that we ave
+
 
 +
[[Image:openSUSE-Overview.png|thumb|left]] [[Image:openSUSE-Expert.png|thumb|left]] [[Image:openSUSE-Grub.png|thumb|none]]
 +
 
 +
 
 +
{{Boite Attention|We need to get this right, otherwise we will be in trouble when the system reboots. We need to ensure that we have
 
* /boot/vmlinuz-xenpae for the kernel image
 
* /boot/vmlinuz-xenpae for the kernel image
 
* /boot/initrd-xenpae for the ramdisk}}
 
* /boot/initrd-xenpae for the ramdisk}}
 +
 +
 +
[[Image:openSUSE-Install.png|thumb|right]]
  
 
The machine will find the packages and proceed with the installation just like on a bare metal system.
 
The machine will find the packages and proceed with the installation just like on a bare metal system.
  
Note that the installer is smart enough to see it is running under [http://www.xensource.com Xen], and will select the appropriate kernel.
+
 
 +
Note that by default the installer will setup a [http://www.xensource.com Xen] kernel.
 +
 
  
 
Time to look at the [http://www.opensuse.org/ openSUSE] slide show or grab a coffee!
 
Time to look at the [http://www.opensuse.org/ openSUSE] slide show or grab a coffee!
 +
  
 
== Reboot ==
 
== Reboot ==
Ligne 167: Ligne 177:
  
 
Since we specified the ''on_reboot=destroy'' parameter, we need to restart the virtual machine, using this time only the parameters from the configuration file:
 
Since we specified the ''on_reboot=destroy'' parameter, we need to restart the virtual machine, using this time only the parameters from the configuration file:
{{Box Code|shell| xm create -c /etc/xen/openSUSE.cfg }}
+
{{Box Code|shell| xm create /etc/xen/openSUSE.cfg }}
  
After the {{Command|pygrub}} boot screen the system will start, ask a couple of post-install questions and you are done!
+
After the {{Command|pygrub}} boot screen the system will start, ask a couple of post-install questions and we are done!
  
 
  Welcome to openSUSE 10.3 (i586) - Kernel 2.6.22.5-31-xenpae (tty1).
 
  Welcome to openSUSE 10.3 (i586) - Kernel 2.6.22.5-31-xenpae (tty1).
Ligne 177: Ligne 187:
 
= Post Install =
 
= Post Install =
  
You can now connect to your system via the console or using {{Command|ssh}}.
+
We can now connect to your system via the console or using {{Command|ssh}}.
 +
 
 +
Graphical session is available through the Xen Virtual Frame Buffer or directly via VNC if we have enabled ''VNC remote console'' in [http://en.opensuse.org/YaST YaST].
 +
 
 +
[[Image:openSUSE-Login.png|thumb|left]] [[Image:openSUSE-Desktop.png|thumb|none]]
 +
 
 +
= Troubleshooting =
 +
== Installer does not start ==
 +
If we do not specify the right parameters for [http://en.opensuse.org/Linuxrc Linuxrc], [http://en.opensuse.org/YaST YaST] will not be able to start. In case we are performing a ''VNC'' install, we are in the dark as no message is available.
 +
<br />When this happens, we can
 +
* switch to the ''Xen Virtual Frame Buffer'' method which will provide an interactive session with [http://en.opensuse.org/Linuxrc Linuxrc];
 +
* pass ''xencons=tty'' as ''extra'' parameter to get [http://en.opensuse.org/Linuxrc Linuxrc] on the Xen console.
 +
 
 +
== Installed system does not (re)boot ==
 +
We forgot to install {{Command|grub}} or have the wrong configuration...
 +
 
 +
There are basically two possibilities to boot the system. Once it runs, we just have to go back in [http://en.opensuse.org/YaST YaST] and install/configure {{Command|grub}} properly
 +
 
 +
=== Edit GrUB configuration ===
 +
If {{Command|grub}} is installed but not configured properly, we can easily fix that on the Xen console, just like we would do on a bare metal environment.
 +
<br />The trick is that obviously we need to know how the exact name of the kernel, etc...
  
Graphical session is available through the Xen Virtual Frame Buffer or directly via VNC if you have enabled ''VNC remote console'' in YaST.
+
=== Use the installer ===
 +
The other approach is even more easy: [http://en.opensuse.org/Linuxrc Linuxrc] can be used to boot an installed system. We just need to launch the installer without parameters and start the system (in console or ''vfb'' mode)!
 +
[[Image:openSUSE-Boot1.png|thumb|left]] [[Image:openSUSE-Boot2.png|thumb|none]]

Version du 14 novembre 2007 à 10:18

This article summarizes the major steps to install openSUSE 10.3 as DomU using a Debian Etch / Xen 3.1.0 Dom0 as described in this Xen article.

Foreword

Everything is easy once you know how to do it!

Installing an openSUSE virtual machine on top of a Xen 3.1.0 hypervisor with a Debian Etch Dom0 is part of these things!

Here are the few steps that need to be done to get an openSUSE as DomU up and running.

About the installer

The openSUSE installer comes in different flavours. We will use the Network installer.

There are roughly 2 major steps in the install process:

  1. The kernel boots with its initial ramdisk. It will asks for the basic information: language, keyboard, source for packages and network configuration.
  2. The graphical installer is then started to perform the actual installation (partitioning, packages selection, ...).

The installer can be started in three modes:

  • text mode;
  • graphical mode using the Xen virtual frame buffer (vfb). Note that this feature is not compiled by default in Xen (see re-compile Xen article should you need to recompile);
  • graphical mode using the VNC feature of the installer (recommended)

Package repository

There is no need to host local mirror of the packages, as the openSUSE network installer is able to fetch the packages direcly from the Mirrors Released Version. Just select a repository near you!

Kernel

To boot our virtual machine, we need a xenified installation kernel. This kernel is available on any openSUSE mirror.

Code: shell

mkdir /boot/opensuse
Mirror=http://ftp.skynet.be/pub/ftp.opensuse.org/opensuse/distribution/10.3/repo/oss
wget ${Mirror}/boot/i386/vmlinuz-xenpae -O /boot/opensuse/vmlinuz-xenpae-install
wget ${Mirror}/boot/i386/initrd-xenpae  -O /boot/opensuse/initrd-xenpae-install

Note that there is also a non-pae kernel available in the repository.

Disk allocation

We use a logical volume to allocate disk space for the virtual machine:

Code: shell
lvcreate  -L 10240 -n openSUSE vgDomU 

It will be used as Disk Image (xvd) by the virtual machine. This gives more flexibility to the guest than individual partitions (hd), and makes the boot process easier (see below).

Xen DomU Configuration file

This is the minimal configuration file that we will use for this installation:

Fichier: /etc/xen/openSUSE.cfg

#  -*- mode: python; -*-
#============================================================================
# Python configuration setup for 'xm create'.
# This script sets the parameters used when a domain is created using 'xm create'.
# You use a separate script for each domain you want to create, or
# you can set the parameters for the domain on the xm command line.
#============================================================================

#----------------------------------------------------------------------------
# Kernel image file.
bootloader="/usr/bin/pygrub"

# Initial memory allocation (in megabytes) for the new domain.
memory = 512

# A name for your domain. All domains must have different names.
name = "openSUSE"

#----------------------------------------------------------------------------
# Define network interfaces.
vif = [ 'ip=xxx.xxx.xxx.xxx,mac=yy:yy:yy:yy:yy:yy,bridge=xenbr0' ]

#----------------------------------------------------------------------------
# Define the disk devices you want the domain to have access to, and
# what you want them accessible as.
# Each disk entry is of the form phy:UNAME,DEV,MODE
# where UNAME is the device, DEV is the device name the domain will see,
# and MODE is r for read-only, w for read-write.
disk = [ 'phy:/dev/vgDomU/openSUSE,xvda,w' ]

#----------------------------------------------------------------------------
# Define frame buffer device.
# vfb = ["type=vnc,vncunused=1"]
keymap = 'fr-be'

#----------------------------------------------------------------------------
# Configure the behaviour when a domain exits.  There are three 'reasons'
# for a domain to stop: poweroff, reboot, and crash.
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

#============================================================================

The interresting aspect of using pygrub as bootloader instead of specifying a kernel and a ramdisk is that the linux kernel will be taken from the DomU virtual machine and not from the Dom0 host. Obviously we will have to override that during the installation.

Installation

Booting

Before starting YaST, the installer will run Linuxrc to gather all the parameters needed for the install. To make our life easier, we will pass all these parameters from the command line:

Code: shell

LinuxRC="hostip=<DomU ip>/<net> gateway=<gw ip> nameserver=<ns ip> install=${Mirror}"

We need now to choose between the character mode, the vfb and the VNC install.
I recommend to go either for the the character mode or the VNC approach, as the vfb method has some issues with the mouse tracking.

In all scenarios, we override the bootloader directive and specify the installation kernel.
We also need to ask for a destroy at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!

Code: shell

XmCreate="bootloader= \
            kernel=/boot/opensuse/vmlinuz-xenpae-install \
            ramdisk=/boot/opensuse/initrd-xenpae-install \
            on_reboot=destroy"


Text Mode

To start the installation, we create the virtual machine:

Code: shell

xm create -c /etc/xen/openSUSE.cfg \
          ${XmCreate} \
          extra="xencons=tty ${LinuxRC}"

Xen Virtual Frame Buffer

We start the installation with the following incantation:

Code: shell

xm create /etc/xen/openSUSE.cfg \
          ${XmCreate} \
          vfb='type=vnc,vncunused=1' \
          extra="${LinuxRC}"

We start xvncviewer to access the install console -- e.g.:

Code: shell

xvncviewer -via <Dom0> :1

Installer's VNC

The openSUSE installer is smart enough to run a VNC server for network installations.
We create the virtual machine:

Code: shell

xm create /etc/xen/openSUSE.cfg \
          ${XmCreate} \
          extra="vnc=1 vncpassword=<mypass> ${LinuxRC}"
Attention: The password is mandatory and must be at least 8 characters long!

Note that this time, we have to connect directly to the virtual machine and no more to the Dom0:

Code: shell

xvncviewer <DomU>:1

Installing

We are now in the (graphical) installer.
We will be asked for the language, timezone...

When it comes to the Overview, switch to Expert mode and ensure grub is selected as boot loader. This is not the case by default!

Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination
Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination
Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination


Attention: We need to get this right, otherwise we will be in trouble when the system reboots. We need to ensure that we have
  • /boot/vmlinuz-xenpae for the kernel image
  • /boot/initrd-xenpae for the ramdisk


Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination

The machine will find the packages and proceed with the installation just like on a bare metal system.


Note that by default the installer will setup a Xen kernel.


Time to look at the openSUSE slide show or grab a coffee!


Reboot

At the end of the installation, the system reboots and you are back at the command prompt of your Dom0 host.

Since we specified the on_reboot=destroy parameter, we need to restart the virtual machine, using this time only the parameters from the configuration file:

Code: shell
xm create /etc/xen/openSUSE.cfg 

After the pygrub boot screen the system will start, ask a couple of post-install questions and we are done!

Welcome to openSUSE 10.3 (i586) - Kernel 2.6.22.5-31-xenpae (tty1).

openSUSE login:

Post Install

We can now connect to your system via the console or using ssh.

Graphical session is available through the Xen Virtual Frame Buffer or directly via VNC if we have enabled VNC remote console in YaST.

Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination
Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination

Troubleshooting

Installer does not start

If we do not specify the right parameters for Linuxrc, YaST will not be able to start. In case we are performing a VNC install, we are in the dark as no message is available.
When this happens, we can

  • switch to the Xen Virtual Frame Buffer method which will provide an interactive session with Linuxrc;
  • pass xencons=tty as extra parameter to get Linuxrc on the Xen console.

Installed system does not (re)boot

We forgot to install grub or have the wrong configuration...

There are basically two possibilities to boot the system. Once it runs, we just have to go back in YaST and install/configure grub properly

Edit GrUB configuration

If grub is installed but not configured properly, we can easily fix that on the Xen console, just like we would do on a bare metal environment.
The trick is that obviously we need to know how the exact name of the kernel, etc...

Use the installer

The other approach is even more easy: Linuxrc can be used to boot an installed system. We just need to launch the installer without parameters and start the system (in console or vfb mode)!

Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination
Erreur lors de la création de la miniature : Impossible d'enregistrer la vignette sur la destination