Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Postgres | Error opening executable #2632

@dzygann

Description

@dzygann

Hi,

we're trying to run Postgres in Graphene. OS is Ubuntu 20.04.

To that end we created our own Dockerfile:

# syntax=docker/dockerfile:1
FROM ubuntu:18.04

# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3
#  There are some warnings (in red) that show up during the build. You can hide
#  them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common postgresql-10 postgresql-client-10 postgresql-contrib-10

# Note: The official Debian and Ubuntu images automatically ``apt-get clean``
# after each ``apt-get``

# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed``
USER postgres

# Create a PostgreSQL role named ``docker`` with ``docker`` as the password and
# then create a database `docker` owned by the ``docker`` role.
# Note: here we use ``&&\`` to run commands one after the other - the ``\``
#       allows the RUN command to span multiple lines.
RUN    /etc/init.d/postgresql start &&\
    psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
    createdb -O docker docker

# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
RUN echo "host all  all    0.0.0.0/0  md5" >> /etc/postgresql/10/main/pg_hba.conf

# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
RUN echo "listen_addresses='*'" >> /etc/postgresql/10/main/postgresql.conf

# Expose the PostgreSQL port
EXPOSE 5432

# Add VOLUMEs to allow backup of config, logs and databases
VOLUME  ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]

# Set the default command to run when starting the container
CMD ["/usr/lib/postgresql/10/bin/postgres", "-D", "/var/lib/postgresql/10/main", "-c", "config_file=/etc/postgresql/10/main/postgresql.conf"]


Which we then build and signed using gsc.
However when starting the image we encounter the following problem:

[P9:postgres] debug: Host: Linux-SGX
[P9:postgres] debug: LibOS xsave_enabled 1, xsave_size 0x440(1088), xsave_features 0x1f
[P9:postgres] debug: Initial VMA region 0xfb2a2000-0xfb545000 (LibOS) bookkeeped
[P9:postgres] debug: Initial VMA region 0xffce6000-0x100000000 (manifest) bookkeeped
[P9:postgres] debug: ASLR top address adjusted to 0x38c53000
[P9:postgres] debug: Shim loaded at 0xfb2a2000, ready to initialize
[P9:postgres] debug: Mounting root as chroot filesystem: from file:/ to /
[P9:postgres] debug: Mounting special proc filesystem: /proc
[P9:postgres] debug: Mounting special dev filesystem: /dev
[P9:postgres] debug: Mounting terminal device /dev/tty under /dev
[P9:postgres] debug: Mounting special sys filesystem: /sys
[P9:T1:postgres] error: init_exec_handle: cannot find executable in filesystem: -2
[P9:T1:postgres] error: Error during shim_init() in init_important_handles (-2)
debug: DkProcessExit: Returning exit code 2

Remembering what dimakuv said in a previous issue, we took a step back to try again without gsc and only graphene-direct using the memcached example as a base.
During the Postgres server startup we faced a similar issue:

# Start Postgres service
graphene-direct bin/pg_ctl -D data -l logfile start

[P71712::] debug: Host: Linux
[P71712::] debug: LibOS xsave_enabled 1, xsave_size 0x440(1088), xsave_features 0x1f
[P71712::] debug: Initial VMA region 0x7fe147624000-0x7fe14769b000 (LibOS) bookkeeped
[P71712::] debug: Initial VMA region 0x7ffd04aae000-0x7ffd04aaf000 (vdso) bookkeeped
[P71712::] debug: Initial VMA region 0x7ffd04aaa000-0x7ffd04aae000 (vvar) bookkeeped
[P71712::] debug: Initial VMA region 0x7fe14769b000-0x7fe14769c000 (pal_internal_me) bookkeeped
[P71712::] debug: ASLR top address adjusted to 0x54629ca88000
[P71712::] debug: host is not Linux-SGX, skipping /dev/attestation setup
[P71712::] debug: Shim loaded at 0x7fe147624000, ready to initialize
[P71712::] debug: Mounting root as chroot filesystem: from file:. to /
[P71712::] debug: Mounting special proc filesystem: /proc
[P71712::] debug: Mounting special dev filesystem: /dev
[P71712::] debug: Mounting terminal device /dev/tty under /dev
[P71712::] debug: Mounting special sys filesystem: /sys
[P71712:T1:] debug: Mounting as chroot filesystem: from file:/usr/local/lib/x86_64-linux-gnu/graphene/runtime/glibc to /lib
[P71712:T1:] debug: Mounting as chroot filesystem: from file:/etc to /etc
[P71712:T1:] debug: Mounting as chroot filesystem: from file:/lib/x86_64-linux-gnu to /lib/x86_64-linux-gnu
[P71712:T1:] debug: Mounting as chroot filesystem: from file:/usr//lib/x86_64-linux-gnu to /usr//lib/x86_64-linux-gnu
[P71712:T1:] error: init_exec_handle: error opening executable: -2
[P71712:T1:] error: Error during shim_init() in init_important_handles (-2)

Do you have any ideas to fix this issue?

Thanks in advance.

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