Difference between revisions of "Vnx-rootfsopenbsd"

From VNX
Jump to: navigation, search
(Configuration)
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Title|How to create a KVM OpenBSD root filesystem for VNX}}
 
{{Title|How to create a KVM OpenBSD root filesystem for VNX}}
  
Follow this procedure to create a KVM OpenBSD based root filesystem for VNX. The procedure has been tested with OpenBSD 5.8.  
+
Follow this procedure to create a KVM OpenBSD based root filesystem for VNX. The procedure has been tested with OpenBSD 7.2.  
  
 
== Basic installation ==
 
== Basic installation ==
 
<ul>
 
<ul>
 
<li>Create the filesystem disk image:</li>
 
<li>Create the filesystem disk image:</li>
  qemu-img create -f qcow2 vnx_rootfs_kvm_openbsd.qcow2 12G
+
  qemu-img create -f qcow2 vnx_rootfs_kvm_openbsd64-7.4.qcow2 20G
 
<li>Get OpenBSD installation CD. For example:</li>
 
<li>Get OpenBSD installation CD. For example:</li>
  wget http://ftp.eu.openbsd.org/pub/OpenBSD/5.8/amd64/install58.iso
+
  wget http://ftp.eu.openbsd.org/pub/OpenBSD/7.4/amd64/install74.iso
  cp install58.iso /almacen/iso
+
  mv install74.iso /almacen/iso/openbsd-install74.iso
 
<li>Create the virtual machine with:</li>
 
<li>Create the virtual machine with:</li>
  vnx --create-rootfs vnx_rootfs_kvm_openbsd64.qcow2 --install-media /almacen/iso/openbsd-install58.iso --mem 512M --arch=x86_64
+
  vnx --create-rootfs vnx_rootfs_kvm_openbsd64-7.4.qcow2 --install-media /almacen/iso/openbsd-install74.iso --mem 2G --arch=x86_64 --vcpu 2
<li>Follow OpenBSD installation menus to install a basic system with a user named "vnx". When asked about the network interface, answer "done". Notice that if you have downloaded installXX.iso, you can specify installation from CD in the setup program, instead of downloading packages from network. Later, you can update the system.</li>
+
<li>Follow OpenBSD installation menus to install a basic system:</li>
<li>After ending installation, but before shutting down the virtual machine, you he to disable mpbios, as follows:</li>
+
<ul>
 +
<li>When asked about the network interface, answer "done" to not configure the network now.</li>
 +
<li>Answer 'yes' to the question "Change the default console to com0" to enable serial console.</li>
 +
<li>Add a user named "vnx".</li>
 +
<li>Use the whole "wd0" or "sd0" disk and "Auto layout".</li>
 +
<li>Choose cd0 for the "location of sets". Choose the default "sets".</li>
 +
</ul>
 +
<li>After ending installation, but before shutting down the virtual machine, you have to disable mpbios, as follows:</li>
 
  chroot /mnt
 
  chroot /mnt
 
  config -ef /bsd
 
  config -ef /bsd
Line 22: Line 29:
 
</ul>
 
</ul>
  
The OS installer will offer to reboot, but do not do that. Instead, kill the VM window and then, in the host OS, interrupt with Ctrl-C the kvm program.
+
The OS installer will offer to reboot, but do not do that. Instead, close the VM console window and then, from the host OS, destroy the virtual machine:
 
+
# virsh list
 +
  Id    Nombre                        Estado
 +
----------------------------------------------------
 +
  33    vnx_rootfs_kvm_openbsd64-7.4.qcow2-7440 ejecutando
 +
 +
# virsh destroy 33
  
 
== Configuration ==
 
== Configuration ==
Line 29: Line 41:
 
<ul>
 
<ul>
 
<li>Start the system with the following command:</li>
 
<li>Start the system with the following command:</li>
  vnx --modify-rootfs vnx_rootfs_kvm_openbsd.qcow2 --update-aced --mem 512M --arch x86_64
+
  vnx --modify-rootfs vnx_rootfs_kvm_openbsd64-7.4.qcow2 --update-aced --mem 2G --arch x86_64 --vcpu 2
 
Note: ignore the errors "timeout waiting for response on VM socket".
 
Note: ignore the errors "timeout waiting for response on VM socket".
 
<li>Access the system through the text console to easy the copy-paste of commands:</li>
 
<li>Access the system through the text console to easy the copy-paste of commands:</li>
Line 35: Line 47:
 
  Id    Name                          State
 
  Id    Name                          State
 
  ----------------------------------------------------
 
  ----------------------------------------------------
  31    vnx_rootfs_kvm_openbsd64-5.8-v025.qcow2-912 running
+
  31    vnx_rootfs_kvm_openbsd64-7.4.qcow2-912 running
 
    
 
    
 
  # virsh console 31
 
  # virsh console 31
 +
<li>In case you do not have access to the serial console, you can configure it manually by editing /etc/ttys file and changing the line:</li>
 +
tty00 "/usr/libexec/getty std.9600"  dialup  off secure
 +
to:
 +
tty00 "/usr/libexec/getty std.9600"  vt100  on secure
 +
Reboot the system after modifying the ttys file.
 
<li>Loogin as root in the console and configure the network with DHCP:</li>
 
<li>Loogin as root in the console and configure the network with DHCP:</li>
 
  dhclient re0
 
  dhclient re0
 
<li>Configure the environment variable with network repository:</li>
 
<li>Configure the environment variable with network repository:</li>
  export PKG_PATH=ftp://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/
+
  export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/
 
<li>Install bash and change package repository (change ftp.es.freebsd.org to your nearest mirror):</li>
 
<li>Install bash and change package repository (change ftp.es.freebsd.org to your nearest mirror):</li>
 
  pkg_add -r bash   
 
  pkg_add -r bash   
 
  usermod -s /usr/local/bin/bash root
 
  usermod -s /usr/local/bin/bash root
 
  usermod -s /usr/local/bin/bash vnx
 
  usermod -s /usr/local/bin/bash vnx
  echo "export PKG_PATH=ftp://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/" > ~/.bash_profile
+
  echo "export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/" > ~/.bash_profile
 +
Note: in case pkg_add does not progress, try using another openbsd mirror in PKG_PATH variable.
 
<li>Install XML::LibXML and NetAddr-IP perl libraries:</li>
 
<li>Install XML::LibXML and NetAddr-IP perl libraries:</li>
 
  pkg_add -r p5-XML-LibXML p5-NetAddr-IP  
 
  pkg_add -r p5-XML-LibXML p5-NetAddr-IP  
 
<li>Install VNX autoconfiguration daemon:</li>
 
<li>Install VNX autoconfiguration daemon:</li>
  mount_msdos /dev/wd1i /mnt
+
  mount_msdos /dev/wd1i /mnt # if virtio=no in vnx.conf
 +
mount_msdos /dev/sd1c /mnt  # if virtio=yes in vnx.conf
 
  perl /mnt/vnxaced-lf/install_vnxaced
 
  perl /mnt/vnxaced-lf/install_vnxaced
 +
sed -i 's#bin/sh#bin/ksh#' /etc/rc.d/vnxaced
 
<li>Create a file /etc/vnx_rootfs_version to store version number and informacion about modification:</li>
 
<li>Create a file /etc/vnx_rootfs_version to store version number and informacion about modification:</li>
 
  VER=v0.25
 
  VER=v0.25
  OS=OpenBSD 5.8
+
  OS=OpenBSD 7.4
  DESC=Basic OpenBSD 5.8 root filesystem without GUI
+
  DESC=Basic OpenBSD 7.4 root filesystem without GUI
 
<li>Configure interface em0 so that it does not get configured with DHCP. To do that, if file /etc/hostname.em0 exists, edit it and delete or comment the line with "dhcp".</li>
 
<li>Configure interface em0 so that it does not get configured with DHCP. To do that, if file /etc/hostname.em0 exists, edit it and delete or comment the line with "dhcp".</li>
 
<li>Stop the machine with that script:</li>
 
<li>Stop the machine with that script:</li>
 
  vnx_halt
 
  vnx_halt
  
<li>Configure the serial console by editting /etc/ttys file and changing the line:</li>
+
</ul>
tty00 "/usr/libexec/getty std.9600"  dialup  off secure
+
 
to:
+
If everything went well, your root filesystem will be ready to be used with VNX. You can make a simple test using the simple_openbsd64.xml scenario distributed with VNX.
tty00 "/usr/libexec/getty std.9600"  vt100  on secure
+
 
 +
== Installing additional software ==
  
 +
To install additional software or to modify your root file system, you just have to:
 +
<ul>
 +
<li>Start a virtual machine from it:</li>
 +
vnx --modify-rootfs vnx_rootfs_kvm_openbsd64-7.2.qcow2 --arch x86_64
 +
<li>Check network connectivity. Maybe you have to activate the network interface by hand:</li>
 +
dhclient re0
 +
<li>Do the modifications you want.</li>
 +
<li>Finally, halt the system using:</li>
 +
vnx_halt
 
</ul>
 
</ul>
  
If everything went well, your root filesystem will be ready to be used with VNX. You can make a simple test using the simple_openbsd.xml scenario distributed with VNX.
+
== Known problems ==
 +
 
 +
== OpenBSD tips ==
 +
 
 +
To upgrade OpenBSD to the next release, the OpenBSD site provides useful hints. For instance, to upgrade from 7.1 to 7.2, you can follow the instructions provided in http://www.openbsd.org/faq/upgrade72.html

Latest revision as of 13:47, 2 December 2023

How to create a KVM OpenBSD root filesystem for VNX

Follow this procedure to create a KVM OpenBSD based root filesystem for VNX. The procedure has been tested with OpenBSD 7.2.

Basic installation

  • Create the filesystem disk image:
  • qemu-img create -f qcow2 vnx_rootfs_kvm_openbsd64-7.4.qcow2 20G
    
  • Get OpenBSD installation CD. For example:
  • wget http://ftp.eu.openbsd.org/pub/OpenBSD/7.4/amd64/install74.iso
    mv install74.iso /almacen/iso/openbsd-install74.iso
    
  • Create the virtual machine with:
  • vnx --create-rootfs vnx_rootfs_kvm_openbsd64-7.4.qcow2 --install-media /almacen/iso/openbsd-install74.iso --mem 2G --arch=x86_64 --vcpu 2
    
  • Follow OpenBSD installation menus to install a basic system:
    • When asked about the network interface, answer "done" to not configure the network now.
    • Answer 'yes' to the question "Change the default console to com0" to enable serial console.
    • Add a user named "vnx".
    • Use the whole "wd0" or "sd0" disk and "Auto layout".
    • Choose cd0 for the "location of sets". Choose the default "sets".
  • After ending installation, but before shutting down the virtual machine, you have to disable mpbios, as follows:
  • chroot /mnt
    config -ef /bsd
    disable mpbios
    quit
    
  • Finally, halt the system:
  • halt -p
    

The OS installer will offer to reboot, but do not do that. Instead, close the VM console window and then, from the host OS, destroy the virtual machine:

# virsh list
 Id    Nombre                         Estado
----------------------------------------------------
 33    vnx_rootfs_kvm_openbsd64-7.4.qcow2-7440 ejecutando

# virsh destroy 33

Configuration

  • Start the system with the following command:
  • vnx --modify-rootfs vnx_rootfs_kvm_openbsd64-7.4.qcow2 --update-aced --mem 2G --arch x86_64 --vcpu 2
    

    Note: ignore the errors "timeout waiting for response on VM socket".

  • Access the system through the text console to easy the copy-paste of commands:
  • # virsh list
    Id    Name                           State
    ----------------------------------------------------
    31    vnx_rootfs_kvm_openbsd64-7.4.qcow2-912 running
     
    # virsh console 31
    
  • In case you do not have access to the serial console, you can configure it manually by editing /etc/ttys file and changing the line:
  • tty00 "/usr/libexec/getty std.9600"   dialup  off secure
    

    to:

    tty00 "/usr/libexec/getty std.9600"   vt100  on secure
    

    Reboot the system after modifying the ttys file.

  • Loogin as root in the console and configure the network with DHCP:
  • dhclient re0
    
  • Configure the environment variable with network repository:
  • export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/
    
  • Install bash and change package repository (change ftp.es.freebsd.org to your nearest mirror):
  • pkg_add -r bash  
    usermod -s /usr/local/bin/bash root
    usermod -s /usr/local/bin/bash vnx
    echo "export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/" > ~/.bash_profile
    

    Note: in case pkg_add does not progress, try using another openbsd mirror in PKG_PATH variable.

  • Install XML::LibXML and NetAddr-IP perl libraries:
  • pkg_add -r p5-XML-LibXML p5-NetAddr-IP 
    
  • Install VNX autoconfiguration daemon:
  • mount_msdos /dev/wd1i /mnt  # if virtio=no in vnx.conf
    mount_msdos /dev/sd1c /mnt  # if virtio=yes in vnx.conf
    perl /mnt/vnxaced-lf/install_vnxaced
    sed -i 's#bin/sh#bin/ksh#' /etc/rc.d/vnxaced
    
  • Create a file /etc/vnx_rootfs_version to store version number and informacion about modification:
  • VER=v0.25
    OS=OpenBSD 7.4
    DESC=Basic OpenBSD 7.4 root filesystem without GUI
    
  • Configure interface em0 so that it does not get configured with DHCP. To do that, if file /etc/hostname.em0 exists, edit it and delete or comment the line with "dhcp".
  • Stop the machine with that script:
  • vnx_halt
    

If everything went well, your root filesystem will be ready to be used with VNX. You can make a simple test using the simple_openbsd64.xml scenario distributed with VNX.

Installing additional software

To install additional software or to modify your root file system, you just have to:

  • Start a virtual machine from it:
  • vnx --modify-rootfs vnx_rootfs_kvm_openbsd64-7.2.qcow2 --arch x86_64
    
  • Check network connectivity. Maybe you have to activate the network interface by hand:
  • dhclient re0
    
  • Do the modifications you want.
  • Finally, halt the system using:
  • vnx_halt
    

Known problems

OpenBSD tips

To upgrade OpenBSD to the next release, the OpenBSD site provides useful hints. For instance, to upgrade from 7.1 to 7.2, you can follow the instructions provided in http://www.openbsd.org/faq/upgrade72.html