Mounting, unmounting, installing, and uninstalling a package in an inactive boot environment
Many times, we want to install a package in an inactive BE and later (maybe at night), boot this BE and test whether the programs are working. Furthermore, we can keep all BEs consistent with each other and have them contain the same packages without booting each one to install a new package.
Getting ready
To follow this recipe, it's necessary that we have a machine (physical or virtual) running Oracle Solaris 11; we log in to the system as the root user and open a terminal.
How to do it…
We use the following commands to install a new package into a new BE (solaris_test_1
):
root@solaris11:~# mkdir /solaris_test_1 root@solaris11:~# beadm mount solaris_test_1 /solaris_test_1 root@solaris11:~# beadm list BE Active Mountpoint Space Policy Created -- ------ ---------- ----- ------ ------- solaris NR / 25.94G static 2013-10-05 20:44 solaris-backup-1 - - 303.0K static 2013-10-26 22:49 solaris-backup-a - - 7.26G static 2013-10-10 19:57 solaris_test_1 - /solaris_test_1 27.37M static 2013-11-05 22:38
We install the package in this mounted boot environment by running the following command:
root@solaris11:~# pkg -R /solaris_test_1 install unrar
Packages to install: 1
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 1/1 6/6 0.1/0.1 656k/s
PHASE ITEMS
Installing new actions 19/19
Updating package state database Done
Updating image state Done
Creating fast lookup database Done
The unrar
package was installed into the new BE (solaris_test_1
) and not into the current one (solaris
). Proving this fact is easy:
root@solaris11:~# unrar
bash: unrar: command not found
root@solaris11:~#
Note
The same package can be removed using the following command:
root@solaris11:~# pkg -R /solaris_test_1 uninstall unrar
Once the unrar
package has been installed, we can unmount the BE by running the following commands:
root@solaris11:~# beadm umount solaris_test_1 root@solaris11:~# beadm list BE Active Mountpoint Space Policy Created -- ------ ---------- ----- ------ ------- solaris NR / 25.94G static 2013-10-05 20:44 solaris-backup-1 - - 303.0K static 2013-10-26 22:49 solaris-backup-a - - 7.26G static 2013-10-10 19:57 solaris_test_1 - - 122.88M static 2013-11-05 22:38
An overview of the recipe
This neat recipe taught us how to mount an inactive boot environment and install a package into this inactive BE by using the -R
option to specify the mount point.