I just followed your tutorial and setup KVM with Ubuntu Linux as a new guest virtual machine. However, I am unable to use the command: ‘virsh console vm’. How do I setup and enable console access in order to gain shell access on the newly created Ubuntu Linux 16.04 LTS VM?

Activating the serial console in the Ubuntu Linux 16.04 LTS guest is an excellent way to log in and solve problems.

Our sample setup

  1. KVM host IP: 192.168.2.15
  2. KVM guest OS: Ubuntu Linux 16.04 LTS
  3. KVM guest IP: 192.168.2.45
  4. KVM guest name: ubuntu-box1
  5. KVM guest user name: vivek
  6. KVM guest password: hidden-secrete

How do I setup console access of Ubuntu 16.04 KVM Guest

First, you need to login using ssh or VNC client to your Ubuntu guest.

Use ssh login

In this example, I am login using ssh client from my workstation (or type command on KVM host itself) to the Ubuntu Linux VM guest:
$ ssh [email protected]
After log in gain access to the root shell:
$ sudo -s

Use vnc login

Type the following command on your KVM host:
$ virsh dumpxml ubuntu-box1 | grep vnc
<graphics type='vnc' port='5901' autoport='yes' listen='127.0.0.1'>

Please note down the port value (i.e. 5901). You need to use an SSH client to setup tunnel and a VNC client to access the remote vnc server. Type the following SSH port forwarding command from your Linux/Unix/MacOS client or desktop system:
$ ssh {user}@{KVM-host-IP-here} -L 5901:127.0.0.1:5901
$ ssh [email protected] -L 5901:127.0.0.1:5901

Once you have ssh tunnel established, you can point your VNC client at your own IP 127.0.0.1 (localhost) address and port 5901 as follows in VNC client:

Fig.01: Graphical VNC client to connect to Ubuntu Linux 16.04 LTS server console

Log in to your VM:

Fig.02: Login to my Ubuntu guest VM

Configure a serial console in the Ubuntu guest

Finally type the following two commands to enable a serial console in the guest to access a connection using ‘virsh console’ command:
$ sudo systemctl enable [email protected]
$ sudo systemctl start [email protected]

Sample outputs:

Created symlink from /etc/systemd/system/getty.target.wants/[email protected] to /lib/systemd/system/[email protected]

How do I access console of Ubuntu 16.04 KVM Guest from KVM host

To see a list of running VM, enter:
$ virsh list
Sample outputs:

 Id    Name                           State
----------------------------------------------------
 1     freebsd                        running
 2     ubuntu-box1                    running
 3     ubuntu-box2                    running

Type the following command from KVM host to login to the guest named ubuntu-box1
$ virsh console ubuntu-box1
OR
$ virsh console 2
Sample session:

Animated gif 01: virsh console demo

Use Ctrl + ]to exit the console.

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

  • Cryptocurrency Hedge Fund Hit With Class Action Lawsuit
  • Salon Offers Readers Choice Between Ads and Mining Monero
  • Linux Password Cracking: Explain unshadow and john Commands ( John the Ripper Tool )
  • Crypto Trading Platform ErisX Hires Serial Exchange Founder Matt Trudeau
  • How to Set up IRC on Ubuntu
  • Bosch and Wien Energie Demo Blockchain-Powered Refrigerator
  • Apache: Graceful Server Reboot From Shell
  • BIS Report: DLT ‘Promising’ But ‘A Long Way Off’
  • Chain Issues Investor Shares on Nasdaq Blockchain Platform
  • Through the Roadblock? Bitcoin’s Price Might Be Priming for a Boost
  • Winklevoss Price Ticker Makes Debut on Bloomberg
  • Bitmarkets Launches Decentralised Bitcoin Marketplace With Tor Support
  • US Marshals: Final Silk Road Bitcoin Auction Likely for 2015
  • How To Set up Any Email Client
  • Crypto Winter Thaws As February Proves Month of Market Gains
  • SXI LLC Company
    SXI.IO is a global Blockchain software company, specialized in developing white label crypto exchange platforms , Wallet platforms, ICO platforms, Token Erc20 .....
    Fully Managed VPS Fully Managed VPS Fully Managed VPS

    You Might Also Enjoy NewS Post

    Best Free Web Hosting 2020

    Free Hosting 1GB $0.00 USD/mo Disk space 1GB Traffic 10GB/Month Domains 2 Plesk Cpanel Databases 10 Free 12 Month https://my.sxi.io/cart.php?a=add&pid=196

    02/05/2020 READ MORE

    Download Windows Templates for Virtualizor KVM

    Download any of client OS template to the location in Node ( /var/virtualizor/Xen or KVM according to the virtualization). http://mirror.softaculous.com/virtualizor/templates/windows-2003-x86.img.gz http://mirror.softaculous.com/virtualizor/templates/windows_2003R264.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2008r2.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2012server.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2003-x86.img.gz http://mirror.softaculous.com/virtualizor/templates/windows_2003R264.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2008r2.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2012server.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2012r2.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2016.img.gz For...

    23/04/2020 READ MORE