Tuesday Dec 11, 2012

Solaris 11 pkg fix is my new friend

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 solaris-auto-install@5.11-0.175.0

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

Creating service from: solaris-auto-install@5.11-0.175.0
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 solaris-auto-install@5.11-0.175.0
Warning: Service svc:/network/dns/multicast:default is not online.
   Installation services will not be advertised via multicast DNS.

Creating service from: solaris-auto-install@5.11-0.175.0
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 solaris-auto-install@5.11-0.175.1
Warning: Service svc:/network/dns/multicast:default is not online.
   Installation services will not be advertised via multicast DNS.

Creating service from: solaris-auto-install@5.11-0.175.1
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.
About

Bob Netherton is a Principal Sales Consultant for the North American Commercial Hardware group, specializing in Solaris, Virtualization and Engineered Systems. Bob is also a contributing author of Solaris 10 Virtualization Essentials.

This blog will contain information about all three, but primarily focused on topics for Solaris system administrators.

Please follow me on Twitter Facebook or send me email

Search

Archives
« December 2012 »
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
29
30
31
     
Today