Skip to content

Entrypoint fails with libgcc_s.so.1: cannot open shared object file #296

Description

@petracvv

I was trying out this tool to experiment with bootc in a VM but I am unable to successfully create a VM with the default podman options. I built this project locally as it's not currently packaged for gentoo. Here is the full output:

❯ bcvk ephemeral run-ssh  quay.io/centos-bootc/centos-bootc:stream10
⠉ Starting VM...                                                                                                                          Error: can only start exec sessions when their container is running: container state improper

Container state: exited (exit code: 127)

Note: Exit code 127 typically means 'command not found'.
This container image may not be a valid bootc image.
Bootc images must have systemd and kernel modules in /usr/lib/modules.
/run/selfexe: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
(Container produced no output)
Error:
   0: Monitor process exited unexpectedly: ExitStatus(unix_wait_status(65280))

Location:
   crates/kit/src/run_ephemeral_ssh.rs:246

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

I traced this down to some differences in shared library packaging between Fedora / openSUSE / CentOS / Alma, etc and other distros. You mount /usr into the initial container tmproot (/run/tmproot) which includes the default library locations. However, some distributions put gcc-specific libraries in subdirectories of /usr/lib and those are not searched by default. So when you do the nested bwrap command, those libraries are missing from the library path for programs running in that tmproot.

After making some small changes to the default podman command I was able to get past this error:

In crates/kit/src/run_ephemeral.rs:

        "-v",
        // Some host distributions don't have all libraries in /lib or /lib64.
        // We mount the current ld.so.cache into the tmproot so it matches
        // library locations in the mounted /usr
        "/etc/ld.so.cache:/run/tmproot/etc/ld.so.cache:ro",

In crates/kit/scripts/entrypoint.sh

# No longer make the /etc dir
mkdir -p {var,dev,proc,run,sys,tmp}

While the above changes do fix things I'm not sure if there's a better way to handle this. I can have a PR ready pretty quickly if this does look like a good solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions