Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-72-2080473.1
Update Date:2017-11-27
Keywords:

Solution Type  Problem Resolution Sure

Solution  2080473.1 :   pkg command doesn't work due to /var/pkg/pkg5.image file corruption  


Related Items
  • SPARC SuperCluster T4-4 Full Rack
  •  
  • Solaris Operating System
  •  
Related Categories
  • PLA-Support>Sun Systems>SAND>Operating System>SN-SND: Sun OS Install and Upgrade
  •  




In this Document
Symptoms
Cause
Solution
References


Created from <SR 3-11730744671>

Applies to:

Solaris Operating System - Version 11 11/11 and later
SPARC SuperCluster T4-4 Full Rack
Information in this document applies to any platform.

Symptoms

'pkg' command used with any argument generates the following error:

# pkg publisher
Traceback (most recent call last):
 File "/usr/bin/pkg", line 6516, in handle_errors
   __ret = func(*args, **kwargs)
 File "/usr/bin/pkg", line 6474, in main_func
   api_inst = __api_alloc(mydir, provided_image_dir, pkg_image_used)
 File "/usr/bin/pkg", line 1470, in __api_alloc
   exact_match=exact_match)
 File "/usr/lib/python2.6/vendor-packages/pkg/client/api.py", line 353, in __init__
   cmdpath=self.cmdpath)
 File "/usr/lib/python2.6/vendor-packages/pkg/client/image.py", line 231, in __init__
   progtrack)
 File "/usr/lib/python2.6/vendor-packages/pkg/client/image.py", line 525, in find_root
   startd=startd, progtrack=progtrack)
 File "/usr/lib/python2.6/vendor-packages/pkg/client/image.py", line 837, in __set_dirs
   self.root)
UnsupportedImageError: The image rooted at / is invalid or is not supported by this version of the packaging system.


pkg: This is an internal error in pkg(5) version 73408dc40dc9.  Please log a
Service Request about this issue including the information above and this
message.

 

Cause

Corrupted pkg5.image on /var/pkg directory. Checking on that directory:
 

# cd /var/pkg
# ls -latr

(snip)
-rw-r--r-- 1 root root 2289 Nov 9 23:26 pkg5.image.1447108083.58
-rw-r--r-- 1 root root 2289 Nov 10 23:26 pkg5.image.1447194471.45
-rw-r--r-- 1 root root 2289 Nov 11 23:26 pkg5.image.1447280852.96
-rw-r--r-- 1 root root 2289 Nov 12 23:26 pkg5.image.1447367290.86
-rw-r--r-- 1 root root 2289 Nov 13 23:26 pkg5.image.1447453684.9
drwxr-xr-x 4 root root 6 Nov 13 23:28 state
drwxr-xr-x 2 root root 1152 Nov 13 23:28 history
-rw-r--r-- 1 root root 0 Nov 13 23:28 lock
drwxr-xr-x 5 root root 8 Nov 13 23:28 cache
-rw-r--r-- 1 root root 399 Nov 18 14:21 pkg5.image <<<
drwxr-xr-x 12 root root 359 Nov 18 14:21 .

# ls -l pkg5.image
-rw-r--r-- 1 root root 399 Nov 18 14:21 pkg5.image

 
The size of pkg5.image file is 399. Looking at backup files, their size is 2289. That is the correct size.
 

Solution

  1. Move the corrupt file to a backup in case we need it

    # cd /var/pkg
    # mv pkg5.image corrupt-Nov18-pkg5.image

  2. Copy the previous backup into place

    # cp -p pkg5.image.1447453684.9 pkg5.image

  3. Validate size

    # ls -l pkg5.image

  4. Clear and verify the SMF service,

    # svcadm clear svc:/application/pkg/system-repository:default
    # svcs svc:/application/pkg/system-repository:default

  5. Run pkg command to verify the issue is resolved

    # pkg info entire

 

If there are no backup files in /var/pkg directory, you can get that file from an old boot environment from same node or from a good known backup.

 

NOTE: The pkg5.image file is a text file. You should take a look at that file and check the contents because the file needs to match the repository.

 

References

<BUG:15747882> - SUNBT7100168 /VAR/PKG/PKG5.IMAGE FILE CORRUPTED AND SYSTEM-REPOSITORY LANDS INTO

Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback