This is a writeup/commentary on using one of NetBSD's small install images to install normally (without moving an pre-built image over). The original idea for this is thanks to "bdragon" who left a note on the talk page of BSD Howto.
This guide will walk you through the installation of NetBSD XEN by using one of the small boot images:
- This isn't officially supported by Linode, it's still, after all, Linux-node.
- SMP is supported only starting with NetBSD 6.0, if you intend to install an older version you will be able to use only one of the four vCPUs provided by Linode.
- NetBSD 6.1.x works both in 386 and amd64 mode, however for i386 you will need to use the PAE version NetBSD 6.1.x XENPAE i386 for it to work properly, the non-PAE verison NetBSD 6.1.x XEN i386 will not work.
- Booting without using a small assist-partition is awkward.
- shutdown -h now and halt do not properly halt the machine, leaving you in a spinlock on the console "Press any key to reboot..." which is hard on the VM host and Linode frowns on it. Use "reboot" which will send the appropriate signal, shutting down everything.
The overall method here is very simple. We will create a small (16+ MB) disk image which should be ext2 or ext3. We will use Finnix to download NetBSD's INSTALL kernel image which includes the installer and enough to connect to the network and download the rest of the system. We will also download the normal XEN kernel for booting. We'll then use pv-grub to boot the INSTALL kernel and do a normal install of NetBSD, then we'll again use pv-grub to boot NetBSD and you'll be running!
Use the XEN3PAE_DOMU for i386 and the normal XEN3_DOMU kernels for amd64.
The INSTALL and normal kernels for NetBSD 6.1.3 amd64 are:
The INSTALL and normal kernels for NetBSD 6.1.3 i386 are:
 On the Dashboard
On the Dashboard,
- Create a small image called "boot" (16 MB should be sufficient), choose the "ext3" type for it.
- Create an image of whatever size you like called "netbsd", choose the "unformatted / raw" type for it. We will install the NetBSD system on this partition.
- Create a profile (I named mine Finnix) for Finnix.
- Set the kernel to Finnix (recovery)
- Set /dev/xvda to "Recovery - Finnix (iso)"
- Set /dev/xvdb to "boot" (or whatever you named your boot image)
- Set "Uncompressed initrd image" to "Recovery -- Finnix initrd"
- Save this profile
- Create another profile (I called my NetBSD) for pv-grub to boot both the installer and the final system.
- Set the kernel to "pv-grub-x86_64" if you will be using NetBSD amd64 or set it to "pv-grub-x86_32" if you will be using NetBSD i386 PAE.
- Set /dev/xvda to "boot"
- Set /dev/xvdb to "netbsd"
- Disable all the "Filesystem/Boot Helpers" options as they won't work with NetBSD.
- Save this profile
 Using Finnix to grab the kernel images
- Boot the Finnix profile and connect to the Lish console. I recommend using the Lish console via SSH, installing through the AJAX Lish console is slow and error-prone.
- Mount the /dev/xvdb device and change to the directory it's mounted at:
root@hvc0:~# mkdir /mnt/xvdb root@hvc0:~# mount /dev/xvdb /mnt/xvdb root@hvc0:~# cd /mnt/xvdb
- Fetch using wget the two files appropriate for what you're going to be running. I will use the i386 PAE version of 6.1.3 for the examples.
root@hvc0:/mnt/xvdb# wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.1.3/i386/binary/kernel/netbsd-INSTALL_XEN3PAE_DOMU.gz root@hvc0:/mnt/xvdb# wget ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.1.3/i386/binary/kernel/netbsd-XEN3PAE_DOMU.gz
- And that's it, go back to the Dashboard and shutdown your Linode.
 Booting NetBSD install
- Boot your NetBSD profile (connect to the Lish console if necessary again).
- After a few seconds you'll get to a screen like:
GNU GRUB version 0.97 (524288K lower / 0K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grubdom>
- If things are a bit corrupted just type clear and hit enter.
- At the grubdom prompt select the install kernel (netbsd-INSTALL_XEN3PAE_DOMU.gz for i386 PAE or INSTALL_XEN3_DOMU.gz for amd64) and boot:
grubdom> kernel (hd0)/netbsd-INSTALL_XEN3PAE_DOMU.gz grubdom> boot
- NetBSD should boot:
NetBSD 6.1.3 (INSTALL_XEN3PAE_DOMU) total memory = 1024 MB avail memory = 993 MB mainbus0 (root) hypervisor0 at mainbus0: Xen version 4.1.5-pre ...
- You should now be presented with NetBSD's install prompt. You might want to hit ctrl-C and type TERM=vt100 to correct terminal problems then run sysinst again to resume the installation.
- Perform a normal installation of NetBSD, select xbd1 (which corresponds to xvdb in your profile) when prompted for which disk do you want to install NetBSD to. Partition as you like, make sure to create some swap space. All those partitions will be inside the "netbsd" image that you created earlier.
- When prompted for the installation type select FTP
- Select xennet0 as the network card to be configured and when prompted for the "network media type" type none
- Perform DHCP configuration but skip IPv6 autoconfiguration, to speed up the process use an FTP mirror close to where your Linode is hosted to download the distribution sets.
- Once the install is finished, halt the system.
- Boot into your Finnix profile again and remount /mnt/xvdb.
- Create the boot/grub directory under this file system that Grub will look for.
root@hvc0:~# mkdir /mnt/xvdb root@hvc0:~# mount /dev/xvdb /mnt/xvdb root@hvc0:~# cd /mnt/xvdb/ root@hvc0:~# mkdir boot boot/grub
- Use an editor (nano/vi/etc...) to create the file /mnt/xvdb/boot/grub/menu.lst
- Put this into it:
default 0 timeout 10 title NetBSD root (hd0) kernel --type=netbsd /netbsd-XEN3PAE_DOMU.gz bootdev=xbd1 title NetBSD install root (hd0) kernel --type=netbsd /netbsd-INSTALL_XEN3PAE_DOMU.gz bootdev=xbd1
- As usual pick the correct boot image, netbsd-XEN3PAE_DOMU.gz for i386 PAE and netbsd-XEN3_DOMU.gz for amd64
- Halt the system.
 First boot
- Boot the NetBSD profile again.
- Grub should find the menu.lst file and proceed to boot NetBSD.
... Sun Dec 30 16:23:50 CET 2012 NetBSD/i386 (yourhostname) (console) login:
- If you're having problems with grub you can boot the kernel manually:
grubdom> kernel (hd0)/netbsd-XEN3PAE_DOMU.gz bootdev=xbd1 grubdom> boot
 Final Notes
- The first thing you should do is add another user belonging to group "wheel" and setup sshd so you can log in remotely as that user, and su to root, and not use the Lish console.
# useradd -m -G wheel mynewuser # passwd mynewuser Enter new password: Retype new password: # cat >> /etc/rc.conf sshd=yes ''(ctrl-D)'' # /etc/rc.d/sshd start
- You might want to remove the extra entries in /etc/ttys. Those getty instances for all but "console" are useless and might cause error messages to be printed out on the console at boot time. You only need the one line for the Lish console login:
# name getty type status comments # console "/usr/libexec/getty Pc" vt100 on secure constty "/usr/libexec/getty Pc" vt100 off secure ttyE0 "/usr/libexec/getty Pc" wsvt25 off secure ttyE1 "/usr/libexec/getty Pc" wsvt25 off secure ttyE2 "/usr/libexec/getty Pc" wsvt25 off secure ttyE3 "/usr/libexec/getty Pc" wsvt25 off secure
- Similarly disable all screens in /etc/wscons.conf by commenting out the following lines:
screen 1 - vt100 screen 2 - vt100 screen 3 - vt100 screen 4 - -
- Enjoy NetBSD on Linode!