[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: trimming changelogs



Hi,

Quoting Mo Zhou (2020-03-20 16:07:04)
> That said, I agree that we move a step further considering a slim base system
> in a more constructive way. Spontaneously, I'd raise such a question: Is the
> changelogs the only files to blame for the waste of precious space? Some
> packages contains lots of unnecessary HTML/PDF/.*
> documentations/resource/assets which are very likely useless on those
> low-storage systems. Who is going to read long documentations on a weak
> embedded device?
> 
> Here is my bold idea: we create a (new) special mode oriented for
> low-storage systems. For important packages (that exist in stage{3,4}),
> maintainers mark those unnecessary files as "trimmable". On
> installation, the dpkg automatically ignores the "trimmable" files
> once the "low-storage" mode has been toggled. For differnent "trimmable"
> files we can write different trimming helpers (such as the one for
> changelogs).
> 
> ^^^ In this way we may be able to solve all system storage headaches for
> people working on embedded device.
> 
> If we decide to invest our energy in trimming the base system, we should
> think about the "trimming stage3" problem in a more systematical way.

this is already possible using three different existing methods:

 1. move documentation to foo-doc packages

 2. do not build documentation with the nodocs build profile and if you need
    the resulting binary packages, host them on your own server

 3. use the dpkg --path-exclude option:
    https://raphaelhertzog.com/2010/11/15/save-disk-space-by-excluding-useless-files-with-dpkg/

As pabs already mentioned you can use mmdebstrap to create a Debian chroot that
includes even less than minbase, namely only Essential:yes packages and their
(transitive) dependencies. Together with --path-exclude you can thus do:

    $ mmdebstrap --variant=essential unstable essential.tar
    $ du -hs essential.tar
    84M	essential.tar

Using dpkg's --path-exclude option you can even go below that:

    $ mmdebstrap --variant=essential --dpkgopt='path-exclude=/usr/share/man/*' --dpkgopt='path-exclude=/usr/share/locale/*' --dpkgopt='path-exclude=/usr/share/doc/*' unstable essential.tar
    $ du -hs essential.tar
    51M	essential.tar

And if you are okay with ending up something that is not even Debian anymore,
you can even install less than essential like this for a busybox-like system:

    $ mmdebstrap --variant=custom \
        --include=base-files,base-passwd,busybox,debianutils,dpkg,libc-bin,mawk,tar \
        --setup-hook='mkdir -p "$1/bin"' \
        --setup-hook='for p in awk cat chmod chown cp diff echo env grep less ln mkdir mount rm rmdir sed sh sleep sort touch uname; do ln -s busybox "$1/bin/$p"; done' \
        --setup-hook='echo root:x:0:0:root:/root:/bin/sh > "$1/etc/passwd"' \
        --setup-hook='printf "root:x:0:\nmail:x:8:\nutmp:x:43:\n" > "$1/etc/group"' \
         unstable busybox.tar
    $ du -hs busybox.tar
    30M	busybox.tar

If you like, remove /usr/share/doc from the busybox system as well and go even
smaller than that. Is there still a problem?

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature


Reply to: