Difference between revisions of "How to install a NetBSD domU on a Linux host (Debian 3.1, Xen 2.0.7, NetBSD 2.1)"

From Xen
m (Removed superfluous <nowiki></nowiki> tag pairs.)
Line 13: Line 13:
   
   
<pre><nowiki>
+
<pre>
 
lvcreate -L4G -n netbsd3.0 vol1
 
lvcreate -L4G -n netbsd3.0 vol1
</nowiki></pre>
+
</pre>
   
   
Line 21: Line 21:
   
   
<pre><nowiki>
+
<pre>
 
wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-INSTALL_XENU.gz
 
wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-INSTALL_XENU.gz
 
wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-XENU.gz
 
wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-XENU.gz
Line 27: Line 27:
 
gunzip netbsd-INSTALL_XENU.gz
 
gunzip netbsd-INSTALL_XENU.gz
 
gunzip netbsd-XENU.gz
 
gunzip netbsd-XENU.gz
</nowiki></pre>
+
</pre>
   
   
 
For Xen3 hosts, use:
 
For Xen3 hosts, use:
   
<pre><nowiki>
+
<pre>
 
wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz
 
wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz
 
wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-XEN3_DOMU.gz
 
wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-XEN3_DOMU.gz
Line 38: Line 38:
 
gunzip netbsd-INSTALL_XEN3_DOMU.gz
 
gunzip netbsd-INSTALL_XEN3_DOMU.gz
 
gunzip netbsd-XEN3_DOMU.gz
 
gunzip netbsd-XEN3_DOMU.gz
</nowiki></pre>
+
</pre>
   
   
Line 46: Line 46:
   
   
<pre><nowiki>
+
<pre>
 
kernel = "/home/garry/kernels/netbsd-INSTALL_XENU" <--- point to where you downloaded the kernels in step #2
 
kernel = "/home/garry/kernels/netbsd-INSTALL_XENU" <--- point to where you downloaded the kernels in step #2
 
memory = 128
 
memory = 128
Line 59: Line 59:
 
netmask = "255.255.x.x"
 
netmask = "255.255.x.x"
 
gateway = "a.b.c.d"
 
gateway = "a.b.c.d"
</nowiki></pre>
+
</pre>
   
   
Line 65: Line 65:
   
   
<pre><nowiki>
+
<pre>
 
xm create -c netbsd.cfg
 
xm create -c netbsd.cfg
</nowiki></pre>
+
</pre>
   
   
Line 77: Line 77:
   
   
<pre><nowiki>
+
<pre>
 
pub/NetBSD/NetBSD-3.1
 
pub/NetBSD/NetBSD-3.1
</nowiki></pre>
+
</pre>
   
   
Line 87: Line 87:
   
   
<pre><nowiki>
+
<pre>
 
mount /dev/xbd0a /mnt
 
mount /dev/xbd0a /mnt
 
cd /mnt/dev
 
cd /mnt/dev
Line 94: Line 94:
   
 
halt -p
 
halt -p
</nowiki></pre>
+
</pre>
   
   
Line 104: Line 104:
   
   
<pre><nowiki>
+
<pre>
 
kernel = "/home/garry/kernels/netbsd-XENU" <--- change /home/garry/kernels to where you downloaded the kernels in step #2
 
kernel = "/home/garry/kernels/netbsd-XENU" <--- change /home/garry/kernels to where you downloaded the kernels in step #2
</nowiki></pre>
+
</pre>
   
   
Line 112: Line 112:
   
   
<pre><nowiki>
+
<pre>
 
xm create -c netbsd.cfg
 
xm create -c netbsd.cfg
</nowiki></pre>
+
</pre>
   
   
Line 124: Line 124:
   
   
<pre><nowiki>
+
<pre>
 
console "/usr/libexec/getty Pc" vt100 on secure
 
console "/usr/libexec/getty Pc" vt100 on secure
 
ttyE0 "/usr/libexec/getty Pc" vt220 off secure
 
ttyE0 "/usr/libexec/getty Pc" vt220 off secure
Line 132: Line 132:
   
 
...
 
...
</nowiki></pre>
+
</pre>
   
   
Line 138: Line 138:
   
   
<pre><nowiki>
+
<pre>
 
#screen 0 - vt100
 
#screen 0 - vt100
 
#screen 1 - vt100
 
#screen 1 - vt100
Line 145: Line 145:
 
#screen 4 - -
 
#screen 4 - -
 
#screen 4 80x25bf vt100
 
#screen 4 80x25bf vt100
</nowiki></pre>
+
</pre>
   
   
Line 151: Line 151:
   
   
<pre><nowiki>
+
<pre>
 
powerd=YES
 
powerd=YES
</nowiki></pre>
+
</pre>
   
   

Revision as of 23:25, 29 November 2011


This mini-HOWTO describes how to install a NetBSD domU on a Linux host (dom0). Specifically, I used Debian 3.1 on Xen 2.0.7 as the host and put NetBSD 2.1 in a domU (with NetBSD 3.0-current kernel). This has been updated to include details on

Create storage space. I used LVM:

lvcreate -L4G -n netbsd3.0 vol1


Download netbsd-XENU-INSTALL and netbsd-XENU kernels:

wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-INSTALL_XENU.gz
wget ftp://ftp.netbsd.org/pub/NetBSD-daily/netbsd-3-0-RC5/200511302123Z/i386/binary/kernel/netbsd-XENU.gz

gunzip netbsd-INSTALL_XENU.gz
gunzip netbsd-XENU.gz


For Xen3 hosts, use:

wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz
wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.1/i386/binary/kernel/netbsd-XEN3_DOMU.gz

gunzip netbsd-INSTALL_XEN3_DOMU.gz
gunzip netbsd-XEN3_DOMU.gz


If the snapshots above are not available at the time you read this, just search for a newer snapshot.

Create /etc/xen/netbsd.cfg:

kernel = "/home/garry/kernels/netbsd-INSTALL_XENU"  <--- point to where you downloaded the kernels in step #2
memory = 128
name = "netbsd3.0"
disk = [ 'phy:/dev/vol1/netbsd3.0,0x3,w' ]

# I needed to add this because the installer couldn't find a network card without it
vif = ['mac=00:0C:6E:40:59:A3']

# Replace with your IP info
ip = "a.b.c.d"
netmask = "255.255.x.x"
gateway = "a.b.c.d"


Start VM

xm create -c netbsd.cfg


Your system will boot into the NetBSD installer. Install NetBSD like normal, noting the following:

When you get to the part where it is formatting your filesystems, you may get an error about "invalid disklabel" or something like that. From my experience, it can be ignored.

When it asks for installation method, choose 'FTP', then change the base directory to:


pub/NetBSD/NetBSD-3.1


NetBSD 3.1 was the latest version of NetBSD at the time of this writing, you may choose a newer one if you wish.

After install is done, don't reboot just yet. You'll be brought back to the main install screen, where you must select "e: Utility menu" -> "a: Run /bin/sh", then type the following at the shell:

mount /dev/xbd0a /mnt
cd /mnt/dev
cp -pR /dev/rxbd* .
cp -pR /dev/xbd* .

halt -p


For some reason, these devices are not created by Xen when the VM is booted. And yes, I tried every combination of the "disk" and "root" Xen options in "netbsd.cfg" that I could think of, but nothing worked.

The above process is probably not necessary for XEN3 3.1 kernels.

Edit /etc/xen/netbsd.cfg, change the first line to the following:

kernel = "/home/garry/kernels/netbsd-XENU"   <--- change /home/garry/kernels to where you downloaded the kernels in step #2


Start VM again

xm create -c netbsd.cfg


You're now booted into your brand new NetBSD VM!

You'll notice some errors during the bootup, such as "wsconscfg: /dev/ttyEcfg: Device not configured".

To turn this off, edit /etc/ttys and turn off all terminals except "console", like so:


console "/usr/libexec/getty Pc"         vt100   on secure
ttyE0   "/usr/libexec/getty Pc"         vt220   off secure
ttyE1   "/usr/libexec/getty Pc"         vt220   off secure
ttyE2   "/usr/libexec/getty Pc"         vt220   off secure
ttyE3   "/usr/libexec/getty Pc"         vt220   off secure

...


Also, comment out all screens in /etc/wscons.conf:


#screen 0       -       vt100
#screen 1       -       vt100
#screen 2       -       vt100
#screen 3       -       vt100
#screen 4       -       -
#screen 4       80x25bf vt100


Finally, so that "xm shutdown" works from your host (dom0), put the following in /etc/rc.conf:


powerd=YES


Enjoy your new NetBSD box!