Untarring a fresh OS image

From PrgmrWiki
Jump to: navigation, search

This applies to systems running the legacy management console. Users of the latest management console may reinstall using option 9 of the main menu.

Versions

Please see Distributions for the most up to date list. It lists memory requirements as well as instructions for using installers instead of an image.

Procedure

Getting Started

The Management Console presents information about the state and settings of your system.

Name                                        ID   Mem VCPUs	State	Time(s)
cnryfield                                  218  1024     1     r-----    1898.8

    Wiki at http://wiki.prgmr.com
    Please contact support@prgmr.com with any issues accessing your machine.

    Options for "cnryfield"
    1. out of band console (press ctrl-] to escape, not resizeable)
    2. create/start, opens OOB console (try this if the machine is not running)
    3. shutdown (requests operating system to shut down)
    4. force power off (destroy/hard shutdown)
    5. reboot (requests operating system to reboot)
    6. swap i386/amd64 bootloaders currently "i386"
    7. view/add/remove ssh authorized_keys
    8. set reverse dns
    9. swap pvgrub/grub2 bootloaders currently "pv-grub"

    0. exit

Select options in the console by pressing the corresponding number. Options 6 and 9 are "toggles" controlling a pair of choices. Selecting those numbers switches the setting from one of the listed choices to the other.

To access the live rescue image more easily, verify that you are using "pv-grub"

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

If the current bootloader is grub2, press 9 to switch to 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.

Force your machine off if it is running.

4. force power off (destroy/hard shutdown)

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, then use either the #Scripted Method or the #Manual Method below.

Scripted method

If you wish to reset your system to be like a fresh install, use the following command from the root command prompt:

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

This will repartition your disk to the default option for the given distro (docker has a 5GB root and rest dedicated to images, netbsd has a boot partition, all else has one large partition,) format the first partition with ext3, expand the tarball, and write out a static network configuration with ipv4 and ipv6 enabled. If you want to use this script but tweak it first, you may edit /usr/local/sbin/wipe-and-reinstall.

Go to #Finishing.

Manual method

If one of your filesystems is full or you upgraded to a bigger disk, you may want to Repartition before reinstalling. Enter the following commands from the root command prompt:

Reformat your filesystem:

# mkfs.ext3 -L PRGMRDISK1 /dev/xvda1

The usual warnings about destroying all your data, etc., apply; presumably you know what you're doing. In the default image the root filesystem is mounted by volume label, but a user can change this if they want. The volume label can also be set with mkfs.ext3 -L or tune2fs -L. The current volume label and other details can also be read with tune2fs -l.

Mount the partition:

mount /dev/xvda1 /mnt

Find the image you want in /distros, in this case ubuntu:

~# ls /distros/*ubuntu*
/distros/ubuntu-precise-12.04-32.tar.gz
/distros/ubuntu-precise-12.04-64.tar.gz
/distros/ubuntu-trusty-14.04-32.tar.gz
/distros/ubuntu-trusty-14.04-64.tar.gz
/distros/ubuntu-trusty-14.04-docker-64.tar.gz

Now, untar it:

tar xzf /distros/ubuntu-trusty-14.04-64.tar.gz -C /mnt/

This newly installed image is based upon a generic one and uses DHCP to obtain a network connection. It also does not have IPv6 support enabled. Since this is a server with a static IP address, you may wish to set up static networking for your system.

Go to #Finishing.

Finishing

cd
umount /mnt
shutdown -h now

Reboot into your new install and set the root password using 'passwd'. You should be all set.

Troubleshooting

Cannot handle page request order 0!
during boot.

The kernel has run out of memory. Experienced when booting the cento64 (CentOS 6.2) image on a 128MB instance; solved by changing the bootloader type to i386 and using the centos32 image.


  Booting 'vmlinuz-3.2.0-23-virtual'

root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
kernel /boot/vmlinuz-3.2.0-23-virtual root=/dev/xvda1 console=hvc0 ro
initrd /boot/initrd.img-3.2.0-23-virtual

can only boot x86 32 PAE kernels, not xen-3.0-x86_64

Error 13: Invalid or unsupported executable format

Press any key to continue...

This message means that your bootloader (the program that first starts running in your virtual machine) is running in 32 bit mode, but the installed system is in 64 bit mode. The error message is similar for the system running in 64 bit mode while the installed version is 32 bit mode. This can be solved by going to the Management Console, performing a hard shutdown, and switching between 32 and 64 bit mode.