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

Closed
72tlukas72 opened this issue Dec 2, 2024 · 18 comments
Closed

Docker: cannot execute oxidized #3331

72tlukas72 opened this issue Dec 2, 2024 · 18 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.

@robertcheramy robertcheramy modified the milestones: 0.32, 0.33 Feb 17, 2025
@72tlukas72
Copy link
Author

Same problem in v0.32.0

@robertcheramy
Copy link
Collaborator

And probably same solution - re-read your container.

@72tlukas72
Copy link
Author

What is "re-read" meaning?

@robertcheramy
Copy link
Collaborator

The Docker container is OK, but with the update it introduces an environment Variable GEM_HOME, wich is set in the container. The problem on this issue was, that the container running engine did not notice the new environment, which causes the problem.

If this is not your problem, create a new issue, and be sure to read https://github.com/ytti/oxidized/blob/master/docs/Issues.md first.

@72tlukas72
Copy link
Author

So what path should be set in GEM_HOME? In docs is nothing about this variable.

@rmcmilli
Copy link

rmcmilli commented Feb 20, 2025

Came looking for info about the ubuntu user. Looks like ubuntu made a decision to include the ubuntu user with their base image and the only way around it is to either remove the user on build or use the ubuntu user instead of a custom one. https://askubuntu.com/questions/1513927/ubuntu-24-04-docker-images-now-includes-user-ubuntu-with-uid-gid-1000

Edit: Looks like the phusion image used gives a disclaimer: https://github.com/phusion/baseimage-docker/releases/tag/noble-1.0.0

@robertcheramy
Copy link
Collaborator

robertcheramy commented Feb 21, 2025

@72tlukas72 - please read the whole Issue, everything is explained in it. I'll produce a FAQ some time, and this is why I assigned the issue to me.
@rmcmilli - Thanks for the information. I've been thinking about migrating to debian-slim [or provide two images], but the effort involved stood so far in the way ;-)

@72tlukas72
Copy link
Author

Okay I will wait to v0.33 :-D

robertcheramy added a commit that referenced this issue Feb 21, 2025
Partly adresses issue #3336 and #3331.
Thanks @rmcmilli for the hint.
robertcheramy added a commit to robertcheramy/oxidized that referenced this issue Feb 26, 2025
- Reverts the pre-build stage with GEM_HOME as it broke things. I've
found a solution which is quite as much compact, but it takes a longer
time to build. Closes Issue ytti#3331
- Improve the docker documentation. Closses Issue ytti#3336
- Remove examples/podman-compose as it is described in the docker
documentation.
- fix rake build_container to comply with the tags in the new GitHub CI.
robertcheramy added a commit that referenced this issue Feb 26, 2025
* Update Dockerfile & Documentation

- Reverts the pre-build stage with GEM_HOME as it broke things. I've
found a solution which is quite as much compact, but it takes a longer
time to build. Closes Issue #3331
- Improve the docker documentation. Closses Issue #3336
- Remove examples/podman-compose as it is described in the docker
documentation.
- fix rake build_container to comply with the tags in the new GitHub CI.
@robertcheramy
Copy link
Collaborator

I've reverted the change in PR #3429, which will fix this issue.

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