Difference between revisions of "NetBSD"

From PrgmrWiki
Line 125: Line 125:
 
</pre>
 
</pre>
  
Select "Back to main menu" and then "Reboot the computer" to complete the install.
+
Select "Back to main menu" and then "Reboot the computer". Wait for the computer to reboot.<br> Type 'ctrl-]' to exit back to the management console. From the management console, select
 
+
<pre>
 +
    4. force power off (destroy/hard shutdown)
 +
</pre>
 +
Select
 +
<pre>
 +
    9. swap pvgrub/grub2 bootloaders currently "pv-grub"
 +
</pre>
 +
to use grub2. Select
 +
<pre>
 +
    2. create/start, opens OOB console (try this if the machine is not running)
 +
</pre>
 +
to start your VM.
 
= Rescuing NetBSD install =
 
= Rescuing NetBSD install =
  
 
The shell available from the NetBSD installer from the initial pv-grub boot menu may be used as a minimal rescue image.
 
The shell available from the NetBSD installer from the initial pv-grub boot menu may be used as a minimal rescue image.

Revision as of 20:15, 4 September 2015

Grub or Grub2?

Using GRUB2 with NetBSD is much easier than legacy pvgrub. GRUB2 with 64-bit NetBSD works everywhere. If you want to use 32-bit NetBSD, however, GRUB2 may not be supported. You can check by trying to change the bootloader . If i386+grub2 is not supported, you can either contact support to see if you can be moved to a server that does support it or you can use a special partition scheme as documented below.

Partitioning for use with pv-grub

From the Management Console, to make accessing the live rescue image more easy verify you are using "pv-grub"

 9. swap pvgrub/grub2 bootloaders currently "pv-grub"

Verify whether you are running in 32 bit (i386) or 64 bit (amd64) mode by looking at

    6. swap i386/amd64 bootloaders currently "i386"

and switch if desired.

Shut down your machine if it is running. Then select

    2. create/start, opens OOB console (try this if the machine is not running)

This will bring up a menu resembling:

    GNU GRUB  version 0.97  (131072K lower / 0K upper memory)

 +-------------------------------------------------------------------------+
 | user bootloader configuration                                           |  
 | Debian GNU/Linux, kernel 3.2.0-4-amd64 Live Rescue                      |
 | Debian GNU/Linux, kernel 3.2.0-4-amd64 (single-user mode) Live Rescue   |
 | ubuntu-trusty-14.04-64 rescue                                           |
 | ubuntu-trusty-14.04-64 install                                          |
 | centos5-64 rescue                                                       |
 | centos5-64 install                                                      |
 | debian-wheezy-7.0-64 rescue                                             |
 | debian-wheezy-7.0-64 install                                            |
 | fedora20-64 rescue                                                      |
 | fedora20-64 install                                                     |
 | centos6-64 rescue                                                       | v
 +-------------------------------------------------------------------------+
    Use the ^ and v keys to select which entry is highlighted.
    Press enter to boot the selected OS, 'e' to edit the
    commands before booting, or 'c' for a command-line.

Boot Debian GNU/Linux Live Rescue from GRUB.

Log in as root.

Run the following:

wipe-and-reinstall /distros/<tab complete to desired distro>

This will create a boot partition and add the normal kernel, install kernel, and menu.lst to that boot partition. Write and quit. "Reboot" the machine so that you can boot the NetBSD installer.

Booting NetBSD installer

From the Management Console, to make accessing the live rescue image more easy verify you are using "pv-grub"

 9. swap pvgrub/grub2 bootloaders currently "pv-grub"

Verify whether you are running in 32 bit (i386) or 64 bit (amd64) mode by looking at

    6. swap i386/amd64 bootloaders currently "i386"

and switch if desired.

Shut down your machine if it is running. Then select

    2. create/start, opens OOB console (try this if the machine is not running)

This will bring up a menu resembling:

    GNU GRUB  version 0.97  (131072K lower / 0K upper memory)

 +-------------------------------------------------------------------------+
 | user bootloader configuration                                           |  
 | Debian GNU/Linux, kernel 3.2.0-4-amd64 Live Rescue                      |
 | Debian GNU/Linux, kernel 3.2.0-4-amd64 (single-user mode) Live Rescue   |
 | ubuntu-trusty-14.04-64 rescue                                           |
 | ubuntu-trusty-14.04-64 install                                          |
 | centos5-64 rescue                                                       |
 | centos5-64 install                                                      |
 | debian-wheezy-7.0-64 rescue                                             |
 | debian-wheezy-7.0-64 install                                            |
 | fedora20-64 rescue                                                      |
 | fedora20-64 install                                                     |
 | centos6-64 rescue                                                       | v
 +-------------------------------------------------------------------------+
    Use the ^ and v keys to select which entry is highlighted.
    Press enter to boot the selected OS, 'e' to edit the
    commands before booting, or 'c' for a command-line.

Boot netbsd install from GRUB.

Installation for pv-grub

You may choose whatever options you want as long as the first partition is preserved as-is. If the boot partition is formatted or removed, however, you will be unable to boot.

Installation for grub2

You may install with whatever options you choose as long as the first partition has room for the netbsd kernel (approximately 8MiB) and the file system is compatible with grub2.

After finishing the install, you will need to manually add the Xen kernel. Enter a shell from the installer and perform the following:

mount /dev/xbd0d /mnt
chroot /mnt

pkg_add ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/6.1.5/sysutils/grub2-2.00nb4.tgz
ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.1.5/amd64/binary/kernel/netbsd-XEN3_DOMU.gz
ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.1.5/amd64/binary/kernel/MD5
ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.1.5/amd64/binary/kernel/SHA512
#Do not use if this fails
grep "$(/usr/bin/cksum -a md5 netbsd-XEN3_DOMU.gz)" MD5
#Do not use if this fails
grep "$(/usr/bin/cksum -a sha512 netbsd-XEN3_DOMU.gz)" SHA512
mkdir /grub
/usr/pkg/sbin/grub-mkconfig -o /grub/grub.cfg
exit
umount /mnt
exit

Select "Back to main menu" and then "Reboot the computer". Wait for the computer to reboot.
Type 'ctrl-]' to exit back to the management console. From the management console, select

    4. force power off (destroy/hard shutdown)

Select

    9. swap pvgrub/grub2 bootloaders currently "pv-grub"

to use grub2. Select

    2. create/start, opens OOB console (try this if the machine is not running)

to start your VM.

Rescuing NetBSD install

The shell available from the NetBSD installer from the initial pv-grub boot menu may be used as a minimal rescue image.