Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Batect 0.80+ unable to run when /tmp mounted noexec #1340

Closed
or1can opened this issue Sep 2, 2022 · 4 comments
Closed

Batect 0.80+ unable to run when /tmp mounted noexec #1340

or1can opened this issue Sep 2, 2022 · 4 comments
Labels

Comments

@or1can
Copy link

or1can commented Sep 2, 2022

Describe the bug

I've just upgraded a build to batect 0.80.1 and am observing failures to run any tasks. I've logged onto a build agent and tried to get batect version information, but getting a fatal exception instead (java.lang.UnsatisfiedLinkError).

Reproduction repo

No response

Steps to reproduce

./batect --version

Expected behaviour

Batect version information is output, similar to:

$ ./batect --version
Batect version:    0.80.1
Built:             2022-09-02 06:35:25 +0000
Built from commit: 49028b35d49139db150797f383f762fa238d2f77 (commit date: 2022-09-02 16:17:11 +1000)
JVM version:       Homebrew OpenJDK 64-Bit Server VM 18.0.2.1
OS version:        Mac OS X 12.5.1 x86_64
Docker version:    20.10.17 (API version: 1.41, minimum supported API version: 1.12, commit: a89b842, operating system: 'linux', architecture: 'amd64', experimental: false)
Git version:       2.32.1 (Apple Git-133)

For documentation and further information on Batect, visit https://github.com/batect/batect.

Actual behaviour

A fatal exception is raised instead (java.lang.UnsatisfiedLinkError), and the following information is output:

$ ./batect --version
Fatal exception: 
java.lang.UnsatisfiedLinkError: /tmp/batect-docker-client11220795272998014237/libdockerclientwrapper.so: failed to map segment from shared object
Library names
[dockerclientwrapper]
Search paths:
[/tmp/batect-docker-client11220795272998014237, /usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib, /usr/local/lib, /usr/local/lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu/libfakeroot]
	at jnr.ffi.provider.jffi.NativeLibrary.loadNativeLibraries(NativeLibrary.java:111)
	at jnr.ffi.provider.jffi.NativeLibrary.getNativeLibraries(NativeLibrary.java:85)
	at jnr.ffi.provider.jffi.NativeLibrary.<init>(NativeLibrary.java:56)
	at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:40)
	at jnr.ffi.LibraryLoader.load(LibraryLoader.java:420)
	at batect.dockerclient.native.APIInstanceKt$nativeAPI$2.invoke(APIInstance.kt:37)
	at batect.dockerclient.native.APIInstanceKt$nativeAPI$2.invoke(APIInstance.kt:26)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at batect.dockerclient.native.APIInstanceKt.getNativeAPI(APIInstance.kt:26)
	at batect.dockerclient.DockerCLIContextJvmKt.determineSelectedCLIContext(DockerCLIContextJvm.kt:33)
	at batect.dockerclient.DockerCLIContext$Companion.getSelectedCLIContext(DockerCLIContext.kt:48)
	at batect.cli.CommandLineOptionsParser$1.invoke(CommandLineOptionsParser.kt:43)
	at batect.cli.CommandLineOptionsParser$1.invoke(CommandLineOptionsParser.kt:43)
	at batect.cli.CommandLineOptionsParser.resolveDockerContext(CommandLineOptionsParser.kt:366)
	at batect.cli.CommandLineOptionsParser.createOptionsObject(CommandLineOptionsParser.kt:394)
	at batect.cli.CommandLineOptionsParser.parseTaskName(CommandLineOptionsParser.kt:317)
	at batect.cli.CommandLineOptionsParser.parse(CommandLineOptionsParser.kt:265)
	at batect.Application.run(Application.kt:69)
	at batect.ApplicationKt.main(Application.kt:45)

Version information

The `./batect --version` information is shown in actual output - batect won't run far enough to generate version output. The expected output is generated locally, using the same batect version.

Any other information

This may be related to, or a duplicate of, #1335, but it appears a little different.

@or1can or1can added the is:bug label Sep 2, 2022
@or1can or1can changed the title batect unable to run on Ubuntu 18.04 LTS batect 0.80.1 unable to run on Ubuntu 18.04 LTS Sep 2, 2022
@charleskorn
Copy link
Collaborator

Thanks for the big report @or1can.

Is /tmp mounted noexec on your system by any chance?

@or1can
Copy link
Author

or1can commented Sep 5, 2022

Good guess 😄, yes, it is:

none on /tmp type tmpfs (rw,nosuid,nodev,noexec,relatime)
none on /var/tmp type tmpfs (rw,nosuid,nodev,noexec,relatime)

@charleskorn
Copy link
Collaborator

OK, that should be easy enough to add a workaround for - I'll try to get a fix out in the next few days.

@charleskorn charleskorn changed the title batect 0.80.1 unable to run on Ubuntu 18.04 LTS Batect 0.80+ unable to run when /tmp mounted noexec Sep 6, 2022
charleskorn added a commit to batect/docker-client that referenced this issue Sep 6, 2022
@charleskorn
Copy link
Collaborator

This should be fixed in v0.81.1 - please give that a go and let me know if you're still running into this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants