Differences between revisions 34 and 35
Revision 34 as of 2013-12-29 00:40:28
Size: 7841
Editor: JensKorte
Comment: added two words and changed link to man dpkg
Revision 35 as of 2014-01-16 19:32:55
Size: 9160
Editor: JensKorte
Comment: Use busybox
Deletions are marked like this. Additions are marked like this.
Line 198: Line 198:
== Use busybox built-ins instead of full packages ==
You can use the tiny busybox tools instead of installing full packages. Run ''busybox'' to see which applets are available. ''man busybox'' gives you details on each applets and which parameters are supported. e.g. ''busybox df'' starts the df applet from busybox.

=== Add busybox less to the Debian Alternatives System as pager ===
[[DebianAlternatives|Debian Alternatives System]] doesn't link to two words like "busybox less". If you just create a symbolic link in /usr/local/bin (''ln -s /bin/busybox /usr/local/bin/less'') then every time you call less, busybox less will be started since ''echo $PATH''
 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
The solution is to create a shell script named busybox.less that calls "busybox less $@".
{{{
cd /usr/local/bin
echo /bin/busybox less \$\@ >busybox.less
chmod +x busybox.less
echo 'export PAGER="pager" >>/etc/profile
#pager without -s because busybox less doesn't support -s (--squeeze-blank-lines), default is "pager -s"
update-alternatives --install /usr/bin/pager pager /usr/local/bin/busybox.less 40 \
          --slave /usr/share/man/man1/pager.1.gz pager.1.gz /usr/share/man/man1/busybox.1.gz
update-alternatives --config pager #activate "busybox less" manually
}}}

Reducing the size of the Debian Installation Footprint

It may be useful to reduce the size of the installation footprint on Embedded systems, or on older computers or laptops with limited drive space, or in cases where a small installation is preferred.

Remove non-critical packages

  • Except essential packages aptitude search '!?essential', you can remove what you don't need.

The following packages are non-critical and can be removed:

The following packages cannot be removed, even though marked as optional:

  • busybox (This is currently required by the kernel due to a dependency bug)

Reconfigure apt so that it does not install additional packages

Add the following entries to the /etc/apt/apt.conf configuration file:

APT::Install-Recommends "0" ; APT::Install-Suggests "0" ;

Replace packages with smaller equivalents

  • Replace packages with smaller equivalents :
    • debconf-english (replaces debconf-il8n)

    • levee (replaces nvi and vim-tiny)

    • lpr replaces lpr-ng or CUPS)

    • madplay (replaces mpg123, mpg321 and mp3-decoder)

    • mutt (replaces GUI MailUserAgent: Evolution, Thunderbird)

    • setmixer (replaces aumix)

    • slrn, tin (replaces GUI Usenet NewsReader)

    • irssi (replaces GUI IRC clients)

    • jed, xjed (replaces Emacs)

    • w3m, lynx, links (replaces GUI WebBrowser)

    • dash (replaces bash, this currently breaks)

Remove unwanted files at install time

Unwanted files, like most of the files from the following sections, can be removed at install time by using dpkg filters, see dpkg(1) --path-exclude and --path-include options.

Remove unnecessary locale files

The introduction of LanguagePacks (tdebs) may also help in reducing the size of the installation footprint.

  • It is recommended that the number of locale configurations installed is kept to a minimum. By limiting the number of locale files built you can save 90% of the space taken up by storing these systems on your system and saves the compilation time for building the locale settings for each package. A side effect or reducing the number of locale options is that the compilation of the glibc library gets a lot faster.

  • ToDo: complete this section

Note: See the dpkg filters.

Remove foreign language man files

With appropriate privileges, it is possible to remove the foreign man pages as follows:

rm -rf /usr/share/man/??
rm -rf /usr/share/man/??_*

Note: See the dpkg filters.

Remove unnecessary kernel modules

Remove unnecessary cups dependencies

Build a smaller kernel using fewer options

Reduce the size of the X installation footprint

  • You can remove the packages xserver-xorg-video-* that you don't use. you should still keep xserver-xorg-video-vesa.

Reduce the size of the initramfs

Remove unnecessary ipv6 files

If you are using only [ipv4] internally, then the following [ipv6] files can be removed:

  • /lib/xtables/libip6t_ah.so
  • /lib/xtables/libip6t_dst.so
  • /lib/xtables/libip6t_eui64.so
  • /lib/xtables/libip6t_frag.so
  • /lib/xtables/libip6t_hbh.so
  • /lib/xtables/libip6t_hl.so
  • /lib/xtables/libip6t_HL.so
  • /lib/xtables/libip6t_icmp6.so
  • /lib/xtables/libip6t_ipv6header.so
  • /lib/xtables/libip6t_LOG.so
  • /lib/xtables/libip6t_mh.so
  • /lib/xtables/libip6t_REJECT.so
  • /lib/xtables/libip6t_rt.so

Remove /etc/alternatives

If your applications have been mapped using traditional methods, then it is possible to remove the /etc/alternatives directory.

/!\ The gain is extremely minor, and there's no much point in doing this.

Replace the getty processes with the ngetty single process daemon

The getty processes can be replaced by the ngetty single process daemon to reduce virtual memory utilization:

Use busybox built-ins instead of full packages

You can use the tiny busybox tools instead of installing full packages. Run busybox to see which applets are available. man busybox gives you details on each applets and which parameters are supported. e.g. busybox df starts the df applet from busybox.

Add busybox less to the Debian Alternatives System as pager

Debian Alternatives System doesn't link to two words like "busybox less". If you just create a symbolic link in /usr/local/bin (ln -s /bin/busybox /usr/local/bin/less) then every time you call less, busybox less will be started since echo $PATH

  • /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

The solution is to create a shell script named busybox.less that calls "busybox less $@".

cd /usr/local/bin
echo /bin/busybox less \$\@ >busybox.less
chmod +x busybox.less
echo 'export PAGER="pager" >>/etc/profile
#pager without -s because busybox less doesn't support -s (--squeeze-blank-lines), default is "pager -s"
update-alternatives --install /usr/bin/pager pager /usr/local/bin/busybox.less 40 \
          --slave /usr/share/man/man1/pager.1.gz pager.1.gz /usr/share/man/man1/busybox.1.gz
update-alternatives --config pager #activate "busybox less" manually

Rebuilding packages using the Tiny C Compiler

Rebuilding packages using the Tiny C Compiler does not reduce size of packages. Differences between tcc and gcc