Hi Gregory,

This seems like the bug:

6445261  Can not install zones after removing KU 118833-17

I think you might have 119254-(24-29) in the system and you might have done a 
couple of patchadd/patchrm of KU patch. Then the pkgmap gets corrupted and 
SUNWcsr doesn't install in the zone. As a result so many required files are 
absent in the zone and zone fails to boot.

This bug is fixed and patches are available.
119254-31 for sparc
119255-31 for x86.

But the patches doesn't hold good for systems which are already affected

I can give you a script(attached) that can correct the corrupted pkgmaps in the 
system that is already affected. I have written this for myself when my system 
was corrupted. probably you can modify it also.

fix_pkgmap on command line will give you all the options

Basically the options are:
-v : verbose
-f filename: where the file should have list of packages which needs to be 
corrected one per line.
-p package list : you can give a package list so that all the packages in the 
list will be corrected
-r : In case if the pkgmap gets corrupted due to this script, you can run this 
option to restore the old files.

the options -r -f and -p are mutaully exclusive. The first option seen will be 
taken into account. And -v should be the first option if you want verbose 
output. Log will be there in the /tmp/fix_pkgmap.log

I have done some round of testing and it seems to work fine.
running the script with out any option would scan all the packages in the 
System and correct those corrupted pkgmaps. This is too slow, and can take 
about 20 minutes, but is the best option when the Customer doesn't know which 
all packages are corrupted.
Do let me know if you have any issues on this.


Thanks
Vineeth


Gregory Edwards - Software Support wrote:
Sun Fire 3800


SunOS netd38 5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Fire

Can't boot a zone after it has been created.

------snip------

I copied /etc/mnttab and /etc/vfstab and it could boot but still other essentials are missing such as the /etc/passwd.

NETD38 # zoneadm -z netd08 install
Preparing to install zone <netd08>. Creating list of files to copy from the global zone. Copying <2577> files to the zone. Initializing zone product registry. Determining zone package initialization order. Preparing to initialize <1058> packages on the zone. Initialized <1058> packages on zone. Zone <netd08> is initialized. Installation of these packages generated errors: <SUNWckr SUNWcsr SUNWcsd SUNWdtdmr SUNWkrbr SUNWib SUNWusb SUNWssad> Installation of <3> packages was skipped. Installation of these packages generated warnings: <SUNWpprou SUNWman SUNWfontconfig-docs SUNWperl-xml-parser-devel-share SUNWsfman> The file </zones/netd08/root/var/sadm/system/logs/install_log> contains a log of the zone installation. NETD38 # zoneadm -z netd08 boot zoneadm: zone 'netd08': mount of /etc/mnttab failed: No such file or directory zoneadm: zone 'netd08': call to zoneadmd failed NETD38 # zoneadm -z netd08 boot zoneadm: zone 'netd08': mount of /etc/mnttab failed: No such file or directory zoneadm: zone 'netd08': call to zoneadmd failed NETD38 # cp /zones/netd11/root/etc/mnttab /zones/netd08/root/etc/mnttab NETD38 # cp /zones/netd11/root/etc/vfstab /zones/netd08/root/etc/vfstab NETD38 # zoneadm -z netd08 boot


We were having problems with our Sun 4620 disk system and were told that if our system was patched above 118833-17 we would experience the problem we had. So we used updatemanager to backout 118833-xx patches but it only went to 118833-18 so we went back to 118833-23 and then did an installation of 118833-24 and still we can't create zones.

/zones/netd08/root/var/sadm/system/logs/install_log

----snip----

*** package <SUNWckr> failed to install - interrupted:

pkgadd: ERROR: duplicate pathname <i.sdconf>
pkgadd: ERROR: unable to process pkgmap

Installation of <SUNWckr> on zone <netd08> failed (internal error).
No changes were made to the system.


*** package <SUNWcnetr> successfully installed.

*** package <SUNWcsl> successfully installed.

*** package <SUNWcsr> failed to install - interrupted:

pkgadd: ERROR: duplicate pathname <i.preserve>
pkgadd: ERROR: duplicate pathname <i.rbac>
pkgadd: ERROR: duplicate pathname <i.voldconf>
pkgadd: ERROR: unable to process pkgmap

Installation of <SUNWcsr> on zone <netd08> failed (internal error).
No changes were made to the system.

pkgadd: ERROR: duplicate pathname <i.preserve>
pkgadd: ERROR: duplicate pathname <i.rbac>
pkgadd: ERROR: duplicate pathname <i.voldconf>
pkgadd: ERROR: unable to process pkgmap

Installation of <SUNWcsr> on zone <netd08> failed (internal error).
No changes were made to the system.


*** package <SUNWcsu> successfully installed.

*** package <SUNWxwice> successfully installed.

*** package <SUNWcsd> failed to install - interrupted:

pkgadd: ERROR: duplicate pathname <i.drvalias>
pkgadd: ERROR: duplicate pathname <i.minorperm>
pkgadd: ERROR: duplicate pathname <i.nametomajor>
pkgadd: ERROR: unable to process pkgmap

Installation of <SUNWcsd> on zone <netd08> failed (internal error).
No changes were made to the system.

---snip----

Any suggestions?


#!/usr/bin/ksh
NAWK=/usr/bin/nawk
RM=/usr/bin/rm
LS=/usr/bin/ls
SUM=/usr/bin/sum
GREP=/usr/bin/grep

PKG=""
PKGNAME=""
VERBOSE=0
AFFECTED_PKG=""
CLD_NOT_CORRECT_PKG=""
PKGDIR=/var/sadm/pkg
LOG=/tmp/fix_pkgmap.log
function is_classaction_script
{
        echo $1|$GREP "^i\." > /dev/null
        return $?
}
function correct_pkgmap
{
name_old=""
line_old=""
sum_old=""
size_old=""
ADDED=0
ADDED_C=0
cp $PKG/pkgmap $PKG/pkgmap.bak
PKGMAP=$PKG/pkgmap
NEWPKGMAP=$PKG/pkgmap.new
INSTALLDIR=$PKG/install
[ "$VERBOSE" = 1 ] && echo "Processing package $PKGNAME"
[ "$VERBOSE" = 0 ] && printf "*"
while read line;do
        name=`echo $line | $NAWK '{print $3}'`
        if [[ "$name" = "deletes" ]]; then
                [ "$VERBOSE" = 1 ] && echo "Deletes file found in pkgmap"
                if [[ -f $INSTALLDIR/deletes ]]; then
                        [ "$VERBOSE" = 1 ] && echo "$PKGNAME: deletes file 
found in install dir"
                        echo $line >> $NEWPKGMAP
                else
                        [ "$VERBOSE" = 1 ] && echo "$PKGNAME: deletes file not 
found in the Install directory. Removing it from pkgmap"
                        echo "$PKGNAME: deletes file not found in the Install 
directory. Removing it from pkgmap" >> $LOG
                        [ "$ADDED" = 0 ] && AFFECTED_PKG="$AFFECTED_PKG$PKGNAME 
" && ADDED=1
                fi
        elif is_classaction_script  $name; then
                size=`echo $line |$NAWK '{ print $4}'`
                sum=`echo $line |$NAWK '{ print $5}'`
                if [[ -f "$INSTALLDIR/$name" ]]; then
                        tmp_size=`$LS -l $INSTALLDIR/$name|$NAWK '{print $5}'`
                        tmp_sum=`$SUM $INSTALLDIR/$name|$NAWK '{print $1}'`
                else
                        [ "$VERBOSE" = 1 ] && echo "$PKGNAME: Removing the file 
$name. Not present in the System"
                        echo "$PKGNAME: Removing the file $name. Not present in 
the System" >> $LOG
                        [ "$ADDED" = 0 ] && AFFECTED_PKG="$AFFECTED_PKG$PKGNAME 
" && ADDED=1
                        continue
                fi
                if [[ "$name_old" = "$name" ]]; then
                        [ "$VERBOSE" = 1 ] && echo "$PKGNAME: Duplicate file 
entry for $name. Checking for the correct one."
                        if [[ "$sum" = "$tmp_sum" ]]; then
                                echo $line >> $NEWPKGMAP
                                echo "$PKGNAME: Duplicate file entry for $name 
deleted" >> $LOG
                                [ "$ADDED" = 0 ] && 
AFFECTED_PKG="$AFFECTED_PKG$PKGNAME " && ADDED=1
                        elif [[ "$sum_old" = "$tmp_sum" ]]; then
                                echo $line_old >> $NEWPKGMAP
                                echo "$PKGNAME: Duplicate file entry for $name 
deleted" >> $LOG
                                [ "$ADDED" = 0 ] && 
AFFECTED_PKG="$AFFECTED_PKG$PKGNAME " && ADDED=1
                        else
                                echo $line_old >> $NEWPKGMAP
                                echo $line >> $NEWPKGMAP
                                [ "$VERBOSE" = 1 ] && echo "$PKGNAME: None of 
the entries in the pkgmap matches for file $name"
                                [ "$VERBOSE" = 1 ] && echo "$PKGNAME: Keeping 
both the instances. Remove it Manually from package $PKG"
                                [ "$ADDED_C" = 0 ] && 
CLD_NOT_CORRECT_PKG="$CLD_NOT_CORRECT_PKG$PKGNAME " && ADDED_C=1
                                echo "$PKGNAME: None of the entries in the 
pkgmap matches for file $name" >> $LOG
                                echo "$PKGNAME: Keeping both the instances. 
Remove it Manually from package $PKG" >> $LOG
                        fi
                        name_old=""
                        line_old=""
                        sum_old=""
                        size_old=""
                else 
                        if ! [[  "$name_old" = "" ]]; then
                                echo $line_old >> $NEWPKGMAP
                        fi
                        name_old=$name
                        line_old=$line
                        sum_old=$sum
                        size_old=$size
                        
                fi
                        
        else
                echo $line >> $NEWPKGMAP
        fi

done < $PKGMAP 
mv $NEWPKGMAP $PKGMAP
}

function print_usage
{
cat << EOF
                Usage: fix_pkgmap [-v] [-f filename] [-p packagename] [-r]
                        -f -r and -p are mutually exclusive. Script will 
process 
                        only the first argument recieved.
                -v: Verbose mode. This has to be the first argument if given.
                -f: specify a file name which has a list of packages to be 
corrected one per line
                -p: Specify the packages to be corrected.
                -r: Restore the pkgmap to the old one in case any pkgmao got 
corrupted.

                By default if no options given, script processes all packages 
in the System.
EOF
}

function print_details
{
        echo "Affected packages are: "
        echo "<$AFFECTED_PKG>"
        if [[ "$CLD_NOT_CORRECT_PKG" != "" ]]; then
                echo "Packages which could not be corrected are:"
                echo "<$CLD_NOT_CORRECT_PKG>"
                echo "Correct the pkgmap file manually"
        fi
        echo "See the logfile /tmp/fix_pkgmap.log for details"
}
##############################
# Main Routine
##############################

$RM -rf $LOG
echo "Checking for corrupt pkgmaps and correcting if possible..."
# Parse the arguments
while [ "$1" != "" ]; do
        case $1 in
                -v)     VERBOSE=1
                        shift;;
                -p)     shift;
                        PKGNAMELIST=$*;
                        for PKGNAME in $PKGNAMELIST; do
                                PKG="$PKGDIR/$PKGNAME/save/pspool/$PKGNAME"
                                if [[ -d "$PKG" ]]; then
                                        correct_pkgmap
                                else
                                        echo "Package $PKGNAME not found. 
Skipping.. "
                                fi
                        done
                        printf "\n"
                        print_details
                        exit 0;
                        shift;;
                -f)     shift;
                        FILENAME=$1;
                        while read PKGNAME; do
                                PKG="$PKGDIR/$PKGNAME/save/pspool/$PKGNAME"
                                if [[ -d "$PKG" ]]; then
                                         correct_pkgmap
                                else
                                        echo "Package $PKGNAME vot found.Not 
processed"
                                fi
                        done < "$FILENAME"
                        print_details
                        printf "\n"
                        exit 0;
                        shift;;
                -r)     echo "Restoring to previous state.."
                        for i in $PKGDIR/*;do
                                PKGNAME=`basename $i`
                                PKG=$i/save/pspool/$PKGNAME/
                                if [[ -f "$PKG/pkgmap.bak" ]]; then
                                        mv $PKG/pkgmap.bak $PKG/pkgmap
                                        echo "Recoverd package: $PKGNAME"
                                fi
                        done
                        exit 0
                        shift;;
                -h)     print_usage
                        exit 0
                        shift;;
                -*)     print_usage
                        exit 1;
                        shift;;
                 *)     print_usage
                        exit 1;
                        shift;;
        esac
done  

for i in $PKGDIR/*; do
        PKGNAME=`basename $i`
        PKG=$i/save/pspool/$PKGNAME
        if [[ -d "$i/save/pspool/$PKGNAME" ]]; then
                correct_pkgmap
        fi
done
printf "\n"
print_details
exit 0
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to