VM Manual

This page provides an overview of some of the commands you will need to interact with your VM.

virsh commands

Use virsh to control your VM from our VM host, gojira. Here are some useful commands:

# List all VMs associated with your account:
[mmalensek@gojira ~]$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     glitter-sparkle                running
 2     magical-unicorn                shut off
 14    basilisk                       running

# Shut down a VM:
[mmalensek@gojira ~]$ virsh destroy glitter-sparkle
Domain glitter-sparkle destroyed
# (you can now verify the machine is offline with virsh list)

# Delete a VM:
[mmalensek@gojira ~]$ virsh undefine glitter-sparkle
Domain glitter-sparkle has been undefined
# (noooooooooo!!!!)

# Log in to the serial console:
[mmalensek@gojira ~]$ virsh console glitter-sparkle

	(console contents are displayed)

# To exit the console, press Ctrl+]

# Edit the VM configuration (VM must be shut down first):
[mmalensek@gojira ~]$ virsh destroy glitter-sparkle
[mmalensek@gojira ~]$ virsh edit glitter-sparkle

	(edit the XML configuration and save)

# Start the VM back up to apply changes
[mmalensek@gojira ~]$ virsh start glitter-sparkle

Installing Software

Over the course of the semester, you’ll probably want to install more software packages on your VM. Package management is provided by the pacman utility. NOTE: you must be root to install packages (run sudo su - to switch to root) or use sudo.

# To search for packages use -Ss:
[mmalensek@magical-unicorn ~]$ sudo pacman -Ss some-package-name

# To install a package, use -Sy:
[mmalensek@magical-unicorn ~]$ sudo pacman -Sy some-package-name

# Updating Arch linux (will install all new package updates):
[mmalensek@magical-unicorn ~]$ sudo pacman -Syu

Emergency Rescue

If you can’t get into your VM because of a configuration error, you can still boot off the installation CD and fix issues. To this, edit the VM’s configuration as described above and then add a <source> tag to the <disk> entry for the VM’s CD-ROM:

<disk type='file' device='cdrom'>
   ... (other entries might be under this tag) ...
	<source file='/home2/mmalensek/iso/archlinux-XXXX.iso'/>
</disk>

Remember to replace XXXX with the correct file path. Next, update the VM’s boot order by adding a new boot tag:

<os>
    ... (other entries might be under this tag) ...
	<boot dev='cdrom'/>
	<boot dev='hd'/>
</os>

This tells the VM to boot from the CD first instead of the hard disk. Boot up the VM with virsh start, make your changes, then shut down again. To restore the original boot order, edit the configuration and move the ‘cdrom’ entry below ‘hd’.