Virtual Guru's Blog – Home of Virtualization Workshops

December 21, 2009

OpenSolaris JeOS Prototype (Part 13: Remove most sized pkgs BE)

Filed under: jeos, opensolaris, virtualbox, Virtualization — natiku @ 5:26 am

This entry is part of OpenSolaris JeOS (Just Enough Operating System) Prototype workshop.

L2 osol0906size Remove Most Top Sized User Packages


L2 osol0906size Remove Most Top Sized User Packages

Lets try to uninstall most sized packages.

1. Create a BE osol0906size

beadm create  osol0906size
mkdir /tmp/osol0906size
beadm mount osol0906size /tmp/osol0906size

2. Getting installed packages install size and download size, ratio, package name , category and description

5775 pkg should provide parseable output access to size and csize

cat >/tmp/sizes.bash << EOF
#!/usr/bin/bash
pkg -R /tmp/osol0906size contents -H -t file,license,set -o "pkg.name,action.raw" \$1 | sed -e "s/variant.arch=i386//g" | sed \
-e "s/[\\":=]/ /g" | gawk 'BEGIN {CSUM=0;SUM=0;DESC="";CAT=""}
{ NAME = \$1; ++FSUM; \
for (i=1;i<NF;i++) if ( \$i ~ /^pkg.csize$/ ) { CSUM += \$(i+1)}
for (i=1;i<NF;i++) if( \$i ~ /^pkg.size$/ ) { SUM += \$(i+1)}
for (i=1;i<NF;i++) if ( \$i ~ /^org.opensolaris.category.2008$/ )  { for (a=(i+1);a<=NF;a++) {CAT = CAT" "\$(a) }} \
for (i=1;i<NF;i++) if ( \$i ~ /^description$/ )  { for (a=(i+2);a<=NF;a++) {DESC = DESC" "\$(a) }} \
}
END { RATIO=((CSUM/(SUM+1))*100);printf "%10d %2d %10d %10d %-30s '%-40s' %s\n", SUM,RATIO,CSUM,FSUM, NAME,CAT,DESC }'
EOF
chmod 0777 /tmp/sizes.bash
pkg -R /tmp/osol1108size list -H | awk '{print $1}' | xargs  -n 1 /tmp/sizes.bash >/tmp/allsized.lst

After some time I get file /tmp/allsizes.lst , sort them to able find most sized ones:

cat /tmp/allsizes.lst | sort -n -r | head -n 100
93819645 35   33308040        692 SUNWj6rt         Development/Java                JDK 6.0 Runtime Env. (1.6.0_13)
46114001 43   20059330        360 SUNWcsl          System/Core                        Core Solaris, (Shared Libs)
41052207 36   15134207        489 SUNWckr          System/Core                        Core Solaris Kernel
34972697 35   12537540      12708 SUNWman       System/Text Tools               On-Line Manual Pages
32438732 34   11111949       2680 SUNWuiu8        System/Internationalization    Iconv modules for UTF-8 Locale
27939000 32    9187114       2058 SUNWPython     Development/Python             The Python interpreter, libraries and utilities
25414652 38    9851619       1577 SUNWcs            System/Core                          Core Solaris 40 pkg.size 20
19904016 31    6199360        864 SUNWperl584usr Development/Perl                  Perl 5.8.4 (non-core)
cat /tmp/allsizes.lst | sort -n -r | head -n 100  > /tmp/osol0906size

3. Lets pplay with some larger sized packages, like evolutions

PS: You need to move some related virtual Meta Cluster packages too.

du -s -k /tmp/osol0908size/
2 946 956 /tmp/osol0906size/
pkg -R /tmp/osol0906size list | egrep "evolution" | grep -v evolution-data-server | awk '{ print $1}' | xargs \
-t pkg -R /tmp/osol0906size uninstall -nvr
pkg -R /tmp/osol906size uninstall -nvr SUNWevolution SUNWevolution-exchange \
SUNWevolution-jescs SUNWevolution-libs SUNWevolution-webcal
Before evaluation:
UNEVALUATED:
-pkg:/SUNWevolution@0.5.11,5.11-0.99:20081002T143237Z
-pkg:/SUNWevolution-exchange@0.5.11,5.11-0.99:20081002T143315Z
-pkg:/SUNWevolution-jescs@0.5.11,5.11-0.99:20081002T143303Z
-pkg:/SUNWevolution-libs@0.5.11,5.11-0.99:20081002T143315Z
-pkg:/SUNWevolution-webcal@0.5.11,5.11-0.99:20081002T143319Z
After evaluation:
pkg:/SUNWevolution@0.5.11,5.11-0.99:20081002T143237Z -> None
pkg:/SUNWevolution-exchange@0.5.11,5.11-0.99:20081002T143315Z -> None
pkg:/SUNWevolution-jescs@0.5.11,5.11-0.99:20081002T143303Z -> None
pkg:/SUNWevolution-libs@0.5.11,5.11-0.99:20081002T143315Z -> None
pkg:/SUNWevolution-webcal@0.5.11,5.11-0.99:20081002T143319Z -> None
pkg -R /tmp/osol0906size list | egrep "evolution" | grep -v evolution-data-server | awk '{ print $1}' | xargs \
-t pkg -R /tmp/osol0906size uninstall -r
du -s -k /tmp/osol0906size/
2 922 704 /tmp/osol0906size/

4. Execute similar command evalutioon and uninstall for Firefox and Thunderbird

pkg -R /tmp/osol0906size list | egrep "firefox" | awk '{ print $1}' | xargs \
-t pkq -R /tmp/osol1108size uninstall -r
du -s -k /tmp/osol0906size/
2 816 718 /tmp/osol0906size/
pkg -R /tmp/osol0906size list | egrep "thunderbird" | awk '{ print $1}' | xargs \
-t pkg -R /tmp/osol1108size uninstall -r
du -s -k /tmp/osol0906size/
2 727 866 /tmp/osol0906size/

5. Process with more selected by size user packages (also like this)

cat /tmp/allsizes.lst | grep compiz | sort -n -r
3687135     723224 SUNWcompiz-fusion-main
3251934    1951456 SUNWcompiz-fusion-extra
480961     136739 SUNWcompiz
45035      12056 SUNWlibcompizconfig
720       1116 SUNWcompizconfig-python
0        755 SUNWcompizconfig-gconf
pkg -R /tmp/osol0906size uninstall -nvr SUNWcompiz SUNWcompiz-fusion-extra \
SUNWcompiz-fusion-main SUNWcompizconfig-python SUNWlibcompizconfig SUNWcompizconfig-gconf
pkg -R /tmp/osol0906size uninstall -r SUNWcompiz SUNWcompiz-fusion-extra \
SUNWcompiz-fusion-main SUNWcompizconfig-python SUNWlibcompizconfig SUNWcompizconfig-gconf
du -s -k /tmp/osol0906size/
2 715 027 /tmp/osol0906size/

6. Check if we don’t have broken dependency

pkg -R /tmp/osol1108size verify | egrep "pkg:|depend:"

7. Now we need to repair uninstalled files by slim_install

cp /etc/pam.conf /tmp/osol0906size/etc/pam.conf.bck
cp  /etc/passwd /tmp/osol0906size/etc/passwd.bck
cp  /etc/shadow /tmp/osol0906size/etc/shadow.bck
cp /etc/user_attr /tmp/osol0906size/etc/user_attr.bck

8. BE is ready to boot into it and test your app there

cd /
beadm list osol0906size
BE           Active Mountpoint Space  Policy Created
--           ------ ---------- -----  ------ -------
osol0906size -      -          52.55M static 2008-10-23 13:11
beadm umount osol0906size
zfs list | grep osol0906size
rpool/ROOT/osol0906size  52.5M  11.2G  2.57G  /
Advertisements

1 Comment »

  1. […] L2 osol0906size Remove Most Top Sized User Packages […]

    Pingback by OpenSolaris JeOS (Main Page) « Virtual Guru's Blog – Home of Virtualization Workshops — February 7, 2010 @ 3:50 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: