Install a kernel zone in 3 steps

One of the shiniest new features in Oracle Solaris 11.2 is Kernel Zones.  Kernel Zones provide the familiarity of zones while providing independent kernels.  This means that it's now possible to have zones that run different patch levels, act as CIFS servers, load kernel modules, etc.  So, let's get to installing a kernel zone.

If you have installed any other zone on Solaris before, this will look quite familiar.  After all, it is  just another zone, right?

For this procedure to work, there are some prerequisites that shouldn't be much of a problem in a production environment, but are a bit of a problem if your normal playground is VirtualBox or the 6 year old server you found on the loading dock.

Step 1: Configure

root@vzl-212:~# zonecfg -z myfirstkz create -t SYSsolaris-kz

Step 2: Install

root@vzl-212:~# zoneadm -z myfirstkz install
Progress being logged to /var/log/zones/zoneadm.20140419T032707Z.myfirstkz.install
pkg cache: Using /var/pkg/publisher.
 Install Log: /system/volatile/install.5368/install_log
 AI Manifest: /tmp/zoneadm4798.dAaO7j/devel-ai-manifest.xml
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
Installation: Starting ...

        Creating IPS image
        Installing packages from:
            solaris
                origin:  http://ipkg/solaris11/dev/
        The following licenses have been accepted and not displayed.
        Please review the licenses for the following packages post-install:
          consolidation/osnet/osnet-incorporation                     
        Package licenses may be viewed using the command:
          pkg info --license <pkg_fmri>

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            549/549   76929/76929  680.9/680.9  8.4M/s

PHASE                                          ITEMS
Installing new actions                   104278/104278
Updating package state database                 Done 
Updating package cache                           0/0 
Updating image state                            Done 
Creating fast lookup database                   Done 
Installation: Succeeded
        Done: Installation completed in 438.132 seconds.

Step 3: Celebrate!

At this point the kernel zone is installed and ready for boot. 

root@vzl-212:~# zoneadm -z myfirstkz boot
root@vzl-212:~# zlogin -C myfirstkz
[Connected to zone 'myfirstkz' console]
Loading smf(5) service descriptions: 220/220
...

Because a sysconfig profile was not provided during installation, sysconfig(1M) will ask a few things on first boot.

                           System Configuration Tool
 
     System Configuration Tool enables you to specify the following            
     configuration parameters for your newly-installed Oracle Solaris 11       
     system:
     - system hostname, network, time zone and locale, date and time, user     
       and root accounts, name services, keyboard layout, support
 
     System Configuration Tool produces an SMF profile file in
     /etc/svc/profile/sysconfig/sysconfig-20140419-034040.
 
     How to navigate through this tool:
     - Use the function keys listed at the bottom of each screen to move       
       from screen to screen and to perform other operations.
     - Use the up/down arrow keys to change the selection or to move           
       between input fields.
     - If your keyboard does not have function keys, or they do not            
       respond, press ESC; the legend at the bottom of the screen will         
       change to show the ESC keys for navigation and other functions.         
 
 
 
  F2_Continue  F6_Help  F9_Quit

If you've read this far into this entry, you know how to take it from here.

Comments:

I'm getting errors. The zone installs fine, on boot however :
-bash-4.1# zoneadm -z test-kz boot
zone 'test-kz': error: boot failed
zone 'test-kz': error: Failed to create VM: Not enough space
zone 'test-kz': error: allocation of guest RAM failed
zoneadm: zone test-kz: call to zoneadmd(1M) failed: zoneadmd(1M) returned an error 1 (unspecified error)

I wonder if I need a bigger swap volume?

Posted by guest on May 06, 2014 at 03:52 AM CDT #

guest,

The error you are seeing is most likely because the ZFS ARC (cache) has consumed too much of the system's memory. Unfortunately, ZFS does not get out of the way quickly enough when there is memory pressure leading to a failed memory allocation.

In the third paragraph of my post, I linked to some prerequisites. One of those was to limit the ARC. On my laptop, I do this with the following entry in /etc/system:

* Limit the ARC to 1 GB
set zfs:zfs_arc_max=0x40000000

Posted by Mike Gerdts on May 06, 2014 at 08:52 AM CDT #

Thanks Mike..

That was indeed the cause of the problem. I should have read the pre-requisites you linked to in your link..

Posted by guest on May 09, 2014 at 06:07 AM CDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

I'm a Principal Software Engineer in the Solaris Zones team. In this blog, I'll talk about zones, how they interact with other parts of Solaris, and related topics.

Search

Categories
Archives
« February 2015
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
       
       
Today