Do you also want to deploy Ubuntu 17.10 Desktop (Artful Aardvark) in a VM using the most efficient and quickest way possible? Then this article is for you.

Host Machine + Virtual Machine

The procedure will create a VM with these coordinates:

  • Domain: myvmtest
  • IPV4 address:
  • MAC address: 52:54:00:ff:ff:66

The installation and configuration scripts conveniently resolve a number of issues when installing / running this O.S. in a VM.

The automation scripts are published as Gists under https://gist.github.com/cvrolf.

The coordinates in the scripts are parametrized and you can change them very easily.

I have not used Ansible for automating the deployment because some installation steps must be executed on the Ubuntu Desktop GUI.

You might know that a fully unattended installation of Ubuntu Desktop is not officially supported (opposed to Ubuntu Server). But we will try to make it as simple and automated as possible.



# How to open a Gnome Terminal with user “root” on the Host Machine, and you are at the Ubuntu Desktop GUI?

  • Right-click on the Desktop and choose the last item “Open a Terminal”.
  • Enter the command “whoami” to verify with what username you are having a session.
  • Enter the command “su” and enter the superuser password.
  • Now you are in Terminal having a session with user “root”. Enter the command “whoami” to verify it.

# How to open a Text Terminal with user “root” on the Host Machine, and you are at another computer?

  • Open a text terminal on the other computer”.
  • Enter the command “ssh root@hostmachine” to SSH into the Host Machine.
  • Now you are in Terminal having a session with user “root”. Enter the command “whoami” to verify it.

Host Machine

  • Ubuntu 17.04 Desktop (Zesty Zapus) with the latest package updates
  • pkg libvirt 2.5.0
  • pkg qemu 2.8
  • pkg virt-manager 1.3.2
  • pkg virtinst 1.3.2

VM Virtual Machine

# Coordinates

  • Domain: myvmtest
  • IPV4 address:
  • IPV6: ignored
  • MAC address: 52:54:00:ff:ff:66
  • User: ubuntu
  • Password: myvmtest
  • Superuser password: myvmtest

# Details

  • Ubuntu 17.10 Desktop (Artful Aardvark)
  • Virtual network iface: ens3
  • Network: default (vnet0 NAT-based)
  • Virtual CPU’s: 1
  • Memory: 2GB
  • Storage: 8GB /dev/vda

# SSH Login into the VM

# Bash
MYDOMAIN="myvmtest"; ssh ubuntu@${MYDOMAIN}

# Start VM

# Bash
MYDOMAIN="myvmtest"; virsh list; virsh shutdown --domain ${MYDOMAIN}; virsh shutdown --domain ${MYDOMAIN}; sleep 10;
virsh start --domain ${MYDOMAIN}; sleep 10;
virsh list --all;

# Shutdown VM

# Bash
MYDOMAIN="myvmtest"; virsh shutdown --domain ${MYDOMAIN}; virsh shutdown --domain ${MYDOMAIN}; sleep 10;
virsh list --all;


What Is New In Ubuntu 17.10 Desktop?

Please read the Ubuntu release notes for more details https://wiki.ubuntu.com/ArtfulAardvark/ReleaseNotes

The Unity / X.org / LightDM display manager has been replaced with Wayland / Gnome / GDM. This is a major change that impacts lots of apps and (system) tools.

The ifupdown package, which managed the network, has been deprecated in favor of netplan. The package is no longer present on new installs. The new installer will generate a configuration file for netplan in /etc/netplan, which will set up the system to configure the network via systemd-networkd (in Ubuntu Server) or NetworkManager (in Ubuntu Desktop).


Highlights: Installing And Running Ubuntu 17.10 Desktop in a Virtual Machine

This procedure uses the latest Ubuntu 17.10 Desktop ISO supplemented with all package updates.

The only virtual video interface in virt-inst that is compatible with Waterland /Gnome is –video qxl. All the other ones (–video vga/cirrus/vmvga) are not supported; the system falls back to Unity / X.org automatically. Secondly, using –video qxl you cannot change the Display Manager from Wayland back to Unity in the Login screen because the cog for that feature is missing.

You cannot specify ubuntu17.10 in the virt-inst parameter –os-variant because it is not an Ubuntu LTS release. So specify the latest LTS release instead: –os-variant ubuntu16.04 for Ubuntu Zenial 16.10 LTS.

The installer for Ubuntu 17.10 Desktop no longer has the option to install openssh-server (openssh-client is installed by default as before). You have to install the SSH Server manually.

The login screen now uses virtual terminal #1 instead of virtual terminal #7.

Do not disable IPV6 else the module systemd-networkd does not work properly. You will get timeouts of 2 minutes in the module systemd-networkd-wait-online during each boot cycle. The typical error message is “ERROR: Oct 20 01:54:56 myvmtemp2 systemd-networkd-wait-online[435]: Event loop failed: Connection timed out”. Enabling IPV6 does not mean you have to assign an address to it.

The Grub2 config must be changed permanently so the splash screen is disabled. The Ubuntu splash screen (the plymouthd module) causes the VM to hang because that module crashes consistently. *Important* It luckily works fine during the installation with the default display resolution of 1024×768. But the system boot sequence will hang as soon as you have increased the display resolution (e.g. to 1440×900 which I used). @tip You can change the Grub2 settings temporarily at boot-time: press the SHIFT key to interrupt whils the grub is loading. Then press ‘e’ for edit and remove “quiet splash”.

Wayland does not allow graphical applications to run under the superuser “root”. We add the command “xhost si:localuser:root” in the startup sequence to resolve that.

The MAC address prefix for QEMU KVM virtual machines is by convention “52:54:00”. For Xen virtual machines it is “00:16:3e”.

The procedure will uses the default network vnet0 of libvirt. This is a NAT-based network; the VM will not be visible on the LAN; it is only visible on the network for the Host Machine. The IPV4 subnet for vnet0 is 192.168.122/24.

You will notice in the Bash scripts that if we want to shutdown a VM then we run “virsh shutdown” twice. Sometimes we experienced that shutting it down once was not working at all (especially when the Ubuntu Desktop GUI is showing the Lock Screen.

You can verify in a GUI Terminal if you are indeed using the new Wayland Display Manager:

    # Bash


STEP 1: Host Machine – Setup

Open a Terminal with user root on the Host Machine.

Paste this in the Terminal:

# Bash
apt --yes install curl
bash -c "$(curl --fail --silent --show-error --location https://gist.githubusercontent.com/cvrolf/2aad36d78e7803b7970cefa4452b76d9/raw/10-master-setup.sh)"

# Leave the Terminal open

Actions in the script https://gist.githubusercontent.com/cvrolf/2aad36d78e7803b7970cefa4452b76d9/raw/10-master-setup.sh :

  • Check that Virtualization Technology is supported.
  • Install libvirt and virt-manager.
  • Add VM to /etc/hosts
  • Libvirt DHCP: reserve a static IP Address for the Guest VM.
  • Create the Virtual Machine using libvirt.


STEP 2: Follow the graphical installation of Ubuntu Desktop

Goto the Ubuntu Desktop GUI of your Host Machine.

Start the Virtual Machine Manager, select VM “myvmtest” and CLICK IT. The Virt-viewer is opened with the GUI installer.

Follow the Ubuntu Installer. @doc Select the default options, unless instructed otherwise.

Screen “Welcome”:

Select “Install Ubuntu”

Ubuntu 17.10 Desktop

Screen “Preparing to install Ubuntu”:

Select *ON for Download updates

Select *ON for Install third party software for Graphics and Wi-Fi hardware, etc.

Ubuntu 17.10 Desktop

Screen “Storage”:

Select “Erase Disk and Install Ubuntu” and confirm.

Ubuntu 17.10 Desktop

Screen “Where Are You”:

Select your city and continue.

Ubuntu 17.10 Desktop

Screen “Keyboard Layout”:

Select your keyboard layout and continue.

Ubuntu 17.10 Desktop

Screen “Who Are You?”:

Your name: ubuntu

Computer name: myvmtest

User: ubuntu

Password: myvmtest

Login Automatically: *YES

Ubuntu 17.10 Desktop

Wait until the installer has completed the installation.

Ubuntu 17.10 Desktop

Screen “Installation Complete”:

Select “Restart Now”

Ubuntu 17.10 Desktop

Screen “Restart Dialog”:

Press ENTER to reboot.

@important If the system does not reboot (the screen with “Press ENTER to reboot” keeps coming back) then goto the Virtual Machine Manager on the Ubuntu Desktop of the Host Machine, select the new VM and select “Force Reset” and confirm, the VM will then always reboot correctly.

Ubuntu 17.10 Desktop

The virt-install command in the Terminal session of the Host Machine will end restart the Virtual Machine and it then returns to the Bash prompt.


STEP 3: Host Machine – Network Validation

Open a Terminal with user root on the Host Machine.

Paste this in the Terminal:

# Bash
bash -c "$(curl --fail --silent --show-error --location https://gist.githubusercontent.com/cvrolf/d8dd2ffa6df77dfff559fb66b5d217c0/raw/30-master-check-network.sh)"

Actions in the script https://gist.githubusercontent.com/cvrolf/d8dd2ffa6df77dfff559fb66b5d217c0/raw/30-master-check-network.sh :

  • Verify that the Virtual Machine can be pinged by IP address and by DNS Name.


STEP 4: Virtual Machine – SSH Server installation & Linux Account Setup

Goto the Ubuntu Desktop GUI of your Host Machine.

Start the Virtual Machine Manager, select VM “myvmtest” and CLICK IT. The Virt-viewer is opened with the GUI installer.

Open a Terminal. @tip Right-click on the Desktop and choose “Terminal”.

Paste this in the Terminal —one command at a time— :

### Install Curl & OpenSSH Server
sudo apt --yes update
sudo apt --yes install curl openssh-server openssh-client

### Enable login as root (su):
#   https://linuxconfig.org/how-to-login-as-root-user-on-ubuntu-xenial-xerus-16-04-linux-desktop
#   @doc The login-as-root feature is disabled by default on Ubuntu Linux.
#   @doc The easiest way to circumvent this is to reset root's password using the passwd command.

sudo passwd
    [sudo] password for ubuntu: myvmtest
    Enter new UNIX password (for root): myvmtest
    Retype new UNIX (for root): myvmtest
    passwd: password updated successfully

## Reboot this Virtual Machine
sudo shutdown -r now


STEP 5: Host Machine – SSH Keys Configuration

Open a Terminal with user root on the Host Machine.

Paste this in the Terminal —one command at a time— :

# Bash
### Global vars

## Install my Master's SSH HOST PPKeys (user account "root") on the VM Guest (user account "ubuntu")
#   @purpose Make SSH login easier (for you, on the master machine).

ssh-keygen -R ${MYDOMAIN}

ssh-copy-id ubuntu@${MYDOMAIN}

ssh ubuntu@${MYDOMAIN} "hostname; whoami; pwd;"


STEP 6: Virtual Machine – Configuration

Open a Terminal with user root on the Host Machine.

Paste this in the Terminal:

# Bash
### Global vars

ssh ubuntu@${MYDOMAIN}

# @important su - become superuser

Paste this in the SAME Terminal:

# Bash

bash -c "$(curl --fail --silent --show-error --location https://gist.githubusercontent.com/cvrolf/a0581a91b2ad223175197d6392924351/raw/60-vm-configure.sh)"

Actions in the script https://gist.githubusercontent.com/cvrolf/a0581a91b2ad223175197d6392924351/raw/60-vm-configure.sh :

  • Configure /etc/hostname
  • Configure /etc/hosts
  • Configure the OpenSSH Server.
  • Make sudo more flexible.
  • Fix the Grub2 boot loader: disable the Plymouthd splash screen (causes crash during the boot cycle).
  • Enable the motherboard speaker (I love the beeps).
  • Remove pkg ufw (unnecessary in a NAT-based VM).
  • Remove pkg AppArmor (more of a burden then a good thing).
  • Install the SPICE Agent for a better remote desktop experience.
  • Install general purpose packages such as apt-show-versions, curl, git, screen, …
  • Install the Gnome Tweak tool.


STEP 7: Virtual Machine – Configure the Ubuntu Desktop GUI (Wayland / GNOME / GDM)

Goto the Ubuntu Desktop GUI of your Host Machine.

Start the Virtual Machine Manager, select VM “myvmtest” and CLICK IT. The Virt-viewer is opened with the GUI installer.

Goto the Ubuntu Desktop GUI and open a Terminal. @tip Right-click on the Desktop and choose “Terminal”.


# VERIFY that you are indeed using the Wayland Display Manager (and NOT X11 which would return “x11”!). Paste this in the Terminal:

# Bash
if [ "${XDG_SESSION_TYPE}" != "wayland" ]; then
    echo "ERROR. This session does not use the Wayland Display Manager. Instead it uses ${XDG_SESSION_TYPE}"
    sleep 10
    echo "OK. This session uses the Wayland Display Manager."


# Allow root users for graphical applications. @doc The most straightforward workaround is to use xhost to temporarily allow the root user to access the local user’s X session.

Start the app “Startup Applications”

  • Add this startup command:
  • Name: xhost si:localuser:root
  • Command: xhost si:localuser:root
  • Comment: Wayland/GDM: allow GUI apps running under the root account

Ubuntu 17.10 Desktop


# Language Support:

Start the app “Settings” -> select Region & Language:

Language = English (United States)

Formats = United States


# Power – Blank screen:

Start the app “Settings” -> select Power:

Blank screen = Never


# Display Resolution: higher

Start the app “Settings” -> select Devices -> Displays: [Default=1024×768]

RESOLUTION: 1440 X 900 (16:10)

Press button Apply

Ubuntu 17.10 Desktop


# User AutoLogon

Start the app “Settings” -> select Details -> Users: ubuntu

Press button Unlock in the window title.

Automatic Login *ON.


# Software & Settings

Start the app “Software Updater”.

Goto “Settings”

select tab UbuntuSoftware:

Section: Downloadable from the Internet: all *ON except “Source”

Ubuntu 17.10 Desktop

Select tab Other Software: all *OFF

Select tab Updates:

Autocheck for updates: *Every 2 weeks

When there are security updates: *Display immediately

When other updates: *Display every 2 weeks

Ubuntu 17.10 Desktop


# Pin these applications to the Dock. @tip Find each app in the “Application Matrix [bottom left]”, then right click each app, then select “Add to favorites”.

  • Terminal
  • Settings
  • Startup Applications
  • Software Updater
  • Tweaks


STEP 8: Make a Snapshot of the Virtual Machine

Open a Terminal with user root on the Host Machine.

Paste this in the Terminal:

# Bash
bash -c "$(curl --fail --silent --show-error --location https://gist.githubusercontent.com/cvrolf/39de5f38085fa0756aea2b0ddde60f55/raw/90-vm-create-snapshot.sh)"

Actions in the script https://gist.githubusercontent.com/cvrolf/39de5f38085fa0756aea2b0ddde60f55/raw/90-vm-create-snapshot.sh :

  • Shutdown the Virtual Machine.
  • Make a snapshot with a good description.
  • Start the Virtual Machine.
  • Double-check that the VM can be pinged by IP address and by DNS name.


COMPLETED: Your Ubuntu Desktop inside a Virtual Machine

Ubuntu 17.10 Desktop


Related Skills




Next Steps

  • You can now try to configure a bridged network for the VM so that the VM is visible on the LAN.

Does it not work for you? Please make the required changes and let me know so we can share it with the community 🙂 @rolfhuijbrechts