Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新的debian镜像相对于之前太大了 #25

Closed
zhangguanzhang opened this issue Jul 27, 2023 · 23 comments
Closed

新的debian镜像相对于之前太大了 #25

zhangguanzhang opened this issue Jul 27, 2023 · 23 comments

Comments

@zhangguanzhang
Copy link
Contributor

zhangguanzhang commented Jul 27, 2023

apt list --installed

最新的 cr.loongnix.cn/library/debian:buster-slim

adduser/now 3.118+nmu1 all [installed,local]
apt/now 1.8.2+nmu1 loongarch64 [installed,local]
base-files/now 1:10.3+deb10u4-lnd.16 loongarch64 [installed,local]
base-passwd/now 3.5.46+nmu1 loongarch64 [installed,local]
bash/now 5.0-4.1 loongarch64 [installed,local]
bsdutils/now 1:2.38.1-5.lnd.1 loongarch64 [installed,local]
coreutils/now 8.30-3.lnd.2 loongarch64 [installed,local]
dash/now 0.5.10.2-5.1 loongarch64 [installed,local]
debconf/now 1.5.71+nmu1 all [installed,local]
debian-archive-keyring/now 2019.1.lnd.2 all [installed,local]
debianutils/now 4.8.6.1+nmu1 loongarch64 [installed,local]
diffutils/now 1:3.7-3.1 loongarch64 [installed,local]
dmsetup/now 2:1.02.155-3.lnd.2 loongarch64 [installed,local]
dpkg/now 1.19.7.lnd.2+nmu1 loongarch64 [installed,local]
e2fsprogs/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
findutils/now 4.6.0+git+20190209-2.1 loongarch64 [installed,local]
gcc-8-base/now 8.3.0-6.lnd.vec.36 loongarch64 [installed,local]
gpgv/now 2.2.12-1+deb10u1.lnd.2 loongarch64 [installed,local]
grep/now 3.3-1.1 loongarch64 [installed,local]
gzip/now 1.9-3.lnd.6 loongarch64 [installed,local]
hostname/now 3.22 loongarch64 [installed,local]
init-system-helpers/now 1.56+nmu2 all [installed,local]
libacl1/now 2.2.53-4.1 loongarch64 [installed,local]
libapparmor1/now 2.13.2-10.1 loongarch64 [installed,local]
libapt-pkg5.0/now 1.8.2+nmu1 loongarch64 [installed,local]
libargon2-1/now 0~20171227-0.2.lnd.2 loongarch64 [installed,local]
libattr1/now 1:2.4.48-4.1 loongarch64 [installed,local]
libaudit-common/now 1:2.8.4-3.lnd.2 all [installed,local]
libaudit1/now 1:2.8.4-3.lnd.2 loongarch64 [installed,local]
libblkid1/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
libbsd0/now 0.9.1-2.lnd.3 loongarch64 [installed,local]
libbz2-1.0/now 1.0.6-9.2~deb10u1.1 loongarch64 [installed,local]
libc-bin/now 2.28-10.lnd.35 loongarch64 [installed,local]
libc-dev-bin/now 2.28-10.lnd.35 loongarch64 [installed,local]
libc6-dev/now 2.28-10.lnd.35 loongarch64 [installed,local]
libc6/now 2.28-10.lnd.35 loongarch64 [installed,local]
libcap-ng0/now 0.7.9-2.1 loongarch64 [installed,local]
libcap2/now 1:2.25-2.1 loongarch64 [installed,local]
libcom-err2/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
libcryptsetup12/now 2:2.1.0-5+deb10u2.1 loongarch64 [installed,local]
libdb5.3/now 5.3.28+dfsg1-0.6 loongarch64 [installed,local]
libdebconfclient0/now 0.249+nmu1 loongarch64 [installed,local]
libdevmapper1.02.1/now 2:1.02.155-3.lnd.2 loongarch64 [installed,local]
libdrm-amdgpu1/now 2.4.97-1.lnd.6 loongarch64 [installed,local]
libdrm-common/now 2.4.97-1.lnd.6 all [installed,local]
libdrm-etnaviv1/now 2.4.97-1.lnd.6 loongarch64 [installed,local]
libdrm-gsgpu1/now 2.4.97-1.lnd.6 loongarch64 [installed,local]
libdrm-nouveau2/now 2.4.97-1.lnd.6 loongarch64 [installed,local]
libdrm-radeon1/now 2.4.97-1.lnd.6 loongarch64 [installed,local]
libdrm2/now 2.4.97-1.lnd.6 loongarch64 [installed,local]
libedit2/now 3.1-20181209-1.1 loongarch64 [installed,local]
libegl-mesa0/now 18.3.6-2+deb10u1.lnd.12 loongarch64 [installed,local]
libegl1/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libelf1/now 0.176-1.2 loongarch64 [installed,local]
libexpat1/now 2.2.6-2+deb10u4.lnd.2 loongarch64 [installed,local]
libext2fs2/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
libffi-dev/now 3.3-5.lnd.4 loongarch64 [installed,local]
libffi7/now 3.3-5.lnd.4 loongarch64 [installed,local]
libgbm1/now 18.3.6-2+deb10u1.lnd.12 loongarch64 [installed,local]
libgcc1/now 1:8.3.0-6.lnd.vec.36 loongarch64 [installed,local]
libgcrypt20/now 1.8.4-5.lnd.1 loongarch64 [installed,local]
libgl1-mesa-dri/now 18.3.6-2+deb10u1.lnd.12 loongarch64 [installed,local]
libgl1/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libglapi-mesa/now 18.3.6-2+deb10u1.lnd.12 loongarch64 [installed,local]
libgles1/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libgles2/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libglvnd-core-dev/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libglvnd-dev/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libglvnd0/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libglx-mesa0/now 18.3.6-2+deb10u1.lnd.12 loongarch64 [installed,local]
libglx0/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libgmp10/now 2:6.1.2+dfsg-4.lnd.2 loongarch64 [installed,local]
libgnutls30/now 3.6.7-4+deb10u3.lnd.2 loongarch64 [installed,local]
libgpg-error0/now 1.35-1.lnd.1 loongarch64 [installed,local]
libhogweed4/now 3.4.1-1.1 loongarch64 [installed,local]
libidn11/now 1.33-2.3 loongarch64 [installed,local]
libidn2-0/now 2.0.5-1+deb10u1.1.loongniy loongarch64 [installed,local]
libip4tc2/now 1.8.7-1.1 loongarch64 [installed,local]
libjson-c3/now 0.12.1+ds-2.lnd.2 loongarch64 [installed,local]
libkmod2/now 26-1.1 loongarch64 [installed,local]
libllvm8/now 1:8.0.1-3~bpo10+1.lnd.37 loongarch64 [installed,local]
liblocale-gettext-perl/now 1.07-3.1 loongarch64 [installed,local]
liblz4-1/now 1.8.3-1.lnd.3 loongarch64 [installed,local]
liblzma5/now 5.2.4-1.1 loongarch64 [installed,local]
libmount1/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
libncurses-dev/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libncurses6/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libncursesw6/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libnettle6/now 3.4.1-1.1 loongarch64 [installed,local]
libopengl0/now 1.1.0-1.lnd.4 loongarch64 [installed,local]
libp11-kit0/now 0.23.15-2.1 loongarch64 [installed,local]
libpam-modules-bin/now 1:1.3.1-5.lnd.6 loongarch64 [installed,local]
libpam-modules/now 1:1.3.1-5.lnd.6 loongarch64 [installed,local]
libpam-runtime/now 1:1.3.1-5.lnd.6 all [installed,local]
libpam0g/now 1:1.3.1-5.lnd.6 loongarch64 [installed,local]
libpcre3/now 2:8.39-12.1 loongarch64 [installed,local]
libselinux1/now 2.8-1.lnd.1 loongarch64 [installed,local]
libsemanage-common/now 2.8-2.1 all [installed,local]
libsemanage1/now 2.8-2.1 loongarch64 [installed,local]
libsensors-config/now 1:3.5.0-3.1 all [installed,local]
libsensors5/now 1:3.5.0-3.1 loongarch64 [installed,local]
libsepol1/now 2.8-1.1 loongarch64 [installed,local]
libsmartcols1/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
libss2/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
libssl1.1/now 1.1.1d-0+lnd.11 loongarch64 [installed,local]
libstdc++6/now 8.3.0-6.lnd.vec.36 loongarch64 [installed,local]
libsystemd0/now 241-7.lnd.11 loongarch64 [installed,local]
libtasn1-6/now 4.13-3.1 loongarch64 [installed,local]
libtext-charwidth-perl/now 0.04-7.2 loongarch64 [installed,local]
libtext-iconv-perl/now 1.7-5.1 loongarch64 [installed,local]
libtext-wrapi18n-perl/now 0.06-7.2 all [installed,local]
libtinfo-dev/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libtinfo6/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libudev1/now 241-7.lnd.11 loongarch64 [installed,local]
libunistring2/now 0.9.10-1.1 loongarch64 [installed,local]
libuuid1/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
libwayland-client0/now 1.16.0-1.1 loongarch64 [installed,local]
libwayland-server0/now 1.16.0-1.1 loongarch64 [installed,local]
libx11-6/now 4:1.6.7-1.lnd.1 loongarch64 [installed,local]
libx11-data/now 4:1.6.7-1.lnd.1 all [installed,local]
libx11-xcb1/now 4:1.6.7-1.lnd.1 loongarch64 [installed,local]
libxau6/now 1:1.0.8-1.1 loongarch64 [installed,local]
libxcb-dri2-0/now 1.13.1-2.1 loongarch64 [installed,local]
libxcb-dri3-0/now 1.13.1-2.1 loongarch64 [installed,local]
libxcb-glx0/now 1.13.1-2.1 loongarch64 [installed,local]
libxcb-present0/now 1.13.1-2.1 loongarch64 [installed,local]
libxcb-sync1/now 1.13.1-2.1 loongarch64 [installed,local]
libxcb-xfixes0/now 1.13.1-2.1 loongarch64 [installed,local]
libxcb1/now 1.13.1-2.1 loongarch64 [installed,local]
libxdamage1/now 1:1.1.4-3.1 loongarch64 [installed,local]
libxdmcp6/now 1:1.1.2-3.1 loongarch64 [installed,local]
libxext6/now 2:1.3.3-1.1 loongarch64 [installed,local]
libxfixes3/now 1:5.0.3-1.1 loongarch64 [installed,local]
libxshmfence1/now 1.3-1.1 loongarch64 [installed,local]
libxxf86vm1/now 1:1.1.4-1.1 loongarch64 [installed,local]
libzstd1/now 1.3.8+dfsg-3.1 loongarch64 [installed,local]
linux-libc-dev/now 1:4.19.190.8.11-lnd.2 loongarch64 [installed,local]
login/now 1:4.5-1.lnd.1 loongarch64 [installed,local]
loonggl-dev/now 0.1.0-1+deb10u1.lnd.3 loongarch64 [installed,local]
loonggl/now 0.1.0-1+deb10u1.lnd.3 loongarch64 [installed,local]
loonggpu-compiler-dev/now 0.1.0-lnd.3 loongarch64 [installed,local]
loonggpu-compiler/now 0.1.0-lnd.3 loongarch64 [installed,local]
loongnix-gpu-driver-service/now 0.0.1-1.lnd.3 all [installed,local]
lsb-base/now 10.2019051400+nmu1 all [installed,local]
mawk/now 1.3.3-17.1 loongarch64 [installed,local]
mount/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
ncurses-base/now 6.1+20181013-2+deb10u2.1 all [installed,local]
ncurses-bin/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
passwd/now 1:4.5-1.lnd.1 loongarch64 [installed,local]
perl-base/now 5.28.1-6.1 loongarch64 [installed,local]
sed/now 4.7-1.1 loongarch64 [installed,local]
sensible-utils/now 0.0.12+nmu1 all [installed,local]
systemd/now 241-7.lnd.11 loongarch64 [installed,local]
sysvinit-utils/now 2.93-8.1 loongarch64 [installed,local]
tar/now 1.30+dfsg-6.1.loongniy loongarch64 [installed,local]
tzdata/now 2020a-0+deb10u1.1.lnd.3 all [installed,local]
util-linux-extra/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
util-linux/now 2.38.1-5.lnd.1 loongarch64 [installed,local]
zlib1g/now 1:1.2.11.dfsg-1.lnd.4 loongarch64 [installed,local]

上一个版本的 cr.loongnix.cn/library/debian:buster-slim

adduser/now 3.118+nmu1 all [installed,local]
apt/now 1.8.2+nmu1 loongarch64 [installed,local]
base-files/now 10.3+deb10u4.lnd.13 loongarch64 [installed,local]
base-passwd/now 3.5.46+nmu1 loongarch64 [installed,local]
bash/now 5.0-4.1 loongarch64 [installed,local]
bsdutils/now 1:2.33.1-0.2 loongarch64 [installed,local]
coreutils/now 8.30-3.lnd.2 loongarch64 [installed,local]
dash/now 0.5.10.2-5.1 loongarch64 [installed,local]
debconf/now 1.5.71+nmu1 all [installed,local]
debian-archive-keyring/now 2019.1.lnd.2 all [installed,local]
debianutils/now 4.8.6.1+nmu1 loongarch64 [installed,local]
diffutils/now 1:3.7-3.1 loongarch64 [installed,local]
dpkg/now 1.19.7.lnd.2+nmu1 loongarch64 [installed,local]
e2fsprogs/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
fdisk/now 2.33.1-0.2 loongarch64 [installed,local]
findutils/now 4.6.0+git+20190209-2.1 loongarch64 [installed,local]
gcc-8-base/now 8.3.0-6.lnd.vec.34 loongarch64 [installed,local]
gpgv/now 2.2.12-1+deb10u1.lnd.2 loongarch64 [installed,local]
grep/now 3.3-1.1 loongarch64 [installed,local]
gzip/now 1.9-3.lnd.6 loongarch64 [installed,local]
hostname/now 3.22 loongarch64 [installed,local]
init-system-helpers/now 1.56+nmu2 all [installed,local]
libacl1/now 2.2.53-4.1 loongarch64 [installed,local]
libapt-pkg5.0/now 1.8.2+nmu1 loongarch64 [installed,local]
libattr1/now 1:2.4.48-4.1 loongarch64 [installed,local]
libaudit-common/now 1:2.8.4-3.lnd.2 all [installed,local]
libaudit1/now 1:2.8.4-3.lnd.2 loongarch64 [installed,local]
libblkid1/now 2.33.1-0.2 loongarch64 [installed,local]
libbz2-1.0/now 1.0.6-9.2~deb10u1.1 loongarch64 [installed,local]
libc-bin/now 2.28-10.lnd.32 loongarch64 [installed,local]
libc6/now 2.28-10.lnd.32 loongarch64 [installed,local]
libcap-ng0/now 0.7.9-2.1 loongarch64 [installed,local]
libcom-err2/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
libdb5.3/now 5.3.28+dfsg1-0.6 loongarch64 [installed,local]
libdebconfclient0/now 0.249+nmu1 loongarch64 [installed,local]
libext2fs2/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
libfdisk1/now 2.33.1-0.2 loongarch64 [installed,local]
libffi7/now 3.3-5.lnd.4 loongarch64 [installed,local]
libgcc1/now 1:8.3.0-6.lnd.vec.34 loongarch64 [installed,local]
libgcrypt20/now 1.8.4-5.lnd.1 loongarch64 [installed,local]
libgmp10/now 2:6.1.2+dfsg-4.lnd.2 loongarch64 [installed,local]
libgnutls30/now 3.6.7-4+deb10u3.lnd.1 loongarch64 [installed,local]
libgpg-error0/now 1.35-1.lnd.1 loongarch64 [installed,local]
libhogweed4/now 3.4.1-1.1 loongarch64 [installed,local]
libidn2-0/now 2.0.5-1+deb10u1.1.loongniy loongarch64 [installed,local]
liblocale-gettext-perl/now 1.07-3.1 loongarch64 [installed,local]
liblz4-1/now 1.8.3-1.lnd.3 loongarch64 [installed,local]
liblzma5/now 5.2.4-1.1 loongarch64 [installed,local]
libmount1/now 2.33.1-0.2 loongarch64 [installed,local]
libncursesw6/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libnettle6/now 3.4.1-1.1 loongarch64 [installed,local]
libp11-kit0/now 0.23.15-2.1 loongarch64 [installed,local]
libpam-modules-bin/now 1.3.1-5.lnd.5 loongarch64 [installed,local]
libpam-modules/now 1.3.1-5.lnd.5 loongarch64 [installed,local]
libpam-runtime/now 1.3.1-5.lnd.5 all [installed,local]
libpam0g/now 1.3.1-5.lnd.5 loongarch64 [installed,local]
libpcre3/now 2:8.39-12.1 loongarch64 [installed,local]
libselinux1/now 2.8-1.lnd.1 loongarch64 [installed,local]
libsemanage-common/now 2.8-2.1 all [installed,local]
libsemanage1/now 2.8-2.1 loongarch64 [installed,local]
libsepol1/now 2.8-1.1 loongarch64 [installed,local]
libsmartcols1/now 2.33.1-0.2 loongarch64 [installed,local]
libss2/now 1.44.5-1+deb10u3.1 loongarch64 [installed,local]
libstdc++6/now 8.3.0-6.lnd.vec.34 loongarch64 [installed,local]
libsystemd0/now 241-7.lnd.10 loongarch64 [installed,local]
libtasn1-6/now 4.13-3.1 loongarch64 [installed,local]
libtext-charwidth-perl/now 0.04-7.2 loongarch64 [installed,local]
libtext-iconv-perl/now 1.7-5.1 loongarch64 [installed,local]
libtext-wrapi18n-perl/now 0.06-7.2 all [installed,local]
libtinfo6/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
libudev1/now 241-7.lnd.10 loongarch64 [installed,local]
libunistring2/now 0.9.10-1.1 loongarch64 [installed,local]
libuuid1/now 2.33.1-0.2 loongarch64 [installed,local]
libzstd1/now 1.3.8+dfsg-3.1 loongarch64 [installed,local]
login/now 1:4.5-1.lnd.1 loongarch64 [installed,local]
lsb-base/now 10.2019051400+nmu1 all [installed,local]
mawk/now 1.3.3-17.1 loongarch64 [installed,local]
mount/now 2.33.1-0.2 loongarch64 [installed,local]
ncurses-base/now 6.1+20181013-2+deb10u2.1 all [installed,local]
ncurses-bin/now 6.1+20181013-2+deb10u2.1 loongarch64 [installed,local]
passwd/now 1:4.5-1.lnd.1 loongarch64 [installed,local]
perl-base/now 5.28.1-6.1 loongarch64 [installed,local]
sed/now 4.7-1.1 loongarch64 [installed,local]
sensible-utils/now 0.0.12+nmu1 all [installed,local]
sysvinit-utils/now 2.93-8.1 loongarch64 [installed,local]
tar/now 1.30+dfsg-6.1.loongniy loongarch64 [installed,local]
tzdata/now 2020a-0+deb10u1.1.lnd.3 all [installed,local]
util-linux/now 2.33.1-0.2 loongarch64 [installed,local]
zlib1g/now 1:1.2.11.dfsg-1.lnd.4 loongarch64 [installed,local]
@rex-ms
Copy link

rex-ms commented Aug 3, 2023

上一个版本和最新版本的列表是不是粘贴反了?

@zhangguanzhang
Copy link
Contributor Author

上一个版本和最新版本的列表是不是粘贴反了?

是的,修改过来了

@wojiushixiaobai
Copy link
Contributor

wojiushixiaobai commented Aug 5, 2023

下面的包是可以移除的,移除后大小和官方大小相差不大。移除的包是参考 amd64, arm64 架构的 debian:buster-slim 镜像,通过 dpkg -l 对比将多出来的包列出来

最终制作的 rootfs.tar.xz 只有 15M 左右

ii  libapparmor1:loongarch64       2.13.2-10.1                loongarch64  changehat AppArmor library
ii  libargon2-1:loongarch64        0~20171227-0.2.lnd.2       loongarch64  memory-hard hashing function - runtime library
ii  libbsd0:loongarch64            0.9.1-2.lnd.3              loongarch64  utility functions from BSD systems - shared library
ii  libc-dev-bin                   2.28-10.lnd.35             loongarch64  GNU C Library: Development binaries
ii  libc6-dev:loongarch64          2.28-10.lnd.35             loongarch64  GNU C Library: Development Libraries and Header Files
ii  libcap2:loongarch64            1:2.25-2.1                 loongarch64  POSIX 1003.1e capabilities (library)
ii  libcryptsetup12:loongarch64    2:2.1.0-5+deb10u2.1        loongarch64  disk encryption support - shared library
ii  libdevmapper1.02.1:loongarch64 2:1.02.155-3.lnd.2         loongarch64  Linux Kernel Device Mapper userspace library
ii  libdrm-amdgpu1:loongarch64     2.4.97-1.lnd.6             loongarch64  Userspace interface to amdgpu-specific kernel DRM services -- runtime
ii  libdrm-common                  2.4.97-1.lnd.6             all          Userspace interface to kernel DRM services -- common files
ii  libdrm-etnaviv1:loongarch64    2.4.97-1.lnd.6             loongarch64  Userspace interface to etnaviv-specific kernel DRM services -- runtime
ii  libdrm-gsgpu1:loongarch64      2.4.97-1.lnd.6             loongarch64  Userspace interface to gsgpu-specific kernel DRM driver
ii  libdrm-nouveau2:loongarch64    2.4.97-1.lnd.6             loongarch64  Userspace interface to nouveau-specific kernel DRM services -- runtime
ii  libdrm-radeon1:loongarch64     2.4.97-1.lnd.6             loongarch64  Userspace interface to radeon-specific kernel DRM services -- runtime
ii  libdrm2:loongarch64            2.4.97-1.lnd.6             loongarch64  Userspace interface to kernel DRM services -- runtime
ii  libedit2:loongarch64           3.1-20181209-1.1           loongarch64  BSD editline and history libraries
ii  libegl-mesa0:loongarch64       18.3.6-2+deb10u1.lnd.12    loongarch64  free implementation of the EGL API -- Mesa vendor library
ii  libegl1:loongarch64            1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- EGL support
ii  libelf1:loongarch64            0.176-1.2                  loongarch64  library to read and write ELF files
ii  libexpat1:loongarch64          2.2.6-2+deb10u4.lnd.2      loongarch64  XML parsing C library - runtime library
ii  libffi-dev:loongarch64         3.3-5.lnd.4                loongarch64  Foreign Function Interface library (development files)
ii  libgbm1:loongarch64            18.3.6-2+deb10u1.lnd.12    loongarch64  generic buffer management API -- runtime
ii  libgl1:loongarch64             1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- legacy GL support
ii  libgl1-mesa-dri:loongarch64    18.3.6-2+deb10u1.lnd.12    loongarch64  free implementation of the OpenGL API -- DRI modules
ii  libglapi-mesa:loongarch64      18.3.6-2+deb10u1.lnd.12    loongarch64  free implementation of the GL API -- shared library
ii  libgles1:loongarch64           1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- GLESv1 support
ii  libgles2:loongarch64           1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- GLESv2 support
ii  libglvnd-core-dev:loongarch64  1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- core development files
ii  libglvnd-dev:loongarch64       1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- development files
ii  libglvnd0:loongarch64          1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library
ii  libglx-mesa0:loongarch64       18.3.6-2+deb10u1.lnd.12    loongarch64  free implementation of the OpenGL API -- GLX vendor library
ii  libglx0:loongarch64            1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- GLX support
ii  libidn11:loongarch64           1.33-2.3                   loongarch64  GNU Libidn library, implementation of IETF IDN specifications
ii  libip4tc2:loongarch64          1.8.7-1.1                  loongarch64  netfilter libip4tc library
ii  libjson-c3:loongarch64         0.12.1+ds-2.lnd.2          loongarch64  JSON manipulation library - shared library
ii  libkmod2:loongarch64           26-1.1                     loongarch64  libkmod shared library
ii  libllvm8:loongarch64           1:8.0.1-3~bpo10+1.lnd.37   loongarch64  Modular compiler and toolchain technologies, runtime library
ii  libncurses-dev:loongarch64     6.1+20181013-2+deb10u2.1   loongarch64  developer's libraries for ncurses
ii  libncurses6:loongarch64        6.1+20181013-2+deb10u2.1   loongarch64  shared libraries for terminal handling
ii  libopengl0:loongarch64         1.1.0-1.lnd.4              loongarch64  Vendor neutral GL dispatch library -- OpenGL support
ii  libsensors-config              1:3.5.0-3.1                all          lm-sensors configuration files
ii  libsensors5:loongarch64        1:3.5.0-3.1                loongarch64  library to read temperature/voltage/fan sensors
ii  libssl1.1:loongarch64          1.1.1d-0+lnd.11            loongarch64  Secure Sockets Layer toolkit - shared libraries
ii  libsystemd0:loongarch64        241-7.lnd.11               loongarch64  systemd utility library
ii  libtinfo-dev:loongarch64       6.1+20181013-2+deb10u2.1   loongarch64  transitional package for libncurses-dev
ii  libwayland-client0:loongarch64 1.16.0-1.1                 loongarch64  wayland compositor infrastructure - client library
ii  libwayland-server0:loongarch64 1.16.0-1.1                 loongarch64  wayland compositor infrastructure - server library
ii  libx11-6:loongarch64           4:1.6.7-1.lnd.1            loongarch64  X11 client-side library
ii  libx11-data                    4:1.6.7-1.lnd.1            all          X11 client-side library
ii  libx11-xcb1:loongarch64        4:1.6.7-1.lnd.1            loongarch64  Xlib/XCB interface library
ii  libxau6:loongarch64            1:1.0.8-1.1                loongarch64  X11 authorisation library
ii  libxcb-dri2-0:loongarch64      1.13.1-2.1                 loongarch64  X C Binding, dri2 extension
ii  libxcb-dri3-0:loongarch64      1.13.1-2.1                 loongarch64  X C Binding, dri3 extension
ii  libxcb-glx0:loongarch64        1.13.1-2.1                 loongarch64  X C Binding, glx extension
ii  libxcb-present0:loongarch64    1.13.1-2.1                 loongarch64  X C Binding, present extension
ii  libxcb-sync1:loongarch64       1.13.1-2.1                 loongarch64  X C Binding, sync extension
ii  libxcb-xfixes0:loongarch64     1.13.1-2.1                 loongarch64  X C Binding, xfixes extension
ii  libxcb1:loongarch64            1.13.1-2.1                 loongarch64  X C Binding
ii  libxdamage1:loongarch64        1:1.1.4-3.1                loongarch64  X11 damaged region extension library
ii  libxdmcp6:loongarch64          1:1.1.2-3.1                loongarch64  X11 Display Manager Control Protocol library
ii  libxext6:loongarch64           2:1.3.3-1.1                loongarch64  X11 miscellaneous extension library
ii  libxfixes3:loongarch64         1:5.0.3-1.1                loongarch64  X11 miscellaneous 'fixes' extension library
ii  libxshmfence1:loongarch64      1.3-1.1                    loongarch64  X shared memory fences - shared library
ii  libxxf86vm1:loongarch64        1:1.1.4-1.1                loongarch64  X11 XFree86 video mode extension library
ii  linux-libc-dev                 1:4.19.190.8.11-lnd.2      loongarch64  Linux support headers for userspace development
ii  loonggl-dev:loongarch64        0.1.0-1+deb10u1.lnd.3      loongarch64  free implementation of the EGL API -- development files
ii  loonggpu-compiler              0.1.0-lnd.3                loongarch64  Shader compiler for loonggpu.
ii  loonggpu-compiler-dev          0.1.0-lnd.3                loongarch64  Shader compiler for loonggpu.
ii  loongnix-gpu-driver-service    0.0.1-1.lnd.3              all          Loongnix GPU 3D Driver Compatibility Service Program
ii  systemd                        241-7.lnd.11               loongarch64  system and service manager
ii  util-linux-extra               2.38.1-5.lnd.1             loongarch64  interactive login tools

移除前后大小

301M	/usr
4.0K	/home
4.0K	/mnt
752K	/etc
0	/dev
4.0K	/boot
0	/sys
12K	/run
4.0K	/media
0	/proc
4.0K	/opt
12K	/root
4.0K	/lib64
7.8M	/var
4.0K	/srv
4.0K	/tmp
309M	/
apt-get autoremove libapparmor1 libargon2-1 libbsd0 libc-dev-bin libc6-dev \
libcap2 libcryptsetup12 libdevmapper1.02.1 libdrm-amdgpu1 libdrm-common \
libdrm-etnaviv1 libdrm-gsgpu1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 \
libegl-mesa0 libegl1 libelf1 libexpat1 libffi-dev libgbm1 libgl1 libgl1-mesa-dri \
libglapi-mesa libgles1 libgles2 libglvnd-core-dev libglvnd-dev libglvnd0 libglx-mesa0 \
libglx0 libidn11 libip4tc2 libjson-c3 libkmod2 libllvm8 libncurses-dev libncurses6 \
libopengl0 libsensors-config libsensors5 libssl1.1 libtinfo-dev libwayland-client0 \
libwayland-server0 libx11-6 libx11-data libx11-xcb1 libxau6 libxcb-dri2-0 libxcb-dri3-0 \
libxcb-glx0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcb1 libxdamage1 libxdmcp6 \
libxext6 libxfixes3 libxshmfence1 libxxf86vm1 linux-libc-dev loonggl-dev loonggpu-compiler \
loonggpu-compiler-dev loongnix-gpu-driver-service systemd util-linux-extra

Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
  dmsetup libapparmor1 libargon2-1 libbsd0 libc-dev-bin libc6-dev libcap2 libcryptsetup12 libdevmapper1.02.1 libdrm-amdgpu1 libdrm-common libdrm-etnaviv1 libdrm-gsgpu1 libdrm-nouveau2
  libdrm-radeon1 libdrm2 libedit2 libegl-mesa0 libegl1 libelf1 libexpat1 libffi-dev libgbm1 libgl1 libgl1-mesa-dri libglapi-mesa libgles1 libgles2 libglvnd-core-dev libglvnd-dev
  libglvnd0 libglx-mesa0 libglx0 libidn11 libip4tc2 libjson-c3 libkmod2 libllvm8 libncurses-dev libncurses6 libopengl0 libsensors-config libsensors5 libssl1.1 libtinfo-dev
  libwayland-client0 libwayland-server0 libx11-6 libx11-data libx11-xcb1 libxau6 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxcb1
  libxdamage1 libxdmcp6 libxext6 libxfixes3 libxshmfence1 libxxf86vm1 linux-libc-dev loonggl loonggl-dev loonggpu-compiler loonggpu-compiler-dev loongnix-gpu-driver-service systemd
  sysvinit-utils util-linux util-linux-extra
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
  sysvinit-utils util-linux (due to sysvinit-utils) util-linux-extra (due to util-linux)
0 upgraded, 0 newly installed, 74 to remove and 0 not upgraded.
After this operation, 381 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
 ?] Yes, do as I say!
(Reading database ... 11030 files and directories currently installed.)
Removing loonggl:loongarch64 (0.1.0-1+deb10u1.lnd.3) ...
Removing loongnix-gpu-driver-service (0.0.1-1.lnd.3) ...
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Removing systemd (241-7.lnd.11) ...
Removing libcryptsetup12:loongarch64 (2:2.1.0-5+deb10u2.1) ...
Removing libapparmor1:loongarch64 (2.13.2-10.1) ...
Removing libargon2-1:loongarch64 (0~20171227-0.2.lnd.2) ...
Removing libglvnd-dev:loongarch64 (1.1.0-1.lnd.4) ...
Removing libegl1:loongarch64 (1.1.0-1.lnd.4) ...
Removing libegl-mesa0:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libgl1:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglx0:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglx-mesa0:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libxcb-dri3-0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-xfixes0:loongarch64 (1.13.1-2.1) ...
Removing libgl1-mesa-dri:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libllvm8:loongarch64 (1:8.0.1-3~bpo10+1.lnd.37) ...
Removing libedit2:loongarch64 (3.1-20181209-1.1) ...
Removing loonggpu-compiler-dev (0.1.0-lnd.3) ...
Removing libtinfo-dev:loongarch64 (6.1+20181013-2+deb10u2.1) ...
Removing libncurses-dev:loongarch64 (6.1+20181013-2+deb10u2.1) ...
Removing libc6-dev:loongarch64 (2.28-10.lnd.35) ...
Removing libc-dev-bin (2.28-10.lnd.35) ...
Removing libcap2:loongarch64 (1:2.25-2.1) ...
Removing libdrm-amdgpu1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libgbm1:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libdrm-etnaviv1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-gsgpu1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-nouveau2:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-radeon1:loongarch64 (2.4.97-1.lnd.6) ...
Removing libelf1:loongarch64 (0.176-1.2) ...
Removing libexpat1:loongarch64 (2.2.6-2+deb10u4.lnd.2) ...
Removing libffi-dev:loongarch64 (3.3-5.lnd.4) ...
Removing libglapi-mesa:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Removing libgles1:loongarch64 (1.1.0-1.lnd.4) ...
Removing libgles2:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglvnd-core-dev:loongarch64 (1.1.0-1.lnd.4) ...
Removing libopengl0:loongarch64 (1.1.0-1.lnd.4) ...
Removing libglvnd0:loongarch64 (1.1.0-1.lnd.4) ...
Removing libidn11:loongarch64 (1.33-2.3) ...
Removing libip4tc2:loongarch64 (1.8.7-1.1) ...
Removing libjson-c3:loongarch64 (0.12.1+ds-2.lnd.2) ...
Removing libkmod2:loongarch64 (26-1.1) ...
Removing libncurses6:loongarch64 (6.1+20181013-2+deb10u2.1) ...
Removing libsensors5:loongarch64 (1:3.5.0-3.1) ...
Removing libsensors-config (1:3.5.0-3.1) ...
Removing libssl1.1:loongarch64 (1.1.1d-0+lnd.11) ...
Removing libwayland-client0:loongarch64 (1.16.0-1.1) ...
Removing libwayland-server0:loongarch64 (1.16.0-1.1) ...
Removing libxxf86vm1:loongarch64 (1:1.1.4-1.1) ...
Removing libxext6:loongarch64 (2:1.3.3-1.1) ...
Removing libxdamage1:loongarch64 (1:1.1.4-3.1) ...
Removing libxfixes3:loongarch64 (1:5.0.3-1.1) ...
Removing libx11-6:loongarch64 (4:1.6.7-1.lnd.1) ...
Removing libx11-data (4:1.6.7-1.lnd.1) ...
Removing libx11-xcb1:loongarch64 (4:1.6.7-1.lnd.1) ...
Removing libxcb-dri2-0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-glx0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-present0:loongarch64 (1.13.1-2.1) ...
Removing libxcb-sync1:loongarch64 (1.13.1-2.1) ...
Removing libxshmfence1:loongarch64 (1.3-1.1) ...
Removing linux-libc-dev (1:4.19.190.8.11-lnd.2) ...
Removing loonggl-dev:loongarch64 (0.1.0-1+deb10u1.lnd.3) ...
Removing loonggpu-compiler (0.1.0-lnd.3) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: this is an essential package; it should not be removed
Removing sysvinit-utils (2.93-8.1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: this is an essential package; it should not be removed
Removing util-linux (2.38.1-5.lnd.1) ...
Removing util-linux-extra (2.38.1-5.lnd.1) ...
Removing libxcb1:loongarch64 (1.13.1-2.1) ...
Removing libxdmcp6:loongarch64 (1:1.1.2-3.1) ...
Removing libbsd0:loongarch64 (0.9.1-2.lnd.3) ...
Removing libdrm2:loongarch64 (2.4.97-1.lnd.6) ...
Removing libdrm-common (2.4.97-1.lnd.6) ...
Removing libxau6:loongarch64 (1:1.0.8-1.1) ...
Removing dmsetup (2:1.02.155-3.lnd.2) ...
Removing libdevmapper1.02.1:loongarch64 (2:1.02.155-3.lnd.2) ...
Processing triggers for libc-bin (2.28-10.lnd.35) ...
dpkg -l | grep "^rc" | awk '{print $2}' | xargs apt-get purge -y

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libgl1-mesa-dri* libsensors-config* libssl1.1* loongnix-gpu-driver-service* systemd* util-linux* util-linux-extra*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 6209 files and directories currently installed.)
Purging configuration files for libssl1.1:loongarch64 (1.1.1d-0+lnd.11) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/loongarch64-linux-gnu/perl/5.28.1 /usr/loca/share/perl/5.28.1 /usr/lib/loongarch64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/loongarch64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/loongarch6-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Purging configuration files for libgl1-mesa-dri:loongarch64 (18.3.6-2+deb10u1.lnd.12) ...
Purging configuration files for libsensors-config (1:3.5.0-3.1) ...
Purging configuration files for systemd (241-7.lnd.11) ...
dpkg: warning: while removing systemd, directory '/usr/lib/systemd' not empty so not removed
Purging configuration files for util-linux (2.38.1-5.lnd.1) ...
Purging configuration files for loongnix-gpu-driver-service (0.0.1-1.lnd.3) ...
/var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: 8: /var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: systemctl: not found
/var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: 20: /var/lib/dpkg/info/loongnix-gpu-driver-service.postrm: systemctl: not found
Purging configuration files for util-linux-extra (2.38.1-5.lnd.1) ...
69M	/usr
4.0K	/home
4.0K	/mnt
596K	/etc
0	/dev
4.0K	/boot
0	/sys
12K	/run
4.0K	/media
0	/proc
4.0K	/opt
12K	/root
4.0K	/lib64
5.4M	/var
4.0K	/srv
24K	/tmp
75M	/

@zhangguanzhang
Copy link
Contributor Author

你提个pr看看

@wojiushixiaobai
Copy link
Contributor

自动脚本构建的我看下 https://github.com/debuerreotype/debuerreotype 的实现,
当前我是手动去处理的,而且我对比了之前的版本,这个需要卸载的表单是会变动的,没法通用,得研究下。

@zhangguanzhang
Copy link
Contributor Author

自动脚本构建的我看下 https://github.com/debuerreotype/debuerreotype 的实现, 当前我是手动去处理的,而且我对比了之前的版本,这个需要卸载的表单是会变动的,没法通用,得研究下。

主要是官方的镜像的rootfs.tar.gz不知道怎么构建出来的

@wojiushixiaobai
Copy link
Contributor

wojiushixiaobai commented Aug 7, 2023

我发的这个仓库就是构建 debian 的 rootfs.tar.gz,脚本都有说明,我已经在研究了。
可以一起交流下,参考 https://github.com/debuerreotype/debuerreotype/blob/master/examples/ubuntu.sh 构建 ubuntu 的脚本,咱们拷贝一份出来:
需要使用 loongnix 的宿主机或者容器特权模式构建 (--privileged)

docker run --rm --privileged -it cr.loongnix.cn/library/debian:buster bash
apt-get update
apt-get install -y debootstrap wget ca-certificates xz-utils git gnupg dirmngr
git clone -b 0.15 --depth=1 https://github.com/debuerreotype/debuerreotype /opt/debuerreotype
cd /opt/debuerreotype
cp examples/ubuntu.sh examples/loongnix.sh 
root@05001a117a1d:/opt/debuerreotype# diff examples/ubuntu.sh examples/loongnix.sh 
5c5
< # 	&& apt-get install -y ubuntu-keyring \
---
> # 	&& apt-get install -y debian-keyring \
16,17c16,17
< 	'output xenial
< --arch arm64 output bionic'
---
> 	'output DaoXiangHu-stable
> --arch loongarch64 output DaoXiangHu-stable'
35a36
> mkdir -p $outputDir
46c47
< archDir="$exportDir/ubuntu/$dpkgArch"
---
> archDir="$exportDir/loongnix/$dpkgArch"
50,52c51,53
< 	amd64 | i386)
< 		mirror='http://archive.ubuntu.com/ubuntu'
< 		secmirror='http://security.ubuntu.com/ubuntu'
---
> 	loongarch64)
> 		mirror='http://pkg.loongnix.cn/loongnix'
> 		secmirror="$mirror"
56,57c57,58
< 		mirror='http://ports.ubuntu.com/ubuntu-ports'
< 		secmirror="$mirror" # no separate security mirror for ports
---
> 		echo "Unsupported architecture: ${dpkgArch}"
> 		exit 1
63a65
> 	--exclude 'loongnix-gpu-driver-service,loonggpu-compiler,util-linux-extra'
66c68
< keyring='/usr/share/keyrings/ubuntu-archive-keyring.gpg'
---
> keyring='/usr/share/keyrings/debian-archive-keyring.gpg'
105,108c107
< 	deb $mirror $suite main restricted universe multiverse
< 	deb $mirror $suite-updates main restricted universe multiverse
< 	deb $mirror $suite-backports main restricted universe multiverse
< 	deb $secmirror $suite-security main restricted universe multiverse
---
> 	deb $mirror $suite main
root@05001a117a1d:/opt/debuerreotype# git diff scripts/debuerreotype-init 
diff --git a/scripts/debuerreotype-init b/scripts/debuerreotype-init
index 9aa86ca..52714bd 100755
--- a/scripts/debuerreotype-init
+++ b/scripts/debuerreotype-init
@@ -178,6 +178,20 @@ fi
        fi
 ' -- "$include"
 
+if [ "$arch" == "loongarch64" ]; then
+       "$thisDir/debuerreotype-chroot" "$targetDir" bash -c '
+               if [ -n "$1" ]; then
+                       IFS=","; excludePackages=( $1 ); unset IFS
+                       apt-get autoremove -y --purge --allow-remove-essential "${excludePackages[@]}"
+               fi
+               for user in systemd-timesync systemd-network systemd-resolve; do
+                       if id $user >/dev/null; then
+                               userdel --force --remove $user
+                       fi
+               done
+       ' -- "$exclude"
+fi
+
 echo 'debuerreotype' > "$targetDir/etc/hostname"
 {
        echo '# https://1.1.1.1 (privacy-focused, highly-available DNS service)'
# 
cd /opt/debuerreotype/scripts
for f in debuerreotype-*; do 
    ln -svL "$PWD/$f" "/usr/local/bin/$f"
done

cd /opt/debuerreotype
ln -svL /usr/share/debootstrap/scripts/DaoXiangHu /opt/debuerreotype/DaoXiangHu-stable
# https://github.com/debuerreotype/debuerreotype/blob/0.15/Dockerfile#L57
cd /opt/debuerreotype
./examples/loongnix.sh --arch loongarch64 output DaoXiangHu-stable

arch 不能使用 loong64,因为线上仓库使用的 loongarch64(到时候新旧世界可以使用这个来区分? 😂)

@zhangguanzhang
Copy link
Contributor Author

loongnix的容器里构建应该也行吧

@wojiushixiaobai
Copy link
Contributor

wojiushixiaobai commented Aug 7, 2023

@zhangguanzhang 构建已经完成了,但是多出来的包还是 #25 (comment) 这个回复里面的那些包,大多数是图形显示和显卡驱动相关的依赖包,应该依赖处理不当导致的,容器不需要使用这些包。但是由于 debootstrap 无法定义 base package 列表,所以当前我能想到的方法是通过 debootstrap --exclude=package 的形式来过滤这些包了。

类似 .slimify-excludes,维护一个 .package-excludes,遍历表单然后传递给 debootstrap

经过分析,都是 loongnix-gpu-driver-service loonggpu-compiler util-linux-extra 的依赖,移除这些包即可

debootstrap --exclude="loongnix-gpu-driver-service,loonggpu-compiler,util-linux-extra"

🤮
然而不知道什么原因,--exclude 根本不生效,最后还是得使用侵入式解决。

@zhangguanzhang
Copy link
Contributor Author

action的子托管机器现在进入维护状态了,后续好了你可以提个pr看看

@wojiushixiaobai
Copy link
Contributor

wojiushixiaobai commented Aug 7, 2023

@zhangguanzhang 基本构建已经验证完成了,可以 forkhttps://github.com/debuerreotype/debuerreotype 这个项目,我可以将修改后的代码提交,需要修改的内容和 #25 (comment) 一致

后续的 rootfs.tar.xz 管理可以参考 docker-debian-artifacts
在有需要时定期 snapshot。

具体架构可以参考:https://github.com/debuerreotype/docker-debian-artifacts/branches/active

最终成果:

root@a26bc7a4aaa6:/opt/debuerreotype# ls -al output/loongnix/loongarch64/DaoXiangHu-stable/
total 29016
drwxrwxr-x 3 root root     4096 Aug  7 10:12 .
drwxrwxr-x 3 root root     4096 Aug  7 09:55 ..
-rw-rw-r-- 1 root root     8261 Jul 22 09:17 InRelease
-rw-rw-r-- 1 root root     7553 Aug  7 09:55 Release
-rw-rw-r-- 1 root root       18 Jul 22 09:17 rootfs.apt-dist
-rw-r--r-- 1 root root        5 Jul 22 09:17 rootfs.debian_version
-rw-rw-r-- 1 root root       11 Jul 22 09:17 rootfs.debuerreotype-epoch
-rw-rw-r-- 1 root root        1 Jul 22 09:17 rootfs.debuerreotype-variant
-rw-rw-r-- 1 root root       20 Jul 22 09:17 rootfs.debuerreotype-version
-rw-rw-r-- 1 root root       12 Jul 22 09:17 rootfs.dpkg-arch
-rw-rw-r-- 1 root root     2984 Jul 22 09:17 rootfs.manifest
-rw-r--r-- 1 root root      273 Jul 22 09:17 rootfs.os-release
-rw-r--r-- 1 root root       59 Jul 22 09:17 rootfs.sources-list
-rw-rw-r-- 1 root root 29637832 Jul 22 09:17 rootfs.tar.xz
-rw-rw-r-- 1 root root       65 Jul 22 09:17 rootfs.tar.xz.sha256
drwxrwxr-x 2 root root     4096 Aug  7 10:10 slim
root@a26bc7a4aaa6:/opt/debuerreotype# du -h -d 1 output/loongnix/loongarch64/DaoXiangHu-stable/rootfs.tar.xz
29M	output/loongnix/loongarch64/DaoXiangHu-stable/rootfs.tar.xz


root@a26bc7a4aaa6:/opt/debuerreotype# ls -al output/loongnix/loongarch64/DaoXiangHu-stable/slim/
total 14408
drwxrwxr-x 2 root root     4096 Aug  7 10:10 .
drwxrwxr-x 3 root root     4096 Aug  7 10:12 ..
-rw-r--r-- 1 root root       46 Aug  7 05:38 Dockerfile
-rw-rw-r-- 1 root root       18 Jul 22 09:17 rootfs.apt-dist
-rw-r--r-- 1 root root        5 Jul 22 09:17 rootfs.debian_version
-rw-rw-r-- 1 root root       11 Jul 22 09:17 rootfs.debuerreotype-epoch
-rw-rw-r-- 1 root root        5 Jul 22 09:17 rootfs.debuerreotype-variant
-rw-rw-r-- 1 root root       20 Jul 22 09:17 rootfs.debuerreotype-version
-rw-rw-r-- 1 root root       12 Jul 22 09:17 rootfs.dpkg-arch
-rw-rw-r-- 1 root root     2775 Jul 22 09:17 rootfs.manifest
-rw-r--r-- 1 root root      273 Jul 22 09:17 rootfs.os-release
-rw-r--r-- 1 root root       59 Jul 22 09:17 rootfs.sources-list
-rw-rw-r-- 1 root root 14698924 Jul 22 09:17 rootfs.tar.xz
-rw-rw-r-- 1 root root       65 Jul 22 09:17 rootfs.tar.xz.sha256
root@a26bc7a4aaa6:/opt/debuerreotype# du -h -d 1 output/loongnix/loongarch64/DaoXiangHu-stable/slim/rootfs.tar.xz
15M	output/loongnix/loongarch64/DaoXiangHu-stable/slim/rootfs.tar.xz

linux/loong64

docker images
REPOSITORY          TAG                IMAGE ID       CREATED          SIZE
debian              buster-slim        50672825a241   14 minutes ago   75MB
debian              buster             2502dd931a94   12 minutes ago   120MB

linux/amd64

docker images
REPOSITORY          TAG                IMAGE ID       CREATED          SIZE
debian              buster-slim        e1b92a6f8d12   10 days ago      69.3MB
debian              buster             1df4474660a1   10 days ago      114MB

@zhangguanzhang
Copy link
Contributor Author

@wojiushixiaobai action机器好了

@wojiushixiaobai
Copy link
Contributor

@zhangguanzhang 直接提交到本仓库吗?
如果用类似 https://github.com/debuerreotype/debuerreotypehttps://github.com/debuerreotype/docker-debian-artifacts
仓库来管理是否会更好一点。

debuerreotype 是构建 rootfs 的代码仓库,docker-debian-artifacts 是管理 rootfs 的代码仓库

后续可以通过 docker-debian-artifacts 管理 loongnix 的发行版本,比如 20.1, 20.2 20.3 .....

@zhangguanzhang
Copy link
Contributor Author

@zhangguanzhang 直接提交到本仓库吗? 如果用类似 https://github.com/debuerreotype/debuerreotypehttps://github.com/debuerreotype/docker-debian-artifacts 仓库来管理是否会更好一点。

debuerreotype 是构建 rootfs 的代码仓库,docker-debian-artifacts 是管理 rootfs 的代码仓库

后续可以通过 docker-debian-artifacts 管理 loongnix 的发行版本,比如 20.1, 20.2 20.3 .....

library/debian/buster-slim/make_rootfs.sh 这个里是生成 rootfs 的

@wojiushixiaobai
Copy link
Contributor

wojiushixiaobai commented Oct 4, 2023

@zhangguanzhang 反复测试了下,直接修改当前仓库的代码没法达到使用 https://github.com/debuerreotype/debuerreotype 仓库构建的效果,能不能 fork 该项目到 https://github.com/Loongson-Cloud-Community/debuerreotype 然后使用该项目构建。
以下是修改当前项目的比对

# git diff
+diff --git a/library/debian/buster-slim/Makefile b/library/debian/buster-slim/Makefile
index 2362add..a595827 100644
--- a/library/debian/buster-slim/Makefile
+++ b/library/debian/buster-slim/Makefile
@@ -7,7 +7,7 @@ TAG?=buster-slim
 
 IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
 
-ROOTFS=rootfs.tar.gz
+ROOTFS=rootfs.tar.xz
 
 default: image
 
@@ -17,7 +17,7 @@ image: $(ROOTFS)
 		-t $(IMAGE) \
 		.
 
-push: 
+push:
 	docker push $(IMAGE)
 
 $(ROOTFS):
diff --git a/library/debian/buster-slim/make_rootfs.sh b/library/debian/buster-slim/make_rootfs.sh
index 74a633a..003b18c 100755
--- a/library/debian/buster-slim/make_rootfs.sh
+++ b/library/debian/buster-slim/make_rootfs.sh
@@ -4,24 +4,66 @@ set -e
 : ${DISTRO:="loongnix"}
 : ${RELEASE:=DaoXiangHu-stable}
 : ${MIRROR_ADDRESS:=http://pkg.loongnix.cn/loongnix}
-: ${ROOTFS:="rootfs.tar.gz"}
+: ${ROOTFS:="rootfs.tar.xz"}
 : ${APT_CONF_URL:="https://raw.githubusercontent.com/GoogleContainerTools/base-images-docker/master/debian/reproducible/overlay/etc/apt/apt.conf.d/"}
 
 WKDIR=$1
 cd ${WKDIR?}
 
 apt update -y
-apt install -y debootstrap curl
+apt install -y debootstrap curl xz-utils
 if [ ! -f /usr/share/debootstrap/scripts/$RELEASE ]; then
-	ln -s /usr/share/debootstrap/scripts/sid /usr/share/debootstrap/scripts/$RELEASE
+    ln -s /usr/share/debootstrap/scripts/sid /usr/share/debootstrap/scripts/$RELEASE
 fi
 
-TMPDIR=`mktemp -d`
+# https://github.com/GoogleContainerTools/base-images-docker/tree/master/debian/reproducible/overlay/etc/apt/apt.conf.d
+apt_conf=(
+    apt-retry
+    docker-autoremove-suggests
+    docker-clean
+    docker-gzip-indexes
+    docker-no-languages
+)
+
+for apt_file in ${apt_conf[@]}; do
+    if [ ! -f "/etc/apt/apt.conf.d/${apt_file}" ]; then
+        curl -o /etc/apt/apt.conf.d/${apt_file} -sSL ${APT_CONF_URL}/${apt_file}
+    fi
+done
+
+TMPDIR=$(mktemp -d)
 cp .slimify-includes $TMPDIR/.slimify-includes
 cp .slimify-excludes $TMPDIR/.slimify-excludes
 # install packages
-debootstrap --no-check-gpg --variant=minbase --components=main,non-free,contrib --arch=loongarch64 --foreign $RELEASE $TMPDIR $MIRROR_ADDRESS
-chroot $TMPDIR debootstrap/debootstrap --second-stage
+EXCLUDE='loongnix-gpu-driver-service,loonggpu-compiler,util-linux-extra'
+debootstrap --variant=minbase --no-merged-usr --no-check-gpg --arch=loongarch64 --exclude=$EXCLUDE $RELEASE $TMPDIR $MIRROR_ADDRESS
+
+chroot $TMPDIR bash -c '
+    apt-get -o Acquire::Check-Valid-Until=false update -qq
+    if apt-mark --help &> /dev/null; then
+        apt-mark auto ".*" > /dev/null
+    fi
+    if [ -n "$1" ]; then
+        IFS=","; excludePackages=( $1 ); unset IFS
+        apt-get autoremove -y --purge --allow-remove-essential "${excludePackages[@]}"
+    fi
+    for user in systemd-timesync systemd-network systemd-resolve; do
+        if id $user >/dev/null; then
+            userdel --force --remove $user
+        fi
+    done
+' -- "$EXCLUDE"
+
+excludeusers=(
+    systemd-timesync
+    systemd-network
+    systemd-resolve
+)
+
+for excludeuser in ${excludeusers[@]}; do
+    chroot $TMPDIR userdel --force --remove "${excludeuser}" \
+        || echo "${excludeuser} not found"
+done
 
 # slimify
 slimIncludes=( $(sed '/^#/d;/^$/d' .slimify-includes | sort -u) )
@@ -48,16 +90,10 @@ for slimExclude in "${slimExcludes[@]}"; do
         }
 done
 
-# https://github.com/GoogleContainerTools/base-images-docker/tree/master/debian/reproducible/overlay/etc/apt/apt.conf.d
-apt_conf=(
-    apt-retry
-    docker-autoremove-suggests
-    docker-clean
-    docker-gzip-indexes
-)
-
-for apt_file in ${apt_conf[@]};do
-    curl -o $TMPDIR/etc/apt/apt.conf.d/${apt_file} -sSL ${APT_CONF_URL}/${apt_file}
+for apt_file in ${apt_conf[@]}; do
+    if [ ! -f "$TMPDIR/etc/apt/apt.conf.d/${apt_file}" ]; then
+        cp -rf $TMPDIR/etc/apt/apt.conf.d/${apt_file} $TMPDIR/etc/apt/apt.conf.d/${apt_file}
+    fi
 done
 
 while [ "$(
@@ -69,4 +105,4 @@ while [ "$(
         )" -gt 0 ]; do true; done
 
 chroot $TMPDIR rm -rf /tmp/* /var/cache/apt/* /var/lib/apt/lists/*
-tar -zcvf $ROOTFS -C $TMPDIR .
+tar -cJf $ROOTFS -C $TMPDIR .

使用修改后的构建,最终 rootfs.tar.xz 的大小为 38M

[root@loong64 buster-slim]# ls -al
总用量 38048
drwxr-xr-x 2 root root      200 10月  4 12:07 .
drwxr-xr-x 5 root root      100 10月  3 17:41 ..
-rw-r--r-- 1 root root      120 10月  3 15:18 Dockerfile
-rw-r--r-- 1 root root       14 10月  3 15:18 .gitignore
-rw-r--r-- 1 root root      546 10月  4 11:38 Makefile
-rwxr-xr-x 1 root root     3464 10月  4 11:41 make_rootfs.sh
-rw-r--r-- 1 root root 38837108 10月  4 12:09 rootfs.tar.xz
-rw-r--r-- 1 root root      706 10月  3 15:18 .slimify-excludes
-rw-r--r-- 1 root root      666 10月  3 15:18 .slimify-includes
-rw-r--r-- 1 root root     1754 10月  3 18:34 .tar-exclude

但是使用 debuerreotype 构建的只有 14M,我已经上传至 https://github.com/wojiushixiaobai/docker-debian-artifacts/tree/dist-loongarch64
可以通过如下方式验证:

docker run --rm --privileged -it cr.loongnix.cn/library/debian:buster bash
apt-get update
apt-get install -y debootstrap wget ca-certificates xz-utils git gnupg dirmngr
git clone --depth=1 https://github.com/wojiushixiaobai/debuerreotype /opt/debuerreotype

cd /opt/debuerreotype/scripts
for f in debuerreotype-*; do 
    ln -svL "$PWD/$f" "/usr/local/bin/$f"
done

cd /opt/debuerreotype
ln -svL /usr/share/debootstrap/scripts/DaoXiangHu /opt/debuerreotype/DaoXiangHu-stable

mkdir output
./examples/loongnix.sh --arch loongarch64 output DaoXiangHu-stable

构建完成后在 /opt/debuerreotype/output 可以看到构建结果

如果能使用 debuerreotype 仓库构建的话,只需要修改 make_rootfs.sh 为上面的内容

@zhangguanzhang
Copy link
Contributor Author

你看下文件最初是谁提交的,艾特下它

@wojiushixiaobai
Copy link
Contributor

@znley 大佬有空看看

@znley
Copy link
Contributor

znley commented Oct 7, 2023

@wojiushixiaobai 好的,我这两天看一下这个问题,然后看看怎么处理

@znley
Copy link
Contributor

znley commented Oct 12, 2023

@wojiushixiaobai
感谢你的建议,我和 x86 对照测试了一下,还是基于现有的模式做了更新,镜像大小目前和 x86 相差不大。#94

采用 debuerreotype 会影响现有的 CI 运行,目前所有镜像共用一个 CI,并没有单独对 debian 镜像做 CI。我个人认为保持当前状态工作量最小,等新世界 debian 和上游同源之后,支持 debuerreotype 会简单许多。

@wojiushixiaobai
Copy link
Contributor

wojiushixiaobai commented Oct 13, 2023

@znley 大佬 666,我看 cr.loongnix.cn 已经更新了镜像,大小非常好。

另外我看提交的代码 userExcludes 这部分的处理貌似重复了,两处都处理了,可以只保留一个就行。

userExcludes=(
  systemd-timesync
  systemd-network
  systemd-resolve
)

chroot $TMPDIR bash -c '
  apt-get -o apt-get -o Acquire::Check-Valid-Until=false update -qq
  if apt-mark --help &> /dev/null; then
    apt-mark auto ".*" > /dev/null
  fi
  if [ -n "$1" ]; then
    IFS=","; includePackages=( $1 ); unset IFS
    apt-get install -y --no-install-recommends "${includePackages[@]}"
  fi
  if [ -n "$2" ]; then
    IFS=","; excludePackages=( $2 ); unset IFS
    apt-get autoremove -y --purge --allow-remove-essential "${excludePackages[@]}"
  fi
  for user in systemd-timesync systemd-network systemd-resolve; do
      if id $user >/dev/null; then
          userdel --force --remove $user
      fi
  done
' -- $pkgIncludes $pkgExcludes

for user in ${userExcludes[@]}; do
    chroot $TMPDIR userdel --force --remove "${user}" \
        || echo "${user} not found"
done

还有就是镜像里面 .slimify-excludes.slimify-includes 文件可以移除。
.tar-exclude 咱们能否也引入这个文件来处理压缩时过滤特定的文件及目录。

@znley
Copy link
Contributor

znley commented Oct 16, 2023

.tar-exclude 咱们能否也引入这个文件来处理压缩时过滤特定的文件及目录。

当然可以,这是我忽略的部分,你可以按照你的想法提交一下 pr,否则我需要安排一下工作时间来处理这些问题。

@znley
Copy link
Contributor

znley commented Oct 19, 2023

已更新 #96

@wojiushixiaobai
Copy link
Contributor

@zhangguanzhang 可以关问题了老哥。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants