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).
- 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
- From the SmartOS host start up the console and substitute in the appropriate UUID of the VM from
# vmadm console <uuid>
- Reboot the VM.
- 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.
- 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.
SAC>ch -si 1
- 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
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.
This is a quick guide for setting up a CIFS/SMB file server using Samba within a virtualized zone on SmartOS. A couple of the many benefits of doing this on SmartOS are that it can utilize ZFS for file storage and also that the file server can be isolated off as a zone and be run in parallel with various other zones and virtual machines.
On to the setup steps…
- From an installed and running SmartOS system setup a JSON config file for the zone. I tend to create a directory
/opt/vmcfg and place the file there, in this case named
samba01.json with the following contents. When placed in a directory under
/opt the files will persist across system reboots. This sample config uses the base-64 15.1.1 image. The delegate_dataset=true creates a ZFS filesystem that can be managed within the zone which is a nice feature to have on a file server for separating out users or shares to different filesystems. The alias, hostname, quota, max_physical_memory, ZFS compression, and network configuration can be updated to your environment.
- Create the zone from the configuration file.
# vmadm create -f samba01.json
Successfully created VM 6153d789-5697-4ec6-a237-55198fe3c6b8
- Log into the zone and install Samba.
# zlogin 6153d789-5697-4ec6-a237-55198fe3c6b8
# pkgin update
# pkgin install samba
- Setup the ZFS home directories and move the admin user home directory to a ZFS filesystem.
# zfs create zones/6153d789-5697-4ec6-a237-55198fe3c6b8/data/home
# zfs create zones/6153d789-5697-4ec6-a237-55198fe3c6b8/data/home/admin
# cp -a /home/admin/. /zones/6153d789-5697-4ec6-a237-55198fe3c6b8/data/home/admin
# rm -rf /home/admin
# zfs set mountpoint=/home zones/6153d789-5697-4ec6-a237-55198fe3c6b8/data/home
- Create a new user with a separate filesystem for the home directory.
# zfs create zones/6153d789-5697-4ec6-a237-55198fe3c6b8/data/home/ed
# chown ed:other /home/ed
# useradd ed
- Set the user’s Samba password.
# smbpasswd -a ed
- Optionally edit the Samba config file in
- Start up Samba. This will also set it to be enabled at startup.
# svcadm enable -r smbd
# svcadm enable -r nmbd
- From a Windows or other computer connect to the user’s home directory/share as
This will get you a basic file server setup. From here you can add addition users, shared directories, etc.
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.
- Create a JSON file with the virtual machine parameters. Also see the SmartOS Wiki for some additional options and details.
"resolvers": [ "10.1.1.1" ],
- 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
- 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 \
- Boot the VM to the ISO.
# vmadm start 3b202a79-f148-4c87-bb7f-ff9d64f724ca \
Successfully started 3b202a79-f148-4c87-bb7f-ff9d64f724ca
- Get the VNC IP and port from the VM.
# vmadm info 3b202a79-f148-4c87-bb7f-ff9d64f724ca vnc
- Connect to the VM with VNC and complete the installation as normal, including the reboot at the end.
- 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.
- Paste the following into
# 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=
stop on runlevel [!2345]
exec /sbin/getty -L 115200 ttyS0 vt102
- Ask upstart to start the getty.
$ sudo start ttyS0
- The serial console can then be connected to from the SmartOS host with the
vmadm tool. Exiting from this console is done with
# 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 10.1.1.4 on pts/0
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com/
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: 10.1.1.11
Swap usage: 0%
Graph this data and manage this system at https://landscape.canonical.com/
9 packages can be updated.
0 updates are security updates.