How to prepare Hyper-V OSTemplate for Debian?

Issue: Debian Virtual Machines not Creating Properly via HC10 Panel on Hyper-V due to improper settings of Debian OSTemplate.

Reasons and Solutions: Such an issue occurs if the Debian OSTemplate is not properly prepared. To configure the Debian OSTemplate the following steps must be followed :

Debian OSTemplate Preparation:

  • Disable Debian Firewall:
  • To disable the Debian Firewall on an OSTemplate, ensure you have root access or use sudo, then launch the iptables program. The default Debian installation includes iptables, which manages firewall rules. To check the firewall status, run the following commands:

  • sudo iptables -L 
    If disabled, the output should look like this:
     
    Chain INPUT (policy ACCEPT)
    target prot opt source destination 
     
    Chain FORWARD (policy ACCEPT)
    target prot opt source destination 
     
    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination
     
    If the above output is not shown this means the firewall is enabled with certain rules. Now to disable the iptables run the following commands in sequence :
     
    iptables -F
    iptables -X
    iptables -t nat -F
    iptables -t nat -X
    iptables -t mangle -F
    iptables -t mangle -X
    iptables -P INPUT ACCEPT
    iptables -P OUTPUT ACCEPT
    iptables -P FORWARD ACCEPT


  • Enable Root User:
  • Activate the root user with the commands in sequence:
  • 1. sudo passwd root  ( This command will prompt you to enter the root user password twice to confirm the password is correctly entered )
  • 2sudo passwd -u root ( The second command will unlock the root user )


  • Install HC Hyper-V Components: 
  • Follow the instructions given below to install HC Hyper-V Components for your Debian Server.
  • 1. For Linux there are 2 versions of HC Hyper-V Components. Choose the one that corresponds to your operating system.
    
    
  1. Once you download, extract the file using the command: tar -xvzf hcvmcomp_x64.tar.gz
  2. After this run this command: chmod 755 ./install_hcvmcomp.sh
  3. And then: ./install_hcvmcomp.sh    

Install Linux Integration Service (LIS): 
If you run lsmod | grep hv_ command, it will show that these are installed properly. However, to install the latest updated LIS tools, following steps are required to be run on the OSTemplate in the following sequence :
 
1. sudo apt-get install hyperv-daemons
2. sudo update-initramfs -u
3. reboot
This will update LIS updated tools on your OSTemplate.


Enable Communication:

    OSTemplate machine must be able to communicate on port 8796 with the Hyper-V node which is HC Provisioning Service port. To ensure it, follow the instructions given below:
 
1. Open SSH from the root user.
2. Type command "telnet Hyper-V-IPAddress 8796"
Where Hyper-V-IPAddress = ipaddress of Hyper-V machine.


HC Panel Configuration:

  • Configure Debian OSTemplate in HC Panel:
    • 1. Access HC Panel as Global Admin.
    • 2. Navigate to Configurations >> Virt. Module Conf. >> OSTemplates.
    • 3. Click Add OS Template and provide details like Generation, Template Size, root user, and password. 

    • Below is a sample of a Debian OSTemplate for reference purposes only. Actual settings may vary depending on the configuration of your custom-created OSTemplate for Debian.

After completing these steps, your Debian OSTemplate will be ready for provisioning Virtual Machines via the HC10 Panel.