-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
/dev/console of docker implementation breaks systemd >= 231 #27202
Comments
ping @mrunalp |
systemd/systemd#4262 (comment) is the primary relevant comment in the ticket. |
@LK4D4 yes, |
Yeah, it should work with some tweaks like mounting --tmpfs at /run --tmpfs at /tmp, bind mounting /sys/fs/cgroup/systemd read write and setting signal to SIGRTMIN+3. I'll take a look at the systemd report to see what's happening with /dev/console. |
Yes systemddefinitly runs in fedora 22,23,24. Although it is broken now for fedora 25, when you try to run it in Actually if you use some of Lennarts tricks he provides with machine
Here is a docker recipe, which I use, there are so many broken systemd FROM master.fedora-24-full
MAINTAINER [email protected]
# A systemd container will probably never run correctly under MacOS (sorry!)
# \* /sys/fs/cgroup is needed until kernel work for cgroups is completed (started at 4.6 ongoing)
# \* tty is needed to output on for docker logs
# \* SYS_ADMIN capability is needed for systemd in order to be able to change user ids for services
#
# Example how to run the image from docker
# docker run -d --tty --security-opt=seccomp:unconfined --cap-add SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro --hostname systemd-fedora.prod.cloud --name systemd fedora.prod.cloud images.fedora-24-full.systemd
#
# To follow logs
# docker logs -f systemd-fedora.prod.cloud
# Tell systemd service that it is running in a docker container
# https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/
# Section "Environment Variables/1"
ENV container docker
# Turn off services which usually are only needed for
# handling hardware or desktop/virtual machine operation
# Some services like sshd may require turning on stuff
# but this can be seen in the logs if a requirement
# for a service fails
# Nothing else done by the standard images!
RUN for service in\
console-getty.service\
dbus.service\
dbus.socket\
dev-hugepages.mount\
getty.target\
sys-fs-fuse-connections.mount\
systemd-logind.service\
systemd-remount-fs.service\
systemd-udevd\
systemd-vconsole-setup.service\
dnf-makecache.timer\
;do systemctl mask $service; done
# systemd complains in newer versions if this is not set
# probably not needed if journal persistence is not used
RUN chattr +C /var/log/journal
# Redirect the logging of journald purely to console
# which enables docker logs to catch everything
# also any persistence of the log in the container
# is turned off
#
ADD install/journald.conf /etc/systemd/journald.conf
# Turn of [OK] messages and log coloring
ADD install/system.conf /etc/systemd/system.conf
# Required for systemd: This should go away at some time
VOLUME [ "/sys/fs/cgroup" ]
# Terminate systemd with the proper signal (inits shutdown)
# "--stop-signal=$(kill -l RTMIN+3)
STOPSIGNAL 37
# We should return tu /sbin/init at some time
CMD [ "/usr/sbin/init" ]
# NOTE: Run container with "--stop-signal=$(kill -l RTMIN+3)" option to |
@DirkTheDaring: for various services that you disable, some of them have been split out into systemd-udev.rpm in F25+, so you can just not install that rpm. You'll save some space and bother. |
From reading the stuff it does not seem to be a problem handling signals but that we close the ptymaster when the copy returns because systemd closes the stdin. @DirkTheDaring do you have an easy way to help verify a fix if I create a patch? |
@crosbymichael That's my read of the problem as well. One solution that I read about was detecting that the slave is being opened using inotify. |
@DirkTheDaring can you give us more information about the |
I will be happy about anything which makes my parch go away |
@DirkTheDaring can you share your |
for commandline see the dockerfile here. the master image was build with a
|
@DirkTheDaring is there anyway you can just push this image so that I can pull it so I have the same base image created from dnf? |
you can try this to create the image on fedora (24) with the script below (if you replace "dnf" with "yum" on centos it should also work). Then you just need to upload the created install into docker
|
@DirkTheDaring What is your exact Also your I am also missing your |
what kind of error do you get ? i am actually using the docker rpm from the docker site docker --versionDocker version 1.12.1, build 23cf638 rpm -qf /usr/bin/dockerdocker-engine-1.12.1-1.fc24.x86_64 cat /etc/fedora-releaseFedora release 24 (Twenty Four) |
@DirkTheDaring ok, whats the output of |
docker infoContainers: 51 |
@DirkTheDaring I have tried following your scripts but I have been unable to reproduce the issue. If you could build a small reproducible image that you can push and that I can download and replicate the problem you are having that would help very much. You were adding various files in the build that I didn't have to configure systemd and journald, I tried to replicate them but still having issues reproducing. |
I put it here md5sum: Please remember that this needs the original docker-engine and not the patched fedora/redhat version (which breaks /dev/console in different way). This is what is use to install docker-engine in /etc/yum.repos.d/
|
i tested it with the new 1.12.3 - still the same problem |
Any news? |
@mrunalp Have you been able to figure out anything? |
/sys/fs/cgroup/systemd needs to be mounted rw.
… On Nov 29, 2016, at 7:41 AM, Antonio Murdaca ***@***.***> wrote:
@crosbymichael since you've been asking, the following simple docker run triggers this issue (by not showing any output):
$ docker run --rm -ti -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp fedora:rawhide /usr/sbin/init
Unable to find image 'fedora:rawhide' locally
rawhide: Pulling from library/fedora
7b6448343582: Pull complete
Digest: sha256:b8dd62c42b48b2ccecb3f6396784ff8c11eabc0fb9cab84070ace36fae1c8e30
Status: Downloaded newer image for fedora:rawhide
Failed to determine whether /sys is a mount point: Operation not permitted
Failed to determine whether /proc is a mount point: Operation not permitted
Failed to determine whether /dev is a mount point: Operation not permitted
Failed to determine whether /dev/shm is a mount point: Operation not permitted
Failed to determine whether /run is a mount point: Operation not permitted
Failed to determine whether /sys/fs/cgroup is a mount point: Operation not permitted
Failed to determine whether /sys/fs/cgroup/systemd is a mount point: Operation not permitted
[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@mrunalp I can't get that running w/ |
Yeah it won't fix this issue.
… On Nov 29, 2016, at 8:07 AM, Antonio Murdaca ***@***.***> wrote:
/sys/fs/cgroup/systemd needs to be mounted rw.
@mrunalp I can't get that running w/ -v /sys/fs/cgroup/systemd:/sys/fs/cgroup/systemd:rw either
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This adds a console implementation for linux based on epoll and its epoll manager (EpollConsole and Epoller). We need this in cases the slave side repeatedly open then closes the slave console when doing I/O. For more information, refers to: - systemd/systemd#4262 - moby/moby#27202 - opencontainers/runc#1446 Signed-off-by: Daniel Dao <[email protected]>
This adds a console implementation for linux based on epoll and its epoll manager (EpollConsole and Epoller). We need this in cases the slave side repeatedly open then closes the slave console when doing I/O. For more information, refers to: - systemd/systemd#4262 - moby/moby#27202 - opencontainers/runc#1446 Signed-off-by: Daniel Dao <[email protected]>
this adds a `platform` interface for shim service to manage platform-specific behaviors such as I/O (which uses epoll in linux to work around bugs with applications that closes all consoles i.e. opencontainers/runc#1434 and moby/moby#27202) Its expected that we only have 1 epollfd per containerd_shim to manage all processes. Since all the work are done outside of the container runtime, upgrading of runc is not required and should be done separately. Signed-off-by: Daniel Dao <[email protected]>
Due to issues between recent systemd and docker, we can't run systemd with a tty properly: https://bugzilla.redhat.com/show_bug.cgi?id=1373780 systemd/systemd#4262 moby/moby#27202
This issue affects console output when running systemd in docker container because moby doesn't correctly manage POLLHUP hangup. The issue was initially created in systemd systemd/systemd#4262 and later redirected to moby moby/moby#27202 . This affects versions after 232 where fd0 fd1 fd2 are redirected to /dev/null leaving no file descriptor pointing to /dev/console. When that happens docker, the pty master, will close the pty and any attempts to open /dev/console will return EIO. This patch removes the /dev/null redirection when running in container. We can get rid of it when moby fixes the issue referenced above. Change-type: patch CHangelog-entry: Fix console output when running resinOS with systemd >= 232 Signed-off-by: Andrei Gherzan <[email protected]>
This issue affects console output when running systemd in docker container because moby doesn't correctly manage POLLHUP hangup. The issue was initially created in systemd systemd/systemd#4262 and later redirected to moby moby/moby#27202 . This affects versions after 232 where fd0 fd1 fd2 are redirected to /dev/null leaving no file descriptor pointing to /dev/console. When that happens docker, the pty master, will close the pty and any attempts to open /dev/console will return EIO. This patch removes the /dev/null redirection when running in container. We can get rid of it when moby fixes the issue referenced above. Change-type: patch CHangelog-entry: Fix console output when running resinOS with systemd >= 232 Signed-off-by: Andrei Gherzan <[email protected]>
Closing since it looks like this was fixed in the console library being used (containerd/console#10). Thanks all! |
1. Rebased the image on the centos:7.7.1908 image 2. Moved exported env var configuration from a file to an env var in the Dockefile 3. Added a script for storing the command-line arguments passed to the container to a file before starting up systemd 4. Made systemd and journald output go to `/dev/console` which should be collected by the container engine automatically Note that certain versions of Docker have an issue with collecting `/dev/console` properly. See the following for explanation: - systemd/systemd#4262 - moby/moby#27202 - https://bugzilla.redhat.com/show_bug.cgi?id=1373780 Signed-off-by: Barak Korren <[email protected]>
1. Rebased the image on the centos:8 image 2. Removed all env-var handling code as its basically superseded by the systemd `PassEnvironment` option that can be specified on a per-unit-file basis 3. Made systemd and journald output go to `/dev/console` which should be collected by the container engine automatically 4. Made a new service unit file that tries to run the arguments given to the container as commands after all systemd services have started and exit the container once those commands are done while returning an appropriate return value. 5. It is possible to have environment variables passed to the invoked commands by setting variable names in the `ARGS_ENV_INCLUDE` variable either when launching the container or when building derived containers Note: The CentOs version upgrade is required, among other things, because the `systemd` version in CentOS 7 does not support returning exit codes on exit. Note: Certain versions of Docker have an issue with collecting `/dev/console` properly. See the following for explanation: - systemd/systemd#4262 - moby/moby#27202 - https://bugzilla.redhat.com/show_bug.cgi?id=1373780 Signed-off-by: Barak Korren <[email protected]>
1. Rebased the image on the centos:8 image 2. Removed all env-var handling code as its basically superseded by the systemd `PassEnvironment` option that can be specified on a per-unit-file basis 3. Made systemd and journald output go to `/dev/console` which should be collected by the container engine automatically 4. Made a new service unit file that tries to run the arguments given to the container as commands after all systemd services have started and exit the container once those commands are done while returning an appropriate return value. 5. It is possible to have environment variables passed to the invoked commands by setting variable names in the `ARGS_ENV_INCLUDE` variable either when launching the container or when building derived containers Note: The CentOs version upgrade is required, among other things, because the `systemd` version in CentOS 7 does not support returning exit codes on exit. Note: Certain versions of Docker have an issue with collecting `/dev/console` properly. See the following for explanation: - systemd/systemd#4262 - moby/moby#27202 - https://bugzilla.redhat.com/show_bug.cgi?id=1373780 This image also include a workaround for the following Podman issue: - containers/podman#4625 Signed-off-by: Barak Korren <[email protected]>
1. Rebased the image on the fedora:31 image 2. Removed all env-var handling code as its basically superseded by the systemd `PassEnvironment` option that can be specified on a per-unit-file basis 3. Made systemd and journald output go to `/dev/console` which should be collected by the container engine automatically 4. Made a new service unit file that tries to run the arguments given to the container as commands after all systemd services have started and exit the container once those commands are done while returning an appropriate return value. 5. It is possible to have environment variables passed to the invoked commands by setting variable names in the `ARGS_ENV_INCLUDE` variable either when launching the container or when building derived containers Note: The CentOs version upgrade is required, among other things, because the `systemd` version in CentOS 7 does not support returning exit codes on exit. Note: Certain versions of Docker have an issue with collecting `/dev/console` properly. See the following for explanation: - systemd/systemd#4262 - moby/moby#27202 - https://bugzilla.redhat.com/show_bug.cgi?id=1373780 This image also include a workaround for the following Podman issue: - containers/podman#4625 Signed-off-by: Barak Korren <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
The patch applied to systemd addressed this upstream moby issue: moby/moby#27202 This was fixed in containerd 1.0.2: containerd/console@c358734 This fix is present in balena engine since v17.13.5, which has been in use since commit 53ce147. Drop this patch from meta-balena-dunfell and later. Change-type: patch Signed-off-by: Joseph Kogut <[email protected]>
Hi guys,
I heard bad reports abouts that systemd and docker folks cannot get along.
Hope this is not the case. With fedora-25 (alpha, now approaching beta) systemd stopped working correctly within a docker container as process 1, if it configured to log to /dev/console. It worked until fedora 24 because systemd actually contained a bug, which made docker "just work." Now with the technically more correct implementation /dev/console stopped working with docker, which actually needs now work the docker guys.
Please have a look at
systemd/systemd#4262
It contains a technical sound description of Lennart, what needs to investigated/changed into docker to make it work again in the comments to the broken /dev/console
Without any change, systemd will stop working from this point which is, not a systemd, but a docker issue, from a technical point of view.
The text was updated successfully, but these errors were encountered: