Difference between revisions of "NetBSD"
(→Installation for grub2) |
(→Installation for pv-grub) |
||
Line 118: | Line 118: | ||
</pre> | </pre> | ||
− | You may choose whatever options you want as long as the | + | You may choose whatever options you want as long as the Linux Ext2 partition is preserved as-is. If the boot partition is formatted or removed, however, you will be unable to boot. |
== Installation for grub2 == | == Installation for grub2 == |
Revision as of 02:16, 5 September 2015
Contents
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:
sed 's#parted /dev/xvda mkpartfs primary ext2 0 32#parted /dev/xvda mkpart primary ext2 0 32; mkfs.ext2 /dev/xvda1#g' -i /usr/local/sbin/wipe-and-reinstall 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
Install to xbd0. When prompted, select 'Use existing partition sizes'. Your root device should be on partition 'a'. This partition scheme should work and was made for a 3GiB disk:
We now have your BSD-disklabel partitions as: This is your last chance to change them. Start MB End MB Size MB FS type Newfs Mount Mount point --------- --------- --------- ---------- ----- ----- ----------- a: 32 3071 3040 FFSv2 Yes Yes / b: 0 0 0 unused c: 0 3071 3072 NetBSD partition d: 0 3071 3072 Whole disk e: 0 29 30 Linux Ext2 f: 0 0 0 unused g: Show all unused partitions h: Change input units (sectors/cylinders/MB) >x: Partition sizes ok
You may choose whatever options you want as long as the Linux Ext2 partition is preserved as-is. If the boot partition is formatted or removed, however, you will be unable to boot.
Installation for grub2
Install to xbd0. Your root device should be on partition 'a'. Example of working partition scheme:
We now have your BSD-disklabel partitions as: This is your last chance to change them. Start MB End MB Size MB FS type Newfs Mount Mount point --------- --------- --------- ---------- ----- ----- ----------- a: 0 2815 2816 FFSv2 Yes Yes / b: 2816 3071 256 swap c: 0 3071 3072 NetBSD partition d: 0 3071 3072 Whole disk e: 0 0 0 unused
Otherwise, 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. Go to the "Utility Menu" and Enter a shell. Perform the following:
mount /dev/xbd0d /mnt chroot /mnt 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 echo "set default=0 set timeout=5 menuentry 'NetBSD, with kernel netbsd-XEN3_DOMU.gz ' { linux /netbsd-XEN3_DOMU.gz }" > /grub/grub.cfg rm MD5 rm SHA512 exit umount /mnt exit
Select "Back to main menu" and then "Halt the system". 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.