Playing with SmartOS on Fedora 22 & KVM

SmartOS is a next-gen incarnation of the Solaris / Unix family of operating systems. DevOps friendly with all the badness of Solaris Greybeards? Sounds like fun. Let's give it a spin in a virtual machine and explore on our own.

Installing with virt-manager

First we'll grab latest installation ISO from SmartOS's homepage:

https://us-east.manta.joyent.com/Joyent_Dev/public/SmartOS/smartos-latest.iso  

Now create a new virtual machine with the following settings:

  • ISO Image: smartos-latest.iso
  • OS Type: Solaris
  • Version: Sun Solaris 11

Note that setting the os type and version is optional and that generic settings for both work also fine.

Now so we've successfully created the VM and booted it into the SmartOS bootscreen, don't select anything as of yet and rather enter the command mode by pressing c and enter the following:

variable os_console ttya  

The default vga console, for some reason, continuously receives ASCII escape code ^[[210z every second, which renders entering installation settings impossible, so we need to switch to text or ttya console. Also don't forget to switch your virt-manager console settings from Graphical Console Spice to Serial 1.

I won't bother with following the installation steps, as you can just hit enter for most of them and get sane defaults. Note that after the installation is done, the system will reboot, and you'll need to do the above vga -> ttya business again.

Lurking around

First thing that got me wonder is what is the actual bitness of the system, since the banner says 64-bit yet, uname reports i386.

SunOS Release 5.11 Version joyent_20151029T053122Z 64-bit

[root@52-54-00-a0-ad-f9 ~]# uname -a
SunOS 52-54-00-a0-ad-f9 5.11 joyent_20151029T053122Z i86pc i386 i86pc  

Hmm, let's take a peek at /bin/ls:

[root@52-54-00-a0-ad-f9 ~]# gdb /bin/ls
(gdb) b *main
(gdb) r
(gdb) disas
=> 0x08055c9e <+0>:    lea    0x4(%esp),%ecx
   0x08055ca2 <+4>:    and    $0xfffffff0,%esp
   0x08055ca5 <+7>:    pushl  -0x4(%ecx)
   0x08055ca8 <+10>:    push   %ebp
   0x08055ca9 <+11>:    mov    %esp,%ebp
   0x08055cab <+13>:    push   %edi
   0x08055cac <+14>:    push   %esi

32-bit! But don't get fooled, the system can still run 64-bit binaries on a whim, it's just major parts of the user-space are still compiled as 32-bit applications.

Where did I get gdb, it's not in the base install?! Good question, as it turns out, packages on SmartOS are handled by NetBSD's pkgsrc.

Pkgsrc

More information about pkgsrc can be found at pkgsrc's SmartOS homepage. Note that there's a problem with self-signed certificate so we need to tweak the curl line from installation docs:

curl -Oks https://pkgsrc.joyent.com/packages/SmartOS/bootstrap/bootstrap-2015Q3-i386.tar.gz  

We've added the -k flag to allow for insecure connections.
Now simply:

pkgin install gdb  

to install gdb or any package of your choice. Searching for packages is possible with:

pkgin search pkgname  

The interesting fact about pkgsrc is that while we installed it externally, it still has all the system packages in it's registry:

pkg_info | wc -l  
26  

On Fedora/RHEL this is equivalent of having RPMdb but no rpm or yum/dnf on the base system.

Coming up next

The reason I started toying with SmartOS was that I was curios about branded lx-zones, which effectively means running Docker containers inside SmartOS/Solaris zones, having SmartOS installed and package manager working was a good start, so next we'll be launching some containers!