slimtoolkit / slim

Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
Apache License 2.0
19.5k stars 732 forks source link

ERROR: Module `xxx` does not exist! #120

Open oozman opened 4 years ago

oozman commented 4 years ago

I'm getting a bunch of Module does not exist issue after doing:

docker-slim build thecodingmachine/php:7.3-v2-apache-node12

Running the slim container returns:

ERROR: Module actions does not exist!
ERROR: Module allowmethods does not exist!
ERROR: Module asis does not exist!
ERROR: Module auth_digest does not exist!
.
.
.
ERROR: Module substitute does not exist!
ERROR: Module suexec does not exist!
ERROR: Module unique_id does not exist!
ERROR: Module userdir does not exist!
ERROR: Module usertrack does not exist!
ERROR: Module vhost_alias does not exist!
ERROR: Module xml2enc does not exist!

Am I missing something?

Thanks

kcq commented 4 years ago

@omarusman It might be related to Apache... I'll need to double check. I assume this is the Docker image: https://github.com/thecodingmachine/docker-images-php/blob/v3/Dockerfile.apache.node12

It does look like you are running docker-slim against a base image and not an application image, so it's not surprising that something is missing. It is possible to use docker-slim with base images, but it requires extra work where you need to explicitly tell docker-slim the extra artifacts/modules/packages/files you'll need.

pentium10 commented 2 years ago

@kcq I went into this issue myself as well (using the master build)

essentially what I've seen is that some files in /var/www/modules are kept but they are zero sized.

httpd: Syntax error on line 85 of /etc/apache2/httpd.conf: Cannot load modules/mod_authz_host.so into server: Error loading shared library /var/www/modules/mod_authz_host.so: Exec format error
/ # ls -l /var/www/modules/mod_*
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_access_compat.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_alias.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_auth_basic.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_authn_core.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_authn_file.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_authz_core.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_authz_groupfile.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_authz_host.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_authz_user.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_autoindex.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_dir.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_env.so
-rwxr-xr-x    1 root     root         18304 Dec 20 22:42 /var/www/modules/mod_filter.so
-rwxr-xr-x    1 root     root         22400 Dec 20 22:42 /var/www/modules/mod_headers.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_log_config.so
-rwxr-xr-x    1 root     root         26496 Dec 20 22:42 /var/www/modules/mod_mime.so
-rwxr-xr-x    1 root     root         34688 Dec 20 22:42 /var/www/modules/mod_mpm_prefork.so
-rwxr-xr-x    1 root     root         34688 Dec 20 22:42 /var/www/modules/mod_negotiation.so
-rwxr-xr-x    1 root     root      26951744 Feb 19 04:12 /var/www/modules/mod_php8.so
-rwxr-xr-x    1 root     root         18304 Dec 20 22:42 /var/www/modules/mod_reqtimeout.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_rewrite.so
-rwxr-xr-x    1 root     root         26496 Dec 20 22:42 /var/www/modules/mod_session.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_setenvif.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_status.so
-rwxr-xr-x    1 root     root         14208 Dec 20 22:42 /var/www/modules/mod_unixd.so
-rwxr-xr-x    1 root     root             0 Feb 22 22:28 /var/www/modules/mod_version.so
/ #

the date says the DS was touching them.

the /etc/apache2/httpd.conf references the following line and its not commented out:

LoadModule authz_host_module modules/mod_authz_host.so
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: collector - data.Mask => 1"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: collector - file read"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: collector - file path => /usr/lib/apache2/mod_authn_core.so"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=0}"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: processor - [38] handling event {38 16 /usr/lib/apache2/mod_authn_core.so true false}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=9}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=9}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=9}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=9}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=3}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=10}"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: collector - data.Mask => 20"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: collector - file open"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=2}"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: collector - file path => /usr/lib/apache2/mod_authz_host.so"
time="2022-02-22T22:40:48Z" level=debug msg="fanmon: processor - [39] handling event {39 16 /usr/lib/apache2/mod_authz_host.so false false}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=72}"
time="2022-02-22T22:40:48Z" level=debug msg="ptrace.App.process: event ==> {pid=16 cn=5}"

❗ interesting is this one (it looks too me that the code went bad for some reason)

time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifacts - fsa artifact => /var/www/html/vendor/composer/../guzzlehttp/psr7/src/Stream.php"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifact - file mode:-rwxr-xr-x"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifacts - fsa artifact => /var/www/html/vendor/composer/../ramsey/uuid/src/Generator/RandomGeneratorFactory.php"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifact - file mode:-rwxr-xr-x"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifacts - fsa artifact => /var/www/html/vendor/composer/../google/auth/src/Cache/MemoryCacheItemPool.php"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifact - file mode:-rwxr-xr-x"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../google/cloud-core/src/Iterator/ItemIterator.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../psr/http-message/src/UriInterface.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/psr/http-message/src/ResponseInterface.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/google/auth/src/HttpHandler/Guzzle7HttpHandler.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="sodeps.AllDependencies(/usr/lib/apache2/mod_version.so): exe error result - wait: no child processes (stderr: 'Error relocating /usr/lib/apache2/mod_version.so: ap_pregcomp: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: ap_regexec: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: ap_soak_end_container: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: apr_pstrmemdup: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: ap_pregfree: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: ap_build_cont_config: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: ap_get_server_revision: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: apr_psprintf: symbol not found\nError relocating /usr/lib/apache2/mod_version.so: apr_pstrcat: symbol not found\n')"
time="2022-02-22T22:41:03Z" level=warning msg="prepareArtifacts.binArtifacts[bsa] - /usr/lib/apache2/mod_version.so - error getting bin artifacts => wait: no child processes\n"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/ramsey/uuid/src/Lazy/LazyUuidFromString.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/etc/apache2/conf.d/languages.conf) - elf.Open error: bad magic number '[35 10 35 32]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../guzzlehttp/guzzle/src/Client.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/./includes/config.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/guzzlehttp/guzzle/src/functions.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/guzzlehttp/guzzle/src/ClientTrait.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="ptrace.App.collect: unknown process is terminated (33)"
time="2022-02-22T22:41:03Z" level=debug msg="ptrace.App.collect: stop (exiting)"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifacts.binArtifacts[bsa] - known file path (/lib/ld-musl-x86_64.so.1)"
time="2022-02-22T22:41:03Z" level=debug msg="prepareArtifacts.binArtifacts[bsa] - known file path (/lib/ld-musl-x86_64.so.1)"
time="2022-02-22T22:41:03Z" level=debug msg="sodeps.AllDependencies(/usr/lib/apache2/mod_alias.so): exe error result - exit status 127 (stderr: 'Error relocating /usr/lib/apache2/mod_alias.so: ap_expr_str_exec: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_is_url: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_pregcomp: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_regexec: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_check_cmd_context: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_server_root_relative: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_uri_unparse: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_pstrdup: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_os_escape_path: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_expr_parse_cmd_mi: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_table_setn: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_set_context_info: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_palloc: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_pstrcat: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_array_push: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_log_error_: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_log_rerror_: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_hook_fixups: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_array_append: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_pregsub: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_construct_url: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_array_make: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: ap_hook_translate_name: symbol not found\nError relocating /usr/lib/apache2/mod_alias.so: apr_uri_parse: symbol not found\n')"
time="2022-02-22T22:41:03Z" level=warning msg="prepareArtifacts.binArtifacts[bsa] - /usr/lib/apache2/mod_alias.so - error getting bin artifacts => exit status 127\n"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../ramsey/uuid/src/Provider/NodeProviderInterface.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../symfony/polyfill-php81/bootstrap.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../ramsey/collection/src/AbstractArray.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
time="2022-02-22T22:41:03Z" level=debug msg="sodeps.AllDependencies(/usr/lib/apache2/mod_authz_host.so): exe error result - exit status 127 (stderr: 'Error relocating /usr/lib/apache2/mod_authz_host.so: ap_hook_post_config: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_expr_str_exec: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_register_auth_provider: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_getword_conf: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_pstrmemdup: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_hash_get: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_pstrdup: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_hash_set: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_hash_make: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_expr_parse_cmd_mi: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_psprintf: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_sockaddr_info_get: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_palloc: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_ipsubnet_create: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_pstrcat: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_get_useragent_host: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_hook_pre_config: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: ap_log_rerror_: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_sockaddr_equal: symbol not found\nError relocating /usr/lib/apache2/mod_authz_host.so: apr_ipsubnet_test: symbol not found\n')"
time="2022-02-22T22:41:03Z" level=warning msg="prepareArtifacts.binArtifacts[bsa] - /usr/lib/apache2/mod_authz_host.so - error getting bin artifacts => exit status 127\n"

some other weird errors, that's a plain PHP file not a binfile

time="2022-02-22T22:41:03Z" level=debug msg="binfile.Detected(/var/www/html/vendor/composer/../google/cloud-core/src/Iterator/ItemIterator.php) - elf.Open error: bad magic number '[60 63 112 104]' in record at byte 0x0"
kcq commented 2 years ago

@pentium10 the bad magic number errors are ok... it's a side effect trying to detect which included files are also binary files

need to investigate therelocating errors

kcq commented 2 years ago

@pentium10 latest code in master might be able to address the errors you observed