Sun Java Solaris Communities My SDN Account Join SDN

Article

Managing Boot Environments With OpenSolaris Package Manager

 
By Michal Pryc, with contributions from Marina Sum, March 2009  

Thanks to the ZFS file system, you can efficiently create multiple system configurations, called boot environments (BEs), on the OpenSolaris Operating System (OS). In addition, you can use Package Manager, Update Manager, and the pkg (1) command-line interface (CLI) to install, update, or delete software from the network-based repositories, also called publishers. In many cases, those tasks involve manipulation of BEs.

This article introduces an example BE set and describes how to manage BEs with Package Manager. For details on how to work with multiple BEs on the OpenSolaris OS, see the SDN article on that subject.

Contents
 
Introducing an Example BE Set
Updating Software in BEs and Cloning BEs
Starting Package Manager and Update Manager
Creating BEs
Deleting BEs
Changing the Default BE
Troubleshooting
For More Information
 
Introducing an Example BE Set

Depending on your requirements, you can set up different sets of BEs in your OpenSolaris OS instance. Figure 1 shows an example set.

Example Set of BEs
Figure 1: Example Set of BEs
Click the image to enlarge it.

 
Updating Software in BEs and Cloning BEs

Each of the rectangles in Figure 1 can contain a different set of software. Clicking the Update All button in Package Manager or choosing Update All from Package Manager's Package menu updates all the software installed in the newly created (cloned) BE, but not the base BE, which stays the same.

Note: You can also perform the update-all task by clicking Update All in Update Manager or by executing the pkg image-update command.

Furthermore, cloning a BE simply creates exactly the same system configuration as that of the cloned BE. You can then maintain many system configurations and boot to any of the BEs with GRand Unified Bootloader (GRUB). More importantly, this approach of updating or installing software is safe and secure.

To clone the BE that's running, type:

% pfexec beadm create clone-BE-name 
 

To clone a BE that's not currently running, type:

% pfexec beadm create -e base-BE-name clone-BE-name
 
 
Starting Package Manager and Update Manager

You can start Package Manager and Update Manager in several ways:

  • For Package Manager, use one of the following methods:
    • Click the Package Manager icon in the panel toolbar.
    • Click the Add More Software icon on the desktop.
    • Choose Administration > Package Manager from the System menu.
    • Click the Start Here icon on the desktop and, when the Start Here with OpenSolaris dialog box is displayed, click "Get more software" under Personalize.
    • Type gksu packagemanager & in a Terminal window.

     
    Figure 2 illustrates all five ways.
     
    Five Ways to Start Package Manager
    Figure 2: Five Ways to Start Package Manager
    Click the image to enlarge it.
     
  • For Update Manager, use one of the following methods:
    • Choose Administration > Update Manager from the System menu.
    • Type gksu updatemanager & in a Terminal window.
    • Click the Update Manager icon Update Manager Icon if it's displayed in the notification area.
 
Creating BEs
Creation of a BE occurs in any of the following ways:  
  • You perform the update-all task in Package Manager.
  • You execute the image-update command after an update task in Update Manager.
  • OpenSolaris might create a BE if an installation or deletion task encounters an error. See the section Troubleshooting for details.
 
Deleting BEs
To save disk space, delete redundant BEs every now and then. To delete a BE:  
  1. In Package Manager, choose Boot Environment Management from the File menu.
     
    The Boot Environment Management dialog box is displayed.
     
    You can also open that dialog box from the Not Enough Disk Space error-message dialog box, which is displayed in case of insufficient disk space while you are running Package Manager. See Figure 3.
     
    " Not Enough Disk Space" Error Message
    Figure 3: " Not Enough Disk Space" Error Message
    Click the image to enlarge it.
     
    Note: In versions of OpenSolaris after OpenSolaris2008.11, Package Manager includes a menu change. In the later versions, choose Manage Boot Environments from the File menu to open the Boot Environment Management dialog box. See Figure 4.
     
    Manage Boot Environments Menu Item in Post-OpenSolaris 2008.11 Versions of Package Manager
    Figure 4: Manage Boot Environments Menu Item in Post-OpenSolaris 2008.11 Versions of Package Manager
    Click the image to enlarge it.
     
  2. Specify the BEs to be deleted by selecting the appropriate check boxes in the Delete column. Click OK. Figure 5 shows an example.
     
    Boot Environment Management Dialog Box
    Figure 5: Boot Environment Management Dialog Box
    Click the image to enlarge it.
     

    Note the following:

    • You cannot delete a currently active BE, whose name is boldfaced, or one that's marked Active on Reboot.
    • The Size column shows the maximum disk space that will be freed up after you've deleted the corresponding BE. However, in some cases, deleting a BE does not free up its disk space because other BEs use some of the data there.
     
    Afterwards, Package Manager prompts you to confirm. Figure 6 is an example.
     
    Prompt for Confirmation of BE Changes
    Figure 6: Prompt for Confirmation of BE Changes
    Click the image to enlarge it.
     
  3. Click OK.
     
    Package Manager deletes the BEs and posts a status bar to display the progress. See Figure 7.
     
    Status Bar
    Figure 7: Status Bar
    Click the image to enlarge it.
     
     
    When the task is complete, Package Manager closes the Boot Environment Management dialog box.
     
Changing the Default BE

Here's a nifty trick: To have the GRUB menu automatically select a BE and boot to it the next time you reboot the OpenSolaris OS, specify that BE as the default. You can always override the default BE by using the arrow keys to choose a different BE to reboot in the GRUB menu. See Figure 8.

GRUB Menu
Figure 8: GRUB Menu
 

To change the default BE:

  1. Open the Boot Environment Management dialog box.
     
    The boldfaced BE that's checkmarked as Currently Active Boot Environment is the one you're running.
     
  2. Select Active on Reboot for the BE you'd like to set as the default. Click OK.
     
    Notes: If that BE is already marked for deletion, you cannot set it as the default. Also, you can specify only one default BE.
     
    Afterwards, Package Manager prompts you to confirm. See Figure 6.
     
  3. Click OK.
     
    Package Manager changes the default BE and posts a status bar to display the progress. See Figure 7. When the task is complete, Package Manager closes the Boot Environment Management dialog box.
Troubleshooting

You might encounter two typical types of problems while running Package Manager or Update Manager:

  • Installation, deletion, or update failures -- If an unknown error occurs during the installation, deletion, or update process, Package Manager displays an error message and, in many cases, creates a BE.
     
    The resolution depends on the related operation:
     
    • If an unknown error occurs while you're updating a BE's software by performing one of the steps described in the section Updating Software in BEs and Cloning BEs, your system does not change. Instead, Package Manager makes the changes to a clone of the running system so that you can examine the failure in the mounted BE. If you don't want to do that, you can safely delete the BE that resulted from the failure.
    • If an unknown error occurs while you're installing, deleting, or updating certain packages, your system might be corrupted. However, Package Manager takes a snapshot of the BE before the failed attempt. You can look at the snapshot by choosing it in the GRUB menu for reboot.
       
  • Boot environment management failures -- If a problem occurs during a BE management operation, an error message is displayed. Figure 9 is an example.
     
    BE Error Messages
    Figure 9: BE Error Messages
     
    To resolve the problem, start Package Manager from the command line and set the BE_PRINT_ERR environment variable to true. Browse the output for clues. See this example:
     
    migi@opensolaris:~# BE_PRINT_ERR=true gksu /usr/bin/packagemanager
    be_get_uuid: failed to get uuid property from BE root dataset user properties.
    get_ver_from_capfile: failed to open file //rpool/boot/grub/capability with err Error 0
    be_activate: failed to get grub versions from capability files.
    pkg: unable to activate opensolaris-2
    
     
    If the output does not help you resolve the problem, log the bug in the OpenSolaris Defect Tracking site or discuss the problem with other users and developers on the pkg-discuss or install-discuss discussion lists.
For More Information
Rate This Article
 
Comments
Do you have comments about this article? We welcome your participation in our community. Please keep your comments civil and on point. You may optionally provide your email address to be notified of replies - your information is not used for any other purpose. By submitting a comment, you agree to these Terms of Use.
Related Links
 
Michal Pryc Michal Pryc, a Sun staff engineer, has enjoyed working on the OpenSolaris desktop since mid-2006, in particular, the key project: Package Manager. Previously, Michal developed Java platform-based games and performed administrative tasks for several years. Away from the computer, depending on the place and time of the year, he plays sports: gliding, sailing, skiing, and badminton. Also see his blog.
 
Marina Sum Marina Sum, having been a writer for Sun since 1989 and a staff writer for Sun Developer Network for several years, plans to continue to blog now and then on Sun-sponsored open-source projects. See her blog for her farewell.