Application-Aware Mode for Linux VMs

Product version: 10.6

Last modified: 6 December 2021

Problem

In application-aware mode, NAKIVO Backup & Replication triggers provided custom scripts before taking snapshots of LVM volumes. In addition, application-aware mode for Linux VMs in Microsoft Hyper-V may encounter issues due to a lack of required files.

Solution

For application-aware mode to work on Linux guest OS, put the custom scripts called pre-freeze-script and post-thaw-script into the /usr/sbin directory and grant them executive permissions. When the backup job starts running, NAKIVO Backup & Replication triggers these scripts before snapshots of LVM volumes. The pre-freeze-script and post-thaw-script scripts require root permissions to be executed. When a non-root user is used, script invocation is done via sudo, therefore the following requirements must be met.

  1. Provided credentials must have full access without a password in /etc/sudoers

    #User privilege specification
    root ALL=(ALL:ALL) ALL
    #Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    #Allow members of group sudo to execute any command
    %sudo ALL=(ALL:ALL) ALL
    #See sudoers(5) for more information on "#include" directives:
    #includedir /etc/sudoers.d
    nakivo ALL=(ALL) NOPASSWD:ALL
  2. If NAKIVO Backup & Replication logs in to an Amazon EC2 instance and there is no password for the Linux user, provided credentials must have a password to execute sudo:
    1. Log into the instance via SSH client using pem key

    2. Execute sudo passwd ubuntu

    3. Open /etc/sudoers in a text editor

    4. Add ubuntu ALL=(ALL) NOPASSWD:ALL to the bottom of the file

    5. Open /etc/ssh/sshd_config in a text editor

    6. Add set up PasswordAuthentication yes

    7. Reboot the instance

    8. Log in to the instance via SSH client without .pem key, enter password

  3. If you are encountering problems with application-aware mode with Linux VMs in Hyper-V, this may be due to a lack of the crucial "hv-kvp-daemon-init" package. To install this tool in Ubuntu, simply execute the following commands in your terminal:

    sudo apt-get update -y
    sudo apt-get install -y hv-kvp-daemon-init

    For debugging or monitoring the status of the Hyper-V Data Exchange Service and the associated key-value pairs (KVPs), enter the following script in PowerShell:

    filter Import-CimXml
    {
       $CimXml = [Xml]$_
       $CimObj = New-Object -TypeName System.Object
       foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY[@NAME='Name']"))
          {
             $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
          }
       foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY[@NAME='Data']"))
          {
             $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
          }
       $CimObj
    }
    $HyperVServer = Read-Host "Specify the Hyper-V Server to use (enter '.' for the local computer)"$VMName = Read-Host "Specify the name of the virtual machine"$query = "Select * From Msvm_ComputerSystem Where ElementName='" + $VMName + "'"$Vm = gwmi -namespace root\virtualization -query $query -computername $HyperVServer
    $query = "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"$Kvp = gwmi -namespace root\virtualization -query $query -computername $HyperVServer
    Write-Host
    Write-Host "Guest KVP information for" $VMName
    $Kvp.GuestIntrinsicExchangeItems | Import-CimXml

    This script will create an XML object and populate it with KVP information based on the prompted user input for Hyper-V server and VM information.

If you run a VM with Linux or FreeBSD guest OS under Hyper-V and the above information is insufficient, refer to this Microsoft support article.