Aquí lo que intentaré será crear la máquina virtual dentro de un disco. No como el ejemplo anterior que yo creaba dos particiones directamente. El objetivo de esto será que el grub se instale dentro del disco que creo y que no tenga que depender del kernel externo... pues usaré pygrub.
Crear el disco:
lvcreate -L3G -ndeb01 dsk
Puedo ahora hacerle un fdisk a esta partición que se verá como un disco a futuro:
fdisk /dev/dsk/deb01
Aquí creo dos particiones:
- la primera será linux (tipo 83)
- la segunda será swap (tipo 82)
Con kpartx abrir el disco:
kpartx -a /dev/dsk/deb01
Oh sí, les presento a kpartx:
"kpartx: este es mi amigo. Mi amigo: este es kpartx". ¿Podemos seguir ahora?
kpartx dividirá el disco en particiones de forma tal que lo pueda
formatar y montar una partición específica (deb01p1).
podemos ver la lista de particiones en /dev/mapper, verás que aparecerán dos: deb01p1 y deb01p2 (las dos particiones que anteriormente creé).
Ahora procederé a formatear ambas (una en ext3 y otra en swap), así como montar la primera que es la de ext3
mkfs.ext3 /dev/mapper/deb01p1
mkswap /dev/mapper/deb01p2
mount /dev/mapper/deb01p1 /mnt
Monto /dev/mapper/deb01p1 en /mnt para poder utilizar debootstrap
Este ejemplo asume que el paquete debootstrap está instalado. Este paquete puede ser obtenido del repo EPEL:
[url]http://www.ecualug.org/?q=2008/05/14/comos/instalando_repo_de_epel_en_nuestro_centos[/url]
Con el debootstrap procedo a instalar la base del sistema:
debootstrap --arch i386 lenny /mnt/ http://ftp.us.debian.org/debian
Ahora me enjaulo e instalo un par de paquetes que me interesan:
chroot /mnt
su -
mount -t proc proc /proc
mount -t sysfs sysfs /sys
/etc/init.d/mountdevsubfs.sh start
mkdir /boot/grub
aptitude update
aptitude install locales
dpkg-reconfigure locales
(aqui salí y entré del su - no sé si sea bueno)
aptitude install linux-image-xen-686 libc6-xen grub ssh
El nuevo debian no tiene fstab, así que me toca crearle a mano:
vi /etc/fstab
/dev/xvda1 / ext3 errors=remount-ro,noatime 0 1
/dev/xvda2 swap swap defaults 0 0
proc /proc proc defaults 0 0
Falta igualmente un pequeño /etc/hosts, lo pongo:
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
1.2.3.4 nombre nombre.de.mimaquina
Lo mismo para la configuración de la red:
vi /etc/network/interfaces
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 7.5.2.23
netmask 255.255.255.0
gateway 7.5.2.1
Tambien pongo un nombre a la maquina:
vi /etc/hostname
deb01.nuestroserver.com
Cambio la clave de root
passwd
En el /etc/inittab busco una linea que comience con 1:2345:...... y le comento, entonecs agrego esta. Es para que puedas ver la consola serial:
[code]
T1:2345:respawn:/sbin/getty 38400 hvc0
[/code]
creo un archivo llamado /boot/grub/menu.lst que contenga esto (Verificar versión del kernel y ramdisk):
#boot=/dev/xvda
default=0
timeout=3
hiddenmenu
title debian
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-xen-686 ro root=/dev/xvda1
initrd /boot/initrd.img-2.6.26-2-xen-686
además creo un enlace directo para menu.lst
ln -s /boot/grub/menu.lst /boot/grub/grub.conf
Salgo del chroot y creo la configuración de la máquina /etc/xen/deb01 que contiene esto:
bootloader = "/usr/bin/pygrub"
memory = 64
name = "deb01"
vif = [ "mac=00:16:3e:43:3d:e1,bridge=xenbr0" ]
disk = [ 'phy:/dev/dsk/deb01,xvda,w' ]
Le activo automáticamente
ln -s /etc/xen/deb01 /etc/xen/auto/
desmonto /mnt
umount /mnt/proc
umount /mnt/sys
umount -f -l /mnt
kpartx -d /dev/dsk/deb01
Esta es la forma que sugiero!!!
Estas pruebas las realicé en mis servidores de virtualización y son completamente funcionales.
Comentarios
Error al tratar de instalar kernel
Que tal,
Estaba siguiendo los pasos de este How To en un CentOS5 para instalar el Debian5, pero obtengo error en la parte de instalación del kernel:
aptitude install linux-image-xen-686 libc6-xen grub ssh
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be installed:
busybox{a} grub grub-common{a} initramfs-tools{a} klibc-utils{a}
libc6-xen libedit2{a} libkeyutils1{a} libklibc{a} libkrb53{a}
libvolume-id0{a} libx11-6{a} libx11-data{a} libxau6{a} libxcb-xlib0{a}
libxcb1{a} libxdmcp6{a} libxext6{a} libxmuu1{a}
linux-image-2.6.26-2-xen-686{a} linux-image-xen-686
linux-modules-2.6-xen-686{a} linux-modules-2.6.26-2-xen-686{a}
openssh-blacklist{a} openssh-blacklist-extra{a} openssh-client{a}
openssh-server{a} ssh udev{a} x11-common{a} xauth{a}
0 packages upgraded, 31 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.8MB of archives. After unpacking 85.6MB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://ftp.us.debian.org lenny/main openssh-blacklist 0.4.1 [2125kB]
Get:2 http://ftp.us.debian.org lenny/main openssh-blacklist-extra 0.4.1 [2127kB]
Get:3 http://ftp.us.debian.org lenny/main libvolume-id0 0.125-7+lenny3 [77.0kB]
Get:4 http://ftp.us.debian.org lenny/main udev 0.125-7+lenny3 [255kB]
Get:5 http://ftp.us.debian.org lenny/main x11-common 1:7.3+20 [343kB]
Get:6 http://ftp.us.debian.org lenny/main libxau6 1:1.0.3-3 [11.9kB]
Get:7 http://ftp.us.debian.org lenny/main libxdmcp6 1:1.0.2-3 [17.0kB]
Get:8 http://ftp.us.debian.org lenny/main libxcb1 1.1-1.2 [43.5kB]
Get:9 http://ftp.us.debian.org lenny/main libxcb-xlib0 1.1-1.2 [15.2kB]
Get:10 http://ftp.us.debian.org lenny/main libx11-data 2:1.1.5-2 [169kB]
Get:11 http://ftp.us.debian.org lenny/main libx11-6 2:1.1.5-2 [623kB]
Get:12 http://ftp.us.debian.org lenny/main libxext6 2:1.0.4-2 [33.7kB]
Get:13 http://ftp.us.debian.org lenny/main libxmuu1 2:1.0.4-1 [13.2kB]
Get:14 http://ftp.us.debian.org lenny/main xauth 1:1.0.3-2 [30.8kB]
Get:15 http://ftp.us.debian.org lenny/main libc6-xen 2.7-18lenny7 [1282kB]
Get:16 http://ftp.us.debian.org lenny/main libedit2 2.11~20080614-1 [67.4kB]
Get:17 http://ftp.us.debian.org lenny/main libkeyutils1 1.2-9 [5584B]
Get:18 http://ftp.us.debian.org lenny/main libkrb53 1.6.dfsg.4~beta1-5lenny7 [480kB]
Get:19 http://ftp.us.debian.org lenny/main openssh-client 1:5.1p1-5 [816kB]
Get:20 http://ftp.us.debian.org lenny/main busybox 1:1.10.2-2 [297kB]
Get:21 http://ftp.us.debian.org lenny/main grub-common 1.96+20080724-16 [189kB]
Get:22 http://ftp.us.debian.org lenny/main grub 0.97-47lenny2 [389kB]
Get:23 http://ftp.us.debian.org lenny/main libklibc 1.5.12-2lenny1 [44.3kB]
Get:24 http://ftp.us.debian.org lenny/main klibc-utils 1.5.12-2lenny1 [151kB]
Get:25 http://ftp.us.debian.org lenny/main initramfs-tools 0.92o [75.3kB]
Get:26 http://ftp.us.debian.org lenny/main linux-modules-2.6.26-2-xen-686 2.6.26-29 [18.2MB]
Get:27 http://ftp.us.debian.org lenny/main linux-image-2.6.26-2-xen-686 2.6.26-29 [1602kB]
Get:28 http://ftp.us.debian.org lenny/main linux-modules-2.6-xen-686 2.6.26+17+lenny1 [2500B]
Get:29 http://ftp.us.debian.org lenny/main linux-image-xen-686 2.6.26+17+lenny1 [2554B]
Get:30 http://ftp.us.debian.org lenny/main openssh-server 1:5.1p1-5 [295kB]
Get:31 http://ftp.us.debian.org lenny/main ssh 1:5.1p1-5 [1202B]
Fetched 29.8MB in 8min0s (62.0kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
Selecting previously deselected package openssh-blacklist.
(Reading database ... 8533 files and directories currently installed.)
Unpacking openssh-blacklist (from .../openssh-blacklist_0.4.1_all.deb) ...
Selecting previously deselected package openssh-blacklist-extra.
Unpacking openssh-blacklist-extra (from .../openssh-blacklist-extra_0.4.1_all.deb) ...
Selecting previously deselected package libvolume-id0.
Unpacking libvolume-id0 (from .../libvolume-id0_0.125-7+lenny3_i386.deb) ...
Selecting previously deselected package udev.
Unpacking udev (from .../udev_0.125-7+lenny3_i386.deb) ...
Selecting previously deselected package x11-common.
Unpacking x11-common (from .../x11-common_1%3a7.3+20_all.deb) ...
Selecting previously deselected package libxau6.
Unpacking libxau6 (from .../libxau6_1%3a1.0.3-3_i386.deb) ...
Selecting previously deselected package libxdmcp6.
Unpacking libxdmcp6 (from .../libxdmcp6_1%3a1.0.2-3_i386.deb) ...
Selecting previously deselected package libxcb1.
Unpacking libxcb1 (from .../libxcb1_1.1-1.2_i386.deb) ...
Selecting previously deselected package libxcb-xlib0.
Unpacking libxcb-xlib0 (from .../libxcb-xlib0_1.1-1.2_i386.deb) ...
Selecting previously deselected package libx11-data.
Unpacking libx11-data (from .../libx11-data_2%3a1.1.5-2_all.deb) ...
Selecting previously deselected package libx11-6.
Unpacking libx11-6 (from .../libx11-6_2%3a1.1.5-2_i386.deb) ...
Selecting previously deselected package libxext6.
Unpacking libxext6 (from .../libxext6_2%3a1.0.4-2_i386.deb) ...
Selecting previously deselected package libxmuu1.
Unpacking libxmuu1 (from .../libxmuu1_2%3a1.0.4-1_i386.deb) ...
Processing triggers for man-db ...
Setting up x11-common (1:7.3+20) ...
Selecting previously deselected package xauth.
(Reading database ... 8955 files and directories currently installed.)
Unpacking xauth (from .../xauth_1%3a1.0.3-2_i386.deb) ...
Selecting previously deselected package libc6-xen.
Unpacking libc6-xen (from .../libc6-xen_2.7-18lenny7_i386.deb) ...
Selecting previously deselected package libedit2.
Unpacking libedit2 (from .../libedit2_2.11~20080614-1_i386.deb) ...
Selecting previously deselected package libkeyutils1.
Unpacking libkeyutils1 (from .../libkeyutils1_1.2-9_i386.deb) ...
Selecting previously deselected package libkrb53.
Unpacking libkrb53 (from .../libkrb53_1.6.dfsg.4~beta1-5lenny7_i386.deb) ...
Selecting previously deselected package openssh-client.
Unpacking openssh-client (from .../openssh-client_1%3a5.1p1-5_i386.deb) ...
Selecting previously deselected package busybox.
Unpacking busybox (from .../busybox_1%3a1.10.2-2_i386.deb) ...
Selecting previously deselected package grub-common.
Unpacking grub-common (from .../grub-common_1.96+20080724-16_i386.deb) ...
Selecting previously deselected package grub.
Unpacking grub (from .../grub_0.97-47lenny2_i386.deb) ...
Selecting previously deselected package libklibc.
Unpacking libklibc (from .../libklibc_1.5.12-2lenny1_i386.deb) ...
Selecting previously deselected package klibc-utils.
Unpacking klibc-utils (from .../klibc-utils_1.5.12-2lenny1_i386.deb) ...
Selecting previously deselected package initramfs-tools.
Unpacking initramfs-tools (from .../initramfs-tools_0.92o_all.deb) ...
/dev/mapper/dsk-swap: error opening volume
Selecting previously deselected package linux-modules-2.6.26-2-xen-686.
Unpacking linux-modules-2.6.26-2-xen-686 (from .../linux-modules-2.6.26-2-xen-686_2.6.26-29_i386.deb) ...
Selecting previously deselected package linux-image-2.6.26-2-xen-686.
Unpacking linux-image-2.6.26-2-xen-686 (from .../linux-image-2.6.26-2-xen-686_2.6.26-29_i386.deb) ...
Selecting previously deselected package linux-modules-2.6-xen-686.
Unpacking linux-modules-2.6-xen-686 (from .../linux-modules-2.6-xen-686_2.6.26+17+lenny1_i386.deb) ...
Selecting previously deselected package linux-image-xen-686.
Unpacking linux-image-xen-686 (from .../linux-image-xen-686_2.6.26+17+lenny1_i386.deb) ...
Selecting previously deselected package openssh-server.
Unpacking openssh-server (from .../openssh-server_1%3a5.1p1-5_i386.deb) ...
Selecting previously deselected package ssh.
Unpacking ssh (from .../ssh_1%3a5.1p1-5_all.deb) ...
Processing triggers for man-db ...
Setting up openssh-blacklist (0.4.1) ...
Setting up openssh-blacklist-extra (0.4.1) ...
Setting up libvolume-id0 (0.125-7+lenny3) ...
Setting up udev (0.125-7+lenny3) ...
A chroot environment has been detected, udev not started.
Setting up libxau6 (1:1.0.3-3) ...
Setting up libxdmcp6 (1:1.0.2-3) ...
Setting up libxcb1 (1.1-1.2) ...
Setting up libxcb-xlib0 (1.1-1.2) ...
Setting up libx11-data (2:1.1.5-2) ...
Setting up libx11-6 (2:1.1.5-2) ...
Setting up libxext6 (2:1.0.4-2) ...
Setting up libxmuu1 (2:1.0.4-1) ...
Setting up xauth (1:1.0.3-2) ...
Setting up libc6-xen (2.7-18lenny7) ...
Setting up libedit2 (2.11~20080614-1) ...
Setting up libkeyutils1 (1.2-9) ...
Setting up libkrb53 (1.6.dfsg.4~beta1-5lenny7) ...
Setting up openssh-client (1:5.1p1-5) ...
Setting up busybox (1:1.10.2-2) ...
Setting up grub-common (1.96+20080724-16) ...
Setting up grub (0.97-47lenny2) ...
Setting up libklibc (1.5.12-2lenny1) ...
Setting up klibc-utils (1.5.12-2lenny1) ...
Setting up initramfs-tools (0.92o) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-modules-2.6.26-2-xen-686 (2.6.26-29) ...
Setting up linux-image-2.6.26-2-xen-686 (2.6.26-29) ...
update-initramfs: Generating /boot/initrd.img-2.6.26-2-xen-686
Searching for GRUB installation directory ... found: /boot/grub
Probing devices to guess BIOS drives. This may take a long time.
dpkg: error processing linux-image-2.6.26-2-xen-686 (--configure):
subprocess post-installation script returned error exit status 1
Setting up linux-modules-2.6-xen-686 (2.6.26+17+lenny1) ...
dpkg: dependency problems prevent configuration of linux-image-xen-686:
linux-image-xen-686 depends on linux-image-2.6.26-2-xen-686; however:
Package linux-image-2.6.26-2-xen-686 is not configured yet.
dpkg: error processing linux-image-xen-686 (--configure):
dependency problems - leaving unconfigured
Setting up openssh-server (1:5.1p1-5) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Restarting OpenBSD Secure Shell server: sshd.
Setting up ssh (1:5.1p1-5) ...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-2.6.26-2-xen-686
Errors were encountered while processing:
linux-image-2.6.26-2-xen-686
linux-image-xen-686
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up linux-image-2.6.26-2-xen-686 (2.6.26-29) ...
update-initramfs: Generating /boot/initrd.img-2.6.26-2-xen-686
Searching for GRUB installation directory ... found: /boot/grub
dpkg: error processing linux-image-2.6.26-2-xen-686 (--configure):
subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-xen-686:
linux-image-xen-686 depends on linux-image-2.6.26-2-xen-686; however:
Package linux-image-2.6.26-2-xen-686 is not configured yet.
dpkg: error processing linux-image-xen-686 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-image-2.6.26-2-xen-686
linux-image-xen-686
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done
Alguna sugerencia?
"Transporta un puñado de tierra todos los días y construirás una montaña" - Confucio
floss.iknaxio.net
dpkg --reconfigure
dpkg --reconfigure linux-image-2.6.26-2-xen-686
creo que es así ... :)
bye
;)
Probé reconfigurar
Probé reconfigurar, pero como el paquete no esta instalado no me permite la acción.
"Transporta un puñado de tierra todos los días y construirás una montaña" - Confucio
floss.iknaxio.net
qué raro eh? no me había
qué raro eh? no me había sucedido antes.. prueba lo que sugiere death, también valida que quizá haya salido una versioń de kernel xen más actualizada... pero no me había pasado.
Saludos
epe
EcuaLinux.com
+(593) 9 9924 6504
Servicios en Software Libre
Como no tenía mucho tiempo
Terminé instalando con virt-install
"Transporta un puñado de tierra todos los días y construirás una montaña" - Confucio
floss.iknaxio.net
Usé la sgte instrucción
Por si alguién lo requiere, usé la sgte instrucción:
virt-install \
> --name=vmDeb01_mail \
> --ram=1024 \
> --network=bridge \
> --os-type=linux \
> --os-variant=debianlenny \
> –-file=/dev/dsk/vmDeb01_mail \
> --location=http://ftp.us.debian.org/debian/dists/lenny/main/installer-i386/
"Transporta un puñado de tierra todos los días y construirás una montaña" - Confucio
floss.iknaxio.net