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

Docker: cannot execute oxidized #3331

Open
72tlukas72 opened this issue Dec 2, 2024 · 9 comments
Open

Docker: cannot execute oxidized #3331

72tlukas72 opened this issue Dec 2, 2024 · 9 comments
Assignees
Milestone

Comments

@72tlukas72
Copy link

Hello,
I tried upgrade Oxidized from 0.30.1 to 0.31.0, but after start I got only error mesage cannot execute oxidized

Log:
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_syslog-ng.init...
Dec 2 11:47:51 f84c882441e4 syslog-ng[14]: syslog-ng starting up; version='4.3.1'
*** Booting runit daemon...
*** Runit started as PID 24
Dec 2 11:47:52 f84c882441e4 cron[30]: (CRON) INFO (pidfile fd = 3)
Dec 2 11:47:52 f84c882441e4 cron[30]: (CRON) INFO (Running @reboot jobs)
setuser: cannot execute oxidized: [Errno 2] No such file or directory
setuser: cannot execute oxidized: [Errno 2] No such file or directory
setuser: cannot execute oxidized: [Errno 2] No such file or directory
setuser: cannot execute oxidized: [Errno 2] No such file or directory

@robertcheramy robertcheramy self-assigned this Dec 3, 2024
@robertcheramy robertcheramy added this to the 0.32 milestone Dec 3, 2024
@robertcheramy
Copy link
Collaborator

Can you provide more information on your setup (how do you start the container, with which arguments...)?
I use podman and so it will help me to setup docker correctly so that I can reproduce your problem ;-)

@72tlukas72
Copy link
Author

I'm using Portainer, nothing change (beside version if image). Command is '/sbin/my_init' and mapped directory for config, data and model.

@robertcheramy
Copy link
Collaborator

I see several problems in the Dockerfile:

  • bd8d579 introduced the creation of /home/oxidized/.config/oxidized/, owned by root
  • f02d689 stated in README.md the option --user oxidized which does not work without extra setup
  • there is an ubuntu user in the image, which should not be there
    I will look after this.

I can run the docker image with docker without problem:

$ sudo docker run -i --rm -v /tmp/oxidized:/home/oxidized/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_syslog-ng.init...
Dec  5 06:45:45 9b83584d0ed1 syslog-ng[14]: syslog-ng starting up; version='4.3.1'
*** Booting runit daemon...
*** Runit started as PID 24
Dec  5 06:45:46 9b83584d0ed1 cron[31]: (CRON) INFO (pidfile fd = 3)
Dec  5 06:45:46 9b83584d0ed1 cron[31]: (CRON) INFO (Running @reboot jobs)
I, [2024-12-05T06:45:46.926363 #30]  INFO -- : Oxidized starting, running as pid 30
I, [2024-12-05T06:45:46.926948 #30]  INFO -- : lib/oxidized/nodes.rb: Loading nodes
I, [2024-12-05T06:45:46.992011 #30]  INFO -- : lib/oxidized/nodes.rb: Loaded 1 nodes
I, [2024-12-05T06:45:47.993645 #30]  INFO -- : Configuration updated for /fw4

Also using /sbin/my_init as an entry point works:

$ sudo docker run -i --rm -v /tmp/oxidized:/home/oxidized/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest /sbin/my_init
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_syslog-ng.init...
Dec  5 06:48:22 58af4f62aa31 syslog-ng[14]: syslog-ng starting up; version='4.3.1'
*** Booting runit daemon...
*** Runit started as PID 24
Dec  5 06:48:23 58af4f62aa31 cron[30]: (CRON) INFO (pidfile fd = 3)
Dec  5 06:48:23 58af4f62aa31 cron[30]: (CRON) INFO (Running @reboot jobs)
I, [2024-12-05T06:48:23.757523 #31]  INFO -- : Oxidized starting, running as pid 31
I, [2024-12-05T06:48:23.758047 #31]  INFO -- : lib/oxidized/nodes.rb: Loading nodes
I, [2024-12-05T06:48:23.818257 #31]  INFO -- : lib/oxidized/nodes.rb: Loaded 1 nodes
I, [2024-12-05T06:48:24.820495 #31]  INFO -- : Configuration updated for /fw4

To further inspect your problem, I really need the arguments you are passing to docker, in order to try to reproduce.

@72tlukas72
Copy link
Author

image

You can study now... What should be change for upgrade from 0.30.1 to 0.31? In release notes is nothing for change.

@robertcheramy
Copy link
Collaborator

I've found the difference. In 0.31.0, oxidized gets installed in /usr/local/bundle/bin/ instead of /usr/local/bin/.

The path is correctly specified in the container image, which explains why it works for me:

$ podman inspect docker.io/oxidized/oxidized:0.30.1 | grep PATH
                    "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
$ podman inspect docker.io/oxidized/oxidized:0.31.0 | grep PATH
                    "PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                    "created_by": "ENV PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",

Portainer probably did not updated its specified path when you tried the new image, which causes the error on your server.

A quick workaround would be to update the PATH in Portainer.

@robertcheramy
Copy link
Collaborator

The change was introduced in commit c56bc4b (PR #3272).

I tend to leave this unchanged: introducing /usr/local/bundle as GEM_HOME helps reduce the container size by installing the gems in a prebuilder-container and copying /usr/local/bundle into the oxidized container.

Portainer should be able to re-read the PATH from the containter image, or let you set the PATH correctly. Could you try this?

@E-t-z
Copy link

E-t-z commented Dec 5, 2024

I tried to update path, but Container still fails to start, now it logs:

2024/12/05 22:52:08,stdout,/usr/lib/ruby/vendor_ruby/rubygems.rb:264:in `find_spec_for_exe': �[1mcan't find gem oxidized (>= 0.a) with executable oxidized (�[1;4mGem::GemNotFoundException�[m�[1m)�[m
2024/12/05 22:52:06,stdout,	from /usr/local/bundle/bin/oxidized:25:in `<main>'
2024/12/05 22:52:06,stdout,	from /usr/lib/ruby/vendor_ruby/rubygems.rb:283:in `activate_bin_path'
2024/12/05 22:52:06,stdout,/usr/lib/ruby/vendor_ruby/rubygems.rb:264:in `find_spec_for_exe': �[1mcan't find gem oxidized (>= 0.a) with executable oxidized (�[1;4mGem::GemNotFoundException�[m�[1m)�[m
2024/12/05 22:52:06,stdout,	from /usr/local/bundle/bin/oxidized:25:in `<main>'

@E-t-z
Copy link

E-t-z commented Dec 5, 2024

Running it on Synology if it matters and using the latest image.

@E-t-z
Copy link

E-t-z commented Dec 5, 2024

Nevermind, creating Container from scratch updated PATH and added GEM_HOME (which was missing from my config)
It would be great if Documentation would reflect such changes.

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

3 participants