Solaris 11 pkg fix is my new friend

Posted by user12611829 on Oracle Blogs See other posts from Oracle Blogs or by user12611829
Published on Wed, 12 Dec 2012 03:50:27 +0000 Indexed on 2012/12/12 5:11 UTC
Read the original article Hit count: 501

Filed under:
While putting together some examples of the Solaris 11 Automated Installer (AI), I managed to really mess up my system, to the point where AI was completely unusable. This was my fault as a combination of unfortunate incidents left some remnants that were causing problems, so I tried to clean things up. Unsuccessfully. Perhaps that was a bad idea (OK, it was a terrible idea), but this is Solaris 11 and there are a few more tricks in the sysadmin toolbox.

Here's what I did.

# rm -rf /install/*
# rm -rf /var/ai

# installadm create-service -n solaris11-x86 --imagepath /install/solaris11-x86 \
                 -s [email protected]

Warning: Service svc:/network/dns/multicast:default is not online.
   Installation services will not be advertised via multicast DNS.

Creating service from: [email protected]
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                1/1       130/130  264.4/264.4    0B/s

PHASE                                          ITEMS
Installing new actions                       284/284
Updating package state database                 Done 
Updating image state                            Done 
Creating fast lookup database                   Done 
Reading search index                            Done 
Updating search index                            1/1 

Creating i386 service: solaris11-x86

Image path: /install/solaris11-x86
So far so good. Then comes an oops.....
setup-service[168]: cd: /var/ai//service/.conf-templ: [No such file or directory]
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is where you generally say a few things to yourself, and then promise to quit deleting configuration files and directories when you don't know what you are doing. Then you recall that the new Solaris 11 packaging system has some ability to correct common mistakes (like the one I just made). Let's give it a try.
# pkg fix installadm
Verifying: pkg://solaris/install/installadm                     ERROR
        dir: var/ai
                Group: 'root (0)' should be 'sys (3)'
        dir: var/ai/ai-webserver
                Missing: directory does not exist
        dir: var/ai/ai-webserver/compatibility-configuration
                Missing: directory does not exist
        dir: var/ai/ai-webserver/conf.d
                Missing: directory does not exist
        dir: var/ai/image-server
                Group: 'root (0)' should be 'sys (3)'
        dir: var/ai/image-server/cgi-bin
                Missing: directory does not exist
        dir: var/ai/image-server/images
                Group: 'root (0)' should be 'sys (3)'
        dir: var/ai/image-server/logs
                Missing: directory does not exist
        dir: var/ai/profile
                Missing: directory does not exist
        dir: var/ai/service
                Group: 'root (0)' should be 'sys (3)'
        dir: var/ai/service/.conf-templ
                Missing: directory does not exist
        dir: var/ai/service/.conf-templ/AI_data
                Missing: directory does not exist
        dir: var/ai/service/.conf-templ/AI_files
                Missing: directory does not exist
        file: var/ai/ai-webserver/ai-httpd-templ.conf
                Missing: regular file does not exist
        file: var/ai/service/.conf-templ/AI.db
                Missing: regular file does not exist
        file: var/ai/image-server/cgi-bin/cgi_get_manifest.py
                Missing: regular file does not exist
Created ZFS snapshot: 2012-12-11-21:09:53
Repairing: pkg://solaris/install/installadm                  
Creating Plan (Evaluating mediators): |

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                1/1           3/3      0.0/0.0    0B/s

PHASE                                          ITEMS
Updating modified actions                      16/16
Updating image state                            Done 
Creating fast lookup database                   Done 
In just a few moments, IPS found the missing files and incorrect ownerships/permissions. Instead of reinstalling the system, or falling back to an earlier Live Upgrade boot environment, I was able to create my AI services and now all is well.
# installadm create-service -n solaris11-x86 --imagepath /install/solaris11-x86 \
                   -s [email protected]
Warning: Service svc:/network/dns/multicast:default is not online.
   Installation services will not be advertised via multicast DNS.

Creating service from: [email protected]
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                1/1       130/130  264.4/264.4    0B/s

PHASE                                          ITEMS
Installing new actions                       284/284
Updating package state database                 Done 
Updating image state                            Done 
Creating fast lookup database                   Done 
Reading search index                            Done 
Updating search index                            1/1 

Creating i386 service: solaris11-x86

Image path: /install/solaris11-x86

Refreshing install services
Warning: mDNS registry of service solaris11-x86 could not be verified.

Creating default-i386 alias

Setting the default PXE bootfile(s) in the local DHCP configuration
to:
bios clients (arch 00:00):  default-i386/boot/grub/pxegrub


Refreshing install services
Warning: mDNS registry of service default-i386 could not be verified.

# installadm create-service -n solaris11u1-x86 --imagepath /install/solaris11u1-x86 \
                    -s [email protected]
Warning: Service svc:/network/dns/multicast:default is not online.
   Installation services will not be advertised via multicast DNS.

Creating service from: [email protected]
DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                1/1       514/514  292.3/292.3    0B/s

PHASE                                          ITEMS
Installing new actions                       661/661
Updating package state database                 Done 
Updating image state                            Done 
Creating fast lookup database                   Done 
Reading search index                            Done 
Updating search index                            1/1 

Creating i386 service: solaris11u1-x86

Image path: /install/solaris11u1-x86

Refreshing install services
Warning: mDNS registry of service solaris11u1-x86 could not be verified.

# installadm list

Service Name    Alias Of      Status  Arch   Image Path 
------------    --------      ------  ----   ---------- 
default-i386    solaris11-x86 on      i386   /install/solaris11-x86
solaris11-x86   -             on      i386   /install/solaris11-x86
solaris11u1-x86 -             on      i386   /install/solaris11u1-x86


This is way way better than pkgchk -f in Solaris 10. I'm really beginning to like this new IPS packaging system.

© Oracle Blogs or respective owner

Related posts about /Solaris