Thursday, 21 August 2008

Opensolaris managing failed package installs

« FWD skal koste penge | Main | Hundekøbere snydt »

I just switched my laptop to run OpenSolaris, Sun's free Unix-alike OS. So far it is a success. There is still a lot to be done, and one of those is the IPS package system. It fails too often to my taste. This article is about how to clean up after a broken IPS installation.

Basics of IPS' pkg tool

You can use pkg authority -H to list the repositories currently added. You add repositories using pkg set-authority -O url name. Some good repositories I use, in addition to the default repository, are:

To find packages to install, you use pkg search -r keyword, and install using pkg install packagename, or alternatively, you use the GUI under System -> Administration -> Package manager.

Installing and failure

So far so good. Now we want to look at what happens when something fails. First you get something like this ...

sorend@kovuru:~/Desktop/tmp$ pfexec pkg install IPSgvim
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                  58/58   5727/5727 121.15/121.15 

PHASE                                        ACTIONS
Install Phase                            14778/15536 A
ction install failed for 'opt/csw/lib/i386' (pkg://blastwave/IPScommon):
  OSError: [Errno 1] Not owner: '//opt/csw/lib/i386'
pkg: An unexpected error happened during installation: [Errno 1] Not owner: '//opt/csw/lib/i386'
The Boot Environment opensolaris failed to be updated. A snapshot was taken before the failed attempt and is mounted here /tmp/tmpYXxKFN.
 Use 'beadm unmount opensolaris_static:-:2008-08-21-13:32:22' and then 'beadm activate opensolaris_static:-:2008-08-21-13:32:22' 
if you wish to boot to this BE.
Traceback (most recent call last):
  File "/usr/bin/pkg", line 1734, in ?
    ret = main_func()
...

To clean up, first you need to cleanup the Boot Environment (BE), this can be done with the beadm command. Check which BE's are available using the command beadm list.

sorend@kovuru:~/Desktop/tmp$ beadm list
BE                                       Active Active on Mountpoint     Space 
Name                                            reboot                   Used 
----                                     ------ --------- ----------     -----
opensolaris_static:-:2008-08-21-13:32:22 no     no        /tmp/tmpYXxKFN 75.5K
opensolaris                              yes    yes       legacy         4.55G

Here you can see there is a opensolaris_static* environment, this is the one you want to remove. If it has a mountpoint, then we need to unmount it first (yes, that is "unmount", not "umount"). You can do that with beadm unmount opensolaris_static:-:2008-08-21-13:32:22. After this has been done, you use beadm destroy opensolaris_static:-:2008-08-21-13:32:22. It will ask you to confirm to remove it, you just say yes :-)

After the you have destroyed the BE, there is still the ZFS snapshots that the BE used left. Those are not destroyed automatically, so you need to do that manually aswell. You can use zfs list to view the available ZFS containers.

sorend@kovuru:~/Desktop/tmp$ zfs list
NAME                                                      USED  AVAIL  REFER  MOUNTPOINT
rpool                                                    5.89G  43.3G  56.5K  /rpool
rpool@install                                              19K      -  55.5K  -
rpool/ROOT                                               4.55G  43.3G    18K  /rpool/ROOT
rpool/ROOT@install                                         15K      -    18K  -
rpool/ROOT/opensolaris                                   4.55G  43.3G  3.38G  legacy
rpool/ROOT/opensolaris@install                            128M      -  2.48G  -
rpool/ROOT/opensolaris@static:-:2008-08-21-13:32:22      2.75M      -  3.38G  -
rpool/ROOT/opensolaris/opt                               1.04G  43.3G   962M  /opt
rpool/ROOT/opensolaris/opt@install                         73K      -  3.60M  -
rpool/ROOT/opensolaris/opt@static:-:2008-08-21-13:32:22  97.7M      -   821M  -
rpool/ROOT/opensolaris_static:-:2008-08-21-13:32:22      75.5K  43.3G  3.38G  legacy
rpool/ROOT/opensolaris_static:-:2008-08-21-13:32:22/opt      0  43.3G   821M  /opt
rpool/export                                             1.34G  43.3G    19K  /export
rpool/export@install                                       15K      -    19K  -
rpool/export/home                                        1.34G  43.3G  1.34G  /export/home
rpool/export/home@install                                  19K      -    21K  -

You see that there are some containers which have opensolaris_static* in their names. These are the ones you want to get rid of, and you can do that by the command zfs destroy containername. You do it for each of the snapshots. Thats it, you've cleaned up after a failed install.

I really hope they fix this to work better, since it is quite annoying, and the error messages are often hard to decipher.

Technorati Tags:

Posted by sorend at 1:15 PM in Stud.IT notes

 

[Trackback URL for this entry]

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
« August »
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
31