Skip to content

Feat: let chisel fetch DEBs for the same architecture as the underlying execution environment #11

Closed

Description

@cjdcordeiro

At the moment, only amd64 seems to be supported.

Steps to reproduce

(if emulation is needed, simply run the following with docker buildx for ease of use. Example docker buildx build --platform=linux/arm64 . --progress plain)

Run on any arch different from amd64:

chisel cut --release ubuntu-22.04 --root /tmp openssl_config

Output:

#8 0.142 2022/07/01 15:45:42 Consulting release repository...
#8 0.413 2022/07/01 15:45:43 Fetching current ubuntu-22.04 release...
#8 0.416 2022/07/01 15:45:43 Processing ubuntu-22.04 release...
#8 0.431 2022/07/01 15:45:43 Selecting slices...
#8 0.431 2022/07/01 15:45:43 Fetching ubuntu 22.04 archive details...
#8 1.171 2022/07/01 15:45:44 Release date: Thu, 21 Apr 2022 17:16:08 UTC
#8 1.171 2022/07/01 15:45:44 Fetching ubuntu 22.04 main component...
#8 1.628 2022/07/01 15:45:44 Fetching ubuntu 22.04 universe component...
#8 4.639 2022/07/01 15:45:47 Fetching pool/main/o/openssl/openssl_3.0.2-0ubuntu1_amd64.deb...
#8 5.210 2022/07/01 15:45:48 Extracting files from package "openssl"...

Notice the line

#8 4.639 2022/07/01 15:45:47 Fetching pool/main/o/openssl/openssl_3.0.2-0ubuntu1_amd64.deb...

Proposed solution

Before defining the archives, infer the underlying architecture instead of defaulting to amd64.

NOTE: this was already planned at

Arch: "amd64", // TODO Option for this, implied from running system

Questions

  1. do we need to define Slice Definition Files / package / architecture? Or can we just have one Slice Definition File per package (as we do right now, for each release), and somehow have a new directive to let us identify contents which are architecture specific?

Activity

  1. woky commented on Jul 4, 2022

    @woky
    Contributor

    Adding to what @cjdcordeiro said above. In the PR we have a PoC for multi-arch chisel, but that leaves some problems on the table.

    Consider libc6 and following arches: amd64 arm64 armhf i386 ppc64el riscv64 s390x

    Below is a listing of contents of the library for all the architectures mentioned above (Note that I removed gconv and /usr/share directories. We don't care about those. At least not now.):

    Details

    amd64
    amd64/etc
    amd64/etc/ld.so.conf.d
    amd64/etc/ld.so.conf.d/x86_64-linux-gnu.conf
    amd64/lib
    amd64/lib/x86_64-linux-gnu
    amd64/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
    amd64/lib/x86_64-linux-gnu/libBrokenLocale.so.1
    amd64/lib/x86_64-linux-gnu/libSegFault.so
    amd64/lib/x86_64-linux-gnu/libanl.so.1
    amd64/lib/x86_64-linux-gnu/libc.so.6
    amd64/lib/x86_64-linux-gnu/libc_malloc_debug.so.0
    amd64/lib/x86_64-linux-gnu/libdl.so.2
    amd64/lib/x86_64-linux-gnu/libm.so.6
    amd64/lib/x86_64-linux-gnu/libmemusage.so
    amd64/lib/x86_64-linux-gnu/libmvec.so.1
    amd64/lib/x86_64-linux-gnu/libnsl.so.1
    amd64/lib/x86_64-linux-gnu/libnss_compat.so.2
    amd64/lib/x86_64-linux-gnu/libnss_dns.so.2
    amd64/lib/x86_64-linux-gnu/libnss_files.so.2
    amd64/lib/x86_64-linux-gnu/libnss_hesiod.so.2
    amd64/lib/x86_64-linux-gnu/libpcprofile.so
    amd64/lib/x86_64-linux-gnu/libpthread.so.0
    amd64/lib/x86_64-linux-gnu/libresolv.so.2
    amd64/lib/x86_64-linux-gnu/librt.so.1
    amd64/lib/x86_64-linux-gnu/libthread_db.so.1
    amd64/lib/x86_64-linux-gnu/libutil.so.1
    amd64/lib64
    amd64/lib64/ld-linux-x86-64.so.2
    amd64/usr
    amd64/usr/lib
    amd64/usr/lib/x86_64-linux-gnu
    amd64/usr/lib/x86_64-linux-gnu/audit
    amd64/usr/lib/x86_64-linux-gnu/audit/sotruss-lib.so
    arm64
    arm64/etc
    arm64/etc/ld.so.conf.d
    arm64/etc/ld.so.conf.d/aarch64-linux-gnu.conf
    arm64/lib
    arm64/lib/aarch64-linux-gnu
    arm64/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1
    arm64/lib/aarch64-linux-gnu/libBrokenLocale.so.1
    arm64/lib/aarch64-linux-gnu/libSegFault.so
    arm64/lib/aarch64-linux-gnu/libanl.so.1
    arm64/lib/aarch64-linux-gnu/libc.so.6
    arm64/lib/aarch64-linux-gnu/libc_malloc_debug.so.0
    arm64/lib/aarch64-linux-gnu/libdl.so.2
    arm64/lib/aarch64-linux-gnu/libm.so.6
    arm64/lib/aarch64-linux-gnu/libmemusage.so
    arm64/lib/aarch64-linux-gnu/libnsl.so.1
    arm64/lib/aarch64-linux-gnu/libnss_compat.so.2
    arm64/lib/aarch64-linux-gnu/libnss_dns.so.2
    arm64/lib/aarch64-linux-gnu/libnss_files.so.2
    arm64/lib/aarch64-linux-gnu/libnss_hesiod.so.2
    arm64/lib/aarch64-linux-gnu/libpcprofile.so
    arm64/lib/aarch64-linux-gnu/libpthread.so.0
    arm64/lib/aarch64-linux-gnu/libresolv.so.2
    arm64/lib/aarch64-linux-gnu/librt.so.1
    arm64/lib/aarch64-linux-gnu/libthread_db.so.1
    arm64/lib/aarch64-linux-gnu/libutil.so.1
    arm64/lib/ld-linux-aarch64.so.1
    arm64/usr
    arm64/usr/lib
    arm64/usr/lib/aarch64-linux-gnu
    arm64/usr/lib/aarch64-linux-gnu/audit
    arm64/usr/lib/aarch64-linux-gnu/audit/sotruss-lib.so
    armhf
    armhf/etc
    armhf/etc/ld.so.conf.d
    armhf/etc/ld.so.conf.d/arm-linux-gnueabihf.conf
    armhf/lib
    armhf/lib/arm-linux-gnueabihf
    armhf/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
    armhf/lib/arm-linux-gnueabihf/ld-linux.so.3
    armhf/lib/arm-linux-gnueabihf/libBrokenLocale.so.1
    armhf/lib/arm-linux-gnueabihf/libSegFault.so
    armhf/lib/arm-linux-gnueabihf/libanl.so.1
    armhf/lib/arm-linux-gnueabihf/libc.so.6
    armhf/lib/arm-linux-gnueabihf/libc_malloc_debug.so.0
    armhf/lib/arm-linux-gnueabihf/libdl.so.2
    armhf/lib/arm-linux-gnueabihf/libm.so.6
    armhf/lib/arm-linux-gnueabihf/libmemusage.so
    armhf/lib/arm-linux-gnueabihf/libnsl.so.1
    armhf/lib/arm-linux-gnueabihf/libnss_compat.so.2
    armhf/lib/arm-linux-gnueabihf/libnss_dns.so.2
    armhf/lib/arm-linux-gnueabihf/libnss_files.so.2
    armhf/lib/arm-linux-gnueabihf/libnss_hesiod.so.2
    armhf/lib/arm-linux-gnueabihf/libpcprofile.so
    armhf/lib/arm-linux-gnueabihf/libpthread.so.0
    armhf/lib/arm-linux-gnueabihf/libresolv.so.2
    armhf/lib/arm-linux-gnueabihf/librt.so.1
    armhf/lib/arm-linux-gnueabihf/libthread_db.so.1
    armhf/lib/arm-linux-gnueabihf/libutil.so.1
    armhf/lib/ld-linux-armhf.so.3
    armhf/usr
    armhf/usr/lib
    armhf/usr/lib/arm-linux-gnueabihf
    armhf/usr/lib/arm-linux-gnueabihf/audit
    armhf/usr/lib/arm-linux-gnueabihf/audit/sotruss-lib.so
    i386
    i386/etc
    i386/etc/ld.so.conf.d
    i386/etc/ld.so.conf.d/i386-linux-gnu.conf
    i386/lib
    i386/lib/i386-linux-gnu
    i386/lib/i386-linux-gnu/ld-linux.so.2
    i386/lib/i386-linux-gnu/libBrokenLocale.so.1
    i386/lib/i386-linux-gnu/libSegFault.so
    i386/lib/i386-linux-gnu/libanl.so.1
    i386/lib/i386-linux-gnu/libc.so.6
    i386/lib/i386-linux-gnu/libc_malloc_debug.so.0
    i386/lib/i386-linux-gnu/libdl.so.2
    i386/lib/i386-linux-gnu/libm.so.6
    i386/lib/i386-linux-gnu/libmemusage.so
    i386/lib/i386-linux-gnu/libnsl.so.1
    i386/lib/i386-linux-gnu/libnss_compat.so.2
    i386/lib/i386-linux-gnu/libnss_dns.so.2
    i386/lib/i386-linux-gnu/libnss_files.so.2
    i386/lib/i386-linux-gnu/libnss_hesiod.so.2
    i386/lib/i386-linux-gnu/libpcprofile.so
    i386/lib/i386-linux-gnu/libpthread.so.0
    i386/lib/i386-linux-gnu/libresolv.so.2
    i386/lib/i386-linux-gnu/librt.so.1
    i386/lib/i386-linux-gnu/libthread_db.so.1
    i386/lib/i386-linux-gnu/libutil.so.1
    i386/lib/ld-linux.so.2
    i386/usr
    i386/usr/lib
    i386/usr/lib/i386-linux-gnu
    i386/usr/lib/i386-linux-gnu/audit
    i386/usr/lib/i386-linux-gnu/audit/sotruss-lib.so
    ppc64el
    ppc64el/etc
    ppc64el/etc/ld.so.conf.d
    ppc64el/etc/ld.so.conf.d/powerpc64le-linux-gnu.conf
    ppc64el/lib
    ppc64el/lib/powerpc64le-linux-gnu
    ppc64el/lib/powerpc64le-linux-gnu/ld64.so.2
    ppc64el/lib/powerpc64le-linux-gnu/libBrokenLocale.so.1
    ppc64el/lib/powerpc64le-linux-gnu/libSegFault.so
    ppc64el/lib/powerpc64le-linux-gnu/libanl.so.1
    ppc64el/lib/powerpc64le-linux-gnu/libc.so.6
    ppc64el/lib/powerpc64le-linux-gnu/libc_malloc_debug.so.0
    ppc64el/lib/powerpc64le-linux-gnu/libdl.so.2
    ppc64el/lib/powerpc64le-linux-gnu/libm.so.6
    ppc64el/lib/powerpc64le-linux-gnu/libmemusage.so
    ppc64el/lib/powerpc64le-linux-gnu/libnsl.so.1
    ppc64el/lib/powerpc64le-linux-gnu/libnss_compat.so.2
    ppc64el/lib/powerpc64le-linux-gnu/libnss_dns.so.2
    ppc64el/lib/powerpc64le-linux-gnu/libnss_files.so.2
    ppc64el/lib/powerpc64le-linux-gnu/libnss_hesiod.so.2
    ppc64el/lib/powerpc64le-linux-gnu/libpcprofile.so
    ppc64el/lib/powerpc64le-linux-gnu/libpthread.so.0
    ppc64el/lib/powerpc64le-linux-gnu/libresolv.so.2
    ppc64el/lib/powerpc64le-linux-gnu/librt.so.1
    ppc64el/lib/powerpc64le-linux-gnu/libthread_db.so.1
    ppc64el/lib/powerpc64le-linux-gnu/libutil.so.1
    ppc64el/lib64
    ppc64el/lib64/ld64.so.2
    ppc64el/usr
    ppc64el/usr/lib
    ppc64el/usr/lib/powerpc64le-linux-gnu
    ppc64el/usr/lib/powerpc64le-linux-gnu/audit
    ppc64el/usr/lib/powerpc64le-linux-gnu/audit/sotruss-lib.so
    riscv64
    riscv64/etc
    riscv64/etc/ld.so.conf.d
    riscv64/etc/ld.so.conf.d/riscv64-linux-gnu.conf
    riscv64/lib
    riscv64/lib/ld-linux-riscv64-lp64d.so.1
    riscv64/lib/riscv64-linux-gnu
    riscv64/lib/riscv64-linux-gnu/ld-linux-riscv64-lp64d.so.1
    riscv64/lib/riscv64-linux-gnu/libBrokenLocale.so.1
    riscv64/lib/riscv64-linux-gnu/libSegFault.so
    riscv64/lib/riscv64-linux-gnu/libanl.so.1
    riscv64/lib/riscv64-linux-gnu/libc.so.6
    riscv64/lib/riscv64-linux-gnu/libc_malloc_debug.so.0
    riscv64/lib/riscv64-linux-gnu/libdl.so.2
    riscv64/lib/riscv64-linux-gnu/libm.so.6
    riscv64/lib/riscv64-linux-gnu/libmemusage.so
    riscv64/lib/riscv64-linux-gnu/libnsl.so.1
    riscv64/lib/riscv64-linux-gnu/libnss_compat.so.2
    riscv64/lib/riscv64-linux-gnu/libnss_dns.so.2
    riscv64/lib/riscv64-linux-gnu/libnss_files.so.2
    riscv64/lib/riscv64-linux-gnu/libnss_hesiod.so.2
    riscv64/lib/riscv64-linux-gnu/libpcprofile.so
    riscv64/lib/riscv64-linux-gnu/libpthread.so.0
    riscv64/lib/riscv64-linux-gnu/libresolv.so.2
    riscv64/lib/riscv64-linux-gnu/librt.so.1
    riscv64/lib/riscv64-linux-gnu/libthread_db.so.1
    riscv64/lib/riscv64-linux-gnu/libutil.so.1
    riscv64/usr
    riscv64/usr/lib
    riscv64/usr/lib/riscv64-linux-gnu
    riscv64/usr/lib/riscv64-linux-gnu/audit
    riscv64/usr/lib/riscv64-linux-gnu/audit/sotruss-lib.so
    s390x
    s390x/etc
    s390x/etc/ld.so.conf.d
    s390x/etc/ld.so.conf.d/s390x-linux-gnu.conf
    s390x/lib
    s390x/lib/ld64.so.1
    s390x/lib/s390x-linux-gnu
    s390x/lib/s390x-linux-gnu/ld64.so.1
    s390x/lib/s390x-linux-gnu/libBrokenLocale.so.1
    s390x/lib/s390x-linux-gnu/libSegFault.so
    s390x/lib/s390x-linux-gnu/libanl.so.1
    s390x/lib/s390x-linux-gnu/libc.so.6
    s390x/lib/s390x-linux-gnu/libc_malloc_debug.so.0
    s390x/lib/s390x-linux-gnu/libdl.so.2
    s390x/lib/s390x-linux-gnu/libm.so.6
    s390x/lib/s390x-linux-gnu/libmemusage.so
    s390x/lib/s390x-linux-gnu/libnsl.so.1
    s390x/lib/s390x-linux-gnu/libnss_compat.so.2
    s390x/lib/s390x-linux-gnu/libnss_dns.so.2
    s390x/lib/s390x-linux-gnu/libnss_files.so.2
    s390x/lib/s390x-linux-gnu/libnss_hesiod.so.2
    s390x/lib/s390x-linux-gnu/libpcprofile.so
    s390x/lib/s390x-linux-gnu/libpthread.so.0
    s390x/lib/s390x-linux-gnu/libresolv.so.2
    s390x/lib/s390x-linux-gnu/librt.so.1
    s390x/lib/s390x-linux-gnu/libthread_db.so.1
    s390x/lib/s390x-linux-gnu/libutil.so.1
    s390x/usr
    s390x/usr/lib
    s390x/usr/lib/s390x-linux-gnu
    s390x/usr/lib/s390x-linux-gnu/audit
    s390x/usr/lib/s390x-linux-gnu/audit/sotruss-lib.so
    

    Immediate difference in paths between architectures is /lib/*-linux-*. This commit shows how libc6 slices can be updated to account for some path differences: woky/chisel-releases@c59d9e8?diff=split With this commit and this piece of shell, I can slice libc6_libs for all arches:

    for a in amd64 arm64 armhf i386 ppc64el riscv64 s390x; do
        rm -rf output-$a
        mkdir output-$a
        chisel cut --release ~/devel/chisel-releases/ --root $PWD/output-$a --arch $a libc6_libs
    done
    

    However, note that I had to comment out /lib/*-linux-*/libmvec.so.* because it doesn't exists for some architectures.

    Also, there are major differences in dynamic linker/loader symlinks (those outside of /lib/*-linux-*/):

    arches/amd64/lib64/ld-linux-x86-64.so.2
    arches/arm64/lib/ld-linux-aarch64.so.1
    arches/armhf/lib/ld-linux-armhf.so.3
    arches/i386/lib/ld-linux.so.2
    arches/ppc64el/lib64/ld64.so.2
    arches/riscv64/lib/ld-linux-riscv64-lp64d.so.1
    arches/s390x/lib/ld64.so.1
    

    I can match all of them with the wildcard /lib*/ld*.so.* but it seems too general. It might work for libc6, but for other packages, we could match unintended files.

    So the question in addition to the previous post is, how should we handle multi-architecture slices?

    /cc @cjdcordeiro @niemeyer

  2. cjdcordeiro commented on Jul 4, 2022

    @cjdcordeiro
    CollaboratorAuthor

    thanks for the example @woky . I also agree that the usage of "*" seems a bit abusive in this case.

  3. niemeyer commented on Jul 5, 2022

    @niemeyer
    Contributor

    Let's get something nice in place to solve this. What's the urgency here?

  4. cjdcordeiro commented on Jul 5, 2022

    @cjdcordeiro
    CollaboratorAuthor

    it depends on whether @woky can make the current SDFs in https://github.com/woky/chisel-releases/tree/ubuntu-22.10-dotnet6/slices work for multi-arch (with the "*" workaround). @woky?

    If not doable, then I'd say this should be addressed as soon as possible.

  5. woky commented on Jul 5, 2022

    @woky
    Contributor

    @cjdcordeiro @niemeyer I think the libc6 is the ugliest case but I can make it work with the wildcards above. I also need to find out which are the architectures that don't contain /lib/*-linux-*/libmvec.so.* and check .NET works without it. We only need amd64 and arm64 right now, so if it's in both, it's fine.

  6. cjdcordeiro commented on Jul 5, 2022

    @cjdcordeiro
    CollaboratorAuthor

    thanks @woky . even if it works, I'd recommend we play it safe and try to address this without too much delay. I don't think we need to rush, but it would probably be nice to make it the next priority item for chisel. Just to kick things off, I'm capturing here the few thoughts I had on this matter:


    What if we have just one Slice Definition File (SDF) per pkg, which encompasses all DEB contents for all the pkg architectures? Something like

    slices:
      slicename:
        contents:
          /path/to/all/archs/file:
          /path/to/amd64/file: {archs: [amd64]}
          /path/to/amd64/and/arm/file: {archs: [amd64, arm]}
          /etc/pkg/someFile*.txt: {text: FIXME, mutate: true}
    

    Concern: mutation scripts could potentially start having a lot of conditionals for mutating the right files for the right architectures. Would it make sense to create yet another directive for creating content aliases? Example:

    slices:
      slicename:
        contents:
          /path/to/all/archs/file:
          /path/to/amd64/file: {archs: [amd64]}
          /path/to/amd64/and/arm/file: {archs: [amd64, arm]}
          /etc/pkg/someFile*.txt: {text: FIXME, mutate: true, alias: someFile}
        mutate: |
          content.write(someFile, "foo")
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions