-
Notifications
You must be signed in to change notification settings - Fork 220
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
systemctl does not work inside the toolbox #176
Comments
Trying out running systemd with the toolbox, I find a problem with it. systemd is not running as PID 1 and tries to start in user mode and not in system mode. This is because there is the May I suggest that found a nice post here: https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container/ |
Remove PID namespace sharing and run the init system as PID 1 instead of sleep when starting up the toolbox. implements debarshiray/toolbox#176 Shell executed within the toolbox are now running in a separate PID namespace. Waiting on issue containers/podman#3205
Trying to use nsenter to have systemd running in a PID namespace and toolbox shells running in the host PID namespace does not work so well. the
Perhaps we can have different features enabled for the toolboxes, and we can choose for each toolbox if we want to
It corresponds to two different use cases. |
Remove PID namespace sharing and run the init system as PID 1 instead of sleep when starting up the toolbox. implements debarshiray/toolbox#176 Shell executed within the toolbox are now running in a separate PID namespace. Waiting on issue containers/podman#3205
There are a few other issues running systemd in the container, systemd is mounting tmpfs to |
It also means we cannot share the system dbus socket inside the toolbox because the system bus needs to points to the toolbox system instead. I don't know what are the consequence of that. |
I thought
I don't know how useful having the system D-Bus socket inside the container is, in practice. I added it so that one could at least browse through the list of names using How insane would it be to run a second instance of the bus inside the container for systemd and then have a |
I found a fix for that, just add
What I did in the referenced pull request is that I let the user choose at toolbox creation time. Either you want to spawn an init system in the toolbox ( |
@mildred Is there a solution yet? I'm trying to migrate from Docker to Podman in my development environment and would like to work with Toolbox and Postgres. |
Will soon have to do the same, hence this feature request. I have a pull request you can test here https://github.com/debarshiray/toolbox/pull/177 but I do not guarantee it works well. Basically, this is a different mode of operation and many things do not work the same. Traditional toolbox allows you to connect to the host system (host dBus in particular) and if running systemd within the toolbox, this has to change. So the toolbox with systemd must be created differently. I'm just thinking that the future might be with systemd portable services you run on the host, and access them on the toolbox (as the toolbox shares the same network namespace) |
Well I tried other solutions to run postgresql, and the toolbox is the best solution I could find. The PR still works and I just updated it to make use of it on top of latest toolbox. |
I do think that better integration between the host's systemd and a systemd (user or system) inside toolboxes is worthwhile, but have you considered running PostgreSQL in a podman container instead? That will be similar to how some people run PostgreSQL in production on real servers so it is rather well tested. |
Yep, it's possible to execute postgresql in a podman container instead,
but you lack the easy use and integration. I believe the toolbox is much
more easy to use of you can just `toolbox enter`and then start working.
Instead if you have to execute some lengthy podman commands outside of
the toolbox first, and redirect ports, you are not as productive.
Also, podman gave me an error when I tried to start the container, but
that's not an issue with toolbox.
|
In my case, this issue doesn't allow to run MongoDB:
@debarshiray The issue blocks the migration to non-testing usage of ostree-based distros like Silverblue, Gnome OS, Endless OS. Can I hope this problem will be fixed in the short term? |
The error is also reproduced in the |
I believe this warrants a separate issue, but I found this because I was investigating using toolbox for debugging and wanted I was able to get this to work by running: ln -s /run/host/var/run/systemd/system /run/systemd/system
SYSTEMD_IGNORE_CHROOT=1 systemctl status This issue seems to be more about starting services inside of the toolbox, however. I'm less interested in that, and more interested in making the toolbox as transparent as possible on the host, while still allowing for installing tools, etc. for debugging. |
What is the status of this? |
I'm setting up a toolbox for a development environment for a web application that requires postgresql running. I'm installing postgresql-server on the toolbox and then trying to start it using the usual method:
This is understandable as I'm running within a container, and systemd usually is not started in containers. Still, it means I have to manually start up postgresql by reading the systemd service file.
It would be great if systemd was started as entrypoint in the toolbox image, instead of
sleep +Inf
. Of course, udev and low level services would have to be prevented from starting so that a blank toolbox would not start any service.The text was updated successfully, but these errors were encountered: