Categories
Tech

Reset Linux Root Password In Xen Paravirtualised Virtual Machine

This can be used to reset forgotten root passwords in paravirtualised VM’s running on the Xen hypervisor.

1. Identify target VM name.

virsh list --all

2. Shutdown the target VM.

virsh shutdown vm-name-goes-here

3. Start the VM back up again in console mode.

xm create -c vm-name-goes-here

4. Quickly stop the boot process on the grub menu and hit the a key on the default kernel. Once the kernel parameters appear, append the number 1 to the end of the line. Then hit enter to continue with the VM boot.

5. You should then be dropped into a single user mode console, allowing you to reset the password as you would on a physical host.

6. Enter this command to change the root password, you have to enter the new password twice when prompted onscreen.

passwd

7. Reboot

reboot
Categories
Tech

Clone Xen & KVM Virtual Machines using LibVirt

This easy to use one line command is all that’s needed to clone an existing virtual machine.

virt-clone -o existing_vm_name -n new_vm_name –auto-clone

Categories
Tech

VMware Fusion 5 Black Screen

After upgrading to my version of VMware Fusion 4 to 5, I noticed upon VM boot none of my machines displayed any graphics except a black screen, essentially rendering them useless.

The quick fix for this I found is to dive into each ‘.vmware’ folder for each of your VM’s located by default in:

~/Documents/Virtual\ Machines.localized/

Right click Show Package Contents will display VM contents.

Open the related .vmx file in your favourite text editor, append the following line, then save and quit.

mks.gl.use32core = TRUE

Support article from VMware here

Categories
Tech

Installing VMITools (VM Introspection Toolkit) with Xen on CentOS 6

This guide provides a good introduction on how to install VMI Tools and Xen on CentOS 6.

Due to dependancy requirements, CentOS 5 is unable to support VMITools by default unless a more recent version of glib2 is compiled from source. Therefore we base this installation on CentOS 6 (6.3 at time of writing).

Xen Installation

Redhat dropped support for Xen based virtualisation with the released of RHEL 6, resulting in the need to manually install the required Xen packages. In previous versions of this post I have referred to Falko’s excellent guide on installing Xen 4 on CentOS 6, link to guide can be found here.

However the recent release of the Xen kernel 3.6 has broken compatibility with the latest version of the libVirt (virsh). In order to restore compatibility we will install the slightly older version of Xen until the libVirt library is updated to resolve the error.

First we add the repos that still contain the older versions of Xen.

cd /etc/yum.repos.d/
wget http://www.gitco.de/linux/x86_64/centos/6/gitco-centos6-x86_64.repo
wget http://xenbits.xen.org/people/mayoung/EL6.xen/EL6.xen.repo

Edit gitco-centos6-x86_64.repo and add ‘enabled’ switches, so it looks like this. We only need this middle entry for Xen Files. The other repo we downloaded contains a better packaged Xen Kernel which we will use.

[gitco-kernel-dom0-centos6-x64]
name= GITCO [ KERNEL DOM0 ] Repository
baseurl=http://www.gitco.de/linux/x86_64/centos/6/kernel-dom0
enabled=0
gpgcheck=1
gpgkey=http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

[gitco-xen4.0.1-centos6-x64]
name= GITCO [ XEN-4.0.1 ] Repository
baseurl=http://www.gitco.de/linux/x86_64/centos/6/xen4.0.1
enabled=1
gpgcheck=1
gpgkey=http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

[gitco-misc-centos6-x64]
name= GITCO [ MISC PACKAGES ] Repository
baseurl=http://www.gitco.de/linux/x86_64/centos/6/misc
enabled=0
gpgcheck=1
gpgkey=http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

yum install xen kernel-xen

follow the rest of falkos guide for the libvirt installation.

VMITools Installation

Install the required packages for installation.

yum install git glib2-devel check-devel

We create a folder named src in the root directory, to use as a basis for our installation.

mkdir /root/src/

cd into the src directory, and checkout a clone of the latest VMITools.

git clone https://code.google.com/p/vmitools/

cd into the vmitools folder, then run the following commands.

./autogen.sh
./configure

After a while the output should return success. Then perform make.

make

As well as installing the library (Optional, necessary for applications wishing to implement the libVMI framework.

make install

Now when you try to compile some of the examples you will run into this error.

Can be easily fixed by editing your .bashrc file within your home folder, and adding this line.

1.) use < .bashrc > file in your home directory (instead of .bash_profile)
2.) add the following line to this file:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ; export LD_LIBRARY_PATH

DO ONE MORE THING : also add this line to < /etc/ld.so.conf > file