sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.08k stars 280 forks source link

How to apply the glibc package after installed? #82

Closed OndraZizka closed 5 months ago

OndraZizka commented 6 years ago

Hi, this is a question, possibly a newbie one. I am trying to get wal2json work with PostgreSQL in postgresql:9.5-alpine. When trying to use the plugin, I get

ERROR: could not load library "/usr/local/lib/postgresql/wal2json.so": Error relocating /usr/local/lib/postgresql/wal2json.so: __snprintf_chk: symbol not found

See https://github.com/eulerto/wal2json/issues/68

So I installed alpine-pkg-glibc, but it still happens. I assume I have to tell the kernel to load the glibc for the PostgreSQL process. But how? I recall something with LD_something... But could someone please show me the proper way? Or am I trying something that's doomed not to work?

OndraZizka commented 6 years ago

I have found this: https://github.com/jeanblanchard/docker-alpine-glibc/blob/master/Dockerfile
And installed the same way. Now /usr/glibc-compat/sbin/ldconfig -p gives me:

...
        libc.so.6 (libc6,x86-64, OS ABI: Linux 3.2.0) => /usr/glibc-compat/lib/libc.so.6
...

So It should be in effect. However, after restarting the container, I still get that ERROR. And:

09d700ea9a4f:/# ldd /usr/local/lib/postgresql/wal2json.so
        ldd (0x7fb6cc5f6000)
        libc.so.6 => ldd (0x7fb6cc5f6000)
Error relocating /usr/local/lib/postgresql/wal2json.so: palloc0: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: __snprintf_chk: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pg_lsn_out: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: parse_bool: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pg_strncasecmp: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: nocachegetattr: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: CurrentMemoryContext: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: OidOutputFunctionCall: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: RelationIdGetRelation: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: OutputPluginWrite: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: lappend: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: ReleaseSysCache: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: elog_finish: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: initStringInfo: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: AllocSetContextCreate: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: list_free_deep: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: text_to_cstring: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errstart: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: OutputPluginPrepareWrite: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: appendStringInfoChar: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: appendStringInfo: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: get_namespace_name: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pg_detoast_datum: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: TopMemoryContext: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: escape_json: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: MemoryContextDelete: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pstrdup: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: RelationClose: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: elog_start: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: format_type: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: getTypeOutputInfo: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: SearchSysCache: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errmsg: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: timestamptz_to_str: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: DirectFunctionCall2Coll: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errfinish: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: appendStringInfoString: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: DirectFunctionCall1Coll: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: RelationGetIndexList: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: heap_getsysattr: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: MemoryContextReset: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pfree: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errcode: symbol not found
sgerrand commented 5 months ago

I'm so sorry for not responding to this bug report sooner. Without an example Dockerfile it's hard to know what's causing these segmentation faults. If you're still experiencing this problem then would you please reply with an example Dockerfile which reproduces the error.

I suggest that if you have chosen to run non-musl based software inside Alpine Linux because of the size of Alpine's Docker images then you and any other future readers in a situation like this should consider running containers based on Docker images that are based on a GNU C library, rather than trying to run binaries which weren't compiled for musl inside Alpine Linux. As an example, Debian currently provide "slim" Docker images for each of their releases which are ~ 30 MB compressed.