osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
559 stars 73 forks source link

OS detection failing on Jetson Xavier #177

Closed Sharrrrk closed 1 year ago

Sharrrrk commented 2 years ago

When I am using rocker on Jetson Xavier, an error occurs during os detection process:

rocker --nvidia --x11 --user --home tfoote/drone_demo

Step 5/12 : RUN . /tmp/distrovenv/bin/activate && pip install distro pyinstaller==4.0 staticx==0.12.3
 ---> Running in 1a33cbfe7b13
Collecting distro
  Downloading distro-1.7.0-py3-none-any.whl
Collecting pyinstaller==4.0
  Downloading pyinstaller-4.0.tar.gz (3.5MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Collecting staticx==0.12.3
  Downloading staticx-0.12.3.tar.gz (68kB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-679zj6xk/staticx/setup.py", line 4, in <module>
        from wheel.bdist_wheel import bdist_wheel
    ModuleNotFoundError: No module named 'wheel'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-679zj6xk/staticx/

You are using pip version 19.0.3, however version 22.1b1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

It seems to be related with the installation of staticx, yet I could not find a solution to solve it.

Environment:

How to reproduce:

rocker --nvidia --x11 --user --home tfoote/drone_demo

ambroise-arm commented 2 years ago

staticx only has an x86 binary released through pip. And compiling it from source seems like too much effort for the use rocker has of it.

I think a good solution would be to remove the use for staticx completely. Instead having detect_os rely only on printing the content "/etc/os-release" from inside of the target docker image and doing the parsing of that on the host with python code. I'll try to create a patch for that.

tfoote commented 2 years ago

Ouch, that's a challenge. Python isn't quite as reliable as might be desired for this. Maybe a rust or go detector might make more sense.

I found there's a crate for this https://docs.rs/os-detect/0.1.0/os_detect/ or standard envs https://doc.rust-lang.org/std/env/consts/constant.OS.html Though they don't seem to be quite at the level we need.

Another alternative would be to prebuild the detectors and put them into docker images that can be fetched instead of building it locally.

tfoote commented 2 years ago

Here's a potential go library https://github.com/dekobon/distro-detect it doesn't have a lot of traction. The integrated GOOS variable doesn't have quite enough info: https://pkg.go.dev/runtime#pkg-constants

ambroise-arm commented 1 year ago

I've looked at https://docs.rs/os-version/0.2.0/os_version/ for this, but it seems the rust compilation step requires some registry cloning, which takes between 1 and 2 minutes on my machine. I don't think that's acceptable. And that's a problem for any rust-based solution. So instead what I propose is using the Go program, which is much lighter to build.