Booting a Cloud Server from an ISO

Boot ISO volumes (created from images in the .iso format) contain the OS distro and are used as an OS installer on a cloud server (virtual machine). They can also be used to recover a server.

Creating a Server from an ISO

To create a server from an ISO, from the Control panel:

  1. Upload the ISO image to the Image store according to the Creating Images instructions.
  2. Create a cloud server by selecting the uploaded image as a source. A system network ISO volume with a name like virtual-cd-rom-for-Server will be created along with the server.

Please note that we do not recommended connecting the ISO volume to an existing cloud server. If you want to create a boot volume for later use, you need to create a new cloud server from the ISO image, configure the server, and install the necessary software. Then create an image from a local disk or a network volume of the server — it will be in .raw format. Learn more about volume images.

Preparing Linux Distributions for Compatibility with the Cloud Platform

All your uploaded ISO images with OS distributions can be made fully compatible with the Selectel Cloud platform. In this case, all functions in the Control panel, OpenStack CLI, and management via Terraform will be available.

Please note that this instruction is created using Oracle Linux as an example. Utilities, repos, and file locations may differ for other distributions.

To prepare a compatible image:

  1. Upload the image to the Image store.
  2. Create a cloud server with a boot network volume using the uploaded image as the source.
  3. Connect to the server via SSH.
  4. Add OpenStack Selectel repos to the selectel-openstack.repo file :

    cat <<EOF > /etc/yum.repos.d/selectel-openstack.repo
    [selectel-openstack]
    name=selectel-openstack
    baseurl=http://repo.os.selectel.org/rpm/centos/7/x86_64
    gpgcheck=1
    gpgkey=http://repo.os.selectel.org/selectel-openstack.key
    EOF
  5. Update the list of repos for the package manager:

    yum update
  6. Install the following packages:

    yum install crontab-randomizer fstrim-blocks qemu-guest-agent set-root-pw cloud-init cloud-utils-growpart compat-openssl10
  7. Go to the directory and create the following configuration files for cloud-init:

    cd /etc/cloud/cloud.cfg.d/

    Prevent from creating the ubuntu user:

    cat <<EOF > 10_no_default_users.cfg
    users: []
    EOF

    Adding data sources for cloud-init-datasources:

    cat <<EOF > 91-dib-cloud-init-datasources.cfg
    datasource_list: [  ConfigDrive, Ec2, None ]
    EOF

    Disable notification about using cloud-init and EC2:

    cat <<EOF > 92-ec2-datasource.cfg
    #cloud-config
    datasource:
      Ec2:
          strict_id: false
    EOF

    Configuring boot options:

    cat <<EOF > 99_boot_routines.cfg
    bootcmd:
    - sed -i '/^;/d' /etc/resolv.conf
    EOF

    Prevent cloud-init from disabling EC2 metadata:

    cat <<EOF > 99_enable_ec2.cfg
    disable_ec2_metadata: false
    EOF

    Configuring first boot:

    cat <<EOF > 99_first_boot_routines.cfg
    runcmd:
    - sed -i '/NetworkManager/d' /etc/resolv.conf
    - sed -i '/^nameserver 10\./d' /etc/resolv.conf
    - sed -i '/^nameserver 192\./d' /etc/resolv.conf
    - sed -i '/^nameserver 172\./d' /etc/resolv.conf
    - sed -i '/^search/d' /etc/resolv.conf
    - set-root-pw 2> /dev/null
    - crontab-randomizer
    EOF

    Prevent from disabling root access via SSH:

    cat <<EOF > 99_keep_root_user.cfg
    disable_root: false
    EOF

    Changing the time zone:

    cat <<EOF > 99_location.cfg
    locale: en_US.UTF-8
    timezone: UTC
    EOF

    Allow password authentication via SSH:

    cat <<EOF > 99_ssh_settings.cfg
    ssh_pwauth: true
    no_ssh_fingerprints: true
    ssh_deletekeys: true
    EOF
  8. Configure service autostart to apply changes and for the server to operate correctly after reboot:

    systemctl enable cloud-init
    systemctl enable cloud-init.service
    systemctl enable cloud-config.service
    systemctl enable cloud-final.service
    systemctl enable qemu-guest-agent.service
    systemctl enable cockpit.socket
  9. Hard reboot the server.

  10. After that, when connecting via SSH, you will see a message that the host ID has changed. This means that cloud-init works successfully when the OS is loaded:

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
  11. Create a new image from the network volume. When creating, select the Linux OS for the image. Please note that after the image is created, you can delete the cloud server.

  12. Configure OpenStack CLI.

  13. For full compatibility with the Control panel, change the image properties:

    glance image-update  --property x_sel_image_owner=Selectel

The image is now compatible with the Cloud platform. From this image, you can create cloud servers, for which all the implemented functions are available (just like servers from prebuilt images).

File System Extension

If you want to create a cloud server with a larger volume from a compatible image, you may need to extend the file system according to the Utilities for increasing volume size instructions.

Server Recovery

Cloud server recovery may be required in several cases:

  • to restore important files;
  • if there are some configuration errors of the boot scripts or the network.

Usually, booting into rescue mode is used to recover a server. Technically, it uses an image (prepared by Selectel specialists) that allows you to access all the virtual machine settings, fix any configuration error, restore the file system, or can be used for other needs.

Sometimes it can be useful to recover a server by booting from a special ISO volume and then fix the server’s network volume.

Network Volume Recovery

Select the cloud server you want to recover in the Servers section of the project:

  1. Stop the server.
  2. Disconnect the network volume from the server.
  3. Create a new cloud server from a boot ISO image.
  4. Connect the network volume you need to fix to the new server.
  5. Perform volume recovery operations on the new cloud server. The network volume is now recovered.
  6. Stop the new server and disconnect the recovered network volume from it.
  7. Connect the network volume back to the server, or create a new server with the recovered network volume.