I was experimenting with building tiny container images and I tried to build one with rescue which should be ~13M based on the size of /rescue/rescue. I use pkgbase to install it but unfortunately it comes with a surprising amount of baggage: # m=$(mktemp -d) # pkg --rootdir $m install -y FreeBSD-rescue Updating FreeBSD repository catalogue... Fetching meta.conf: 100% 163 B 0.2kB/s 00:01 Fetching packagesite.pkg: 100% 6 MiB 6.7MB/s 00:01 pkg: Error opening the trusted directory /usr/share/keys/pkg/trusted pkg: Error loading trusted certificates Unable to update repository FreeBSD Updating FreeBSD-base repository catalogue... Fetching meta.conf: 100% 163 B 0.2kB/s 00:01 Fetching packagesite.pkg: 100% 30 KiB 30.6kB/s 00:01 Processing entries: 0% Processing entries: 100% FreeBSD-base repository update completed. 382 packages processed. Error updating repositories! pkg: Repository FreeBSD cannot be opened. 'pkg update' required The following 9 package(s) will be affected (of 0 checked): New packages to be INSTALLED: FreeBSD-clibs: 13.snap20221118212755 [FreeBSD-base] FreeBSD-libarchive: 13.snap20221114213305 [FreeBSD-base] FreeBSD-libbsm: 13.snap20221114213305 [FreeBSD-base] FreeBSD-libbz2: 13.snap20221020163203 [FreeBSD-base] FreeBSD-liblzma: 13.snap20221020163203 [FreeBSD-base] FreeBSD-libopie: 13.snap20221020163203 [FreeBSD-base] FreeBSD-openssl: 13.snap20221118212755 [FreeBSD-base] FreeBSD-rescue: 13.snap20221123214900 [FreeBSD-base] FreeBSD-runtime: 13.snap20221123214900 [FreeBSD-base] Number of packages to be installed: 9 The process will require 39 MiB more space. 17 MiB to be downloaded. [1/9] Fetching FreeBSD-libbsm-13.snap20221114213305.pkg: 100% 103 KiB 105.3kB/s 00:01 [2/9] Fetching FreeBSD-rescue-13.snap20221123214900.pkg: 100% 5 MiB 2.6MB/s 00:02 [3/9] Fetching FreeBSD-liblzma-13.snap20221020163203.pkg: 100% 78 KiB 79.4kB/s 00:01 [4/9] Fetching FreeBSD-runtime-13.snap20221123214900.pkg: 100% 5 MiB 2.5MB/s 00:02 [5/9] Fetching FreeBSD-libarchive-13.snap20221114213305.pkg: 100% 457 KiB 467.8kB/s 00:01 [6/9] Fetching FreeBSD-openssl-13.snap20221118212755.pkg: 100% 3 MiB 1.7MB/s 00:02 [7/9] Fetching FreeBSD-clibs-13.snap20221118212755.pkg: 100% 3 MiB 1.7MB/s 00:02 [8/9] Fetching FreeBSD-libopie-13.snap20221020163203.pkg: 100% 26 KiB 26.7kB/s 00:01 [9/9] Fetching FreeBSD-libbz2-13.snap20221020163203.pkg: 100% 37 KiB 37.6kB/s 00:01 Checking integrity... done (0 conflicting) [1/9] Installing FreeBSD-runtime-13.snap20221123214900... [1/9] Extracting FreeBSD-runtime-13.snap20221123214900: 100% [2/9] Installing FreeBSD-libbsm-13.snap20221114213305... [2/9] Extracting FreeBSD-libbsm-13.snap20221114213305: 100% [3/9] Installing FreeBSD-rescue-13.snap20221123214900... [3/9] Extracting FreeBSD-rescue-13.snap20221123214900: 100% [4/9] Installing FreeBSD-liblzma-13.snap20221020163203... [4/9] Extracting FreeBSD-liblzma-13.snap20221020163203: 100% [5/9] Installing FreeBSD-libarchive-13.snap20221114213305... [5/9] Extracting FreeBSD-libarchive-13.snap20221114213305: 100% [6/9] Installing FreeBSD-openssl-13.snap20221118212755... [6/9] Extracting FreeBSD-openssl-13.snap20221118212755: 100% [7/9] Installing FreeBSD-clibs-13.snap20221118212755... [7/9] Extracting FreeBSD-clibs-13.snap20221118212755: 100% [8/9] Installing FreeBSD-libopie-13.snap20221020163203... [8/9] Extracting FreeBSD-libopie-13.snap20221020163203: 100% [9/9] Installing FreeBSD-libbz2-13.snap20221020163203... [9/9] Extracting FreeBSD-libbz2-13.snap20221020163203: 100% # du -sh $m 51M /tmp/tmp.zHzHzH3p
Currently we put runtime as a dep for every packages. I don't think we need to do this, since we create the packages with -o ALLOW_BASE_SHLIBS=yes that should be enough. bapt what do you think ?
This is where we set the dep : https://cgit.freebsd.org/src/tree/release/packages/generate-ucl.sh#n98
Most things will be just fine without depending on runtime - any shared library dependencies should automatically pull in clibs etc. to resolve. On the other hand, this isn't super important - I can work around it by unpacking rescue into a staging environment and copying just what I need for the tiny image.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6933abc3e4bd316c1a10862d7dfc0688765fb723 commit 6933abc3e4bd316c1a10862d7dfc0688765fb723 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-12-08 10:55:39 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2022-12-08 19:02:41 +0000 pkgbase: Stop adding FreeBSD-runtime as a dep for every package shlib_required/provided is enough for the dependencies and this also causes problems for packages like rescue which shouldn't depend on runtime at all. PR: 268063 Sponsored by: Beckhoff Automation GmbH & Co. KG release/packages/generate-ucl.sh | 1 - 1 file changed, 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=a53b1150e4ec7aecc7970598dce0033ff26cafa1 commit a53b1150e4ec7aecc7970598dce0033ff26cafa1 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-12-08 10:55:39 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2023-02-02 09:34:47 +0000 pkgbase: Stop adding FreeBSD-runtime as a dep for every package shlib_required/provided is enough for the dependencies and this also causes problems for packages like rescue which shouldn't depend on runtime at all. PR: 268063 Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 6933abc3e4bd316c1a10862d7dfc0688765fb723) release/packages/generate-ucl.sh | 1 - 1 file changed, 1 deletion(-)