Objective: Create a new virtual machine using the existing Ubuntu 22.04 disk image, allocate 1024 MiB of RAM, register the virtual machine with libvirt, and ensure virt-install exits without opening an interactive console.
The correct solution uses virt-install with the --import and --noautoconsole options. The --import option is essential because the task provides an existing operating system disk image rather than requesting a fresh installation.
Step 1: Connect to the correct Linux server.
The video specifies that this task must be completed on host lfcs00083.
From the candidate terminal, execute:
ssh lfcs00083
This connects to the virtualization host where the VM must be created.
All subsequent commands must be executed on this host.
Step 2: Verify that virtualization tools are available.
Check the virt-install utility:
virt-install --version
Check the virsh utility:
virsh --version
Also check the QEMU image-management utility:
qemu-img --version
These tools serve different purposes:
virt-install creates and configures virtual machines.
virsh manages and inspects virtual machines through libvirt.
qemu-img examines and manages virtual disk images.
The task states that libvirt must be used, so creating the VM directly with a standalone qemu-system command would not be the appropriate solution.
Step 3: Verify connectivity to the libvirt hypervisor.
Execute:
sudo virsh --connect qemu:///system list --all
virsh communicates with the libvirt virtualization manager.
--connect qemu:///system selects the system-wide QEMU/KVM connection.
list --all displays both running and stopped virtual machines.
An illustrative result is:
Id Name State
--------------------------------
1 existing-vm running
- test-vm shut off
The actual VM list will depend on the host.
If libvirt cannot be contacted, check the host's libvirt services and sockets:
sudo systemctl status libvirtd
Some systems use modular libvirt daemons such as virtqemud, so inspect the installed service arrangement rather than assuming libvirtd is always present.
Step 4: Check whether cool-moray already exists.
Execute:
sudo virsh --connect qemu:///system list --all
Look for a virtual machine named:
cool-moray
You can check directly:
sudo virsh --connect qemu:///system dominfo cool-moray
If libvirt reports that the domain does not exist, proceed.
If the domain already exists, inspect it before making changes. Do not delete or recreate an existing machine without establishing why it is present.
The --name option of virt-install requires a name unique to the target libvirt connection.
Step 5: Verify that the existing disk image is present.
The task specifies the exact disk image path:
/vms/cool-moray/jammy-server-cloudimg-amd64.img
Execute:
ls -lh /vms/cool-moray/jammy-server-cloudimg-amd64.img
If normal user permissions do not allow inspection:
sudo ls -lh /vms/cool-moray/jammy-server-cloudimg-amd64.img
The image must exist before creating the VM.
Do not create an empty virtual disk in its place. The requirement is to use the existing disk image.
Step 6: Inspect the existing virtual disk image.
Execute:
sudo qemu-img info /vms/cool-moray/jammy-server-cloudimg-amd64.img
An example of the resulting information is:
image: /vms/cool-moray/jammy-server-cloudimg-amd64.img
file format: qcow2
virtual size: 2 GiB
disk size: 650 MiB
These size values are illustrative.
qemu-img info identifies the image's format, virtual size, actual allocated storage, and any backing image relationship.
Ubuntu cloud images commonly use QCOW2, but verify the actual image format instead of assuming it from the .img extension.
The existing image must remain intact.
Step 7: Confirm the guest operating-system type.
The disk filename contains:
jammy-server-cloudimg-amd64.img
jammy refers to Ubuntu 22.04 LTS, and amd64 indicates the x86-64 architecture.
Check the installed OS profiles:
virt-install --osinfo list
To find Ubuntu 22.04 specifically:
virt-install --osinfo list | grep -i ubuntu22
If ubuntu22.04 is available, it can be selected using:
--osinfo ubuntu22.04
This provides appropriate guest operating-system metadata and configuration defaults.
If that profile is unavailable, the upstream Ubuntu cloud-image procedure supports using:
--osinfo generic
Do not install a new operating system or download a different disk image merely to complete the task.
Step 8: Create the virtual machine using virt-install.
Once the disk exists, the libvirt connection works and the Ubuntu profile is supported, execute:
sudo virt-install \
--connect qemu:///system \
--name cool-moray \
--memory 1024 \
--disk path=/vms/cool-moray/jammy-server-cloudimg-amd64.img \
--osinfo ubuntu22.04 \
--import \
--noautoconsole
This is the principal solution.
If ubuntu22.04 is not recognized by the installed libosinfo database, substitute --osinfo generic, following the official Ubuntu cloud-image instructions.
The command leaves CPU count, network configuration and other parameters at their supported defaults because the visible task does not prescribe specific values for them.
Step 9: Understand every parameter in the command.
Parameter
Explanation
sudo
Executes with administrative privileges
virt-install
Creates and defines a VM through libvirt
--connect qemu:///system
Targets the system-wide QEMU/KVM hypervisor
--name cool-moray
Assigns the required VM name
--memory 1024
Allocates 1024 MiB of guest memory
--disk path=...
Attaches the existing virtual disk image
--osinfo ubuntu22.04
Selects the Ubuntu 22.04 operating-system profile
--import
Boots an existing OS image without running an installer
--noautoconsole
Prevents automatic attachment to the guest console and allows the command to return
Three arguments are especially important.
--memory 1024
The task specifies memory of 1024 MB. The virt-install utility interprets this parameter in MiB.
Therefore:
--memory 1024
sets the guest's configured RAM to 1024 MiB, equivalent to 1 GiB.
--import
This tells virt-install to create the VM around an existing disk image and skip the operating-system installation process.
Without an appropriate installation method such as --import, virt-install may expect installation media or fail to determine how the guest should be created.
--noautoconsole
The task explicitly requires this flag.
It prevents virt-install from automatically connecting to the guest's graphical or text console. Official documentation states that it also allows virt-install to exit promptly rather than waiting on an interactive console session.
Step 10: Verify that the creation command succeeds.
When virt-install succeeds, it normally prints messages indicating that the VM has been created and the domain is being started.
An illustrative successful message could be:
Starting install...
Creating domain...
Domain creation completed.
Do not treat these example messages as an actual result from the video.
Immediately after the command completes, check the exit status:
echo $?
Expected successful exit status:
0
If the command fails, read the actual error before attempting it again.
Common failure conditions include an existing VM name, inaccessible image path, unsupported OS profile, missing virtualization support or an unavailable default network.
Step 11: Verify that the new virtual machine is registered.
Execute:
sudo virsh --connect qemu:///system list --all
The output should now contain:
cool-moray
For example:
Id Name State
---------------------------
2 cool-moray running
The domain ID and runtime state may differ.
This command verifies that libvirt recognizes the VM.
Step 12: Verify the virtual machine's assigned memory.
Execute:
sudo virsh --connect qemu:///system dominfo cool-moray
Inspect the memory information.
For a VM configured with 1024 MiB, an expected value is:
Max memory: 1048576 KiB
Calculation:
\[ 1024 \times 1024 = 1,048,576 \text{ KiB} \]
This confirms that libvirt has the required memory allocation.
Also verify the VM name and general status in the same output.
Step 13: Verify the attached virtual disk.
Execute:
sudo virsh --connect qemu:///system domblklist cool-moray --details
The output should identify a disk whose source is:
/vms/cool-moray/jammy-server-cloudimg-amd64.img
This verifies that the VM uses the exact existing image required by the task.
Do not confuse creating a new blank disk with attaching the existing disk. The latter is required.
Step 14: Inspect the VM's persistent configuration.
Execute:
sudo virsh --connect qemu:///system dumpxml cool-moray
This displays the libvirt domain definition in XML format.
Look for the guest name:
< name > cool-moray < /name >
Also inspect the memory setting and the disk source.
The relevant configuration should contain the equivalent of:
< memory unit='KiB' > 1048576 < /memory >
And a disk source referencing:
< source file='/vms/cool-moray/jammy-server-cloudimg-amd64.img'/ >
The actual XML may include additional attributes, devices, generated addresses and machine-specific settings.
Step 15: Verify the VM's runtime state.
Execute:
sudo virsh --connect qemu:///system domstate cool-moray
A successful initial launch should normally report:
running
If it reports shut off, investigate the reason:
sudo virsh --connect qemu:///system dominfo cool-moray
You can also inspect the appropriate libvirt/QEMU logs.
Importing a cloud image registers and starts a guest, but it does not automatically establish guest login credentials or configure cloud-init user data. Those operations are not requested by this task.
Step 16: Verify that virt-install has returned control to the terminal.
Because --noautoconsole was specified, the virt-install command should return to the shell after initiating VM creation.
For example, the terminal prompt should become available again:
candidate@lfcs00083:~$
The presence of the normal shell prompt indicates that the creation utility is no longer occupying the terminal.
This is separate from the VM's own runtime state: the virtual machine may continue running after virt-install exits.
Step 17: Perform final verification.
Execute:
sudo virsh --connect qemu:///system list --all
sudo virsh --connect qemu:///system dominfo cool-moray
sudo virsh --connect qemu:///system domblklist cool-moray --details
sudo virsh --connect qemu:///system domstate cool-moray
Confirm the following:
Requirement
Expected result
VM name
cool-moray
Existing disk image
/vms/cool-moray/jammy-server-cloudimg-amd64.img
Memory
1024 MiB
Installation method
Existing image imported
Mandatory option
--noautoconsole used
VM registration
Present in libvirt
VM initial startup
Successful
Terminal
Returns to shell after creation
Final Solution
The essential commands are:
# Connect to the designated server
ssh lfcs00083
# Verify the existing disk image
ls -lh /vms/cool-moray/jammy-server-cloudimg-amd64.img
# Inspect the image
sudo qemu-img info /vms/cool-moray/jammy-server-cloudimg-amd64.img
# Check the VM name is available
sudo virsh --connect qemu:///system list --all
# Confirm the guest OS profile exists
virt-install --osinfo list
# Create the VM
sudo virt-install \
--connect qemu:///system \
--name cool-moray \
--memory 1024 \
--disk path=/vms/cool-moray/jammy-server-cloudimg-amd64.img \
--osinfo ubuntu22.04 \
--import \
--noautoconsole
# Verify the new VM
sudo virsh --connect qemu:///system list --all
sudo virsh --connect qemu:///system dominfo cool-moray
sudo virsh --connect qemu:///system domblklist cool-moray --details
sudo virsh --connect qemu:///system domstate cool-moray
Technical Verification and References
The solution is based on the official virt-install, libvirt and Ubuntu cloud-image documentation.
Ubuntu virt-install(1) Manual — Describes the --memory, --disk, --import, --osinfo and --noautoconsole options.
libvirt virsh Command Reference — Documents VM inspection commands, including list, dominfo, domblklist and domstate.
Ubuntu — Launch QCOW Cloud Images Using libvirt — Provides a practical example of launching an existing Ubuntu cloud image with virt-install, --import and --noautoconsole.
Video verification finding: At approximately 28:30, the recording shows Question 7 and the required host lfcs00083. The candidate begins entering the SSH command but cancels it and moves to Question 8. The recording therefore does not demonstrate a successful VM creation. The solution above is independently documentation-validated, not confirmed as executed in that recording.
Expected result: A virtual machine named cool-moray is created and registered through libvirt using the existing Ubuntu image, with 1024 MiB RAM. The VM starts successfully, and virt-install exits without attaching to the VM's console.