Still trimming down Suse installation... :-(
Hi, I hope I'm not too annoying in trying to slim down SuSE installation and taking your time. I did scenario with SuSE Rescue image, added kernel and grub, but I'm somehow scared that I missed some important dependencies.... I can share notes if anyone is interested (but beware "Newbie on the work" style). Also if I want to add some package, there are a lot of dependencies and it's hard to decide which to ignore and which not. So I guess that I'd want to have minimal system with dependencies satisfied, but in that case Rescue image grows really fast... I got advice to go on another route. To take minimal install (Why SuSE installs default system with KDE, although one can comment that out in installation process?) and then delete all unneeded packages. But here comes dependency hell. Each package requires or depends on another and sooner or later you want to erase one part of yast and then whole yast in second dependency level... Any better way to do this? Should I ignore dependencies ? Is there any convenient way to get minimal base system install and proceed from there? I'd like to fit system on CF card, so I'm seeking for smaller size of distro... Thanks in advance for your patience, regards, Rob.
"Robert Rozman"
Hi,
I hope I'm not too annoying in trying to slim down SuSE installation and
taking your time.
I got advice to go on another route. To take minimal install (Why SuSE installs default system with KDE, although one can comment that out in installation process?) and then delete all unneeded packages. But here comes dependency hell. Each package requires or depends on another and sooner or later you want to erase one part of yast and then whole yast in second dependency level... Any better way to do this? Should I ignore dependencies ?
Is there any convenient way to get minimal base system install and
In fact I would suggest to start with selecting the minimal system. To avoid dependency problem, you should then remove the packages using yast, and not 'rpm -e', as yast take into account dependency proceed
from there? I'd like to fit system on CF card, so I'm seeking for smaller size of distro...
The fact is that I'm not sure Suse is the distribution more adapted for that kind of job Gaël
On Tuesday 05 April 2005 12:53 pm, Robert Rozman wrote:
I got advice to go on another route. To take minimal install (Why SuSE installs default system with KDE, although one can comment that out in installation process?) and then delete all unneeded packages. But here comes dependency hell. Each package requires or depends on another and sooner or later you want to erase one part of yast and then whole yast in second dependency level... Any better way to do this? Should I ignore dependencies ?
I've done this before (I've also created small distros from scratch). Here's my preferred method: Make a directory to work in and make the following subdirectories under it: RPMS/ root/ custom/ config/ scripts/ Make a config file under config containing some variables: BASEDIR="/path/to/your/work/directory" ROOTDIR="$BASEDIR/root" RPMDIR="$BASEDIR/RPMS" ... and so on... Put all of the SUSE packages in RPMS Make a list of packages you want and put it in the file config/packages, one per line, just the names (no versions) Make a script under scripts to install the RPMS in $ROOTDIR: #!/bin/bash # Source your config variables (assuming you're running this script from the # main work directory) . config/config # Clear out directory so we start fresh if [ -z $ROOTDIR ] ; then echo "ROOTDIR not defined" exit 1 fi rm -rf $ROOTDIR mkdir $ROOTDIR # Get filenames for requested packages RPMFILES="" for pkgname in `cat config/packages` ; do for rpmfile in $RPMDIR/$pkgname-* ; do if [ `rpm -qp --queryformat '%{NAME}' $rpmfile` = $pkgname ] ; then RPMFILES="$RPMFILES $rpmfile" break fi done done # Create some initial directories for d in etc var/lib/rpm tmp dev ; do mkdir -p $ROOTDIR/$d done # Initialise rpm db rpm --root=$ROOTDIR --initdb # Install packages under $ROOTDIR rpm --root=$ROOTDIR --excludedocs -Uvh $RPMFILES ######### end This attempts to install the requested rpms leaving out any files marked %doc. It will definitely fail the first time, so keep adding needed packages to config/packages as necessary until everything installs ok. This will take a while, but you will be sure you have the necessary dependencies and you gain a better understanding of what goes in a Linux system. Now create a file, config/removelist, containing a list of directories and files left over that you want to remove (including rpm, which you no longer need at this point): /usr/share/man /usr/share/doc /bin/rpm /var/lib/rpm /usr/lib/rpm ... and so on... I use mc to browse the resulting filesystem to look for binaries and other filesI don't need. Remove them like this: for f in `cat config/removelist` ; do rm -rf $ROOTDIR/$f done Now put any files you want to add or overwrite (config files, scripts, etc) in their target directories under the custom directory. To add them to the root system do cp -a $CUSTOMDIR/* $ROOTDIR Now you can make a script to format your CF device and copy the resulting system to it. While that all looks like a lot of work, it's worth it. You will be able to reproduce your image at any time and you will never get into the situation where you tweaked something and forgot about it 3 months later. Also, upgrading rpms is easy. Just replace with newer packages and rebuild. At this point your system will be roughly equivalent to SUSE's rescue system, but if it's not small enough, you can go further. One thing you can do is replace a lot of stuff with Busybox. Busybox is a program that contains the functionality of a *lot* of standard commands in one small binary. To use it, simply replace your binaries with symlinks to busybox. Say busybox is installed in /bin/busybox. Your /bin might look like this: lrwxrwxrwx 1 root root 7 Dec 31 1969 ash -> busybox -rwxr-xr-x 1 root root 204252 Dec 31 1969 busybox lrwxrwxrwx 1 root root 7 Dec 31 1969 cat -> busybox lrwxrwxrwx 1 root root 7 Dec 31 1969 cp -> busybox ... and so on... As you can imagine, you will save a lot of space this way. Another thing you can do is get rid of libraries you don't need, such as openldap. To do this you need to rebuild packages that depend on it. To find out which packages to rebuild, do this: rpm -q --whatrequires libldap.so.2 Grab the source packages, edit the spec files, and modify the ./configure lines. If you see a '--with-ldap' or similar, remove it and rebuild. If you don't see a '--with' option, you may have add '--without-ldap' or similar. Use ./configure --help to see what you can do here. Finally, you can save even more space by using a cramfs image for parts of the filesystem that will not change. This can get a bit complicated because you can't write to a cramfs. You'd have to split the system into writeable and non-writeable areas and make a custom initrd that mounts the cramfs filesystem, then the writeable areas. I once made a minimal system where I copied /etc and /root to /var, created symlinks for them, tarred all of /var to a file on the cramfs, then removed everything under /var. The initrd mounted the cramfs, mounted a ramfs on /var, and untarred the file to the ramfs. Of course, since you're using Asterisk, you'd probably want your writable directories persistent, so you could use a separate partition instead of the ramfs+tarball approach I used. Hope that helps, -- James Oakley Engineering - SolutionInc Ltd. joakley@solutioninc.com http://www.solutioninc.com
James, I realize I'm top posting, but I have nothing to add or comment on what you've written and want people to see this first... What you've given us is a gem, and doesn't even need much polishing... Have you considered submitting it as a mini-howto? I'm definitely going to keep this one around. Jim Cunning Today at 4:22pm, James Oakley wrote:
On Tuesday 05 April 2005 12:53 pm, Robert Rozman wrote:
I got advice to go on another route. To take minimal install (Why SuSE installs default system with KDE, although one can comment that out in installation process?) and then delete all unneeded packages. But here comes dependency hell. Each package requires or depends on another and sooner or later you want to erase one part of yast and then whole yast in second dependency level... Any better way to do this? Should I ignore dependencies ?
I've done this before (I've also created small distros from scratch).
Here's my preferred method:
Make a directory to work in and make the following subdirectories under it:
RPMS/ root/ custom/ config/ scripts/
Make a config file under config containing some variables:
BASEDIR="/path/to/your/work/directory" ROOTDIR="$BASEDIR/root" RPMDIR="$BASEDIR/RPMS" ... and so on...
Put all of the SUSE packages in RPMS
Make a list of packages you want and put it in the file config/packages, one per line, just the names (no versions)
Make a script under scripts to install the RPMS in $ROOTDIR:
#!/bin/bash # Source your config variables (assuming you're running this script from the # main work directory) . config/config
# Clear out directory so we start fresh if [ -z $ROOTDIR ] ; then echo "ROOTDIR not defined" exit 1 fi rm -rf $ROOTDIR mkdir $ROOTDIR
# Get filenames for requested packages RPMFILES="" for pkgname in `cat config/packages` ; do for rpmfile in $RPMDIR/$pkgname-* ; do if [ `rpm -qp --queryformat '%{NAME}' $rpmfile` = $pkgname ] ; then RPMFILES="$RPMFILES $rpmfile" break fi done done
# Create some initial directories for d in etc var/lib/rpm tmp dev ; do mkdir -p $ROOTDIR/$d done
# Initialise rpm db rpm --root=$ROOTDIR --initdb
# Install packages under $ROOTDIR rpm --root=$ROOTDIR --excludedocs -Uvh $RPMFILES
######### end
This attempts to install the requested rpms leaving out any files marked %doc. It will definitely fail the first time, so keep adding needed packages to config/packages as necessary until everything installs ok. This will take a while, but you will be sure you have the necessary dependencies and you gain a better understanding of what goes in a Linux system.
Now create a file, config/removelist, containing a list of directories and files left over that you want to remove (including rpm, which you no longer need at this point):
/usr/share/man /usr/share/doc /bin/rpm /var/lib/rpm /usr/lib/rpm ... and so on...
I use mc to browse the resulting filesystem to look for binaries and other filesI don't need.
Remove them like this:
for f in `cat config/removelist` ; do rm -rf $ROOTDIR/$f done
Now put any files you want to add or overwrite (config files, scripts, etc) in their target directories under the custom directory. To add them to the root system do
cp -a $CUSTOMDIR/* $ROOTDIR
Now you can make a script to format your CF device and copy the resulting system to it.
While that all looks like a lot of work, it's worth it. You will be able to reproduce your image at any time and you will never get into the situation where you tweaked something and forgot about it 3 months later. Also, upgrading rpms is easy. Just replace with newer packages and rebuild.
At this point your system will be roughly equivalent to SUSE's rescue system, but if it's not small enough, you can go further.
One thing you can do is replace a lot of stuff with Busybox. Busybox is a program that contains the functionality of a *lot* of standard commands in one small binary. To use it, simply replace your binaries with symlinks to busybox. Say busybox is installed in /bin/busybox. Your /bin might look like this:
lrwxrwxrwx 1 root root 7 Dec 31 1969 ash -> busybox -rwxr-xr-x 1 root root 204252 Dec 31 1969 busybox lrwxrwxrwx 1 root root 7 Dec 31 1969 cat -> busybox lrwxrwxrwx 1 root root 7 Dec 31 1969 cp -> busybox ... and so on...
As you can imagine, you will save a lot of space this way.
Another thing you can do is get rid of libraries you don't need, such as openldap. To do this you need to rebuild packages that depend on it. To find out which packages to rebuild, do this:
rpm -q --whatrequires libldap.so.2
Grab the source packages, edit the spec files, and modify the ./configure lines. If you see a '--with-ldap' or similar, remove it and rebuild. If you don't see a '--with' option, you may have add '--without-ldap' or similar. Use ./configure --help to see what you can do here.
Finally, you can save even more space by using a cramfs image for parts of the filesystem that will not change. This can get a bit complicated because you can't write to a cramfs. You'd have to split the system into writeable and non-writeable areas and make a custom initrd that mounts the cramfs filesystem, then the writeable areas.
I once made a minimal system where I copied /etc and /root to /var, created symlinks for them, tarred all of /var to a file on the cramfs, then removed everything under /var. The initrd mounted the cramfs, mounted a ramfs on /var, and untarred the file to the ramfs.
Of course, since you're using Asterisk, you'd probably want your writable directories persistent, so you could use a separate partition instead of the ramfs+tarball approach I used.
Hope that helps,
The Wednesday 2005-04-06 at 12:45 -0700, Jim Cunning wrote:
I realize I'm top posting, but I have nothing to add or comment on what you've written and want people to see this first...
Yes, but you are forcing hundreds of people to download again 9 kb that we already have. Please delete uneeded (ie, repeated) text.
What you've given us is a gem, and doesn't even need much polishing... Have you considered submitting it as a mini-howto? I'm definitely going to keep this one around.
Agreed. -- Cheers, Carlos Robinson
On Wednesday 06 April 2005 4:45 pm, Jim Cunning wrote:
What you've given us is a gem, and doesn't even need much polishing... Have you considered submitting it as a mini-howto?
No, but maybe I should. It would give me a reason to play with Conglomerate. Maybe I could call it "Debigulation HOWTO" :-) -- James Oakley Engineering - SolutionInc Ltd. joakley@solutioninc.com http://www.solutioninc.com
Hi, thanks again for informations.... As newbie I'd kindly ask if you're willing to share any package listings that work to get me going (I'd prefer minimal system that boots and works - maybe similar to Suse Rescue - has anyone idea how Rescue image is produced ?). Also I'd kindly ask if you can give more info on how to use and make image in /root/ bootable on disk partition. Is installation of kernel and grub enough on root partition or should there be any other procedures done ? Thanks in advance, regards, Rob.
participants (5)
-
Carlos E. R.
-
g.lams@itcilo.org
-
James Oakley
-
Jim Cunning
-
Robert Rozman