moby: Cannot build emacs using Dockerfile
Hello,
I’m building https://github.com/Silex/docker-emacs/blob/master/24.5/Dockerfile on ubuntu 16.04 with docker version:
Client:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Tue Apr 26 23:43:49 2016
OS/Arch: linux/amd64
Server:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Tue Apr 26 23:43:49 2016
OS/Arch: linux/amd64
But it fails like so:
Dumping under the name emacs
**************************************************
Warning: Your system has a gap between BSS and the
heap (4301663 bytes). This usually means that exec-shield
or something similar is in effect. The dump may
fail because of this. See the section about
exec-shield in etc/PROBLEMS for more information.
**************************************************
/bin/bash: line 7: 7052 Segmentation fault (core dumped) ./temacs --batch --load loadup bootstrap
make[1]: *** [bootstrap-emacs] Error 1
make[1]: Leaving directory `/root/emacs-24.5/src'
make: *** [src] Error 2
I discovered two workarounds:
- Don’t build with a Dockerfile and build in a running container that has a seccomp profile that allows the
personality
syscall. - Disable
/proc/sys/kernel/randomize_va_space
before building
Related issues:
https://github.com/docker/docker/issues/20550 https://github.com/docker/docker/issues/22296 https://github.com/docker/docker/issues/22304
Questions:
- Will this get fixed automagically with docker 1.11.2 ?
- Is there a way to modify the seccomp profile for when an image gets build? I could not find a
.json
file in/var/lib/docker
,/etc
or/usr
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 35 (8 by maintainers)
Commits related to this issue
- Work around https://github.com/docker/docker/issues/22801 — committed to royseto/devbase by royseto 8 years ago
- fix deps. without X. won't work. https://github.com/docker/docker/issues/22801 et al. — committed to andrewrothstein/ansible-emacs-build by andrewrothstein 7 years ago
Emacs 27 will be able to build inside docker (currently it’s the master branch).
For previous versions, you can use https://hub.docker.com/r/silex/emacs or disable
/proc/sys/kernel/randomize_va_space
like mentionned above.@Silex that
setfattr -n user.pax.flags
would be only for a PaX setup, which is not that common.For some more comments on the horrible emacs build process see http://www.openwall.com/lists/musl/2015/02/03/1 which documents the issues building it on Musl libc.
As far as I can see the options are:
docker run --privileged --pid=host alpine sh -c "echo 0 > /proc/sys/kernel/randomize_va_space"
Need to think about which option is best.
cc @jfrazelle
@fommil many people have asked for this misfeature to be optional for a long time, and support for it was nearly removed from glibc at one point, see https://lwn.net/Articles/673724/
@Silex, thanks!
I still have to use the
pid=host
hack though, because I mount the docker client from moby linux (which docker for windows employs as the linux vm for the docker daemon host). I can’t justecho 0 > blah
because the address is read only. Magically, with this hack:then it works. go figure.
it’s the same, but not really the same in docker for windows.
Well no, you are turning it for the host:
That’s what
--pid=host
does.AFAIK
docker run -it --rm --privileged --pid=host centos COMMAND
is basically a complicated way to dosudo COMMAND
😉Anyway, even if it worked requiring privileged containers is not a workaround. The docker hub will likely never build with privileged containers.
Also, someone correct me if I’m wrong but ASLR will always be shared between the host and the containers… given the containers share the same kernel.
@ninrod: in effect this is the same as disabling ASLR before building… only with more steps. Also it looks like you don’t restore ASLR in the end so your machine now has ASLR disabled.
This is much simpler:
For information, there’s quite a discussion going on at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23529
The current idea is to simply remove the undump feature in Emacs and replace it with something more straightforward which should not require special privileges.
Link to emacs bug report, but unlikely to be fixed in emacs itself: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23529
We are working on an easier workaround too, will update here soon.
On 14 Sep 2016 3:16 a.m., “Filipe Silva” notifications@github.com wrote:
@fommil Docker Hub recently updated to a more recent version of Docker for builds I believe, and also a newer base distribution, with seccomp enabled, so that is when the change would be from.
I really can’t see a
RUN_PRIVILEGED
Dockerfile command being accepted, as you would need to know that this was required before running the whole Dockerfile, as once you have started without privilege you cannot escalate.I also can’t see any service which operates on the internet willingly disabling basic protections like ASLR, so I think it is unlikely that Docker Hub would want to support this as an option.