Posts Tagged ‘kvm’

Windows Text Console on SmartOS

July 23rd, 2015 Comments off

With SmartOS the vmadm console command offers a convenience method for pulling up a text console for a guest VM.  This is commonly used for Linux and BSD VMs and it can be enabled for Windows VMs too.  The below steps outline how to enable and utilize this feature on Windows 2012 R2 through the use of the Windows Emergency Management Services (EMS).


  1. As an administrator user run the following commands. If you have configured more than one boot entry you may want to tailor this command to target only a specific boot entry.  Together these enable EMS and then set it to run on COM1 at a baud rate of 115,200.
    C:\>bcdedit /ems on
    C:\>bcdedit /emssettings EMSPORT:1 EMSBAUDRATE:115200
  2. From the SmartOS host start up the console and substitute in the appropriate UUID of the VM from vmadm list:
    # vmadm console <uuid>
  3. Reboot the VM.
  4. On the console window you will see something like the following:
    Computer is booting, SAC started and initialized.                               
    Use the "ch -?" command for information about using channels.                   
    Use the "?" command for general help.                                           
    EVENT: The CMD command is now available.                                        
  5. We’re at a SAC prompt, but it’s not yet the familiar CMD.EXE.  The SAC is the Special Administration Console which has some additional functionality, one of which is to start CMD.  To do so simple run cmd and then switch to the channel that it created:
    The Command Prompt session was successfully launched.
    EVENT:   A new channel has been created.  Use "ch -?" for channel help.
    Channel: Cmd0001
    SAC>ch -si 1
  6. From here press any key and then enter in the username, domain, and password when prompted and CMD prompt will then be usable as well as PowerShell by running powershell at the CMD prompt:
    Microsoft Windows [Version 6.3.9600]                                            
    (c) 2013 Microsoft Corporation. All rights reserved.                            


This does not appear to work on all versions of Windows.  When I tried with Windows 7 the bcdedit commands completed successfully but the console text never appeared.  Older versions will need to use the bootcfg command instead of bcdedit.

While functional, the serial console can be a bit sluggish at times.  Also, when using this within xterm the text scrolls at the 25 line mark rather than filling up the full terminal window.

Tags: , ,

Creating an Ubuntu 12.04 LTS VM on SmartOS

April 28th, 2012 Comments off

Joyent’s SmartOS, a fairly recent hypervisor for virtualization, provides a number of prebuilt virtual machine images for various operating systems but doesn’t yet have one available for Ubuntu 12.04 LTS.  This post provides the steps required to install it manually including the basic SmartOS commands as well as some Ubuntu-specific customizations.

  1. Create a JSON file with the virtual machine parameters.  Also see the SmartOS Wiki for some additional options and details.
      "alias": "ubuntu12",
      "hostname": "ubuntu12",
      "brand": "kvm",
      "vcpus": 1,
      "autoboot": false,
      "ram": 4096,
      "resolvers": [ "" ],
      "disks": [
          "boot": true,
          "model": "virtio",
          "size": 40960
      "nics": [
          "nic_tag": "admin",
          "model": "virtio",
          "ip": "",
          "netmask": "",
          "gateway": "",
          "primary": true
  2. Create the virtual machine with the vmadm command using the JSON file as the input.
    # vmadm create -f ubuntu-12.04.json
    Successfully created 3b202a79-f148-4c87-bb7f-ff9d64f724ca
  3. Copy the Ubuntu 12.04 LTS install ISO to the root dataset for this virtual machine. This assumes the ISO has already been copied to the /zones/isos directory on the SmartOS server.
    # cp /zones/isos/ubuntu-12.04-server-amd64.iso \
  4. Boot the VM to the ISO.
    # vmadm start 3b202a79-f148-4c87-bb7f-ff9d64f724ca \
                  order=cd,once=d cdrom=/ubuntu-12.04-server-amd64.iso,ide
    Successfully started 3b202a79-f148-4c87-bb7f-ff9d64f724ca
  5. Get the VNC IP and port from the VM.
    # vmadm info 3b202a79-f148-4c87-bb7f-ff9d64f724ca vnc
      "vnc": {
        "host": "",
        "port": 63407,
        "display": 57507
  6. Connect to the VM with VNC and complete the installation as normal, including the reboot at the end.
  7. Enable the serial console in Ubuntu with the steps from the Ubuntu SerialConsoleHowto.  This step is optional but adds some nice administration benefits as demonstrated in the next step.
    1. Paste the following into /etc/init/ttyS0.conf.
      # ttyS0 - getty
      # This service maintains a getty on ttyS0 from the point the system is
      # started until it is shut down again.
      start on stopped rc or RUNLEVEL=[2345]
      stop on runlevel [!2345]
      exec /sbin/getty -L 115200 ttyS0 vt102
    2. Ask upstart to start the getty.
      $ sudo start ttyS0
  8. The serial console can then be connected to from the SmartOS host with the vmadm tool. Exiting from this console is done with CTRL-].
    # vmadm console 3b202a79-f148-4c87-bb7f-ff9d64f724ca
    Unknown command: console
    Ubuntu 12.04 LTS ubuntu12 ttyS0
    ubuntu12 login: ed
    Last login: Sat Apr 28 22:38:41 CDT 2012 from on pts/0
    Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
     * Documentation:
      System information as of Sat Apr 28 22:39:26 CDT 2012
      System load:  0.0               Processes:           61
      Usage of /:   4.1% of 35.92GB   Users logged in:     1
      Memory usage: 1%                IP address for eth0:
      Swap usage:   0%
      Graph this data and manage this system at
    9 packages can be updated.
    0 updates are security updates.
Tags: , ,