public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Gylstorff Quirin <quirin.gylstorff@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	isar-users@googlegroups.com, henning.schild@siemens.com
Subject: Re: [RFC 1/2] meta/classes: Add remove packages to rootfs postprocessing
Date: Mon, 24 Feb 2020 14:04:53 +0100	[thread overview]
Message-ID: <c6cc6460-b788-8a2c-a691-9e7082b89ef2@siemens.com> (raw)
In-Reply-To: <bbf6d0ac-eee9-753c-e8c1-8ac77aa63bdb@siemens.com>



On 2/21/20 7:28 PM, Jan Kiszka wrote:
> On 21.02.20 15:53, Q. Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> Remove non-essential packages to reduce the amount of packages
>> to be cleared. It can also to used to reduce the foot print
>> of a image.
> 
> Lacks documentation: This does not remove non-essential packages by 
> itself. It provides a configuration channel 
> (ROOTFS_PACKAGES_FORCE_REMOVE) to request arbitrary package removals. 
> That should be clearly described, along with the warning about this 
> weapon (expert tool).
> 
> Do you also have a set of removal candidates to share with users?
>

You mean something like this:

This function allows to remove non essential debian packages
even if there are dependencies to them.

The feature can be activate in a image or sdk rootfs by adding
`remove_packages` to the variable ROOTFS_FEATURES.

The packages you want to remove are added to
`ROOTFS_PACKAGES_FORCE_REMOVE` separated by a space. e.g.
ROOTFS_PACKAGES_FORCE_REMOVE = "example_package".

The following package are installed and are non-essential [1]:
adduser, apt, debian-archive-keyring, gcc-8-base, gpgv,
libapt-pkg5.0, libffi6, libgmp10, libgnutls30, libhogweed4,
libidn2-0, libnettle6, libp11-kit0, libsemanage-common,
libsemanage1, libsepol1, libstdc++6, libtasn1-6, libunistring2,
libustr-1.0-1, lsb-base, passwd, tzdata

Also removable are:
e2fsprogs[2]

The removal of a package depends on the given use-case and
should be executed by a expert user as it can leave the
system non-functional.

[1]: https://wiki.debian.org/BusterPriorityRequalification
[2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=474540




>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>>   meta/classes/image.bbclass  |  2 +-
>>   meta/classes/rootfs.bbclass | 13 +++++++++++++
>>   2 files changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>> index 6bcc6cd..62d6f46 100644
>> --- a/meta/classes/image.bbclass
>> +++ b/meta/classes/image.bbclass
>> @@ -60,7 +60,7 @@ image_do_mounts() {
>>   }
>>   ROOTFSDIR = "${IMAGE_ROOTFS}"
>> -ROOTFS_FEATURES += "copy-package-cache clean-package-cache 
>> finalize-rootfs generate-manifest"
>> +ROOTFS_FEATURES += "copy-package-cache clean-package-cache 
>> finalize-rootfs generate-manifest remove_packages"
>>   ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
>>   ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
>> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
>> index 64eaef7..0329f55 100644
>> --- a/meta/classes/rootfs.bbclass
>> +++ b/meta/classes/rootfs.bbclass
>> @@ -187,6 +187,19 @@ rootfs_postprocess_clean_package_cache() {
>>           /usr/bin/apt-get clean
>>       sudo rm -rf "${ROOTFSDIR}/var/lib/apt/lists/"*
>>   }
>> +ROOTFS_POSTPROCESS_COMMAND += 
>> "${@bb.utils.contains('ROOTFS_FEATURES', 'remove_packages', 
>> 'rootfs_rm_packages', '', d)}"
>> +rootfs_rm_packages () {
>> +    if [ -n "${ROOTFS_PACKAGES_FORCE_REMOVE}" ]; then
>> +        RMPKGS=$(sudo -E chroot "${ROOTFSDIR}" \
>> +              dpkg-query \
>> +              -f '${Package}\n' \
>> +              -W ${ROOTFS_PACKAGES_FORCE_REMOVE} 2>/dev/null || true)
>> +    fi
>> +    if [ -n "${RMPKGS}" ]; then
>> +        sudo -E chroot "${ROOTFSDIR}" \
>> +            dpkg --purge --force-depends ${RMPKGS}
>> +    fi
>> +}
>>   ROOTFS_POSTPROCESS_COMMAND += 
>> "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-manifest', 
>> 'rootfs_generate_manifest', '', d)}"
>>   rootfs_generate_manifest () {
>>
> 
> Jan
> 

-- 
Quirin Gylstorff

Siemens AG
Corporate Technology
Research in Digitalization and Automation
Smart Embedded Systems
CT RDA IOT SES-DE
Otto-Hahn-Ring 6
81739 Muenchen, Germany
Mobile: +49 173 3746683
mailto:quirin.gylstorff@siemens.com
www.siemens.com/ingenuityforlife

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim 
Hagemann Snabe; Managing Board: Joe Kaeser, Chairman, President and 
Chief Executive Officer; Roland Busch, Lisa Davis, Klaus Helmrich, 
Cedrik Neike, Michael Sen, Ralf P. Thomas; Registered offices: Berlin 
and Munich, Germany; Commercial registries: Berlin Charlottenburg, HRB 
12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322

Important notice: This e-mail and any attachment thereof contain 
corporate proprietary information. If you have received it by mistake, 
please notify us immediately by reply e-mail and delete this e-mail and 
its attachments from your system. Thank you.

  reply	other threads:[~2020-02-24 13:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 14:53 [RFC 0/2] Remove Packages during Postprocessing Q. Gylstorff
2020-02-21 14:53 ` [RFC 1/2] meta/classes: Add remove packages to rootfs postprocessing Q. Gylstorff
2020-02-21 18:28   ` Jan Kiszka
2020-02-24 13:04     ` Gylstorff Quirin [this message]
2020-02-21 14:53 ` [RFC 2/2] meta-isar/images: Remove gcc-8-base from rootfs Q. Gylstorff
2020-02-21 18:29   ` Jan Kiszka
2020-02-24 14:24 ` [RFC 0/2] Remove Packages during Postprocessing Henning Schild
2020-02-25  5:43   ` Gylstorff Quirin
2020-02-25 13:10     ` Henning Schild
2020-03-17 10:23       ` Gylstorff Quirin
2020-03-17 10:28         ` Jan Kiszka
2020-03-17 10:48       ` Gylstorff Quirin
2022-09-22  5:55     ` Balasubramanian Sundaram
2022-09-22  9:26       ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6cc6460-b788-8a2c-a691-9e7082b89ef2@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox