Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Building with Docker #142

Open
djmccarthy12 opened this issue May 6, 2021 · 6 comments
Open

Issue Building with Docker #142

djmccarthy12 opened this issue May 6, 2021 · 6 comments

Comments

@djmccarthy12
Copy link

djmccarthy12 commented May 6, 2021

Upon Running docker image build -t bang . I get the following error:

> docker image build -t bang .
[+] Building 2.0s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                         0.0s 
 => => transferring dockerfile: 1.24kB                                                                                                                                                                       0.0s 
 => [internal] load .dockerignore                                                                                                                                                                            0.1s 
 => => transferring context: 45B                                                                                                                                                                             0.0s 
 => CANCELED [internal] load metadata for docker.io/library/fedora:33                                                                                                                                        1.9s 
 => ERROR [internal] load metadata for docker.io/library/kaitai:latest                                                                                                                                       1.9s 
 => [auth] library/kaitai:pull token for registry-1.docker.io                                                                                                                                                0.0s 

 > [internal] load metadata for docker.io/library/kaitai:latest:

failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

I have authenticated to Docker Hub, so I'm not sure where the issue is stemming from here. I am running this on a Debian system under WSL2.

@seihtam
Copy link

seihtam commented May 7, 2021

It's because you need to build the kaitai docker image in the util folder locally. I updated the README intructions and included fixes for other problems you will run into afterwards in #141.

@djmccarthy12
Copy link
Author

djmccarthy12 commented May 7, 2021

Thanks, I went ahead and installed podman, and made the other handful of changes in #141, however I am still running into a different issue now while building the Kaitai image:

> make docker-kaitai
[ -d kaitai_struct ] || git clone --recursive https://github.com/kaitai-io/kaitai_struct.git
podman image build -t kaitai -f Dockerfile.kaitai .
WARN[0000] Failed to detect the owner for the current cgroup: stat /sys/fs/cgroup/systemd: no such file or directory 
STEP 1: FROM mozilla/sbt AS builder
STEP 2: FROM openjdk:jre-slim
ERRO[0000] unable to write build event: "write unixgram @00011->/run/systemd/journal/socket: sendmsg: no such file or directory"
Error: error creating build container: short-name "mozilla/sbt" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"
make: *** [Makefile:12: docker-kaitai] Error 125

@seihtam
Copy link

seihtam commented May 9, 2021

I'm actually using docker, I just didn't change that in the pull request since I didn't want to change their default setting.

@djmccarthy12
Copy link
Author

Ok, I switched to using Docker instead of podman, and was able to get the docker container built, and running the BANG shell now works.

Still experiencing an issue when invoking the scanner as described however:

python3 bang-scanner -c bang.config -f /home/dj/go/src/netrise/parser-framework/data/tmp/squashfs-root/bin/busybox
Traceback (most recent call last):
  File "/home/dj/binaryanalysis-ng/src/bang-scanner", line 59, in <module>
    from bangsignatures import maxsignaturesoffset
  File "/home/dj/binaryanalysis-ng/src/bangsignatures.py", line 470, in <module>
    extension_to_unpackparser = get_unpackers_for_extensions()
  File "/home/dj/binaryanalysis-ng/src/bangsignatures.py", line 464, in get_unpackers_for_extensions
    for u in get_unpackers():
  File "/home/dj/binaryanalysis-ng/src/bangsignatures.py", line 458, in get_unpackers
    unpackers = _get_unpackers_recursive(
  File "/home/dj/binaryanalysis-ng/src/bangsignatures.py", line 452, in _get_unpackers_recursive
    unpackers.extend(_get_unpackers_recursive(
  File "/home/dj/binaryanalysis-ng/src/bangsignatures.py", line 444, in _get_unpackers_recursive
    module = importlib.import_module(module_name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/dj/binaryanalysis-ng/src/parsers/archivers/cpio/UnpackParser.py", line 4, in <module>
    from . import cpio_new_ascii
ImportError: cannot import name 'cpio_new_ascii' from 'parsers.archivers.cpio' (/home/dj/binaryanalysis-ng/src/parsers/archivers/cpio/__init__.py)

I've installed all dependencies, any idea what else I need to do to get this running properly?

@CsatariGergely
Copy link

I do not see the text added in #141 in current master was it removed?
I modified the docker file to use librespace/kaitai as a base image for the build image. It bulds stuff for a very long time, but can not find the kaitai_struct folder.

@armijnhemel
Copy link
Owner

I do not see the text added in #141 in current master was it removed? I modified the docker file to use librespace/kaitai as a base image for the build image. It bulds stuff for a very long time, but can not find the kaitai_struct folder.

A lot has changed and is still in flux, so this should be considered broken at the moment. I will fix it but don't know when I will have the time for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants