Branded (LX) Zones on SmartOS

Branded (LX) Zones on SmartOS

One of the biggest historical weaknesses of SmartOS has been its inability to provide the Linux API/ABI directly to user space within a zone.  This is because the list of system calls are not only different between operating systems, but the way they are handled differs.

This means that Linux exclusive applications are effectively second-class citizens in SmartOS (compared to applications hosted from a native zone), as their system calls have to be run through KVM and a guest operating system kernel.  This equates to less IO performance, less visibility with Dtrace, less flexibility with ZFS, etc.

But what if we could just translate system calls from one API/ABI to another?

This is exactly what an LX Branded Zone does.

How it Works

Simply by passing all Linux system calls through a daemon in the same zone which translates each call to it's equivalent call(s) in Solaris, and then returns the appropriate responses.

This may seem quite simple, but it really isn't.  Unfortunately, this is beyond the scope of this blog post right now.

Setting it Up

At the time of this posting, LX Branded datasets are available for CentOS, Debian, and Ubuntu.  Simply acquire what you want with imgadm.

The VM manifest is pretty similar to a normal SmartOS Zone:

[root@gz ~]# vmadm create <<EOF
  "alias": "debian-7",
  "brand": "lx",
  "hostname": "debian-7",
  "kernel_version": "4.3.0",
  "max_physical_memory": 1024,
  "quota": 10,
  "delegate_dataset": true,
  "image_uuid": "7d13c646-e3a7-11e4-8603-f79ddc0a5474",
  "resolvers": [ "", "" ],
  "nics": [
      "nic_tag": "admin",
      "ips": [ "dhcp" ],
      "primary": true

Native binaries

In addition to Linux binaries, you can also run Illumos native binaries within the same userspace.  They have been conveniently placed under /native/sbin, /native/usr/sbin and /native/usr/bin.  Include these into your $PATH variable to make them much easier to use.

Final thoughts

I've not used Linux in a server since switching to SmartOS, but LX Branded Zones makes it as easy as spinning up a SmartOS Zone.

While I do miss not having SMF, ZFS, or any of the other things I've grown to love from SmartOS, I'm sure this technology will continue to develop, and I'm expecting an even smoother Linux experience in the next few releases of datasets and global zone images.

I just hope it doesn't happen at the cost of the native SmartOS Zone.

Also, this is a rapidly developing technology.  Be sure to keep an eye on the relevant SmartOS Wiki page to stay on top of new developments.