Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

This page is for all the users that are not used to manage linux environment.

Add/delete a user in your virtual machine

In order to add the user and set his/her password  use following commands

sudo /usr/sbin/adduser <username> 

sudo chage -d 0 <username>

After you need to modify the file /etc/ssh/sshd_config, enabling the PasswordAuthentication and then restart and check the SSH deamon:

Ubuntu: 

sudo systemctl restart sshd.service

sudo systemctl status sshd.service

CentOS:

sudo systemctl restart sshd.service

sudo systemctl status sshd.service

In order to delete a user and his/her HOME directory just execute the command:

deluser --remove-home <username>

Grant a user root privileges in your virtual machine

  • It is possible to grant a user with root privileges using O the command adduser instead of useradd when the new user is created: 

    sudo /urs/sbin/adduser <username> sudo

    Otherwise you can add the following line in the section #User privilege specification of  the file /etc/sudoers:

  • <username> ALL=(ALL:ALL) ALL

How to mount remote filesystem with FUSE (Filesystem in USEr space) on CentOS or Ubuntu

...

To use Docker in your virtual machine please set the MTU value at 1400 in the file  /etc/docker/daemon.json.  More in particular edit the file /etc/docker/daemon.json and then set


      • {

        "mtu" : 1400

        }

...


Rescue a Virtual Machine

Instance rescue provides a mechanism for access, even if an image renders the instance inaccessible. Two rescue modes are currently provided.

Ephemeral Virtual Machine

Warning
titleIMPORTANT WARNING

If the virtual machine has encrypted LUKS VOLUMESattached, it is mandatory to detach them before starting the rescue operation. 

The steps needed to rescue an inaccessible ephemeral virtual machine on ADA Cloud are:

Step 0.

  • Create a rescuer virtual machine with a new key pair. Although this is not a fixed rule, it is suggested to create the rescuer machine using an image with same OS as the one on the inaccessible machine (same version or newer).
  • Login to the rescuer and update it. As an example, for Ubuntu virtual machines:

    Code Block
    languagebash
    sudo apt update
    sudo apt upgrade
  • Logout the rescuer and create a snapshot image of this virtual machine.

Step 1.

  • Select the instance you want to rescue and from the drop-down menu on the right select "rescue instance":
    • In the menu that appears, select the image you just created from the rescuer machine.
  • Login via ssh to the broken machine using the rescuer username/key 
  • Check that the boot of the machine has been correctly executed using the command

    Code Block
    languagebash
    lsblk

    you should see the rescuer machine (/dev/vda1) mounted and the inaccessible machine on the device /dev/vdb1

  • Mount such device /dev/vdb1 

    Code Block
    languagebash
    sudo mkdir /mnt/inaccessible_vm
    sudo mount /dev/sdb1 /mnt/inaccessible_vm
  • Now you can access the files in the inaccessible machine to fix the problems (lsblk, fsck, xfs_repair, chroot, etc.) or backup important data
  • Once the operation is done, logout the virtual machine and from the Dashboard select "unrescue".

Virtual Machine booted from a Bootable Volume

Warning
titleIMPORTANT WARNING

If the virtual machine has encrypted LUKS VOLUMESattached, it is mandatory to detach them before starting the rescue operation. 

The steps needed to rescue an inaccessible VM instantiated from a bootable volume on ADA Cloud are:

Step 0.

  • Shutdown the instance.

  • In the tab "Volumes", track which secondary volumes are attached to the VM to be rescued and detach them.

  • IMPORTANT:verify that the bootable volume won't be erased when deleting the VM!

    • To do this check, execute the command "openstack server show <id-vm-to-be-rescued>", have a look in the field "volumes_attached" and check that all the volumes listed have the property "delete_on_terminations='False' ". 
    • NB: In case you don't have access to the OpenStack CLI, please contact superc@cineca.it
  • Keep track of the Flavor, Security Groups and FIP associated with the VM (FIP in particular if there is a DNS association).

  • Delete the instance.

Step 1.

  • Create a throwaway VM, attach the bootable volume to rescue as a secondary volume and associate a FIP to such VM.

  • Login via ssh to the throwaway VM and execute all the needed operations on the volume to rescue (lsblk, fsck, xfs_repair, chroot, etc.).

  • Once the volume has been recovered, exit the throwaway VM and detach the secondary volume that has been rescued.

  • Restart the VM from the rescued bootable volume, reattaching the secondary volumes, FIP, and check the problem has been solved.