-
Notifications
You must be signed in to change notification settings - Fork 216
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
New version of the overlay, designed together with Gorka #10
Conversation
- Dependencies: latest execline/s6/s6-portable-utils at this time - Interactive CMDs should now work properly with or without terminals. If not, play with s6-setsid a bit more. - The scandir is now in /var/run/s6/service, because it gets written into at run-time - User service directories are now listed in /etc/services.d and will be *copied* to /var/run/s6/service during init-stage2 - Yeah, I really hate writing to /, and you should hate it, too. - Init order: * our own services in /etc/s6/service are copied to /var/run/s6/service (stage 1) * s6-svscan is run * scripts in /etc/cont-init.d are run (stage 2) * services in /etc/services.d are copied to /var/run/s6/service and picked up by s6-svscan * If a CMD was given, it is run. i.e. the whole stage 2 is executed whether a CMD was given or not, so CMDs are always executed in a properly initted environment. - Since all the user stuff is started in stage 2, we can guarantee all the dependencies for stage 1, so no fix-attrs in stage 1. Stage 1 is now extremely short, as it should be. - Can't escape the fix-attrs in stage 2 though, but provided a chunk of execline to do the functionality. (Probably very slow.) - Plus a bunch of tiny fixes, mostly cosmetic.
- modify init-stage2 to use it properly, by reading everything in /etc/fix-attrs.d - the original fix descriptions are now a file in /etc/fix-attrs.d - minor fixes/changes to init-stage2 - make /usr/bin/with-* executable (!)
New version of the overlay, designed together with Gorka
thanks! |
Just wanted to comment on how awesome this is! Can't wait to start trying it out in my containers |
yes it is, i participated just being the executor arm! great work Laurent. |
@skarnet Also very grateful. Thank you +1. Once a new tarball is built, I shall test again previous Again, many thanks. |
Hmm. With this new version I get an error that didn't happen before: time docker run dreamcat4/s6test
if: fatal: child crashed with signal 13
!!!!!
init-stage2 failed.
Logs are in /var/log/s6-uncaught-logs
!!!!!
# there are no logs
id@emachines-e520:~/docker-images$ docker exec -it trusting_ardinghelli ls -lsa /var/log/s6-uncaught-logs/
total 8
4 drwx--S--- 2 65534 65534 4096 Mar 11 12:29 .
4 drwxr-xr-x 4 root root 4096 Mar 11 18:26 .. Dockerfile: [EDIT] Show missing lines that were already in Dockefile. FROM busybox:ubuntu-14.04
ADD https://github.com/glerchundi/container-s6-overlay-builder/releases/download/v1.7.0/s6-overlay-1.7.0-linux-amd64.tar.gz /s6-overlay.tar.gz
RUN gunzip -c /s6-overlay.tar.gz | tar -xf - -C / && rm /s6-overlay.tar.gz
ADD myprogram.sh /myprogram.sh
RUN chmod +x /myprogram.sh
ENTRYPOINT ["/init","/myprogram.sh"]
CMD ["arg1","arg2","arg3"] Where the #!/bin/sh
exit 0 It just's |
it seems like u need to include |
@glerchundi Ah sorry. I didn't copy-paste here fully my Dockerfile - it actually already had the missing statements to begin with. ADD myprogram.sh /myprogram.sh
RUN chmod +x /myprogram.sh ... so the error message must be for some other reason. |
thanks for pointing this out @dreamcat4. This is a bug, in busybox nobody/nogroup use 99/99 as uid/gid instead of using the common ones which are 65534 for both (http://www.linfo.org/uid.html). @skarnet we need to fix s6-uncaught-logs and s6-folderd log directories in runtime :( Although, this doesn't happen with |
I'm not so sure it's the UID and GID numbers. It looks like dreamcat's image is missing the nobody and daemon users entirely. After adding them, I'm still getting a crash. As far as I can tell, I think s6-echo is being killed due to a broken pipe which causes the crash. Here's the /etc/passwd file I made:
And the /etc/group file I made:
Here's some output from strace. These process IDs are high because I've been running this a couple of times:
|
Yeah, it looks like that's the problem. I just tried commenting out all the s6-echos from init-stage2 and it seemed to work |
I try Johns temporary disablement - to allow other testing in meantime. FYI, the seem to be quite a few s6 processes running at time of the crash: $ docker exec -it trusting_ardinghelli ps -a
PID USER COMMAND
1 root s6-svscan -t0 /var/run/s6/service
21 root s6-supervise s6-fdholderd/log
22 root s6-supervise s6-fdholderd
23 root s6-supervise s6-svscan-log
12341 root s6-envuidgid nobody s6-applyuidgid -Uz -- exec -c s6-log -bp -- t /var/log/s6-uncaught-logs
12342 root s6-envuidgid daemon s6-fdholder-daemon -U -1 -i rules -- /var/run/s6/fdholderd-socket
12344 root s6-notifywhenup s6-envuidgid daemon s6-fdholder-daemon -U -1 -i rules -- /var/run/s6/fdholderd-socket
12345 root s6-envuidgid nobody s6-applyuidgid -Uz -- exec -c -- s6-log -- t /var/log/s6-fdholderd
12356 root ps -a I'm not saying that isn't normal / correct / justified. It just seems like quite a few things are going on. |
OK. Like @jprjr said, I comment out all of the lines containing time docker run dreamcat4/s6test
if: fatal: child crashed with signal 11
real 0m9.966s
user 0m0.020s
sys 0m0.004s
id@emachines-e520:~/docker-images$ |
I really dislike the idea of having to run fix-attrs in stage 1. Stage 1 should be absolutely minimal and independent from everything; if it depends on stuff the user can mount and modify, that's not right. The catch-all logging directory is not supposed to be sticky: those logs are not supposed to live from one invocation to another. In a "normal" system, I mount a tmpfs in stage 1, and put the catch-all logging directory in it. I guess the solution for Docker is to recreate /var/log/s6-uncaught-logs for every invocation, in stage 1.
if { s6-rmrf /var/log/s6-uncaught-logs } If there's no guaranteed user "nobody" in the image's /etc/passwd, then find another user to run the logger as. (Same with "daemon" for s6-fdholderd.) As for the s6-fdholderd log, it can go entirely. s6-fdholderd is barely logging anything, so it can go into the catch-all logs without trouble.
(edit: typo) |
I agree with you, i'm already modifying this so expect a new version which solves @dreamcat4 issues soon. |
@dreamcat4 can you test against v1.7.1? it should fix this issue and have only these running processes:
thanks. |
@glerchundi i'm not entirely sure if is OK yet (your 1.7.1). Because there's a new error message now: time docker run dreamcat4/s6test
s6-envuidgid: fatal: unknown user: nobody
real 0m1.957s
user 0m0.016s
sys 0m0.008s
id@emachines-e520:~/docker-images$ |
Honestly, images without even a "nobody" user should be fixed. Is there a way we can modify existing files from an overlay ? As in, I'd like to add lines in /etc/passwd to define s6-specific users, but without clobbering the existing image's /etc/passwd. |
Well is there any reason we can't just fail over to be using a hardcoded It was my understanding that you don't necessarily need usernames in unix - as they end up just being translated into |
I wouldn't recommend using a uid if you can't find the user. What's weird is the official buildroot-based busybox image has those users.
I think the right answer here is to open a bug against busybox:ubuntu-14.04 about missing important users. |
@jprjr - Yes no doubt we should tell the busybox image maintainers about that issue in their image. However the underlying probelm still remains, if we are not fixing this ourselves - and even if busybox fix their image. Because some people want to build from scratch and run their own pre-compiled binary without anything else in there. Which may mean no Indeed. The whole point of why I am using the busybox image to test s6 with is because it is missing so many expected things. To try and show these things up and give us a chance to find errors like this as early as we possibly can. It goes back to the idea of making sure the overlay does not depend on anything in the distro (and brings all tools, everything it needs with it). I try to solve with just minor changes - replacing If the first command fails that means the specified user name does not exist - so it would be most often likely be safe to use inside a docker image which was already built. Because users are usually added at build time, rather than run-time (although we cannot be sure of that). However using a uid of So the code I tried to fix this issue with now look like this: /home/id/docker-images/s6test/s6/etc/s6/init/init-stage1:
34: ifelse { s6-envuidgid nobody s6-chown -U /var/log/s6-uncaught-logs } {}
35 { s6-chown -u 65534 -g 65534 /var/log/s6-uncaught-logs } But it still crash, with message: time docker run dreamcat4/s6test
s6-envuidgid: fatal: unknown user: nobody
if: fatal: child crashed with signal 13
!!!!!
init-stage2 failed.
Logs are in /var/log/s6-uncaught-logs
!!!!! Sorry - I don't understand why it do that. If the 1st |
Well, the documentation of You can pass a flag
|
@dreamcat4 I don't think we need to take care of that basic things! Indeed, busybox HAS
So, for now I wouldn't try to correct it, because I do not think it's a problem yet. Lets see if you get issues with this when we really publish to the real world! :-) |
I understand that an image would want to be as small as possible and not come with its own complete POSIX environment, but missing a uid database is nonsensical. I've run boxes without /bin/sh - this very overlay runs without /bin/sh until the user stuff starts - but I can't run a box without /etc/passwd. Users who want an s6-enabled image should understand that it's also about security, and security means one uid per service, and that means having an /etc/passwd, or whatever uid database they prefer, with enough uids. To get things working ASAP, I just assumed "daemon" and "nobody" were present everywhere, and I very much hope that assumption is true, but the right solution would be to be able to add our own users to the image's /etc/passwd at image build time. Is it possible ? Or is the "original image + overlay" mix performed at run-time ? |
Ok, i'm not going to be the blocker guy and turn back. If you all three feel that we need to deal with this problem, let's do it. @skarnet i would like to do it in build time, but that would cause another issues. Depending in the stage in which people includes our overlay, this will override /etc/{passwd, group} with the problems that would follow. As our overlay can just deploy static files in the destination image the solution would be to perform these actions in runtime:
What do you think? Moving this to thread to a new issue. #15. |
Here it is, as convened.